diff --git a/CHANGES.md b/CHANGES.md index e82e4e1..da593cc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ +## 0.2.1 - 2026-09-07 + +### Changed + +* Updated to vertigo 0.13 + ## 0.2.0 - 2026-07-01 ### Added diff --git a/Cargo.lock b/Cargo.lock index 2e0634b..1734c37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,20 +8,11 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "cc" -version = "1.2.65" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +checksum = "005ec2760ca554fae18df7a11195552ec576cd665632a881bc011d5bb2fd4d80" dependencies = [ "find-msvc-tools", "shlex", @@ -33,15 +24,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - [[package]] name = "crc" version = "3.4.0" @@ -57,16 +39,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "darling" version = "0.23.0" @@ -87,7 +59,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -98,7 +70,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -109,40 +81,20 @@ checksum = "d08b3a0bcc0d079199cd476b2cae8435016ec11d1c0986c6901c5ac223041534" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", + "syn 2.0.119", ] [[package]] name = "either" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" [[package]] name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "generic-array" -version = "0.14.7" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] +checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" [[package]] name = "getrandom" @@ -178,21 +130,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.186" +version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "log" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "memchr" -version = "2.8.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "minreq" @@ -207,9 +159,9 @@ dependencies = [ [[package]] name = "pest" -version = "2.8.6" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" +checksum = "6d45aeb61b4bf818e12d4205f2466f8c4748f85f4fce0146d1c03d69d753f0ad" dependencies = [ "memchr", "ucd-trie", @@ -217,9 +169,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.6" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" +checksum = "89cc5a242e25ed4e7704d0be240f2cfbe20a8c27e7e252d94835be93d92dc39f" dependencies = [ "pest", "pest_generator", @@ -227,25 +179,24 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.6" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" +checksum = "7abf21475cc3820fe4b2ca2dc2142902f67a02189f3b5b3a229f4febc01a43e5" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "pest_meta" -version = "2.8.6" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" +checksum = "adba4db388f687393c18c51348d44a41d870ca9df71a2c98172ea3035dc6936e" dependencies = [ "pest", - "sha2", ] [[package]] @@ -320,9 +271,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -335,16 +286,16 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", "version_check", "yansi", ] [[package]] name = "quote" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -373,7 +324,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.118", + "syn 2.0.119", "syn_derive", "thiserror", ] @@ -410,17 +361,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "shlex" version = "2.0.1" @@ -445,9 +385,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" dependencies = [ "proc-macro2", "quote", @@ -463,35 +414,29 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.5", ] -[[package]] -name = "typenum" -version = "1.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" - [[package]] name = "ucd-trie" version = "0.1.7" @@ -518,9 +463,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vertigo" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3033a63e59421406b7887e8a3f40f835148b3817053d282752398d9780c74edb" +checksum = "d973870822864b0a6ae9bc191172ed162ae2ed492aafe52850bfd1c67ddf3001" dependencies = [ "base64", "log", @@ -529,7 +474,7 @@ dependencies = [ [[package]] name = "vertigo-forms" -version = "0.2.0" +version = "0.2.1" dependencies = [ "base64", "either", @@ -562,9 +507,9 @@ dependencies = [ [[package]] name = "vertigo-macro" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4f8a05a0aae8f252020526e0c910696393090ce6a0eb9359e0bb58ff04236d" +checksum = "61132b314900597417642d2aeaf495fd4cbcb32acb6c2e17ca14853a8ffaca8c" dependencies = [ "base64", "crc", @@ -579,7 +524,7 @@ dependencies = [ "proc-macro2", "quote", "rstml", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e72681b..5465f76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["storybook", "examples/manual_form", "examples/model_form"] [package] name = "vertigo-forms" -version = "0.2.0" +version = "0.2.1" authors = ["MichaƂ Pokrywka "] description = "Building block for forms in vertigo" readme = "README.md" @@ -15,10 +15,13 @@ categories = ["asynchronous", "gui", "wasm", "web-programming"] license = "MIT OR Apache-2.0" edition = "2024" +[workspace.dependencies] +vertigo = "0.13" + [dependencies] base64 = "0.22" either = "1.15" -vertigo = "0.12" +vertigo = { workspace = true } # [patch.crates-io] # vertigo = { git = "https://github.com/vertigo-web/vertigo", branch = "master" } diff --git a/README.md b/README.md index a51cf0a..c479e79 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Blocks for building forms in [vertigo](https://crates.io/crates/vertigo). [![crates.io](https://img.shields.io/crates/v/vertigo-forms)](https://crates.io/crates/vertigo-forms) [![Documentation](https://docs.rs/vertigo-forms/badge.svg)](https://docs.rs/vertigo-forms) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/vertigo-forms.svg) -[![Dependency Status](https://deps.rs/crate/vertigo-forms/0.1.3/status.svg)](https://deps.rs/crate/vertigo-forms/0.1.3) +[![Dependency Status](https://deps.rs/crate/vertigo-forms/0.2.1/status.svg)](https://deps.rs/crate/vertigo-forms/0.2.1) [![CI](https://github.com/vertigo-web/vertigo-forms/actions/workflows/pipeline.yaml/badge.svg)](https://github.com/vertigo-web/vertigo-forms/actions/workflows/pipeline.yaml) [![downloads](https://img.shields.io/crates/d/vertigo-forms.svg)](https://crates.io/crates/vertigo-forms) diff --git a/examples/manual_form/Cargo.toml b/examples/manual_form/Cargo.toml index 8631ec6..cda6bce 100644 --- a/examples/manual_form/Cargo.toml +++ b/examples/manual_form/Cargo.toml @@ -8,5 +8,5 @@ edition = "2024" crate-type = ["cdylib", "rlib"] [dependencies] -vertigo = "0.12" +vertigo = { workspace = true } vertigo-forms = { path = "../.." } diff --git a/examples/model_form/Cargo.toml b/examples/model_form/Cargo.toml index 76c55b2..01dea1c 100644 --- a/examples/model_form/Cargo.toml +++ b/examples/model_form/Cargo.toml @@ -8,5 +8,5 @@ edition = "2024" crate-type = ["cdylib", "rlib"] [dependencies] -vertigo = "0.12" +vertigo = { workspace = true } vertigo-forms = { path = "../.." } diff --git a/src/form/render/field.rs b/src/form/render/field.rs index 2574921..d56a644 100644 --- a/src/form/render/field.rs +++ b/src/form/render/field.rs @@ -59,7 +59,7 @@ pub fn Field<'a>(field: &'a DataField) { let on_click = bind!(value, |_| value .change(|list| list.push(Value::new(0)))); dom! { - + } }); diff --git a/src/select/dict_select.rs b/src/select/dict_select.rs index 47014fc..c2c7423 100644 --- a/src/select/dict_select.rs +++ b/src/select/dict_select.rs @@ -43,21 +43,16 @@ pub fn DictSelect + PartialEq + ToString + 'static>( .then(|| dom! { } - } else { - dom! { } - } - } - )) - ); + let list = render_list(&options, |(key, _)| key.to_string(), { + let value = value.clone(); + move |item: &Computed<(i64, T)>| { + let key = item.map(|(key, _)| key); + let text_item = item.map(|(_, item)| item.to_string()); + let selected = computed_tuple!(key, value) + .map(|(key, value)| (key == value).then(|| "selected".to_string())); + dom! { } + } + }); dom! { diff --git a/storybook/Cargo.toml b/storybook/Cargo.toml index 790b25c..b3ab828 100644 --- a/storybook/Cargo.toml +++ b/storybook/Cargo.toml @@ -8,5 +8,5 @@ edition = "2024" crate-type = ["cdylib", "rlib"] [dependencies] -vertigo = "0.12" +vertigo = { workspace = true } vertigo-forms = { path = ".." } diff --git a/storybook/src/select_search.rs b/storybook/src/select_search.rs index 3d128fe..7e189b0 100644 --- a/storybook/src/select_search.rs +++ b/storybook/src/select_search.rs @@ -30,13 +30,22 @@ pub fn select_search() -> DomNode { let selected_value = computed_tuple!(value, options) .map(|(value, options)| options.get(&value).cloned().unwrap_or_default()); + // `render_list` takes a `Vec`, so flatten the map into one with a stable order + let sorted_options = options.map(|options| { + let mut options = options.into_iter().collect::>(); + options.sort_by_key(|(key, _)| *key); + options + }); + let hints = render_list( - &options, + sorted_options, |(key, _)| key.to_string(), - |(_key, value)| { - dom! { -
  • {value.split(' ').next().unwrap_or_default()}
  • - } + |item| { + item.render_value(|(_key, value)| { + dom! { +
  • {value.split(' ').next().unwrap_or_default()}
  • + } + }) }, ); diff --git a/storybook/src/tabs.rs b/storybook/src/tabs.rs index 461bb6f..5023e69 100644 --- a/storybook/src/tabs.rs +++ b/storybook/src/tabs.rs @@ -1,5 +1,5 @@ use std::rc::Rc; -use vertigo::{DomNode, Value, bind_rc, dom}; +use vertigo::{DomDisplay, DomNode, Value, bind_rc, dom}; use vertigo_forms::{Tab, TabsContentMapped, TabsHeader}; use crate::bordered_tabs; @@ -72,6 +72,8 @@ pub fn tabs() -> DomNode { } } +impl DomDisplay for MyView {} + impl std::fmt::Display for MyView { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self {