lib.rs 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119
  1. //! # Dioxus Namespace for HTML
  2. //!
  3. //! This crate provides a set of compile-time correct HTML elements that can be used with the Rsx and Html macros.
  4. //! This system allows users to easily build new tags, new types, and customize the output of the Rsx and Html macros.
  5. //!
  6. //! An added benefit of this approach is the ability to lend comprehensive documentation on how to use these elements inside
  7. //! of the Rsx and Html macros. Each element comes with a substantial amount of documentation on how to best use it, hopefully
  8. //! making the development cycle quick.
  9. //!
  10. //! All elements are used as zero-sized unit structs with trait impls.
  11. //!
  12. //! Currently, we don't validate for structures, but do validate attributes.
  13. //!
  14. //!
  15. //!
  16. //!
  17. use std::fmt::Arguments;
  18. use dioxus_core::{nodes::Attribute, DioxusElement, NodeFactory};
  19. macro_rules! no_namespace_trait_methods {
  20. (
  21. $(
  22. $(#[$attr:meta])*
  23. $name:ident;
  24. )*
  25. ) => {
  26. $(
  27. $(#[$attr])*
  28. fn $name<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
  29. cx.attr(stringify!($name), val, None, false)
  30. }
  31. )*
  32. };
  33. }
  34. macro_rules! style_trait_methods {
  35. (
  36. $(
  37. $(#[$attr:meta])*
  38. $name:ident: $lit:literal,
  39. )*
  40. ) => {
  41. $(
  42. $(#[$attr])*
  43. fn $name<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
  44. cx.attr($lit, val, Some("style"), false)
  45. }
  46. )*
  47. };
  48. }
  49. macro_rules! aria_trait_methods {
  50. (
  51. $(
  52. $(#[$attr:meta])*
  53. $name:ident: $lit:literal,
  54. )*
  55. ) => {
  56. $(
  57. $(#[$attr])*
  58. fn $name<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
  59. cx.attr($lit, val, None, false)
  60. }
  61. )*
  62. };
  63. }
  64. pub trait GlobalAttributes {
  65. no_namespace_trait_methods! {
  66. accesskey;
  67. /// The HTML class attribute is used to specify a class for an HTML element.
  68. ///
  69. /// ## Details
  70. /// Multiple HTML elements can share the same class.
  71. ///
  72. /// The class global attribute is a space-separated list of the case-sensitive classes of the element.
  73. /// Classes allow CSS and Javascript to select and access specific elements via the class selectors or
  74. /// functions like the DOM method document.getElementsByClassName.
  75. ///
  76. /// ## Example
  77. ///
  78. /// ### HTML:
  79. /// ```html
  80. /// <p class="note editorial">Above point sounds a bit obvious. Remove/rewrite?</p>
  81. /// ```
  82. ///
  83. /// ### CSS:
  84. /// ```css
  85. /// .note {
  86. /// font-style: italic;
  87. /// font-weight: bold;
  88. /// }
  89. ///
  90. /// .editorial {
  91. /// background: rgb(255, 0, 0, .25);
  92. /// padding: 10px;
  93. /// }
  94. /// ```
  95. class;
  96. contenteditable;
  97. data;
  98. dir;
  99. draggable;
  100. hidden;
  101. id;
  102. lang;
  103. spellcheck;
  104. style;
  105. tabindex;
  106. title;
  107. translate;
  108. }
  109. style_trait_methods! {
  110. /// Specifies the alignment of flexible container's items within the flex container.
  111. align_content: "align-content",
  112. /// Specifies the default alignment for items within the flex container.
  113. align_items: "align-items",
  114. /// Specifies the alignment for selected items within the flex container.
  115. align_self: "align-self",
  116. /// Specifies the keyframe_based animations.
  117. animation: "animation",
  118. /// Specifies when the animation will start.
  119. animation_delay: "animation-delay",
  120. /// Specifies whether the animation should play in reverse on alternate cycles or not.
  121. animation_direction: "animation-direction",
  122. /// Specifies the number of seconds or milliseconds an animation should take to complete one cycle
  123. animation_duration: "animation-duration",
  124. /// Specifies how a CSS animation should apply styles to its target before and after it is executing
  125. animation_fill_mode: "animation-fill-mode",
  126. /// Specifies the number of times an animation cycle should be played before stopping.
  127. animation_iteration_count: "animation-iteration-count",
  128. /// Specifies the name of @keyframes defined animations that should be applied to the selected element
  129. animation_name: "animation-name",
  130. /// Specifies whether the animation is running or paused.
  131. animation_play_state: "animation-play-state",
  132. /// Specifies how a CSS animation should progress over the duration of each cycle.
  133. animation_timing_function: "animation-timing-function",
  134. /// Specifies whether or not the "back" side of a transformed element is visible when facing the user.
  135. backface_visibility: "backface-visibility",
  136. /// Defines a variety of background properties within one declaration.
  137. background: "background",
  138. /// Specify whether the background image is fixed in the viewport or scrolls.
  139. background_attachment: "background-attachment",
  140. /// Specifies the painting area of the background.
  141. background_clip: "background-clip",
  142. /// Defines an element's background color.
  143. background_color: "background-color",
  144. /// Defines an element's background image.
  145. background_image: "background-image",
  146. /// Specifies the positioning area of the background images.
  147. background_origin: "background-origin",
  148. /// Defines the origin of a background image.
  149. background_position: "background-position",
  150. /// Specify whether/how the background image is tiled.
  151. background_repeat: "background-repeat",
  152. /// Specifies the size of the background images.
  153. background_size: "background-size",
  154. /// Sets the width, style, and color for all four sides of an element's border.
  155. border: "border",
  156. /// Sets the width, style, and color of the bottom border of an element.
  157. border_bottom: "border-bottom",
  158. /// Sets the color of the bottom border of an element.
  159. border_bottom_color: "border-bottom-color",
  160. /// Defines the shape of the bottom_left border corner of an element.
  161. border_bottom_left_radius: "border-bottom-left-radius",
  162. /// Defines the shape of the bottom_right border corner of an element.
  163. border_bottom_right_radius: "border-bottom-right-radius",
  164. /// Sets the style of the bottom border of an element.
  165. border_bottom_style: "border-bottom-style",
  166. /// Sets the width of the bottom border of an element.
  167. border_bottom_width: "border-bottom-width",
  168. /// Specifies whether table cell borders are connected or separated.
  169. border_collapse: "border-collapse",
  170. /// Sets the color of the border on all the four sides of an element.
  171. border_color: "border-color",
  172. /// Specifies how an image is to be used in place of the border styles.
  173. border_image: "border-image",
  174. /// Specifies the amount by which the border image area extends beyond the border box.
  175. border_image_outset: "border-image-outset",
  176. /// Specifies whether the image_border should be repeated, rounded or stretched.
  177. border_image_repeat: "border-image-repeat",
  178. /// Specifies the inward offsets of the image_border.
  179. border_image_slice: "border-image-slice",
  180. /// Specifies the location of the image to be used as a border.
  181. border_image_source: "border-image-source",
  182. /// Specifies the width of the image_border.
  183. border_image_width: "border-image-width",
  184. /// Sets the width, style, and color of the left border of an element.
  185. border_left: "border-left",
  186. /// Sets the color of the left border of an element.
  187. border_left_color: "border-left-color",
  188. /// Sets the style of the left border of an element.
  189. border_left_style: "border-left-style",
  190. /// Sets the width of the left border of an element.
  191. border_left_width: "border-left-width",
  192. /// Defines the shape of the border corners of an element.
  193. border_radius: "border-radius",
  194. /// Sets the width, style, and color of the right border of an element.
  195. border_right: "border-right",
  196. /// Sets the color of the right border of an element.
  197. border_right_color: "border-right-color",
  198. /// Sets the style of the right border of an element.
  199. border_right_style: "border-right-style",
  200. /// Sets the width of the right border of an element.
  201. border_right_width: "border-right-width",
  202. /// Sets the spacing between the borders of adjacent table cells.
  203. border_spacing: "border-spacing",
  204. /// Sets the style of the border on all the four sides of an element.
  205. border_style: "border-style",
  206. /// Sets the width, style, and color of the top border of an element.
  207. border_top: "border-top",
  208. /// Sets the color of the top border of an element.
  209. border_top_color: "border-top-color",
  210. /// Defines the shape of the top_left border corner of an element.
  211. border_top_left_radius: "border-top-left-radius",
  212. /// Defines the shape of the top_right border corner of an element.
  213. border_top_right_radius: "border-top-right-radius",
  214. /// Sets the style of the top border of an element.
  215. border_top_style: "border-top-style",
  216. /// Sets the width of the top border of an element.
  217. border_top_width: "border-top-width",
  218. /// Sets the width of the border on all the four sides of an element.
  219. border_width: "border-width",
  220. /// Specify the location of the bottom edge of the positioned element.
  221. bottom: "bottom",
  222. /// Applies one or more drop_shadows to the element's box.
  223. box_shadow: "box-shadow",
  224. /// Alter the default CSS box model.
  225. box_sizing: "box-sizing",
  226. /// Specify the position of table's caption.
  227. caption_side: "caption-side",
  228. /// Specifies the placement of an element in relation to floating elements.
  229. clear: "clear",
  230. /// Defines the clipping region.
  231. clip: "clip",
  232. /// Specify the color of the text of an element.
  233. color: "color",
  234. /// Specifies the number of columns in a multi_column element.
  235. column_count: "column-count",
  236. /// Specifies how columns will be filled.
  237. column_fill: "column-fill",
  238. /// Specifies the gap between the columns in a multi_column element.
  239. column_gap: "column-gap",
  240. /// Specifies a straight line, or "rule", to be drawn between each column in a multi_column element.
  241. column_rule: "column-rule",
  242. /// Specifies the color of the rules drawn between columns in a multi_column layout.
  243. column_rule_color: "column-rule-color",
  244. /// Specifies the style of the rule drawn between the columns in a multi_column layout.
  245. column_rule_style: "column-rule-style",
  246. /// Specifies the width of the rule drawn between the columns in a multi_column layout.
  247. column_rule_width: "column-rule-width",
  248. /// Specifies how many columns an element spans across in a multi_column layout.
  249. column_span: "column-span",
  250. /// Specifies the optimal width of the columns in a multi_column element.
  251. column_width: "column-width",
  252. /// A shorthand property for setting column_width and column_count properties.
  253. columns: "columns",
  254. /// Inserts generated content.
  255. content: "content",
  256. /// Increments one or more counter values.
  257. counter_increment: "counter-increment",
  258. /// Creates or resets one or more counters.
  259. counter_reset: "counter-reset",
  260. /// Specify the type of cursor.
  261. cursor: "cursor",
  262. /// Define the text direction/writing direction.
  263. direction: "direction",
  264. /// Specifies how an element is displayed onscreen.
  265. display: "display",
  266. /// Show or hide borders and backgrounds of empty table cells.
  267. empty_cells: "empty-cells",
  268. /// Specifies the components of a flexible length.
  269. flex: "flex",
  270. /// Specifies the initial main size of the flex item.
  271. flex_basis: "flex-basis",
  272. /// Specifies the direction of the flexible items.
  273. flex_direction: "flex-direction",
  274. /// A shorthand property for the flex_direction and the flex_wrap properties.
  275. flex_flow: "flex-flow",
  276. /// Specifies how the flex item will grow relative to the other items inside the flex container.
  277. flex_grow: "flex-grow",
  278. /// Specifies how the flex item will shrink relative to the other items inside the flex container
  279. flex_shrink: "flex-shrink",
  280. /// Specifies whether the flexible items should wrap or not.
  281. flex_wrap: "flex-wrap",
  282. /// Specifies whether or not a box should float.
  283. float: "float",
  284. /// Defines a variety of font properties within one declaration.
  285. font: "font",
  286. /// Defines a list of fonts for element.
  287. font_family: "font-family",
  288. /// Defines the font size for the text.
  289. font_size: "font-size",
  290. /// Preserves the readability of text when font fallback occurs.
  291. font_size_adjust: "font-size-adjust",
  292. /// Selects a normal, condensed, or expanded face from a font.
  293. font_stretch: "font-stretch",
  294. /// Defines the font style for the text.
  295. font_style: "font-style",
  296. /// Specify the font variant.
  297. font_variant: "font-variant",
  298. /// Specify the font weight of the text.
  299. font_weight: "font-weight",
  300. /// Specify the height of an element.
  301. height: "height",
  302. /// Specifies how flex items are aligned along the main axis of the flex container after any flexible lengths and auto margins have been resolved.
  303. justify_content: "auto margins have been resolved.",
  304. /// Specify the location of the left edge of the positioned element.
  305. left: "left",
  306. /// Sets the extra spacing between letters.
  307. letter_spacing: "letter-spacing",
  308. /// Sets the height between lines of text.
  309. line_height: "line-height",
  310. /// Defines the display style for a list and list elements.
  311. list_style: "list-style",
  312. /// Specifies the image to be used as a list_item marker.
  313. list_style_image: "list-style-image",
  314. /// Specifies the position of the list_item marker.
  315. list_style_position: "list-style-position",
  316. /// Specifies the marker style for a list_item.
  317. list_style_type: "list-style-type",
  318. /// Sets the margin on all four sides of the element.
  319. margin: "margin",
  320. /// Sets the bottom margin of the element.
  321. margin_bottom: "margin-bottom",
  322. /// Sets the left margin of the element.
  323. margin_left: "margin-left",
  324. /// Sets the right margin of the element.
  325. margin_right: "margin-right",
  326. /// Sets the top margin of the element.
  327. margin_top: "margin-top",
  328. /// Specify the maximum height of an element.
  329. max_height: "max-height",
  330. /// Specify the maximum width of an element.
  331. max_width: "max-width",
  332. /// Specify the minimum height of an element.
  333. min_height: "min-height",
  334. /// Specify the minimum width of an element.
  335. min_width: "min-width",
  336. /// Specifies the transparency of an element.
  337. opacity: "opacity",
  338. /// Specifies the order in which a flex items are displayed and laid out within a flex container.
  339. order: "order",
  340. /// Sets the width, style, and color for all four sides of an element's outline.
  341. outline: "outline",
  342. /// Sets the color of the outline.
  343. outline_color: "outline-color",
  344. /// Set the space between an outline and the border edge of an element.
  345. outline_offset: "outline-offset",
  346. /// Sets a style for an outline.
  347. outline_style: "outline-style",
  348. /// Sets the width of the outline.
  349. outline_width: "outline-width",
  350. /// Specifies the treatment of content that overflows the element's box.
  351. overflow: "overflow",
  352. /// Specifies the treatment of content that overflows the element's box horizontally.
  353. overflow_x: "overflow-x",
  354. /// Specifies the treatment of content that overflows the element's box vertically.
  355. overflow_y: "overflow-y",
  356. /// Sets the padding on all four sides of the element.
  357. padding: "padding",
  358. /// Sets the padding to the bottom side of an element.
  359. padding_bottom: "padding-bottom",
  360. /// Sets the padding to the left side of an element.
  361. padding_left: "padding-left",
  362. /// Sets the padding to the right side of an element.
  363. padding_right: "padding-right",
  364. /// Sets the padding to the top side of an element.
  365. padding_top: "padding-top",
  366. /// Insert a page breaks after an element.
  367. page_break_after: "page-break-after",
  368. /// Insert a page breaks before an element.
  369. page_break_before: "page-break-before",
  370. /// Insert a page breaks inside an element.
  371. page_break_inside: "page-break-inside",
  372. /// Defines the perspective from which all child elements of the object are viewed.
  373. perspective: "perspective",
  374. /// Defines the origin (the vanishing point for the 3D space) for the perspective property.
  375. perspective_origin: "perspective-origin",
  376. /// Specifies how an element is positioned.
  377. position: "position",
  378. /// Specifies quotation marks for embedded quotations.
  379. quotes: "quotes",
  380. /// Specifies whether or not an element is resizable by the user.
  381. resize: "resize",
  382. /// Specify the location of the right edge of the positioned element.
  383. right: "right",
  384. /// Specifies the length of the tab character.
  385. tab_size: "tab-size",
  386. /// Specifies a table layout algorithm.
  387. table_layout: "table-layout",
  388. /// Sets the horizontal alignment of inline content.
  389. text_align: "text-align",
  390. /// Specifies how the last line of a block or a line right before a forced line break is aligned when is justify.",
  391. text_align_last: "text-align-last",
  392. /// Specifies the decoration added to text.
  393. text_decoration: "text-decoration",
  394. /// Specifies the color of the text_decoration_line.
  395. text_decoration_color: "text-decoration-color",
  396. /// Specifies what kind of line decorations are added to the element.
  397. text_decoration_line: "text-decoration-line",
  398. /// Specifies the style of the lines specified by the text_decoration_line property
  399. text_decoration_style: "text-decoration-style",
  400. /// Indent the first line of text.
  401. text_indent: "text-indent",
  402. /// Specifies the justification method to use when the text_align property is set to justify.
  403. text_justify: "text-justify",
  404. /// Specifies how the text content will be displayed, when it overflows the block containers.
  405. text_overflow: "text-overflow",
  406. /// Applies one or more shadows to the text content of an element.
  407. text_shadow: "text-shadow",
  408. /// Transforms the case of the text.
  409. text_transform: "text-transform",
  410. /// Specify the location of the top edge of the positioned element.
  411. top: "top",
  412. /// Applies a 2D or 3D transformation to an element.
  413. transform: "transform",
  414. /// Defines the origin of transformation for an element.
  415. transform_origin: "transform-origin",
  416. /// Specifies how nested elements are rendered in 3D space.
  417. transform_style: "transform-style",
  418. /// Defines the transition between two states of an element.
  419. transition: "transition",
  420. /// Specifies when the transition effect will start.
  421. transition_delay: "transition-delay",
  422. /// Specifies the number of seconds or milliseconds a transition effect should take to complete.
  423. transition_duration: "transition-duration",
  424. /// Specifies the names of the CSS properties to which a transition effect should be applied.
  425. transition_property: "transition-property",
  426. /// Specifies the speed curve of the transition effect.
  427. transition_timing_function: "transition-timing-function",
  428. /// Sets the vertical positioning of an element relative to the current text baseline.
  429. vertical_align: "vertical-align",
  430. /// Specifies whether or not an element is visible.
  431. visibility: "visibility",
  432. /// Specifies how white space inside the element is handled.
  433. white_space: "white-space",
  434. /// Specify the width of an element.
  435. width: "width",
  436. /// Specifies how to break lines within words.
  437. word_break: "word-break",
  438. /// Sets the spacing between words.
  439. word_spacing: "word-spacing",
  440. /// Specifies whether to break words when the content overflows the boundaries of its container.
  441. word_wrap: "word-wrap",
  442. /// Specifies a layering or stacking order for positioned elements.
  443. z_index : "z-index ",
  444. }
  445. aria_trait_methods! {
  446. aria_current: "aria-current",
  447. aria_details: "aria-details",
  448. aria_disabled: "aria-disabled",
  449. aria_hidden: "aria-hidden",
  450. aria_invalid: "aria-invalid",
  451. aria_keyshortcuts: "aria-keyshortcuts",
  452. aria_label: "aria-label",
  453. aria_roledescription: "aria-roledescription",
  454. // Widget Attributes
  455. aria_autocomplete: "aria-autocomplete",
  456. aria_checked: "aria-checked",
  457. aria_expanded: "aria-expanded",
  458. aria_haspopup: "aria-haspopup",
  459. aria_level: "aria-level",
  460. aria_modal: "aria-modal",
  461. aria_multiline: "aria-multiline",
  462. aria_multiselectable: "aria-multiselectable",
  463. aria_orientation: "aria-orientation",
  464. aria_placeholder: "aria-placeholder",
  465. aria_pressed: "aria-pressed",
  466. aria_readonly: "aria-readonly",
  467. aria_required: "aria-required",
  468. aria_selected: "aria-selected",
  469. aria_sort: "aria-sort",
  470. aria_valuemax: "aria-valuemax",
  471. aria_valuemin: "aria-valuemin",
  472. aria_valuenow: "aria-valuenow",
  473. aria_valuetext: "aria-valuetext",
  474. // Live Region Attributes
  475. aria_atomic: "aria-atomic",
  476. aria_busy: "aria-busy",
  477. aria_live: "aria-live",
  478. aria_relevant: "aria-relevant",
  479. aria_dropeffect: "aria-dropeffect",
  480. aria_grabbed: "aria-grabbed",
  481. // Relationship Attributes
  482. aria_activedescendant: "aria-activedescendant",
  483. aria_colcount: "aria-colcount",
  484. aria_colindex: "aria-colindex",
  485. aria_colspan: "aria-colspan",
  486. aria_controls: "aria-controls",
  487. aria_describedby: "aria-describedby",
  488. aria_errormessage: "aria-errormessage",
  489. aria_flowto: "aria-flowto",
  490. aria_labelledby: "aria-labelledby",
  491. aria_owns: "aria-owns",
  492. aria_posinset: "aria-posinset",
  493. aria_rowcount: "aria-rowcount",
  494. aria_rowindex: "aria-rowindex",
  495. aria_rowspan: "aria-rowspan",
  496. aria_setsize: "aria-setsize",
  497. }
  498. }
  499. macro_rules! builder_constructors {
  500. (
  501. $(
  502. $(#[$attr:meta])*
  503. $name:ident {
  504. $($fil:ident: $vil:ident,)*
  505. };
  506. )*
  507. ) => {
  508. $(
  509. #[allow(non_camel_case_types)]
  510. $(#[$attr])*
  511. pub struct $name;
  512. impl DioxusElement for $name {
  513. const TAG_NAME: &'static str = stringify!($name);
  514. const NAME_SPACE: Option<&'static str> = None;
  515. }
  516. impl GlobalAttributes for $name {}
  517. impl $name {
  518. $(
  519. pub fn $fil<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
  520. cx.attr(stringify!($fil), val, None, false)
  521. }
  522. )*
  523. }
  524. )*
  525. };
  526. ( $(
  527. $(#[$attr:meta])*
  528. $name:ident <> $namespace:tt {
  529. $($fil:ident: $vil:ident,)*
  530. };
  531. )* ) => {
  532. $(
  533. #[allow(non_camel_case_types)]
  534. $(#[$attr])*
  535. pub struct $name;
  536. impl DioxusElement for $name {
  537. const TAG_NAME: &'static str = stringify!($name);
  538. const NAME_SPACE: Option<&'static str> = Some($namespace);
  539. }
  540. impl SvgAttributes for $name {}
  541. impl $name {
  542. $(
  543. pub fn $fil<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
  544. cx.attr(stringify!($fil), val, Some(stringify!($namespace)), false)
  545. }
  546. )*
  547. }
  548. )*
  549. };
  550. }
  551. // Organized in the same order as
  552. // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
  553. //
  554. // Does not include obsolete elements.
  555. //
  556. // This namespace represents a collection of modern HTML-5 compatiable elements.
  557. //
  558. // This list does not include obsolete, deprecated, experimental, or poorly supported elements.
  559. builder_constructors! {
  560. // Document metadata
  561. /// Build a
  562. /// [`<base>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
  563. /// element.
  564. ///
  565. base {
  566. href: Uri,
  567. target: Target,
  568. };
  569. /// Build a
  570. /// [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)
  571. /// element.
  572. head {};
  573. /// Build a
  574. /// [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
  575. /// element.
  576. link {
  577. // as: Mime,
  578. crossorigin: CrossOrigin,
  579. href: Uri,
  580. hreflang: LanguageTag,
  581. media: String, // FIXME media query
  582. rel: LinkType,
  583. sizes: String, // FIXME
  584. title: String, // FIXME
  585. r#type: Mime,
  586. };
  587. /// Build a
  588. /// [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)
  589. /// element.
  590. meta {
  591. charset: String, // FIXME IANA standard names
  592. content: String,
  593. http_equiv: HTTPEquiv,
  594. name: Metadata,
  595. };
  596. /// Build a
  597. /// [`<style>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
  598. /// element.
  599. style {
  600. r#type: Mime,
  601. media: String, // FIXME media query
  602. nonce: Nonce,
  603. title: String, // FIXME
  604. };
  605. /// Build a
  606. /// [`<title>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title)
  607. /// element.
  608. title { };
  609. // Sectioning root
  610. /// Build a
  611. /// [`<body>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body)
  612. /// element.
  613. body {};
  614. // ------------------
  615. // Content sectioning
  616. // ------------------
  617. /// Build a
  618. /// [`<address>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address)
  619. /// element.
  620. address {};
  621. /// Build a
  622. /// [`<article>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article)
  623. /// element.
  624. article {};
  625. /// Build a
  626. /// [`<aside>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)
  627. /// element.
  628. aside {};
  629. /// Build a
  630. /// [`<footer>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer)
  631. /// element.
  632. footer {};
  633. /// Build a
  634. /// [`<header>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header)
  635. /// element.
  636. header {};
  637. /// Build a
  638. /// [`<h1>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h1)
  639. /// element.
  640. ///
  641. /// # About
  642. /// - The HTML `<h1>` element is found within the `<body>` tag.
  643. /// - Headings can range from `<h1>` to `<h6>`.
  644. /// - The most important heading is `<h1>` and the least important heading is `<h6>`.
  645. /// - The `<h1>` heading is the first heading in the document.
  646. /// - The `<h1>` heading is usually a large bolded font.
  647. ///
  648. /// # Usage
  649. ///
  650. /// ```
  651. /// html!(<h1> A header element </h1>)
  652. /// rsx!(h1 { "A header element" })
  653. /// LazyNodes::new(|f| f.el(h1).children([f.text("A header element")]).finish())
  654. /// ```
  655. h1 {};
  656. /// Build a
  657. /// [`<h2>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h2)
  658. /// element.
  659. ///
  660. /// # About
  661. /// - The HTML `<h2>` element is found within the `<body>` tag.
  662. /// - Headings can range from `<h1>` to `<h6>`.
  663. /// - The most important heading is `<h1>` and the least important heading is `<h6>`.
  664. /// - The `<h2>` heading is the second heading in the document.
  665. /// - The `<h2>` heading is usually a large bolded font.
  666. ///
  667. /// # Usage
  668. /// ```
  669. /// html!(<h2> A header element </h2>)
  670. /// rsx!(h2 { "A header element" })
  671. /// LazyNodes::new(|f| f.el(h2).children([f.text("A header element")]).finish())
  672. /// ```
  673. h2 {};
  674. /// Build a
  675. /// [`<h3>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h3)
  676. /// element.
  677. ///
  678. /// # About
  679. /// - The HTML <h1> element is found within the <body> tag.
  680. /// - Headings can range from <h1> to <h6>.
  681. /// - The most important heading is <h1> and the least important heading is <h6>.
  682. /// - The <h1> heading is the first heading in the document.
  683. /// - The <h1> heading is usually a large bolded font.
  684. h3 {};
  685. /// Build a
  686. /// [`<h4>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h4)
  687. /// element.
  688. h4 {};
  689. /// Build a
  690. /// [`<h5>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h5)
  691. /// element.
  692. h5 {};
  693. /// Build a
  694. /// [`<h6>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h6)
  695. /// element.
  696. h6 {};
  697. /// Build a
  698. /// [`<main>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main)
  699. /// element.
  700. main {};
  701. /// Build a
  702. /// [`<nav>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav)
  703. /// element.
  704. nav {};
  705. /// Build a
  706. /// [`<section>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section)
  707. /// element.
  708. section {};
  709. // Text content
  710. /// Build a
  711. /// [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote)
  712. /// element.
  713. blockquote {
  714. cite: Uri,
  715. };
  716. /// Build a
  717. /// [`<dd>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd)
  718. /// element.
  719. dd {};
  720. /// Build a
  721. /// [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div)
  722. /// element.
  723. ///
  724. /// ## Definition and Usage
  725. /// - The <div> tag defines a division or a section in an HTML document.
  726. /// - The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript.
  727. /// - The <div> tag is easily styled by using the class or id attribute.
  728. /// - Any sort of content can be put inside the <div> tag!
  729. ///
  730. /// Note: By default, browsers always place a line break before and after the <div> element.
  731. ///
  732. /// ## Usage
  733. /// ```
  734. /// html!(<div> A header element </div>)
  735. /// rsx!(div { "A header element" })
  736. /// LazyNodes::new(|f| f.element(div, &[], &[], &[], None))
  737. /// ```
  738. ///
  739. /// ## References:
  740. /// - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
  741. /// - https://www.w3schools.com/tags/tag_div.asp
  742. div {};
  743. /// Build a
  744. /// [`<dl>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)
  745. /// element.
  746. dl {};
  747. /// Build a
  748. /// [`<dt>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt)
  749. /// element.
  750. dt {};
  751. /// Build a
  752. /// [`<figcaption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption)
  753. /// element.
  754. figcaption {};
  755. /// Build a
  756. /// [`<figure>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure)
  757. /// element.
  758. figure {};
  759. /// Build a
  760. /// [`<hr>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr)
  761. /// element.
  762. hr {};
  763. /// Build a
  764. /// [`<li>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li)
  765. /// element.
  766. li {
  767. value: isize,
  768. };
  769. /// Build a
  770. /// [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol)
  771. /// element.
  772. ol {
  773. reversed: Bool,
  774. start: isize,
  775. r#type: OrderedListType,
  776. };
  777. /// Build a
  778. /// [`<p>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p)
  779. /// element.
  780. p {};
  781. /// Build a
  782. /// [`<pre>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre)
  783. /// element.
  784. pre {};
  785. /// Build a
  786. /// [`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul)
  787. /// element.
  788. ul {};
  789. // Inline text semantics
  790. /// Build a
  791. /// [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
  792. /// element.
  793. a {
  794. download: String,
  795. href: Uri,
  796. hreflang: LanguageTag,
  797. target: Target,
  798. r#type: Mime,
  799. // ping: SpacedList<Uri>,
  800. // rel: SpacedList<LinkType>,
  801. };
  802. /// Build a
  803. /// [`<abbr>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/abbr)
  804. /// element.
  805. abbr {};
  806. /// Build a
  807. /// [`<b>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b)
  808. /// element.
  809. b {};
  810. /// Build a
  811. /// [`<bdi>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi)
  812. /// element.
  813. bdi {};
  814. /// Build a
  815. /// [`<bdo>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo)
  816. /// element.
  817. bdo {};
  818. /// Build a
  819. /// [`<br>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br)
  820. /// element.
  821. br {};
  822. /// Build a
  823. /// [`<cite>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite)
  824. /// element.
  825. cite {};
  826. /// Build a
  827. /// [`<code>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code)
  828. /// element.
  829. code {};
  830. /// Build a
  831. /// [`<data>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data)
  832. /// element.
  833. data {
  834. value: String,
  835. };
  836. /// Build a
  837. /// [`<dfn>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dfn)
  838. /// element.
  839. dfn {};
  840. /// Build a
  841. /// [`<em>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em)
  842. /// element.
  843. em {};
  844. /// Build a
  845. /// [`<i>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i)
  846. /// element.
  847. i {};
  848. /// Build a
  849. /// [`<kbd>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd)
  850. /// element.
  851. kbd {};
  852. /// Build a
  853. /// [`<mark>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark)
  854. /// element.
  855. mark {};
  856. /// Build a
  857. /// [`<q>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q)
  858. /// element.
  859. q {
  860. cite: Uri,
  861. };
  862. /// Build a
  863. /// [`<rp>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rp)
  864. /// element.
  865. rp {};
  866. /// Build a
  867. /// [`<rt>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rt)
  868. /// element.
  869. rt {};
  870. /// Build a
  871. /// [`<ruby>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby)
  872. /// element.
  873. ruby {};
  874. /// Build a
  875. /// [`<s>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s)
  876. /// element.
  877. s {};
  878. /// Build a
  879. /// [`<samp>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/samp)
  880. /// element.
  881. samp {};
  882. /// Build a
  883. /// [`<small>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small)
  884. /// element.
  885. small {};
  886. /// Build a
  887. /// [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span)
  888. /// element.
  889. span {};
  890. /// Build a
  891. /// [`<strong>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong)
  892. /// element.
  893. strong {};
  894. /// Build a
  895. /// [`<sub>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub)
  896. /// element.
  897. sub {};
  898. /// Build a
  899. /// [`<sup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup)
  900. /// element.
  901. sup {};
  902. /// Build a
  903. /// [`<time>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time)
  904. /// element.
  905. time {};
  906. /// Build a
  907. /// [`<u>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/u)
  908. /// element.
  909. u {};
  910. /// Build a
  911. /// [`<var>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/var)
  912. /// element.
  913. var {};
  914. /// Build a
  915. /// [`<wbr>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr)
  916. /// element.
  917. wbr {};
  918. // Image and multimedia
  919. /// Build a
  920. /// [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)
  921. /// element.
  922. area {
  923. alt: String,
  924. coords: String, // TODO could perhaps be validated
  925. download: Bool,
  926. href: Uri,
  927. hreflang: LanguageTag,
  928. shape: AreaShape,
  929. target: Target,
  930. // ping: SpacedList<Uri>,
  931. // rel: SpacedSet<LinkType>,
  932. };
  933. /// Build a
  934. /// [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio)
  935. /// element.
  936. audio {
  937. autoplay: Bool,
  938. controls: Bool,
  939. crossorigin: CrossOrigin,
  940. muted: Bool,
  941. preload: Preload,
  942. src: Uri,
  943. r#loop: Bool,
  944. };
  945. /// Build a
  946. /// [`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
  947. /// element.
  948. img {
  949. alt: String,
  950. crossorigin: CrossOrigin,
  951. decoding: ImageDecoding,
  952. height: usize,
  953. ismap: Bool,
  954. src: Uri,
  955. srcset: String, // FIXME this is much more complicated
  956. usemap: String, // FIXME should be a fragment starting with '#'
  957. width: usize,
  958. referrerpolicy: String,
  959. // sizes: SpacedList<String>, // FIXME it's not really just a string
  960. };
  961. /// Build a
  962. /// [`<map>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map)
  963. /// element.
  964. map {
  965. name: Id,
  966. };
  967. /// Build a
  968. /// [`<track>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track)
  969. /// element.
  970. track {
  971. default: Bool,
  972. kind: VideoKind,
  973. label: String,
  974. src: Uri,
  975. srclang: LanguageTag,
  976. };
  977. /// Build a
  978. /// [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video)
  979. /// element.
  980. video {
  981. autoplay: Bool,
  982. controls: Bool,
  983. crossorigin: CrossOrigin,
  984. height: usize,
  985. r#loop: Bool,
  986. muted: Bool,
  987. preload: Preload,
  988. playsinline: Bool,
  989. poster: Uri,
  990. src: Uri,
  991. width: usize,
  992. };
  993. // Embedded content
  994. /// Build a
  995. /// [`<embed>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed)
  996. /// element.
  997. embed {
  998. height: usize,
  999. src: Uri,
  1000. r#type: Mime,
  1001. width: usize,
  1002. };
  1003. /// Build a
  1004. /// [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)
  1005. /// element.
  1006. iframe {
  1007. allow: FeaturePolicy,
  1008. allowfullscreen: Bool,
  1009. allowpaymentrequest: Bool,
  1010. height: usize,
  1011. name: Id,
  1012. referrerpolicy: ReferrerPolicy,
  1013. src: Uri,
  1014. srcdoc: Uri,
  1015. width: usize,
  1016. // sandbox: SpacedSet<Sandbox>,
  1017. };
  1018. /// Build a
  1019. /// [`<object>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object)
  1020. /// element.
  1021. object {
  1022. data: Uri,
  1023. form: Id,
  1024. height: usize,
  1025. name: Id,
  1026. r#type: Mime,
  1027. typemustmatch: Bool,
  1028. usemap: String, // TODO should be a fragment starting with '#'
  1029. width: usize,
  1030. };
  1031. /// Build a
  1032. /// [`<param>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/param)
  1033. /// element.
  1034. param {
  1035. name: String,
  1036. value: String,
  1037. };
  1038. /// Build a
  1039. /// [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture)
  1040. /// element.
  1041. picture {};
  1042. /// Build a
  1043. /// [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source)
  1044. /// element.
  1045. source {
  1046. src: Uri,
  1047. r#type: Mime,
  1048. };
  1049. // Scripting
  1050. /// Build a
  1051. /// [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas)
  1052. /// element.
  1053. canvas {
  1054. height: usize,
  1055. width: usize,
  1056. };
  1057. /// Build a
  1058. /// [`<noscript>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript)
  1059. /// element.
  1060. noscript {};
  1061. /// Build a
  1062. /// [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
  1063. /// element.
  1064. script {
  1065. crossorigin: CrossOrigin,
  1066. defer: Bool,
  1067. integrity: Integrity,
  1068. nomodule: Bool,
  1069. nonce: Nonce,
  1070. src: Uri,
  1071. text: String,
  1072. r#async: Bool,
  1073. r#type: String, // TODO could be an enum
  1074. };
  1075. // Demarcating edits
  1076. /// Build a
  1077. /// [`<del>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del)
  1078. /// element.
  1079. del {
  1080. cite: Uri,
  1081. datetime: Datetime,
  1082. };
  1083. /// Build a
  1084. /// [`<ins>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins)
  1085. /// element.
  1086. ins {
  1087. cite: Uri,
  1088. datetime: Datetime,
  1089. };
  1090. // Table content
  1091. /// Build a
  1092. /// [`<caption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption)
  1093. /// element.
  1094. caption {};
  1095. /// Build a
  1096. /// [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col)
  1097. /// element.
  1098. col {
  1099. span: usize,
  1100. };
  1101. /// Build a
  1102. /// [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup)
  1103. /// element.
  1104. colgroup {
  1105. span: usize,
  1106. };
  1107. /// Build a
  1108. /// [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table)
  1109. /// element.
  1110. table {};
  1111. /// Build a
  1112. /// [`<tbody>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody)
  1113. /// element.
  1114. tbody {};
  1115. /// Build a
  1116. /// [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td)
  1117. /// element.
  1118. td {
  1119. colspan: usize,
  1120. rowspan: usize,
  1121. // headers: SpacedSet<Id>,
  1122. };
  1123. /// Build a
  1124. /// [`<tfoot>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot)
  1125. /// element.
  1126. tfoot {};
  1127. /// Build a
  1128. /// [`<th>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th)
  1129. /// element.
  1130. th {
  1131. abbr: String,
  1132. colspan: usize,
  1133. rowspan: usize,
  1134. scope: TableHeaderScope,
  1135. // headers: SpacedSet<Id>,
  1136. };
  1137. /// Build a
  1138. /// [`<thead>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead)
  1139. /// element.
  1140. thead {};
  1141. /// Build a
  1142. /// [`<tr>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr)
  1143. /// element.
  1144. tr {};
  1145. // Forms
  1146. /// Build a
  1147. /// [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button)
  1148. /// element.
  1149. button {
  1150. autofocus: Bool,
  1151. disabled: Bool,
  1152. form: Id,
  1153. formaction: Uri,
  1154. formenctype: FormEncodingType,
  1155. formmethod: FormMethod,
  1156. formnovalidate: Bool,
  1157. formtarget: Target,
  1158. name: Id,
  1159. r#type: ButtonType,
  1160. value: String,
  1161. };
  1162. /// Build a
  1163. /// [`<datalist>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist)
  1164. /// element.
  1165. datalist {};
  1166. /// Build a
  1167. /// [`<fieldset>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset)
  1168. /// element.
  1169. fieldset {};
  1170. /// Build a
  1171. /// [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
  1172. /// element.
  1173. form {
  1174. // accept-charset: SpacedList<CharacterEncoding>,
  1175. action: Uri,
  1176. autocomplete: OnOff,
  1177. enctype: FormEncodingType,
  1178. method: FormMethod,
  1179. name: Id,
  1180. novalidate: Bool,
  1181. target: Target,
  1182. };
  1183. /// Build a
  1184. /// [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
  1185. /// element.
  1186. input {
  1187. accept: String,
  1188. alt: String,
  1189. autocomplete: String,
  1190. autofocus: Bool,
  1191. capture: String,
  1192. checked: Bool,
  1193. disabled: Bool,
  1194. form: Id,
  1195. formaction: Uri,
  1196. formenctype: FormEncodingType,
  1197. formmethod: FormDialogMethod,
  1198. formnovalidate: Bool,
  1199. formtarget: Target,
  1200. height: isize,
  1201. list: Id,
  1202. max: String,
  1203. maxlength: usize,
  1204. min: String,
  1205. minlength: usize,
  1206. multiple: Bool,
  1207. name: Id,
  1208. pattern: String,
  1209. placeholder: String,
  1210. readonly: Bool,
  1211. required: Bool,
  1212. size: usize,
  1213. spellcheck: Bool,
  1214. src: Uri,
  1215. step: String,
  1216. tabindex: usize,
  1217. r#type: InputType,
  1218. value: String,
  1219. width: isize,
  1220. };
  1221. /// Build a
  1222. /// [`<label>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
  1223. /// element.
  1224. label {
  1225. r#for: Id,
  1226. form: Id,
  1227. };
  1228. /// Build a
  1229. /// [`<legend>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)
  1230. /// element.
  1231. legend {};
  1232. /// Build a
  1233. /// [`<meter>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter)
  1234. /// element.
  1235. meter {
  1236. value: isize,
  1237. min: isize,
  1238. max: isize,
  1239. low: isize,
  1240. high: isize,
  1241. optimum: isize,
  1242. form: Id,
  1243. };
  1244. /// Build a
  1245. /// [`<optgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup)
  1246. /// element.
  1247. optgroup {
  1248. disabled: Bool,
  1249. label: String,
  1250. };
  1251. /// Build a
  1252. /// [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
  1253. /// element.
  1254. option {
  1255. disabled: Bool,
  1256. label: String,
  1257. selected: Bool,
  1258. value: String,
  1259. };
  1260. /// Build a
  1261. /// [`<output>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output)
  1262. /// element.
  1263. output {
  1264. form: Id,
  1265. name: Id,
  1266. // r#for: SpacedSet<Id>,
  1267. };
  1268. /// Build a
  1269. /// [`<progress>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress)
  1270. /// element.
  1271. progress {
  1272. max: f64,
  1273. value: f64,
  1274. };
  1275. /// Build a
  1276. /// [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
  1277. /// element.
  1278. select {
  1279. autocomplete: String,
  1280. autofocus: Bool,
  1281. disabled: Bool,
  1282. form: Id,
  1283. multiple: Bool,
  1284. name: Id,
  1285. required: Bool,
  1286. size: usize,
  1287. };
  1288. /// Build a
  1289. /// [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
  1290. /// element.
  1291. textarea {
  1292. autocomplete: OnOff,
  1293. autofocus: Bool,
  1294. cols: usize,
  1295. disabled: Bool,
  1296. form: Id,
  1297. maxlength: usize,
  1298. minlength: usize,
  1299. name: Id,
  1300. placeholder: String,
  1301. readonly: Bool,
  1302. required: Bool,
  1303. rows: usize,
  1304. spellcheck: BoolOrDefault,
  1305. wrap: Wrap,
  1306. };
  1307. // Interactive elements
  1308. /// Build a
  1309. /// [`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)
  1310. /// element.
  1311. details {
  1312. open: Bool,
  1313. };
  1314. /// Build a
  1315. /// [`<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary)
  1316. /// element.
  1317. summary {};
  1318. // Web components
  1319. /// Build a
  1320. /// [`<slot>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot)
  1321. /// element.
  1322. slot {};
  1323. /// Build a
  1324. /// [`<template>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template)
  1325. /// element.
  1326. template {};
  1327. }
  1328. pub trait SvgAttributes {
  1329. aria_trait_methods! {
  1330. accent_height: "accent-height",
  1331. accumulate: "accumulate",
  1332. additive: "additive",
  1333. alignment_baseline: "alignment-baseline",
  1334. alphabetic: "alphabetic",
  1335. amplitude: "amplitude",
  1336. arabic_form: "arabic-form",
  1337. ascent: "ascent",
  1338. attributeName: "attributeName",
  1339. attributeType: "attributeType",
  1340. azimuth: "azimuth",
  1341. baseFrequency: "baseFrequency",
  1342. baseline_shift: "baseline-shift",
  1343. baseProfile: "baseProfile",
  1344. bbox: "bbox",
  1345. begin: "begin",
  1346. bias: "bias",
  1347. by: "by",
  1348. calcMode: "calcMode",
  1349. cap_height: "cap-height",
  1350. class: "class",
  1351. clip: "clip",
  1352. clipPathUnits: "clipPathUnits",
  1353. clip_path: "clip-path",
  1354. clip_rule: "clip-rule",
  1355. color: "color",
  1356. color_interpolation: "color-interpolation",
  1357. color_interpolation_filters: "color-interpolation-filters",
  1358. color_profile: "color-profile",
  1359. color_rendering: "color-rendering",
  1360. contentScriptType: "contentScriptType",
  1361. contentStyleType: "contentStyleType",
  1362. crossorigin: "crossorigin",
  1363. cursor: "cursor",
  1364. cx: "cx",
  1365. cy: "cy",
  1366. d: "d",
  1367. decelerate: "decelerate",
  1368. descent: "descent",
  1369. diffuseConstant: "diffuseConstant",
  1370. direction: "direction",
  1371. display: "display",
  1372. divisor: "divisor",
  1373. dominant_baseline: "dominant-baseline",
  1374. dur: "dur",
  1375. dx: "dx",
  1376. dy: "dy",
  1377. edgeMode: "edgeMode",
  1378. elevation: "elevation",
  1379. enable_background: "enable-background",
  1380. end: "end",
  1381. exponent: "exponent",
  1382. fill: "fill",
  1383. fill_opacity: "fill-opacity",
  1384. fill_rule: "fill-rule",
  1385. filter: "filter",
  1386. filterRes: "filterRes",
  1387. filterUnits: "filterUnits",
  1388. flood_color: "flood-color",
  1389. flood_opacity: "flood-opacity",
  1390. font_family: "font-family",
  1391. font_size: "font-size",
  1392. font_size_adjust: "font-size-adjust",
  1393. font_stretch: "font-stretch",
  1394. font_style: "font-style",
  1395. font_variant: "font-variant",
  1396. font_weight: "font-weight",
  1397. format: "format",
  1398. from: "from",
  1399. fr: "fr",
  1400. fx: "fx",
  1401. fy: "fy",
  1402. g1: "g1",
  1403. g2: "g2",
  1404. glyph_name: "glyph-name",
  1405. glyph_orientation_horizontal: "glyph-orientation-horizontal",
  1406. glyph_orientation_vertical: "glyph-orientation-vertical",
  1407. glyphRef: "glyphRef",
  1408. gradientTransform: "gradientTransform",
  1409. gradientUnits: "gradientUnits",
  1410. hanging: "hanging",
  1411. height: "height",
  1412. href: "href",
  1413. hreflang: "hreflang",
  1414. horiz_adv_x: "horiz-adv-x",
  1415. horiz_origin_x: "horiz-origin-x",
  1416. id: "id",
  1417. ideographic: "ideographic",
  1418. image_rendering: "image-rendering",
  1419. _in: "_in",
  1420. in2: "in2",
  1421. intercept: "intercept",
  1422. k: "k",
  1423. k1: "k1",
  1424. k2: "k2",
  1425. k3: "k3",
  1426. k4: "k4",
  1427. kernelMatrix: "kernelMatrix",
  1428. kernelUnitLength: "kernelUnitLength",
  1429. kerning: "kerning",
  1430. keyPoints: "keyPoints",
  1431. keySplines: "keySplines",
  1432. keyTimes: "keyTimes",
  1433. lang: "lang",
  1434. lengthAdjust: "lengthAdjust",
  1435. letter_spacing: "letter-spacing",
  1436. lighting_color: "lighting-color",
  1437. limitingConeAngle: "limitingConeAngle",
  1438. local: "local",
  1439. marker_end: "marker-end",
  1440. marker_mid: "marker-mid",
  1441. marker_start: "marker_start",
  1442. markerHeight: "markerHeight",
  1443. markerUnits: "markerUnits",
  1444. markerWidth: "markerWidth",
  1445. mask: "mask",
  1446. maskContentUnits: "maskContentUnits",
  1447. maskUnits: "maskUnits",
  1448. mathematical: "mathematical",
  1449. max: "max",
  1450. media: "media",
  1451. method: "method",
  1452. min: "min",
  1453. mode: "mode",
  1454. name: "name",
  1455. numOctaves: "numOctaves",
  1456. offset: "offset",
  1457. opacity: "opacity",
  1458. operator: "operator",
  1459. order: "order",
  1460. orient: "orient",
  1461. orientation: "orientation",
  1462. origin: "origin",
  1463. overflow: "overflow",
  1464. overline_position: "overline-position",
  1465. overline_thickness: "overline-thickness",
  1466. panose_1: "panose-1",
  1467. paint_order: "paint-order",
  1468. path: "path",
  1469. pathLength: "pathLength",
  1470. patternContentUnits: "patternContentUnits",
  1471. patternTransform: "patternTransform",
  1472. patternUnits: "patternUnits",
  1473. ping: "ping",
  1474. pointer_events: "pointer-events",
  1475. points: "points",
  1476. pointsAtX: "pointsAtX",
  1477. pointsAtY: "pointsAtY",
  1478. pointsAtZ: "pointsAtZ",
  1479. preserveAlpha: "preserveAlpha",
  1480. preserveAspectRatio: "preserveAspectRatio",
  1481. primitiveUnits: "primitiveUnits",
  1482. r: "r",
  1483. radius: "radius",
  1484. referrerPolicy: "referrerPolicy",
  1485. refX: "refX",
  1486. refY: "refY",
  1487. rel: "rel",
  1488. rendering_intent: "rendering-intent",
  1489. repeatCount: "repeatCount",
  1490. repeatDur: "repeatDur",
  1491. requiredExtensions: "requiredExtensions",
  1492. requiredFeatures: "requiredFeatures",
  1493. restart: "restart",
  1494. result: "result",
  1495. rotate: "rotate",
  1496. rx: "rx",
  1497. ry: "ry",
  1498. scale: "scale",
  1499. seed: "seed",
  1500. shape_rendering: "shape-rendering",
  1501. slope: "slope",
  1502. spacing: "spacing",
  1503. specularConstant: "specularConstant",
  1504. specularExponent: "specularExponent",
  1505. speed: "speed",
  1506. spreadMethod: "spreadMethod",
  1507. startOffset: "startOffset",
  1508. stdDeviation: "stdDeviation",
  1509. stemh: "stemh",
  1510. stemv: "stemv",
  1511. stitchTiles: "stitchTiles",
  1512. stop_color: "stop_color",
  1513. stop_opacity: "stop_opacity",
  1514. strikethrough_position: "strikethrough-position",
  1515. strikethrough_thickness: "strikethrough-thickness",
  1516. string: "string",
  1517. stroke: "stroke",
  1518. stroke_dasharray: "stroke-dasharray",
  1519. stroke_dashoffset: "stroke-dashoffset",
  1520. stroke_linecap: "stroke-linecap",
  1521. stroke_linejoin: "stroke-linejoin",
  1522. stroke_miterlimit: "stroke-miterlimit",
  1523. stroke_opacity: "stroke-opacity",
  1524. stroke_width: "stroke-width",
  1525. style: "style",
  1526. surfaceScale: "surfaceScale",
  1527. systemLanguage: "systemLanguage",
  1528. tabindex: "tabindex",
  1529. tableValues: "tableValues",
  1530. target: "target",
  1531. targetX: "targetX",
  1532. targetY: "targetY",
  1533. text_anchor: "text-anchor",
  1534. text_decoration: "text-decoration",
  1535. text_rendering: "text-rendering",
  1536. textLength: "textLength",
  1537. to: "to",
  1538. transform: "transform",
  1539. transform_origin: "transform-origin",
  1540. _type: "_type",
  1541. u1: "u1",
  1542. u2: "u2",
  1543. underline_position: "underline-position",
  1544. underline_thickness: "underline-thickness",
  1545. unicode: "unicode",
  1546. unicode_bidi: "unicode-bidi",
  1547. unicode_range: "unicode-range",
  1548. units_per_em: "units-per-em",
  1549. v_alphabetic: "v-alphabetic",
  1550. v_hanging: "v-hanging",
  1551. v_ideographic: "v-ideographic",
  1552. v_mathematical: "v-mathematical",
  1553. values: "values",
  1554. vector_effect: "vector-effect",
  1555. version: "version",
  1556. vert_adv_y: "vert-adv-y",
  1557. vert_origin_x: "vert-origin-x",
  1558. vert_origin_y: "vert-origin-y",
  1559. viewBox: "viewBox",
  1560. viewTarget: "viewTarget",
  1561. visibility: "visibility",
  1562. width: "width",
  1563. widths: "widths",
  1564. word_spacing: "word-spacing",
  1565. writing_mode: "writing-mode",
  1566. x: "x",
  1567. x_height: "x-height",
  1568. x1: "x1",
  1569. x2: "x2",
  1570. xmlns: "xmlns",
  1571. xChannelSelector: "xChannelSelector",
  1572. y: "y",
  1573. y1: "y1",
  1574. y2: "y2",
  1575. yChannelSelector: "yChannelSelector",
  1576. z: "z",
  1577. zoomAndPan: "zoomAndPan",
  1578. }
  1579. }
  1580. builder_constructors! {
  1581. // SVG components
  1582. /// Build a
  1583. /// [`<svg>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg)
  1584. /// element.
  1585. svg <> "http://www.w3.org/2000/svg" { };
  1586. /// Build a
  1587. /// [`<path>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path)
  1588. /// element.
  1589. path <> "http://www.w3.org/2000/svg" {
  1590. };
  1591. /// Build a
  1592. /// [`<circle>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/circle)
  1593. /// element.
  1594. circle <> "http://www.w3.org/2000/svg" {
  1595. };
  1596. /// Build a
  1597. /// [`<ellipse>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/ellipse)
  1598. /// element.
  1599. ellipse <> "http://www.w3.org/2000/svg" {
  1600. };
  1601. /// Build a
  1602. /// [`<line>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/line)
  1603. /// element.
  1604. line <> "http://www.w3.org/2000/svg" {
  1605. };
  1606. /// Build a
  1607. /// [`<polygon>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon)
  1608. /// element.
  1609. polygon <> "http://www.w3.org/2000/svg" {
  1610. };
  1611. /// Build a
  1612. /// [`<polyline>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline)
  1613. /// element.
  1614. polyline <> "http://www.w3.org/2000/svg" {
  1615. };
  1616. /// Build a
  1617. /// [`<rect>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect)
  1618. /// element.
  1619. rect <> "http://www.w3.org/2000/svg" {
  1620. };
  1621. /// Build a
  1622. /// [`<image>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image)
  1623. /// element.
  1624. image <> "http://www.w3.org/2000/svg" {
  1625. };
  1626. }
  1627. /*
  1628. Ideal format:
  1629. /// Build a
  1630. /// [`<h1>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h1)
  1631. /// element.
  1632. ///
  1633. /// # About
  1634. /// - The HTML `<h1>` element is found within the `<body>` tag.
  1635. /// - Headings can range from `<h1>` to `<h6>`.
  1636. /// - The most important heading is `<h1>` and the least important heading is `<h6>`.
  1637. /// - The `<h1>` heading is the first heading in the document.
  1638. /// - The `<h1>` heading is usually a large bolded font.
  1639. ///
  1640. /// # Usage
  1641. ///
  1642. /// ```
  1643. /// html!(<h1> A header element </h1>)
  1644. /// rsx!(h1 { "A header element" })
  1645. /// LazyNodes::new(|f| f.el(h1).children([f.text("A header element")]).finish())
  1646. /// ```
  1647. Full List:
  1648. ---------
  1649. base
  1650. head
  1651. link
  1652. meta
  1653. style
  1654. title
  1655. body
  1656. address
  1657. article
  1658. aside
  1659. footer
  1660. header
  1661. h1
  1662. h1
  1663. h2
  1664. h2
  1665. h3
  1666. h4
  1667. h5
  1668. h6
  1669. main
  1670. nav
  1671. section
  1672. blockquote
  1673. dd
  1674. div
  1675. dl
  1676. dt
  1677. figcaption
  1678. figure
  1679. hr
  1680. li
  1681. ol
  1682. p
  1683. pre
  1684. ul
  1685. a
  1686. abbr
  1687. b
  1688. bdi
  1689. bdo
  1690. br
  1691. cite
  1692. code
  1693. data
  1694. dfn
  1695. em
  1696. i
  1697. kbd
  1698. mark
  1699. q
  1700. rp
  1701. rt
  1702. ruby
  1703. s
  1704. samp
  1705. small
  1706. span
  1707. strong
  1708. sub
  1709. sup
  1710. time
  1711. u
  1712. var
  1713. wbr
  1714. area
  1715. audio
  1716. img
  1717. map
  1718. track
  1719. video
  1720. embed
  1721. iframe
  1722. object
  1723. param
  1724. picture
  1725. source
  1726. canvas
  1727. noscript
  1728. script
  1729. del
  1730. ins
  1731. caption
  1732. col
  1733. colgroup
  1734. table
  1735. tbody
  1736. td
  1737. tfoot
  1738. th
  1739. thead
  1740. tr
  1741. button
  1742. datalist
  1743. fieldset
  1744. form
  1745. input
  1746. label
  1747. legend
  1748. meter
  1749. optgroup
  1750. option
  1751. output
  1752. progress
  1753. select
  1754. textarea
  1755. details
  1756. summary
  1757. slot
  1758. template
  1759. */
  1760. trait AsAttributeValue: Sized {
  1761. fn into_attribute_value<'a>(self, cx: NodeFactory<'a>) -> AttributeValue<'a>;
  1762. }
  1763. enum AttributeValue<'a> {
  1764. Int(i32),
  1765. Float(f32),
  1766. Str(&'a str),
  1767. Bool(bool),
  1768. }
  1769. impl<'b> AsAttributeValue for Arguments<'b> {
  1770. fn into_attribute_value<'a>(self, cx: NodeFactory<'a>) -> AttributeValue<'a> {
  1771. todo!()
  1772. }
  1773. }
  1774. impl AsAttributeValue for &'static str {
  1775. fn into_attribute_value<'a>(self, cx: NodeFactory<'a>) -> AttributeValue<'a> {
  1776. todo!()
  1777. }
  1778. }
  1779. impl AsAttributeValue for f32 {
  1780. fn into_attribute_value<'a>(self, cx: NodeFactory<'a>) -> AttributeValue<'a> {
  1781. todo!()
  1782. }
  1783. }
  1784. impl AsAttributeValue for i32 {
  1785. fn into_attribute_value<'a>(self, cx: NodeFactory<'a>) -> AttributeValue<'a> {
  1786. todo!()
  1787. }
  1788. }