From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [RFC PATCH yew-widget-toolkit 2/3] macros: widget: impl WidgetStyleBuilder for svgs
Date: Fri, 20 Mar 2026 17:03:59 +0100 [thread overview]
Message-ID: <20260320160816.4113364-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260320160816.4113364-1-d.csapak@proxmox.com>
svg elements such as Circle, Group, etc. have a style property that can
be set, so implement this for them.
padding/margin/border can be set on such elements too but have no
effect, so don't implement them for svg elements.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pwt-macros/src/widget.rs | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/pwt-macros/src/widget.rs b/pwt-macros/src/widget.rs
index 08f2c1c..7e9ade2 100644
--- a/pwt-macros/src/widget.rs
+++ b/pwt-macros/src/widget.rs
@@ -218,24 +218,27 @@ fn derive_widget(setup: &WidgetSetup, widget: DeriveInput) -> Result<proc_macro2
}
});
- if !setup.is_svg {
- output.extend(quote!{
- impl #impl_generics #pwt::props::AsClassesMut for #ident #ty_generics #where_clause {
- fn as_classes_mut(&mut self) -> &mut ::yew::Classes {
- &mut self.std_props.class
- }
+ output.extend(quote! {
+ impl #impl_generics #pwt::props::AsClassesMut for #ident #ty_generics #where_clause {
+ fn as_classes_mut(&mut self) -> &mut ::yew::Classes {
+ &mut self.std_props.class
}
+ }
- impl #impl_generics #pwt::props::AsCssStylesMut for #ident #ty_generics #where_clause {
- fn as_css_styles_mut(&mut self) -> &mut #pwt::props::CssStyles {
- &mut self.std_props.styles
- }
+ impl #impl_generics #pwt::props::AsCssStylesMut for #ident #ty_generics #where_clause {
+ fn as_css_styles_mut(&mut self) -> &mut #pwt::props::CssStyles {
+ &mut self.std_props.styles
}
+ }
+
+ impl #impl_generics #pwt::props::WidgetStyleBuilder for #ident #ty_generics #where_clause {}
+ });
+ if !setup.is_svg {
+ output.extend(quote! {
impl #impl_generics #pwt::props::CssMarginBuilder for #ident #ty_generics #where_clause {}
impl #impl_generics #pwt::props::CssPaddingBuilder for #ident #ty_generics #where_clause {}
impl #impl_generics #pwt::props::CssBorderBuilder for #ident #ty_generics #where_clause {}
- impl #impl_generics #pwt::props::WidgetStyleBuilder for #ident #ty_generics #where_clause {}
});
}
--
2.47.3
next prev parent reply other threads:[~2026-03-20 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 16:03 [RFC PATCH yew-widget-toolkit 0/3] implement pie chart widget Dominik Csapak
2026-03-20 16:03 ` [RFC PATCH yew-widget-toolkit 1/3] widget: button: add 'icon_style' property Dominik Csapak
2026-03-20 16:03 ` Dominik Csapak [this message]
2026-03-20 16:04 ` [RFC PATCH yew-widget-toolkit 3/3] add pie chart widget Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260320160816.4113364-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox