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 357811FF142 for ; Tue, 07 Apr 2026 19:26:44 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F32FC303A6; Tue, 7 Apr 2026 19:27:18 +0200 (CEST) MIME-Version: 1.0 Date: Tue, 7 Apr 2026 17:26:35 +0000 Subject: Re: [PATCH yew-widget-toolkit v3] widget: add 'div', 'span' and 'italic' helper functions In-Reply-To: <20260407130919.3451837-1-d.csapak@proxmox.com> References: <20260407130919.3451837-1-d.csapak@proxmox.com> X-Mailer: BlueMind-MailApp-v5 Message-ID: From: Dietmar Maurer To: Dominik Csapak Content-Type: multipart/alternative; boundary="-=Part.4f06.7119c00b6c57def4.19d68fa5355.620520987b64ec1e=-" X-Bm-Parsing-Options: encoded-parts X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775582736627 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.335 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 HTML_MESSAGE 0.001 HTML included in message KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 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.001 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.001 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: XWTJ66FSJOSP6BJCLCXU2O2TMCXAVRE7 X-Message-ID-Hash: XWTJ66FSJOSP6BJCLCXU2O2TMCXAVRE7 X-MailFrom: dietmar@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 CC: yew-devel@lists.proxmox.com 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: ---=Part.4f06.7119c00b6c57def4.19d68fa5355.620520987b64ec1e=- Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable italic() is IMHO very missleading =2E=2E=2E On Tuesday, 04/07/2026, 15:09, Dominik Csapak w= rote: >>From : Dominik Csapak Sent on : Tuesday, 04/07/2026, 15:09 To : yew-devel@lists=2Eproxmox=2Ecom Subject : [PATCH yew-widget-toolkit v3] widget: add 'div', 'span' and 'ita= lic' helper functions these are just a simple wrapper around the `Container` widget, but it's very useful in situations where bare strings are used in a flex layout, since e=2Eg=2E a `Row` with multiple children that are all strings won't g= et a proper flex layout (since they're not elements) So instead of writing ``` Row::new() =C2=A0 =C2=A0=2Ewith_child(Container::new()=2Ewith_child("Text1")) =C2=A0 =C2=A0=2Ewith_child(Container::new()=2Ewith_child("Text2")) ``` one can now write ``` Row::new() =C2=A0 =C2=A0=2Ewith_child(div("Text1")) =C2=A0 =C2=A0=2Ewith_child(div("Text2")) ``` which is much shorter and more readable=2E In addition to the `div` helper also add a `span` and `italic` helper, which correspond to the `` and `` tag respectively=2E We have to use the ContainerBuilder trait in the individual functions, since a global import in this file here would conflict with the `Properties` derive macro=2E To expose these functions, simply make the 'container' module public=2E Signed-off-by: Dominik Csapak --- src/widget/container=2Ers [http://container=2Ers/] | 24 +++++++++++++++++= +++++++ src/widget/mod=2Ers [http://mod=2Ers/] =C2=A0 =C2=A0 =C2=A0 | =C2=A02 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/widget/container=2Ers [http://container=2Ers/] b/src/widg= et/container=2Ers [http://container=2Ers/] index 23d637b=2E=2E0f5e9b5 100644 --- a/src/widget/container=2Ers [http://container=2Ers/] +++ b/src/widget/container=2Ers [http://container=2Ers/] @@ -57,3 +57,27 @@ impl IntoVTag for Container { =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) =C2=A0 =C2=A0 } } + +/// Helper function to create a `
` element with a single child=2E +/// +/// It's the same as `Container::new()=2Ewith_child(comp)` +pub fn div(comp: impl Into) -> Container { + =C2=A0 =C2=A0use crate::props::ContainerBuilder; + =C2=A0 =C2=A0Container::new()=2Ewith_child(comp) +} + +/// Helper function to create a `` element with a single child=2E +/// +/// It's the same as `Container::from_tag("span")=2Ewith_child(comp)` +pub fn span(comp: impl Into) -> Container { + =C2=A0 =C2=A0use crate::props::ContainerBuilder; + =C2=A0 =C2=A0Container::from_tag("span")=2Ewith_child(comp) +} + +/// Helper function to create an `` element with a single child=2E +/// +/// It's the same as `Container::from_tag("i")=2Ewith_child(comp)` +pub fn italic(comp: impl Into) -> Container { + =C2=A0 =C2=A0use crate::props::ContainerBuilder; + =C2=A0 =C2=A0Container::from_tag("i")=2Ewith_child(comp) +} diff --git a/src/widget/mod=2Ers [http://mod=2Ers/] b/src/widget/mod=2Ers = [http://mod=2Ers/] index 0df2cbf=2E=2Eff3234a 100644 --- a/src/widget/mod=2Ers [http://mod=2Ers/] +++ b/src/widget/mod=2Ers [http://mod=2Ers/] @@ -31,7 +31,7 @@ pub use catalog_loader::PwtCatalogLoader; mod column; pub use column::Column; =20 -mod container; +pub mod container; pub use container::Container; =20 mod confirm_dialog; --=20 2=2E47=2E3 ---=Part.4f06.7119c00b6c57def4.19d68fa5355.620520987b64ec1e=- Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
italic() is IMHO very missleading =2E=2E=2E

On Tuesday, 04/07/2026, 15:09, Do= minik Csapak <d=2Ecsapak@proxmox=2Ecom> wrote:

From  : Dominik Csapak <d=2Ecsapak@proxmox=2Ecom>
<= span style=3D"font-weight: 600;">Sent on  : Tuesday, 04/07/2026= , 15:09
To : yew-devel@lis= ts=2Eproxmox=2Ecom
Subject : [PATCH yew-widget-toolkit v3] widget: add 'div', 'span' and 'italic' hel= per functions

these are just a simple wrapper around the `= Container` widget, but it's very useful in situations where bare strings ar= e used in a flex layout, since e=2Eg=2E a `Row` with multiple children that= are all strings won't get a proper flex layout (since they're not elements= ) So instead of writing ``` Row::new()    =2Ewith_child(Contain= er::new()=2Ewith_child("Text1"))    =2Ewith_child(Container::new= ()=2Ewith_child("Text2")) ``` one can now write ``` Row::new()   &nb= sp;=2Ewith_child(div("Text1"))    =2Ewith_child(div("Text2")) ``= ` which is much shorter and more readable=2E In addition to the `div` hel= per also add a `span` and `italic` helper, which correspond to the `<spa= n>` and `<i>` tag respectively=2E We have to use the ContainerBui= lder trait in the individual functions, since a global import in this file = here would conflict with the `Properties` derive macro=2E To expose these = functions, simply make the 'container' module public=2E Signed-off-by: Dom= inik Csapak <d=2Ecsapak@proxmox=2Ecom> --- src/widget/contai= ner=2Ers | 24 ++++++++++++++++++++++++ src/widget/mod=2Ers     &n= bsp; |  2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff -= -git a/src/widget/container=2Ers b/src/widget/container=2Ers index 23d63= 7b=2E=2E0f5e9b5 100644 --- a/src/widget/container=2Ers +++ b/src/widget/conta= iner=2Ers @@ -57,3 +57,27 @@ impl IntoVTag for Container {   &nbs= p;     )     } } + +/// Helper function to create a `= <div>` element with a single child=2E +/// +/// It's the same as `Con= tainer::new()=2Ewith_child(comp)` +pub fn div(comp: impl Into<Html>) = -> Container { +    use crate::props::ContainerBuilder; + &nbs= p;  Container::new()=2Ewith_child(comp) +} + +/// Helper function to c= reate a `<span>` element with a single child=2E +/// +/// It's the sa= me as `Container::from_tag("span")=2Ewith_child(comp)` +pub fn span(comp: i= mpl Into<Html>) -> Container { +    use crate::props::Co= ntainerBuilder; +    Container::from_tag("span")=2Ewith_child(com= p) +} + +/// Helper function to create an `<i>` element with a single= child=2E +/// +/// It's the same as `Container::from_tag("i")=2Ewith_child= (comp)` +pub fn italic(comp: impl Into<Html>) -> Container { + &nb= sp;  use crate::props::ContainerBuilder; +    Container::fro= m_tag("i")=2Ewith_child(comp) +} diff --git a/src/widget/mod=2Ers b/src/widget/<= a href=3D"http://mod=2Ers" target=3D"_blank" class=3D"linkified">mod=2Ers index 0df2cbf=2E=2Eff3234a 100644 --- a/src/widget/mod=2Ers +++ b/src/widget/= mod=2Ers<= /a> @@ -31,7 +31,7 @@ pub use catalog_loader::PwtCatalogLoader; mod column= ; pub use column::Column; -mod container; +pub mod container; pub use c= ontainer::Container; mod confirm_dialog; -- 2=2E47=2E3

---=Part.4f06.7119c00b6c57def4.19d68fa5355.620520987b64ec1e=---