Merge origin/main into macos
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -681,23 +681,49 @@ fn expand_node(node: &Node) -> proc_macro2::TokenStream {
|
||||
let value = &property.value;
|
||||
quote! { .#name(#value) }
|
||||
});
|
||||
let children = expand_children(&node.children);
|
||||
|
||||
if is_component_path(path) {
|
||||
// Component nodes: eager children so #[component] builder impls keep working.
|
||||
let children = expand_children(&node.children);
|
||||
quote! {
|
||||
#path::builder()
|
||||
#(#prop_calls)*
|
||||
.children(#children)
|
||||
}
|
||||
} else {
|
||||
} else if is_text_path(path) {
|
||||
// text(): children are TextChildren (string/value), not Views — keep eager.
|
||||
let children = expand_children(&node.children);
|
||||
quote! {
|
||||
::ruin_app::#path()
|
||||
#(#prop_calls)*
|
||||
.children(#children)
|
||||
}
|
||||
} else {
|
||||
// Primitive container nodes (column, row, block, button, scroll_box, …):
|
||||
// Wrap children in a LazyChildren closure so that PartialTextStyle context is
|
||||
// pushed BEFORE children run, enabling correct text style inheritance.
|
||||
//
|
||||
// Each child is spread via Children::into_views(), which handles:
|
||||
// - Child::Node results (View) via impl<T: IntoView> Children for T
|
||||
// - &str literals via Children for &str
|
||||
// - ChildViews (slot values) via Children for ChildViews (flattens)
|
||||
let items = node.children.iter().map(expand_child);
|
||||
quote! {
|
||||
::ruin_app::#path()
|
||||
#(#prop_calls)*
|
||||
.children(::ruin_app::LazyChildren(|| {
|
||||
let mut __v: ::std::vec::Vec<::ruin_app::View> = ::std::vec::Vec::new();
|
||||
#(__v.extend(::ruin_app::Children::into_views(#items));)*
|
||||
__v
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_text_path(path: &Path) -> bool {
|
||||
path.segments.len() == 1 && path.segments[0].ident == "text"
|
||||
}
|
||||
|
||||
fn expand_provider_node(node: &Node) -> proc_macro2::TokenStream {
|
||||
let path = &node.path;
|
||||
let value = match node.props.as_slice() {
|
||||
|
||||
Reference in New Issue
Block a user