mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
chore: adjust attribute macro
This commit is contained in:
parent
a0b0558624
commit
2409d499e0
1 changed files with 1535 additions and 1527 deletions
|
@ -5,15 +5,21 @@ use crate::AttributeDiscription;
|
|||
macro_rules! trait_methods {
|
||||
(
|
||||
@base
|
||||
|
||||
$(#[$trait_attr:meta])*
|
||||
$trait:ident;
|
||||
$(
|
||||
$(#[$attr:meta])*
|
||||
$name:ident $(: $($arg:literal),*)*;
|
||||
)+
|
||||
) => {
|
||||
$(#[$trait_attr])*
|
||||
pub trait $trait {
|
||||
$(
|
||||
$(#[$attr])*
|
||||
const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; };
|
||||
)*
|
||||
}
|
||||
};
|
||||
|
||||
// Rename the incoming ident and apply a custom namespace
|
||||
|
@ -25,10 +31,12 @@ macro_rules! trait_methods {
|
|||
// Don't rename the incoming ident
|
||||
( $name:ident; ) => { (stringify!($name), None, false) };
|
||||
}
|
||||
pub trait GlobalAttributes {
|
||||
|
||||
trait_methods! {
|
||||
@base
|
||||
|
||||
GlobalAttributes;
|
||||
|
||||
/// Prevent the default action for this element.
|
||||
///
|
||||
/// For more information, see the MDN docs:
|
||||
|
@ -1534,12 +1542,12 @@ pub trait GlobalAttributes {
|
|||
/// <https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize>
|
||||
aria_setsize: "aria-setsize";
|
||||
}
|
||||
}
|
||||
|
||||
pub trait SvgAttributes {
|
||||
trait_methods! {
|
||||
@base
|
||||
|
||||
SvgAttributes;
|
||||
|
||||
/// Prevent the default action for this element.
|
||||
///
|
||||
/// For more information, see the MDN docs:
|
||||
|
@ -2293,5 +2301,5 @@ pub trait SvgAttributes {
|
|||
|
||||
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/zoomAndPan>
|
||||
zoomAndPan: "zoomAndPan";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue