From 4eecb7599a7c1542017d8747ae742763c88748a5 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 30 Apr 2021 14:04:44 +0500 Subject: [PATCH] Implicit optional attributes (#1637) --- examples/boids/src/slider.rs | 6 +- examples/crm/src/add_client.rs | 6 +- examples/js_callback/src/main.rs | 2 +- examples/keyed_list/src/main.rs | 2 +- examples/keyed_list/src/person.rs | 4 +- examples/mount_point/src/main.rs | 2 +- examples/nested_list/src/main.rs | 3 +- examples/router/src/components/author_card.rs | 2 +- examples/router/src/components/post_card.rs | 2 +- .../router/src/components/progress_delay.rs | 2 +- examples/router/src/pages/author.rs | 2 +- examples/router/src/pages/author_list.rs | 2 +- examples/store/src/post.rs | 2 +- examples/store/src/text_input.rs | 2 +- examples/todomvc/src/main.rs | 4 +- packages/yew-components/src/select.rs | 2 +- packages/yew-macro/src/derive_props/field.rs | 90 ++-- .../yew-macro/src/html_tree/html_element.rs | 338 +++++-------- packages/yew-macro/src/html_tree/html_list.rs | 6 +- packages/yew-macro/src/props/component.rs | 18 +- packages/yew-macro/src/props/element.rs | 14 +- packages/yew-macro/src/props/prop.rs | 44 +- packages/yew-macro/src/props/prop_macro.rs | 5 +- packages/yew-macro/src/stringify.rs | 38 +- .../yew-macro/tests/derive_props/fail.stderr | 37 +- packages/yew-macro/tests/derive_props/pass.rs | 11 +- .../tests/html_macro/component-fail.rs | 2 - .../tests/html_macro/component-fail.stderr | 64 +-- .../tests/html_macro/component-pass.rs | 4 +- .../tests/html_macro/element-fail.rs | 57 ++- .../tests/html_macro/element-fail.stderr | 463 ++++++++---------- .../tests/html_macro/element-pass.rs | 41 -- .../tests/html_macro/html-element-pass.rs | 81 +++ .../tests/html_macro/html-node-pass.rs | 23 + .../yew-macro/tests/html_macro/list-fail.rs | 16 +- .../tests/html_macro/list-fail.stderr | 66 ++- .../yew-macro/tests/html_macro/node-pass.rs | 12 +- packages/yew/src/agent/link.rs | 3 + packages/yew/src/callback.rs | 3 + packages/yew/src/html/classes.rs | 22 + packages/yew/src/html/component/lifecycle.rs | 4 + packages/yew/src/html/conversion.rs | 89 ++++ packages/yew/src/html/listener/macros.rs | 9 +- packages/yew/src/html/mod.rs | 2 + packages/yew/src/virtual_dom/key.rs | 6 +- packages/yew/src/virtual_dom/mod.rs | 43 +- packages/yew/src/virtual_dom/vcomp.rs | 50 +- packages/yew/src/virtual_dom/vtag.rs | 157 ++---- packages/yew/src/virtual_dom/vtext.rs | 7 +- packages/yewtil/src/history.rs | 2 +- website/docs/concepts/html/components.md | 41 +- 51 files changed, 890 insertions(+), 1023 deletions(-) delete mode 100644 packages/yew-macro/tests/html_macro/element-pass.rs create mode 100644 packages/yew-macro/tests/html_macro/html-element-pass.rs create mode 100644 packages/yew-macro/tests/html_macro/html-node-pass.rs create mode 100644 packages/yew/src/html/conversion.rs diff --git a/examples/boids/src/slider.rs b/examples/boids/src/slider.rs index a86c77f82e8..f98be3d01ee 100644 --- a/examples/boids/src/slider.rs +++ b/examples/boids/src/slider.rs @@ -80,13 +80,13 @@ impl Component for Slider { html! {
- + { display_value }
diff --git a/examples/crm/src/add_client.rs b/examples/crm/src/add_client.rs index ed2683092cf..f5eba187286 100644 --- a/examples/crm/src/add_client.rs +++ b/examples/crm/src/add_client.rs @@ -78,19 +78,19 @@ impl Component for AddClientForm {