fix bounds on generated element extensions
This commit is contained in:
1 parent
0e0819d284
commit
5ed116b060
2 files changed
+29
-5
No files matched your search
+27
-3
@@ -9,7 +9,11 @@ use dioxus::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus_desktop::launch(app);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
dom.rebuild();
|
||||||
|
let html = dioxus_ssr::render(&dom);
|
||||||
|
|
||||||
|
println!("{}", html);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
@@ -36,7 +40,8 @@ fn app(cx: Scope) -> Element {
|
|||||||
bump: __cx.bump(),
|
bump: __cx.bump(),
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
}
|
}
|
||||||
.width("hello"),
|
.width(10)
|
||||||
|
.height("100px"),
|
||||||
"Component",
|
"Component",
|
||||||
)]),
|
)]),
|
||||||
dynamic_attrs: __cx.bump().alloc([]),
|
dynamic_attrs: __cx.bump().alloc([]),
|
||||||
@@ -72,5 +77,24 @@ impl<'a> HasAttributesBox<'a, Props<'a>> for Props<'a> {
|
|||||||
impl ExtendedGlobalAttributesMarker for Props<'_> {}
|
impl ExtendedGlobalAttributesMarker for Props<'_> {}
|
||||||
|
|
||||||
fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
|
fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
|
||||||
todo!()
|
let attributes = &cx.props.attributes;
|
||||||
|
render! {
|
||||||
|
// rsx! {
|
||||||
|
// audio {
|
||||||
|
// ...attributes,
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
::dioxus::core::LazyNodes::new(move |__cx: &::dioxus::core::ScopeState| -> ::dioxus::core::VNode {
|
||||||
|
static TEMPLATE: ::dioxus::core::Template = ::dioxus::core::Template { name: concat!(file!(), ":", line!(), ":", column!(), ":", "123" ), roots: &[::dioxus::core::TemplateNode::Element { tag: dioxus_elements::audio::TAG_NAME, namespace: dioxus_elements::audio::NAME_SPACE, attrs: &[::dioxus::core::TemplateAttribute::Dynamic { id: 0usize }], children: &[] }], node_paths: &[], attr_paths: &[&[0u8]] };
|
||||||
|
let attrs = vec![(&**attributes).into()];
|
||||||
|
::dioxus::core::VNode {
|
||||||
|
parent: None,
|
||||||
|
key: None,
|
||||||
|
template: std::cell::Cell::new(TEMPLATE),
|
||||||
|
root_ids: dioxus::core::exports::bumpalo::collections::Vec::new_in(__cx.bump()).into(),
|
||||||
|
dynamic_nodes: __cx.bump().alloc([]),
|
||||||
|
dynamic_attrs: __cx.bump().alloc(attrs),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ impl ToTokens for ImplExtensionAttributes {
|
|||||||
|
|
||||||
let defs = self.attrs.iter().map(|ident| {
|
let defs = self.attrs.iter().map(|ident| {
|
||||||
quote! {
|
quote! {
|
||||||
fn #ident(self, value: impl IntoAttributeValue<'a> + 'static) -> Self;
|
fn #ident(self, value: impl IntoAttributeValue<'a>) -> Self;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let impls = self.attrs.iter().map(|ident| {
|
let impls = self.attrs.iter().map(|ident| {
|
||||||
@@ -66,7 +66,7 @@ impl ToTokens for ImplExtensionAttributes {
|
|||||||
quote! { <#impl_name as #name>::#ident }
|
quote! { <#impl_name as #name>::#ident }
|
||||||
};
|
};
|
||||||
quote! {
|
quote! {
|
||||||
fn #ident(self, value: impl IntoAttributeValue<'a> + 'static) -> Self {
|
fn #ident(self, value: impl IntoAttributeValue<'a>) -> Self {
|
||||||
let d = #d;
|
let d = #d;
|
||||||
self.push_attribute(d.0, d.1, value, d.2)
|
self.push_attribute(d.0, d.1, value, d.2)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user