diff --git a/packages/autofmt/src/component.rs b/packages/autofmt/src/component.rs index 0da8a85d7..6b6821a64 100644 --- a/packages/autofmt/src/component.rs +++ b/packages/autofmt/src/component.rs @@ -22,13 +22,13 @@ enum ShortOptimization { impl Buffer { pub fn write_component( &mut self, - Component { + ComponentNode { name, fields, children, manual_props, prop_gen_args, - }: &Component, + }: &ComponentNode, ) -> Result { self.write_component_name(name, prop_gen_args)?; diff --git a/packages/autofmt/src/element.rs b/packages/autofmt/src/element.rs index f17aac462..84abeeec8 100644 --- a/packages/autofmt/src/element.rs +++ b/packages/autofmt/src/element.rs @@ -22,13 +22,13 @@ enum ShortOptimization { impl Buffer { pub fn write_element( &mut self, - Element { + ElementNode { name, key, attributes, children, _is_static, - }: &Element, + }: &ElementNode, ) -> Result { /* 1. Write the tag diff --git a/packages/html/src/global_attributes.rs b/packages/html/src/global_attributes.rs index a03b2f5e6..6f21b8372 100644 --- a/packages/html/src/global_attributes.rs +++ b/packages/html/src/global_attributes.rs @@ -4,18 +4,16 @@ use crate::AttributeDiscription; macro_rules! trait_methods { ( - $trait:ident; + @base $( $(#[$attr:meta])* $name:ident $(: $($arg:literal),*)*; )+ ) => { - pub trait $trait { - $( - $(#[$attr])* - const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; - )* - } + $( + $(#[$attr])* + const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; + )* }; // Rename the incoming ident and apply a custom namespace @@ -27,2272 +25,2273 @@ macro_rules! trait_methods { // Don't rename the incoming ident ( $name:ident; ) => { (stringify!($name), None, false) }; } +pub trait GlobalAttributes { + trait_methods! { + @base -trait_methods! { - GlobalAttributes; + /// Prevent the default action for this element. + /// + /// For more information, see the MDN docs: + /// + prevent_default: "dioxus-prevent-default"; - /// Prevent the default action for this element. - /// - /// For more information, see the MDN docs: - /// - prevent_default: "dioxus-prevent-default"; + /// + accesskey: "accesskey"; - /// - accesskey: "accesskey"; + /// + autocapitalize: "autocapitalize"; - /// - autocapitalize: "autocapitalize"; + /// + autofocus; - /// - autofocus; + /// The HTML class attribute is used to specify a class for an HTML element. + /// + /// ## Details + /// Multiple HTML elements can share the same class. + /// + /// The class global attribute is a space-separated list of the case-sensitive classes of the element. + /// Classes allow CSS and Javascript to select and access specific elements via the class selectors or + /// functions like the DOM method document.getElementsByClassName. + /// + /// ## Example + /// + /// ### HTML: + /// ```html + ///

Above point sounds a bit obvious. Remove/rewrite?

+ /// ``` + /// + /// ### CSS: + /// ```css + /// .note { + /// font-style: italic; + /// font-weight: bold; + /// } + /// + /// .editorial { + /// background: rgb(255, 0, 0, .25); + /// padding: 10px; + /// } + /// ``` + /// + class; - /// The HTML class attribute is used to specify a class for an HTML element. - /// - /// ## Details - /// Multiple HTML elements can share the same class. - /// - /// The class global attribute is a space-separated list of the case-sensitive classes of the element. - /// Classes allow CSS and Javascript to select and access specific elements via the class selectors or - /// functions like the DOM method document.getElementsByClassName. - /// - /// ## Example - /// - /// ### HTML: - /// ```html - ///

Above point sounds a bit obvious. Remove/rewrite?

- /// ``` - /// - /// ### CSS: - /// ```css - /// .note { - /// font-style: italic; - /// font-weight: bold; - /// } - /// - /// .editorial { - /// background: rgb(255, 0, 0, .25); - /// padding: 10px; - /// } - /// ``` - /// - class; + /// + contenteditable; - /// - contenteditable; + /// + data; - /// - data; + /// + dir; - /// - dir; + /// + draggable; - /// - draggable; + /// + enterkeyhint; - /// - enterkeyhint; + /// + exportparts; - /// - exportparts; + ///