From 2409d499e05c1f4ab8cf47ea0c9ccd9544ceae4d Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 23 Dec 2022 19:46:09 -0500 Subject: [PATCH] chore: adjust attribute macro --- packages/html/src/global_attributes.rs | 3062 ++++++++++++------------ 1 file changed, 1535 insertions(+), 1527 deletions(-) diff --git a/packages/html/src/global_attributes.rs b/packages/html/src/global_attributes.rs index 6f21b8372..10a8008f2 100644 --- a/packages/html/src/global_attributes.rs +++ b/packages/html/src/global_attributes.rs @@ -5,15 +5,21 @@ use crate::AttributeDiscription; macro_rules! trait_methods { ( @base + + $(#[$trait_attr:meta])* + $trait:ident; $( $(#[$attr:meta])* $name:ident $(: $($arg:literal),*)*; )+ ) => { - $( - $(#[$attr])* - const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; - )* + $(#[$trait_attr])* + pub trait $trait { + $( + $(#[$attr])* + const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; + )* + } }; // Rename the incoming ident and apply a custom namespace @@ -25,2273 +31,2275 @@ macro_rules! trait_methods { // Don't rename the incoming ident ( $name:ident; ) => { (stringify!($name), None, false) }; } -pub trait GlobalAttributes { - trait_methods! { - @base - /// Prevent the default action for this element. - /// - /// For more information, see the MDN docs: - /// - prevent_default: "dioxus-prevent-default"; +trait_methods! { + @base + GlobalAttributes; - /// - accesskey: "accesskey"; + /// Prevent the default action for this element. + /// + /// For more information, see the MDN docs: + /// + prevent_default: "dioxus-prevent-default"; - /// - autocapitalize: "autocapitalize"; + /// + accesskey: "accesskey"; - /// - autofocus; + /// + autocapitalize: "autocapitalize"; - /// 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; + /// + autofocus; - /// - data; + /// 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; - /// - dir; + /// + contenteditable; - /// - draggable; + /// + data; - /// - enterkeyhint; + /// + dir; - /// - exportparts; + /// + draggable; - ///