#13 cleanup frontend and widgets

This commit is contained in:
2025-08-01 19:44:55 -05:00
parent da1ecb1f21
commit 063c90d986
4 changed files with 53 additions and 44 deletions
+9 -3
View File
@@ -147,7 +147,9 @@ macro_rules! rsx {
macro_rules! rsx_inner {
// static
($r:expr, $(@$comp:expr;)* static $s:literal $($rest:tt)*) => {
$r.create_element_static(std::sync::Arc::new($crate::widget::StaticWidget::new(Box::new(format!($s)))) $(.component($comp))* .clone(), $crate::frontend::Rsx(Vec::new()));
let w = $crate::widget::StaticWidget::new(Box::new(format!($s)));
$(w.component($comp);)*
$r.create_element_static(w, $crate::frontend::Rsx(Vec::new()));
$crate::rsx_inner! { $r, $($rest)* };
};
@@ -160,13 +162,17 @@ macro_rules! rsx_inner {
// static
($r:expr, $(%$dep:ident)* $(@$comp:expr;)* static $name:path { $($inner:tt)* } ($($e:expr),*) $($rest:tt)*) => {
$r.create_element_static(std::sync::Arc::new($crate::widget::StaticWidget::new(Box::new(<$name>::new($($e),*)))) $(.component($comp))* .clone(), $crate::frontend::Rsx(Vec::new()));
let w = $crate::widget::StaticWidget::new(Box::new(<$name>::new($($e),*)));
$(w.component($comp);)*
$r.create_element_static(w, $crate::frontend::Rsx(Vec::new()));
$crate::rsx_inner! { $r, $($rest)* };
};
// static
($r:expr, $(@$comp:expr;)* static $name:path { $($inner:tt)* } $($rest:tt)*) => {
$r.create_element_static(std::sync::Arc::new($crate::widget::StaticWidget::new(Box::new(<$name>::new()))) $(.component($comp))* .clone(), $crate::frontend::Rsx(Vec::new()));
let w = $crate::widget::StaticWidget::new(Box::new(<$name>::new()));
$(w.component($comp);)*
$r.create_element_static(w, $crate::frontend::Rsx(Vec::new()));
$crate::rsx_inner! { $r, $($rest)* };
};