From 8fcccfa2942a692c14d512daea27eaa087833967 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Fri, 23 Dec 2022 17:59:51 -0600 Subject: [PATCH] intigrate upstream changes --- packages/html/src/global_attributes.rs | 5307 ++++++++++-------------- 1 file changed, 2270 insertions(+), 3037 deletions(-) diff --git a/packages/html/src/global_attributes.rs b/packages/html/src/global_attributes.rs index b754faa2c..275df155c 100644 --- a/packages/html/src/global_attributes.rs +++ b/packages/html/src/global_attributes.rs @@ -2,56 +2,12 @@ use crate::AttributeDiscription; -macro_rules! trait_method { - ( - ( - $(#[$attr:meta])* - $name:ident; - ) - ) => { - $(#[$attr])* - const $name: AttributeDiscription = ( - stringify!($name), - None, - false - ); - }; - ( - ( - $(#[$attr:meta])* - $name:ident: $lit:literal; - ) - ) => { - $(#[$attr])* - const $name: AttributeDiscription = ( - $lit, - None, - false - ); - }; - ( - ( - $(#[$attr:meta])* - $name:ident: $lit:literal, $ns:literal; - ) - ) => { - $(#[$attr])* - const $name: AttributeDiscription = ( - $lit, - Some($ns), - false - ); - }; -} - #[cfg(feature = "hot-reload-context")] macro_rules! trait_method_mapping { ( $matching:ident; - ( - $(#[$attr:meta])* - $name:ident; - ) + $(#[$attr:meta])* + $name:ident; ) => { if $matching == stringify!($name) { return Some((stringify!($name), None)); @@ -59,10 +15,8 @@ macro_rules! trait_method_mapping { }; ( $matching:ident; - ( - $(#[$attr:meta])* - $name:ident: $lit:literal; - ) + $(#[$attr:meta])* + $name:ident: $lit:literal; ) => { if $matching == stringify!($name) { return Some(($lit, None)); @@ -70,10 +24,8 @@ macro_rules! trait_method_mapping { }; ( $matching:ident; - ( - $(#[$attr:meta])* - $name:ident: $lit:literal, $ns:literal; - ) + $(#[$attr:meta])* + $name:ident: $lit:literal, $ns:literal; ) => { if $matching == stringify!($name) { return Some(($lit, Some($ns))); @@ -83,18 +35,18 @@ macro_rules! trait_method_mapping { macro_rules! trait_methods { ( - $(#[$attr:meta])* + @base $trait:ident; $fn:ident; $( - $tokens:tt, - )* + $(#[$attr:meta])* + $name:ident $(: $($arg:literal),*)*; + )+ ) => { pub trait $trait { $( - trait_method! { - $tokens - } + $(#[$attr])* + const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; }; )* } @@ -103,175 +55,159 @@ macro_rules! trait_methods { $( trait_method_mapping! { attr; - $tokens + $name$(: $($arg),*)*; } )* None } }; + + // 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) }; } + trait_methods! { + @base + GlobalAttributes; map_global_attributes; - ( - /// Prevent the default action for this element. - /// - /// For more information, see the MDN docs: - /// - prevent_default: "dioxus-prevent-default"; - ), - ( - /// - accesskey; - ), - ( - /// - autocapitalize; - ), - ( - /// - 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; - ), - ( - /// - contenteditable; - ), - ( - /// - data; - ), - ( - /// - dir; - ), - ( - /// - draggable; - ), - ( - /// - enterkeyhint; - ), - ( - /// - exportparts; - ), - ( - ///