Implemented commands on scopes

This commit is contained in:
2026-01-28 19:33:12 +01:00
parent 715175c412
commit 63abf41094
4 changed files with 26 additions and 17 deletions
+6 -12
View File
@@ -28,21 +28,15 @@ fn emit_deps(deps: &[Dep]) -> TokenStream {
fn emit_node(node: &RsxNode) -> TokenStream {
match node {
RsxNode::Text(text) => quote! {
{
let scope = osui::component::Scope::new();
scope.view(Arc::new(move |ctx| {
ctx.draw_text(Point { x: 0, y: 0 }, &format!(#text))
}));
r.static_scope(scope);
}
r.static_scope(|scope| scope.view(Arc::new(move |ctx| {
ctx.draw_text(Point { x: 0, y: 0 }, &format!(#text))
})));
},
RsxNode::Component(name) => quote! {
{
let scope = osui::component::Scope::new();
scope.child(#name, None);
r.static_scope(scope);
}
r.static_scope(|scope| scope.view(Arc::new(move |ctx| {
scope.child(#name, None)
})));
},
RsxNode::Mount(m) => quote! {