use crate::{GlobalAttributes, SvgAttributes}; use dioxus_core::*; use std::fmt::Arguments; macro_rules! builder_constructors { ( $( $(#[$attr:meta])* $name:ident { $( $(#[$attr_method:meta])* $fil:ident: $vil:ident, )* }; )* ) => { $( #[allow(non_camel_case_types)] $(#[$attr])* pub struct $name; impl DioxusElement for $name { const TAG_NAME: &'static str = stringify!($name); const NAME_SPACE: Option<&'static str> = None; } impl GlobalAttributes for $name {} impl $name { $( $(#[$attr_method])* pub fn $fil<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> { cx.attr(stringify!($fil), val, None, false) } )* } )* }; ( $( $(#[$attr:meta])* $name:ident <> $namespace:tt { $($fil:ident: $vil:ident,)* }; )* ) => { $( #[allow(non_camel_case_types)] $(#[$attr])* pub struct $name; impl DioxusElement for $name { const TAG_NAME: &'static str = stringify!($name); const NAME_SPACE: Option<&'static str> = Some($namespace); } impl SvgAttributes for $name {} impl $name { $( pub fn $fil<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> { cx.attr(stringify!($fil), val, Some(stringify!($namespace)), false) } )* } )* }; } // Organized in the same order as // https://developer.mozilla.org/en-US/docs/Web/HTML/Element // // Does not include obsolete elements. // // This namespace represents a collection of modern HTML-5 compatiable elements. // // This list does not include obsolete, deprecated, experimental, or poorly supported elements. builder_constructors! { // Document metadata /// Build a /// [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) /// element. /// base { href: Uri, target: Target, }; /// Build a /// [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) /// element. head {}; /// Build a /// [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) /// element. link { // as: Mime, crossorigin: CrossOrigin, href: Uri, hreflang: LanguageTag, media: String, // FIXME media query rel: LinkType, sizes: String, // FIXME title: String, // FIXME r#type: Mime, integrity: String, }; /// Build a /// [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) /// element. meta { charset: String, // FIXME IANA standard names content: String, http_equiv: HTTPEquiv, name: Metadata, }; /// Build a /// [`