diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2024-05-19 17:44:44 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2024-05-19 17:44:44 +0100 |
commit | 11e6552edb05772c6dd8baac2655a32ba64d2de5 (patch) | |
tree | c9abeac7da320fc6ac86b24d9a51da94704b7d50 /src | |
parent | 33cbc3b9b71ae22f7e56aca4d65c866cf3e2c275 (diff) | |
download | lustre-11e6552edb05772c6dd8baac2655a32ba64d2de5.tar.gz lustre-11e6552edb05772c6dd8baac2655a32ba64d2de5.zip |
:sparkles: Emit ints and float properties.
Diffstat (limited to 'src')
-rw-r--r-- | src/lustre/internals/vdom.gleam | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lustre/internals/vdom.gleam b/src/lustre/internals/vdom.gleam index 5d03b2b..c4cab69 100644 --- a/src/lustre/internals/vdom.gleam +++ b/src/lustre/internals/vdom.gleam @@ -2,6 +2,7 @@ import gleam/dict.{type Dict} import gleam/dynamic.{type Decoder, type Dynamic} +import gleam/float import gleam/int import gleam/json.{type Json} import gleam/list @@ -391,6 +392,9 @@ fn attribute_to_string_parts( "Atom" | "Bool" | "Boolean" if value == true_atom -> Ok(#(name, "")) "Atom" | "Bool" | "Boolean" -> Error(Nil) + "Int" -> Ok(#(name, int.to_string(dynamic.unsafe_coerce(value)))) + "Float" -> Ok(#(name, float.to_string(dynamic.unsafe_coerce(value)))) + // For everything else, we care whether or not the attribute is actually // a property. Properties are *Javascript* values that aren't necessarily // reflected in the DOM. |