diff --git a/packages/core-macro/src/lib.rs b/packages/core-macro/src/lib.rs index 4e4f5600a..501c38e7b 100644 --- a/packages/core-macro/src/lib.rs +++ b/packages/core-macro/src/lib.rs @@ -1,5 +1,6 @@ use proc_macro::TokenStream; use quote::ToTokens; +use rsx::RenderCallBody; use syn::parse_macro_input; mod inlineprops; @@ -41,10 +42,7 @@ pub fn rsx(s: TokenStream) -> TokenStream { pub fn render(s: TokenStream) -> TokenStream { match syn::parse::(s) { Err(err) => err.to_compile_error().into(), - Ok(mut body) => { - body.inline_cx = true; - body.into_token_stream().into() - } + Ok(body) => RenderCallBody(body).into_token_stream().into(), } } diff --git a/packages/html/src/global_attributes.rs b/packages/html/src/global_attributes.rs index 5c4ac42e8..6f21b8372 100644 --- a/packages/html/src/global_attributes.rs +++ b/packages/html/src/global_attributes.rs @@ -2,70 +2,51 @@ use crate::AttributeDiscription; -macro_rules! no_namespace_trait_methods { +macro_rules! trait_methods { ( + @base $( $(#[$attr:meta])* - $name:ident; - )* + $name:ident $(: $($arg:literal),*)*; + )+ ) => { $( $(#[$attr])* - const $name: AttributeDiscription = ( - stringify!($name), - None, - false - ); + const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; )* }; -} -macro_rules! style_trait_methods { - ( - $( - $(#[$attr:meta])* - $name:ident: $lit:literal, - )* - ) => { - $( - $(#[$attr])* - const $name: AttributeDiscription = ( - $lit, - Some("style"), - false - ); - )* - }; -} -macro_rules! aria_trait_methods { - ( - $( - $(#[$attr:meta])* - $name:ident: $lit:literal, - )* - ) => { - $( - $(#[$attr])* - const $name: AttributeDiscription = ( - $lit, - None, - false - ); - )* - }; -} + // Rename the incoming ident and apply a custom namespace + ( $name:ident: $lit:literal, $ns:literal; ) => { ($lit, Some($ns), false) }; + + // Rename the incoming ident + ( $name:ident: $lit:literal; ) => { ($lit, None, false ) }; + + // Don't rename the incoming ident + ( $name:ident; ) => { (stringify!($name), None, false) }; +} pub trait GlobalAttributes { - /// Prevent the default action for this element. - /// - /// For more information, see the MDN docs: - /// + trait_methods! { + @base - const prevent_default: AttributeDiscription = ("dioxus-prevent-default", None, false); + /// Prevent the default action for this element. + /// + /// For more information, see the MDN docs: + /// + prevent_default: "dioxus-prevent-default"; - no_namespace_trait_methods! { - accesskey; - autocapitalize; + + /// + accesskey: "accesskey"; + + + /// + autocapitalize: "autocapitalize"; + + + /// autofocus; + /// The HTML class attribute is used to specify a class for an HTML element. /// /// ## Details @@ -94,765 +75,2223 @@ pub trait GlobalAttributes { /// padding: 10px; /// } /// ``` + /// class; + + /// contenteditable; + + /// data; + + /// dir; + + /// draggable; + + /// enterkeyhint; + + /// exportparts; + + ///