From 9c055f2856eb4bd431b5e470459e97d85ad374af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=8A=E6=AC=A7?= Date: Sat, 16 Nov 2024 16:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Implement=20`Serialize`=20and=20?= =?UTF-8?q?`Deserialize`=20for=20all=20the=20components'=20properties.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/components/src/container/layout/aside.rs | 5 ++++- .../components/src/container/layout/container.rs | 5 ++++- .../components/src/container/layout/footer.rs | 5 ++++- .../components/src/container/layout/header.rs | 5 ++++- packages/components/src/container/layout/main.rs | 5 ++++- packages/components/src/container/place/column.rs | 5 ++++- packages/components/src/container/place/grid.rs | 5 ++++- packages/components/src/container/place/row.rs | 5 ++++- .../components/src/container/place/skeleton.rs | 5 ++++- packages/components/src/container/place/space.rs | 5 ++++- .../components/src/container/system/anchor.rs | 5 ++++- .../components/src/container/system/breakpoint.rs | 5 ++++- .../components/src/container/system/cursor.rs | 5 ++++- .../components/src/container/system/draggable.rs | 5 ++++- packages/components/src/container/system/flex.rs | 5 ++++- packages/components/src/container/system/modal.rs | 5 ++++- .../components/src/container/system/resizable.rs | 5 ++++- .../components/src/container/system/scrollable.rs | 5 ++++- packages/components/src/data/block/card.rs | 5 ++++- packages/components/src/data/block/carousel.rs | 5 ++++- packages/components/src/data/block/list/item.rs | 5 ++++- packages/components/src/data/block/list/mod.rs | 5 ++++- packages/components/src/data/block/masonry.rs | 5 ++++- packages/components/src/data/block/paper.rs | 5 ++++- .../src/data/block/progress/circular.rs | 5 ++++- .../components/src/data/block/progress/linear.rs | 5 ++++- packages/components/src/data/block/summary.rs | 5 ++++- packages/components/src/data/block/tree/item.rs | 5 ++++- packages/components/src/data/block/tree/mod.rs | 5 ++++- packages/components/src/data/paragraph/affix.rs | 5 ++++- packages/components/src/data/paragraph/avatar.rs | 5 ++++- packages/components/src/data/paragraph/badge.rs | 5 ++++- packages/components/src/data/paragraph/chip.rs | 5 ++++- packages/components/src/data/paragraph/icon.rs | 5 ++++- .../src/data/paragraph/rich/markdown/mod.rs | 5 ++++- .../components/src/data/paragraph/rich/mod.rs | 5 ++++- .../components/src/data/typography/baseline.rs | 5 ++++- packages/components/src/data/typography/bold.rs | 5 ++++- packages/components/src/data/typography/code.rs | 5 ++++- packages/components/src/data/typography/delete.rs | 5 ++++- .../components/src/data/typography/direction.rs | 5 ++++- packages/components/src/data/typography/italic.rs | 5 ++++- packages/components/src/data/typography/mark.rs | 5 ++++- packages/components/src/data/typography/quote.rs | 5 ++++- packages/components/src/data/typography/ruby.rs | 5 ++++- packages/components/src/data/typography/sizing.rs | 15 +++++++++++---- packages/components/src/data/typography/split.rs | 5 ++++- .../components/src/data/typography/underline.rs | 5 ++++- packages/components/src/form/button/button.rs | 6 +++++- .../components/src/form/button/button_group.rs | 5 ++++- .../components/src/form/button/icon_button.rs | 5 ++++- packages/components/src/form/button/tag.rs | 5 ++++- packages/components/src/form/input/rich.rs | 5 ++++- packages/components/src/form/input/text.rs | 13 ++++++++----- packages/components/src/form/input/text_area.rs | 5 ++++- packages/components/src/form/picker/color.rs | 5 ++++- packages/components/src/form/picker/date.rs | 5 ++++- packages/components/src/form/picker/date_time.rs | 5 ++++- packages/components/src/form/picker/file.rs | 5 ++++- packages/components/src/form/picker/time.rs | 5 ++++- .../components/src/form/selector/check_box.rs | 6 +++++- .../components/src/form/selector/multi_select.rs | 5 ++++- packages/components/src/form/selector/radio.rs | 5 ++++- packages/components/src/form/selector/range.rs | 5 ++++- packages/components/src/form/selector/rating.rs | 5 ++++- packages/components/src/form/selector/select.rs | 5 ++++- packages/components/src/form/selector/slider.rs | 5 ++++- packages/components/src/form/selector/switch.rs | 5 ++++- .../components/src/navigation/aside/bottom_nav.rs | 5 ++++- .../components/src/navigation/aside/breadcrumb.rs | 5 ++++- .../components/src/navigation/aside/pagination.rs | 5 ++++- packages/components/src/navigation/aside/steps.rs | 5 ++++- packages/components/src/navigation/aside/tabs.rs | 5 ++++- .../components/src/navigation/aside/top_nav.rs | 5 ++++- .../components/src/navigation/modal/drawer.rs | 5 ++++- packages/components/src/navigation/modal/menu.rs | 5 ++++- .../src/navigation/modal/message_box.rs | 5 ++++- .../src/navigation/modal/notification.rs | 5 ++++- .../components/src/navigation/modal/popover.rs | 5 ++++- .../components/src/navigation/modal/speed_dial.rs | 5 ++++- .../components/src/navigation/modal/tooltip.rs | 5 ++++- packages/theme/src/components/form/button.rs | 8 ++++++-- packages/theme/src/context.rs | 3 ++- packages/theme/src/types/layout.rs | 5 ++++- packages/theme/src/types/palette.rs | 9 ++++++--- packages/theme/src/types/typography.rs | 7 +++++-- 86 files changed, 360 insertions(+), 97 deletions(-) diff --git a/packages/components/src/container/layout/aside.rs b/packages/components/src/container/layout/aside.rs index d1ac0c6..b83b17b 100644 --- a/packages/components/src/container/layout/aside.rs +++ b/packages/components/src/container/layout/aside.rs @@ -1,12 +1,15 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or(256)] pub width: u32, #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/layout/container.rs b/packages/components/src/container/layout/container.rs index 997748e..eebb021 100644 --- a/packages/components/src/container/layout/container.rs +++ b/packages/components/src/container/layout/container.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::{html::ChildrenRenderer, prelude::*, virtual_dom::VChild}; @@ -25,9 +27,10 @@ impl Into for ContainerLayoutVariant { } } -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: ChildrenRenderer, } diff --git a/packages/components/src/container/layout/footer.rs b/packages/components/src/container/layout/footer.rs index da83970..ccfecfb 100644 --- a/packages/components/src/container/layout/footer.rs +++ b/packages/components/src/container/layout/footer.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/layout/header.rs b/packages/components/src/container/layout/header.rs index 354f624..e0ff6d2 100644 --- a/packages/components/src/container/layout/header.rs +++ b/packages/components/src/container/layout/header.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/layout/main.rs b/packages/components/src/container/layout/main.rs index b5d5ba7..2b95abe 100644 --- a/packages/components/src/container/layout/main.rs +++ b/packages/components/src/container/layout/main.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/place/column.rs b/packages/components/src/container/place/column.rs index a21ceaa..796c32f 100644 --- a/packages/components/src/container/place/column.rs +++ b/packages/components/src/container/place/column.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/place/grid.rs b/packages/components/src/container/place/grid.rs index 5d5d9eb..7d366f6 100644 --- a/packages/components/src/container/place/grid.rs +++ b/packages/components/src/container/place/grid.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/place/row.rs b/packages/components/src/container/place/row.rs index 44a3496..b8fe2a9 100644 --- a/packages/components/src/container/place/row.rs +++ b/packages/components/src/container/place/row.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/place/skeleton.rs b/packages/components/src/container/place/skeleton.rs index 73d7922..9a7c444 100644 --- a/packages/components/src/container/place/skeleton.rs +++ b/packages/components/src/container/place/skeleton.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/place/space.rs b/packages/components/src/container/place/space.rs index bc16693..f06f0b3 100644 --- a/packages/components/src/container/place/space.rs +++ b/packages/components/src/container/place/space.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/anchor.rs b/packages/components/src/container/system/anchor.rs index e7861db..ca12748 100644 --- a/packages/components/src/container/system/anchor.rs +++ b/packages/components/src/container/system/anchor.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/breakpoint.rs b/packages/components/src/container/system/breakpoint.rs index bcf5ce3..8053c88 100644 --- a/packages/components/src/container/system/breakpoint.rs +++ b/packages/components/src/container/system/breakpoint.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/cursor.rs b/packages/components/src/container/system/cursor.rs index 784637e..e846ef1 100644 --- a/packages/components/src/container/system/cursor.rs +++ b/packages/components/src/container/system/cursor.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/draggable.rs b/packages/components/src/container/system/draggable.rs index 7e8b5ba..26658f7 100644 --- a/packages/components/src/container/system/draggable.rs +++ b/packages/components/src/container/system/draggable.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/flex.rs b/packages/components/src/container/system/flex.rs index 40659cc..4b6e1c4 100644 --- a/packages/components/src/container/system/flex.rs +++ b/packages/components/src/container/system/flex.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/modal.rs b/packages/components/src/container/system/modal.rs index ace026a..131ce43 100644 --- a/packages/components/src/container/system/modal.rs +++ b/packages/components/src/container/system/modal.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/resizable.rs b/packages/components/src/container/system/resizable.rs index 9e056d8..a1d3fef 100644 --- a/packages/components/src/container/system/resizable.rs +++ b/packages/components/src/container/system/resizable.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/container/system/scrollable.rs b/packages/components/src/container/system/scrollable.rs index ed626c8..b2d21b4 100644 --- a/packages/components/src/container/system/scrollable.rs +++ b/packages/components/src/container/system/scrollable.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/card.rs b/packages/components/src/data/block/card.rs index 5c3512b..29e8270 100644 --- a/packages/components/src/data/block/card.rs +++ b/packages/components/src/data/block/card.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/carousel.rs b/packages/components/src/data/block/carousel.rs index 0bfd5ea..efa013a 100644 --- a/packages/components/src/data/block/carousel.rs +++ b/packages/components/src/data/block/carousel.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/list/item.rs b/packages/components/src/data/block/list/item.rs index 51b5387..12ceaa6 100644 --- a/packages/components/src/data/block/list/item.rs +++ b/packages/components/src/data/block/list/item.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/list/mod.rs b/packages/components/src/data/block/list/mod.rs index 0fa72de..5e5af84 100644 --- a/packages/components/src/data/block/list/mod.rs +++ b/packages/components/src/data/block/list/mod.rs @@ -1,11 +1,14 @@ pub mod item; +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/masonry.rs b/packages/components/src/data/block/masonry.rs index 99f22e6..de6ee56 100644 --- a/packages/components/src/data/block/masonry.rs +++ b/packages/components/src/data/block/masonry.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/paper.rs b/packages/components/src/data/block/paper.rs index c667abf..e68bf17 100644 --- a/packages/components/src/data/block/paper.rs +++ b/packages/components/src/data/block/paper.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/progress/circular.rs b/packages/components/src/data/block/progress/circular.rs index c236081..8a53c4a 100644 --- a/packages/components/src/data/block/progress/circular.rs +++ b/packages/components/src/data/block/progress/circular.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/progress/linear.rs b/packages/components/src/data/block/progress/linear.rs index 5a38856..2cd7704 100644 --- a/packages/components/src/data/block/progress/linear.rs +++ b/packages/components/src/data/block/progress/linear.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/summary.rs b/packages/components/src/data/block/summary.rs index 69e01af..38d6478 100644 --- a/packages/components/src/data/block/summary.rs +++ b/packages/components/src/data/block/summary.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/tree/item.rs b/packages/components/src/data/block/tree/item.rs index 816be13..feb3b09 100644 --- a/packages/components/src/data/block/tree/item.rs +++ b/packages/components/src/data/block/tree/item.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/block/tree/mod.rs b/packages/components/src/data/block/tree/mod.rs index b0921d2..ec47a4f 100644 --- a/packages/components/src/data/block/tree/mod.rs +++ b/packages/components/src/data/block/tree/mod.rs @@ -1,11 +1,14 @@ pub mod item; +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/affix.rs b/packages/components/src/data/paragraph/affix.rs index 5c44006..cef433d 100644 --- a/packages/components/src/data/paragraph/affix.rs +++ b/packages/components/src/data/paragraph/affix.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/avatar.rs b/packages/components/src/data/paragraph/avatar.rs index b623fcf..0fe8731 100644 --- a/packages/components/src/data/paragraph/avatar.rs +++ b/packages/components/src/data/paragraph/avatar.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/badge.rs b/packages/components/src/data/paragraph/badge.rs index 720f8aa..be6acb5 100644 --- a/packages/components/src/data/paragraph/badge.rs +++ b/packages/components/src/data/paragraph/badge.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/chip.rs b/packages/components/src/data/paragraph/chip.rs index 0e0f237..7dac444 100644 --- a/packages/components/src/data/paragraph/chip.rs +++ b/packages/components/src/data/paragraph/chip.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/icon.rs b/packages/components/src/data/paragraph/icon.rs index 4934982..53c075b 100644 --- a/packages/components/src/data/paragraph/icon.rs +++ b/packages/components/src/data/paragraph/icon.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/rich/markdown/mod.rs b/packages/components/src/data/paragraph/rich/markdown/mod.rs index 4151f18..7766c6f 100644 --- a/packages/components/src/data/paragraph/rich/markdown/mod.rs +++ b/packages/components/src/data/paragraph/rich/markdown/mod.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/paragraph/rich/mod.rs b/packages/components/src/data/paragraph/rich/mod.rs index 9d6baba..e80e291 100644 --- a/packages/components/src/data/paragraph/rich/mod.rs +++ b/packages/components/src/data/paragraph/rich/mod.rs @@ -5,12 +5,15 @@ mod markdown; #[cfg(feature = "form-input-rich-mediawiki")] mod mediawiki; +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/baseline.rs b/packages/components/src/data/typography/baseline.rs index 63012dc..bb27d73 100644 --- a/packages/components/src/data/typography/baseline.rs +++ b/packages/components/src/data/typography/baseline.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/bold.rs b/packages/components/src/data/typography/bold.rs index d42cf08..7a88e80 100644 --- a/packages/components/src/data/typography/bold.rs +++ b/packages/components/src/data/typography/bold.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/code.rs b/packages/components/src/data/typography/code.rs index dcfeedf..5a74573 100644 --- a/packages/components/src/data/typography/code.rs +++ b/packages/components/src/data/typography/code.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/delete.rs b/packages/components/src/data/typography/delete.rs index bd6a5a7..d24626b 100644 --- a/packages/components/src/data/typography/delete.rs +++ b/packages/components/src/data/typography/delete.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/direction.rs b/packages/components/src/data/typography/direction.rs index 3dfe46e..dbb0f6f 100644 --- a/packages/components/src/data/typography/direction.rs +++ b/packages/components/src/data/typography/direction.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/italic.rs b/packages/components/src/data/typography/italic.rs index 53a8b0a..3685e58 100644 --- a/packages/components/src/data/typography/italic.rs +++ b/packages/components/src/data/typography/italic.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/mark.rs b/packages/components/src/data/typography/mark.rs index 22f7ce5..f3a0c9e 100644 --- a/packages/components/src/data/typography/mark.rs +++ b/packages/components/src/data/typography/mark.rs @@ -1,11 +1,14 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; use hikari_theme::types::Color; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, #[prop_or_default] pub color: Option, diff --git a/packages/components/src/data/typography/quote.rs b/packages/components/src/data/typography/quote.rs index b0f36a7..5612846 100644 --- a/packages/components/src/data/typography/quote.rs +++ b/packages/components/src/data/typography/quote.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/ruby.rs b/packages/components/src/data/typography/ruby.rs index 6f1d31e..7aef74b 100644 --- a/packages/components/src/data/typography/ruby.rs +++ b/packages/components/src/data/typography/ruby.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/sizing.rs b/packages/components/src/data/typography/sizing.rs index 3d9a411..e126293 100644 --- a/packages/components/src/data/typography/sizing.rs +++ b/packages/components/src/data/typography/sizing.rs @@ -1,14 +1,18 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; use hikari_theme::types::FontSize; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { - #[prop_or_default] - pub children: Children, #[prop_or(FontSize::H1)] pub size: FontSize, + + #[prop_or_default] + #[serde(skip)] + pub children: Children, } /// `` component can be used to set the font size. @@ -28,15 +32,18 @@ pub fn Sizing(props: &Props) -> Html { } pub mod headers { + use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; use super::Sizing; use hikari_theme::types::FontSize; - #[derive(Properties, Debug, PartialEq)] + #[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/split.rs b/packages/components/src/data/typography/split.rs index ed051aa..cb103a7 100644 --- a/packages/components/src/data/typography/split.rs +++ b/packages/components/src/data/typography/split.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/data/typography/underline.rs b/packages/components/src/data/typography/underline.rs index 4b79d8d..283f273 100644 --- a/packages/components/src/data/typography/underline.rs +++ b/packages/components/src/data/typography/underline.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/button/button.rs b/packages/components/src/form/button/button.rs index bb109ea..7154dd7 100644 --- a/packages/components/src/form/button/button.rs +++ b/packages/components/src/form/button/button.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; @@ -6,7 +8,7 @@ use hikari_theme::{ types::{ColorType, SizeType}, }; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] pub size: SizeType, @@ -16,9 +18,11 @@ pub struct Props { pub outlined: bool, #[prop_or_default] + #[serde(skip)] pub on_click: Callback, #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/button/button_group.rs b/packages/components/src/form/button/button_group.rs index 5c5e7da..acac590 100644 --- a/packages/components/src/form/button/button_group.rs +++ b/packages/components/src/form/button/button_group.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::{html::ChildrenRenderer, prelude::*, virtual_dom::VChild}; @@ -20,7 +22,7 @@ impl From for Html { } } -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or(SizeType::Medium)] pub size: SizeType, @@ -30,6 +32,7 @@ pub struct Props { pub outlined: bool, #[prop_or_default] + #[serde(skip)] pub children: ChildrenRenderer, } diff --git a/packages/components/src/form/button/icon_button.rs b/packages/components/src/form/button/icon_button.rs index dc43aca..ff67273 100644 --- a/packages/components/src/form/button/icon_button.rs +++ b/packages/components/src/form/button/icon_button.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/button/tag.rs b/packages/components/src/form/button/tag.rs index a0eed76..0dd3e2f 100644 --- a/packages/components/src/form/button/tag.rs +++ b/packages/components/src/form/button/tag.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/input/rich.rs b/packages/components/src/form/input/rich.rs index 9786e7d..a1de14a 100644 --- a/packages/components/src/form/input/rich.rs +++ b/packages/components/src/form/input/rich.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/input/text.rs b/packages/components/src/form/input/text.rs index cc0ef40..75844b7 100644 --- a/packages/components/src/form/input/text.rs +++ b/packages/components/src/form/input/text.rs @@ -1,14 +1,17 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] - pub placeholder: AttrValue, + pub placeholder: String, #[prop_or_default] - pub value: AttrValue, + pub value: String, #[prop_or_default] + #[serde(skip)] pub oninput: Callback, } @@ -65,8 +68,8 @@ pub fn TextInput(props: &Props) -> Html { outline: 1px solid rgba(var(--color-primary), 0.8); } "#)} - placeholder={&props.placeholder} - value={&props.value} + placeholder={props.placeholder.clone()} + value={props.value.clone()} oninput={&props.oninput} /> diff --git a/packages/components/src/form/input/text_area.rs b/packages/components/src/form/input/text_area.rs index 67f829c..7d0c960 100644 --- a/packages/components/src/form/input/text_area.rs +++ b/packages/components/src/form/input/text_area.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/picker/color.rs b/packages/components/src/form/picker/color.rs index 9a5c11f..dfc9d81 100644 --- a/packages/components/src/form/picker/color.rs +++ b/packages/components/src/form/picker/color.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/picker/date.rs b/packages/components/src/form/picker/date.rs index 4fa5b8e..053124b 100644 --- a/packages/components/src/form/picker/date.rs +++ b/packages/components/src/form/picker/date.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/picker/date_time.rs b/packages/components/src/form/picker/date_time.rs index 11485e1..7fe444d 100644 --- a/packages/components/src/form/picker/date_time.rs +++ b/packages/components/src/form/picker/date_time.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/picker/file.rs b/packages/components/src/form/picker/file.rs index 4a36a4e..93f80d2 100644 --- a/packages/components/src/form/picker/file.rs +++ b/packages/components/src/form/picker/file.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/picker/time.rs b/packages/components/src/form/picker/time.rs index 022f607..5e680f4 100644 --- a/packages/components/src/form/picker/time.rs +++ b/packages/components/src/form/picker/time.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/check_box.rs b/packages/components/src/form/selector/check_box.rs index df83599..10a6231 100644 --- a/packages/components/src/form/selector/check_box.rs +++ b/packages/components/src/form/selector/check_box.rs @@ -1,9 +1,11 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; use hikari_theme::types::{ColorType, SizeType}; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] pub size: SizeType, @@ -13,9 +15,11 @@ pub struct Props { pub outlined: bool, #[prop_or_default] + #[serde(skip)] pub on_toggle: Callback, #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/multi_select.rs b/packages/components/src/form/selector/multi_select.rs index d96acd3..e303e80 100644 --- a/packages/components/src/form/selector/multi_select.rs +++ b/packages/components/src/form/selector/multi_select.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/radio.rs b/packages/components/src/form/selector/radio.rs index a15aeff..192ca2a 100644 --- a/packages/components/src/form/selector/radio.rs +++ b/packages/components/src/form/selector/radio.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/range.rs b/packages/components/src/form/selector/range.rs index ed5fe38..44479b2 100644 --- a/packages/components/src/form/selector/range.rs +++ b/packages/components/src/form/selector/range.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/rating.rs b/packages/components/src/form/selector/rating.rs index 39bef55..c859348 100644 --- a/packages/components/src/form/selector/rating.rs +++ b/packages/components/src/form/selector/rating.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/select.rs b/packages/components/src/form/selector/select.rs index c0f05c0..49a57d7 100644 --- a/packages/components/src/form/selector/select.rs +++ b/packages/components/src/form/selector/select.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/slider.rs b/packages/components/src/form/selector/slider.rs index 791bd35..7871cc1 100644 --- a/packages/components/src/form/selector/slider.rs +++ b/packages/components/src/form/selector/slider.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/form/selector/switch.rs b/packages/components/src/form/selector/switch.rs index d770b66..88fce4c 100644 --- a/packages/components/src/form/selector/switch.rs +++ b/packages/components/src/form/selector/switch.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/bottom_nav.rs b/packages/components/src/navigation/aside/bottom_nav.rs index af4aae3..fffb7b7 100644 --- a/packages/components/src/navigation/aside/bottom_nav.rs +++ b/packages/components/src/navigation/aside/bottom_nav.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/breadcrumb.rs b/packages/components/src/navigation/aside/breadcrumb.rs index 7229540..7ecba2b 100644 --- a/packages/components/src/navigation/aside/breadcrumb.rs +++ b/packages/components/src/navigation/aside/breadcrumb.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/pagination.rs b/packages/components/src/navigation/aside/pagination.rs index d6ccb94..2afd109 100644 --- a/packages/components/src/navigation/aside/pagination.rs +++ b/packages/components/src/navigation/aside/pagination.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/steps.rs b/packages/components/src/navigation/aside/steps.rs index e00f18f..aead593 100644 --- a/packages/components/src/navigation/aside/steps.rs +++ b/packages/components/src/navigation/aside/steps.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/tabs.rs b/packages/components/src/navigation/aside/tabs.rs index 02fafe1..28263f6 100644 --- a/packages/components/src/navigation/aside/tabs.rs +++ b/packages/components/src/navigation/aside/tabs.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/aside/top_nav.rs b/packages/components/src/navigation/aside/top_nav.rs index 2bfe5b1..9f30afb 100644 --- a/packages/components/src/navigation/aside/top_nav.rs +++ b/packages/components/src/navigation/aside/top_nav.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/drawer.rs b/packages/components/src/navigation/modal/drawer.rs index 191e37d..11874e2 100644 --- a/packages/components/src/navigation/modal/drawer.rs +++ b/packages/components/src/navigation/modal/drawer.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/menu.rs b/packages/components/src/navigation/modal/menu.rs index dc2848c..8fdd390 100644 --- a/packages/components/src/navigation/modal/menu.rs +++ b/packages/components/src/navigation/modal/menu.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/message_box.rs b/packages/components/src/navigation/modal/message_box.rs index ab8a42f..89f4dc8 100644 --- a/packages/components/src/navigation/modal/message_box.rs +++ b/packages/components/src/navigation/modal/message_box.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/notification.rs b/packages/components/src/navigation/modal/notification.rs index f93d36c..5030b86 100644 --- a/packages/components/src/navigation/modal/notification.rs +++ b/packages/components/src/navigation/modal/notification.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/popover.rs b/packages/components/src/navigation/modal/popover.rs index 4e5cc5a..fea654b 100644 --- a/packages/components/src/navigation/modal/popover.rs +++ b/packages/components/src/navigation/modal/popover.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/speed_dial.rs b/packages/components/src/navigation/modal/speed_dial.rs index 2cf3596..1772db9 100644 --- a/packages/components/src/navigation/modal/speed_dial.rs +++ b/packages/components/src/navigation/modal/speed_dial.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/components/src/navigation/modal/tooltip.rs b/packages/components/src/navigation/modal/tooltip.rs index e6ca5ae..525cbe5 100644 --- a/packages/components/src/navigation/modal/tooltip.rs +++ b/packages/components/src/navigation/modal/tooltip.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use stylist::yew::styled_component; use yew::prelude::*; -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct Props { #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/theme/src/components/form/button.rs b/packages/theme/src/components/form/button.rs index 935d9a6..0d66dba 100644 --- a/packages/theme/src/components/form/button.rs +++ b/packages/theme/src/components/form/button.rs @@ -1,8 +1,11 @@ +use serde::{Deserialize, Serialize}; + use yew::prelude::*; use crate::types::{ColorType, SizeType}; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum BorderRadiusType { #[default] Default, @@ -16,7 +19,7 @@ pub struct ComponentContextState { pub border_radius_type: BorderRadiusType, } -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct ComponentContextProps { #[prop_or(SizeType::Medium)] pub size: SizeType, @@ -28,6 +31,7 @@ pub struct ComponentContextProps { pub border_radius_type: BorderRadiusType, #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/theme/src/context.rs b/packages/theme/src/context.rs index 479b21e..8cb7847 100644 --- a/packages/theme/src/context.rs +++ b/packages/theme/src/context.rs @@ -17,11 +17,12 @@ derive_struct!( } ); -#[derive(Properties, Debug, PartialEq)] +#[derive(Properties, Debug, PartialEq, Serialize, Deserialize)] pub struct ThemeContextProviderProps { pub context: Theme, #[prop_or_default] + #[serde(skip)] pub children: Children, } diff --git a/packages/theme/src/types/layout.rs b/packages/theme/src/types/layout.rs index b454820..7059a14 100644 --- a/packages/theme/src/types/layout.rs +++ b/packages/theme/src/types/layout.rs @@ -1,4 +1,7 @@ -#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum SizeType { Large, #[default] diff --git a/packages/theme/src/types/palette.rs b/packages/theme/src/types/palette.rs index 961a730..297ce0c 100644 --- a/packages/theme/src/types/palette.rs +++ b/packages/theme/src/types/palette.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum ColorType { #[default] Primary, @@ -11,14 +12,16 @@ pub enum ColorType { Warning, } -#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum ColorMode { #[default] Light, Dark, } -#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum ColorLevel { #[default] Full, diff --git a/packages/theme/src/types/typography.rs b/packages/theme/src/types/typography.rs index de599ab..8fad732 100644 --- a/packages/theme/src/types/typography.rs +++ b/packages/theme/src/types/typography.rs @@ -1,6 +1,9 @@ // TODO: fonts, scales and default font size -#[derive(Debug, Clone, Copy, PartialEq)] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum FontSize { H1, H2, @@ -11,5 +14,5 @@ pub enum FontSize { Px(f64), Em(f64), Rem(f64), - Custom(&'static str), + Custom(String), }