From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8E9571FF13E for ; Fri, 20 Mar 2026 17:08:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DDD351C23D; Fri, 20 Mar 2026 17:08:51 +0100 (CET) From: Dominik Csapak 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 Message-ID: <20260320160816.4113364-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260320160816.4113364-1-d.csapak@proxmox.com> References: <20260320160816.4113364-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -1.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: T2MPSV5RXG57PG6R35M7SDYMPZDW4PB4 X-Message-ID-Hash: T2MPSV5RXG57PG6R35M7SDYMPZDW4PB4 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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 &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