axum-wire 0.0.3

Server-driven reactive UI components for Axum — like Laravel Livewire, but for Rust
Documentation
//! Typed HTML elements and attributes for IDE support.
//!
//! Each HTML element is a Rust module containing:
//! - `TAG_NAME`: the element's tag name as a string
//! - Attribute consts re-exported from [`global_attributes`] and element-specific ones
//!
//! The `html!` macro references these modules so rust-analyzer can provide
//! hover documentation, go-to-definition, and **attribute completions**.
//! None of this code runs at runtime.

#![allow(non_upper_case_globals, non_snake_case)]

// ---------------------------------------------------------------------------
// Global HTML attributes — re-exported into every element module
// ---------------------------------------------------------------------------

/// Global HTML attributes available on all elements.
pub mod global_attributes {
    /// The `class` attribute specifies one or more CSS class names.
    pub const class: (&str, Option<&str>, bool) = ("class", None, false);
    /// The `id` attribute specifies a unique identifier.
    pub const id: (&str, Option<&str>, bool) = ("id", None, false);
    /// The `style` attribute specifies inline CSS styles.
    pub const style: (&str, Option<&str>, bool) = ("style", None, false);
    /// The `title` attribute provides advisory tooltip text.
    pub const title: (&str, Option<&str>, bool) = ("title", None, false);
    /// The `lang` attribute specifies the language.
    pub const lang: (&str, Option<&str>, bool) = ("lang", None, false);
    /// The `dir` attribute specifies text direction.
    pub const dir: (&str, Option<&str>, bool) = ("dir", None, false);
    /// The `hidden` attribute hides the element.
    pub const hidden: (&str, Option<&str>, bool) = ("hidden", None, false);
    /// The `tabindex` attribute specifies tab order.
    pub const tabindex: (&str, Option<&str>, bool) = ("tabindex", None, false);
    /// The `accesskey` attribute specifies a keyboard shortcut.
    pub const accesskey: (&str, Option<&str>, bool) = ("accesskey", None, false);
    /// The `draggable` attribute specifies if draggable.
    pub const draggable: (&str, Option<&str>, bool) = ("draggable", None, false);
    /// The `contenteditable` attribute makes content editable.
    pub const contenteditable: (&str, Option<&str>, bool) = ("contenteditable", None, false);
    /// The `spellcheck` attribute enables spell checking.
    pub const spellcheck: (&str, Option<&str>, bool) = ("spellcheck", None, false);
    /// The `role` attribute defines the ARIA role.
    pub const role: (&str, Option<&str>, bool) = ("role", None, false);
}

// ---------------------------------------------------------------------------
// Element module macro — IMPORTANT: never put /// on same line as } or {
// ---------------------------------------------------------------------------

macro_rules! el {
    // Element with no extra attributes
    ($doc:literal, $name:ident) => {
        #[doc = $doc]
        #[allow(non_camel_case_types)]
        pub mod $name {
            pub use super::global_attributes::*;
            /// The HTML tag name for this element.
            pub const TAG_NAME: &str = stringify!($name);
        }
    };
    // Element with extra attributes
    ($doc:literal, $name:ident, { $( $adoc:literal $attr:ident ),* $(,)? }) => {
        #[doc = $doc]
        #[allow(non_camel_case_types)]
        pub mod $name {
            pub use super::global_attributes::*;
            /// The HTML tag name for this element.
            pub const TAG_NAME: &str = stringify!($name);
            $(
                #[doc = $adoc]
                pub const $attr: (&str, Option<&str>, bool) = (stringify!($attr), None, false);
            )*
        }
    };
}

// ---------------------------------------------------------------------------
// Document metadata
// ---------------------------------------------------------------------------

el!("The `<html>` root element.", html);
el!("The `<head>` metadata container.", head);
el!("The `<base>` element sets the base URL.", base, { "Base URL." href, "Default target." target });
el!("The `<link>` element links external resources.", link, { "Resource URL." href, "Relationship type." rel, "Media query." media, "Icon sizes." sizes, "CORS mode." crossorigin, "SRI hash." integrity });
el!("The `<meta>` element provides metadata.", meta, { "Character encoding." charset, "Metadata value." content, "Metadata name." name });
el!("The `<style>` element contains CSS.", style, { "Media query." media });
el!("The `<title>` element sets the document title.", title);
el!("The `<body>` element contains document content.", body);

// ---------------------------------------------------------------------------
// Content sectioning
// ---------------------------------------------------------------------------

el!("The `<address>` element — contact info.", address);
el!("The `<article>` element — self-contained content.", article);
el!("The `<aside>` element — tangential content.", aside);
el!("The `<footer>` element — section footer.", footer);
el!("The `<header>` element — introductory content.", header);
el!("The `<h1>` heading (most important).", h1);
el!("The `<h2>` heading.", h2);
el!("The `<h3>` heading.", h3);
el!("The `<h4>` heading.", h4);
el!("The `<h5>` heading.", h5);
el!("The `<h6>` heading (least important).", h6);
el!("The `<hgroup>` groups heading + subheading.", hgroup);
el!("The `<main>` element — dominant body content.", main);
el!("The `<nav>` element — navigation links.", nav);
el!("The `<section>` element — standalone section.", section);
el!("The `<search>` element — search/filter area.", search);

// ---------------------------------------------------------------------------
// Text content
// ---------------------------------------------------------------------------

el!("The `<blockquote>` element — extended quotation.", blockquote, { "Source URL." cite });
el!("The `<dd>` element — description of a term.", dd);
el!("The `<div>` element — generic flow container.", div);
el!("The `<dl>` element — description list.", dl);
el!("The `<dt>` element — term in description list.", dt);
el!("The `<figcaption>` — caption for a figure.", figcaption);
el!("The `<figure>` — self-contained content + caption.", figure);
el!("The `<hr>` element — thematic break.", hr);
el!("The `<li>` element — list item.", li, { "Ordinal value." value });
el!("The `<menu>` element — unordered command list.", menu);
el!("The `<ol>` element — ordered list.", ol, { "Reverse order." reversed, "Start number." start, "Numbering type." r#type });
el!("The `<p>` element — paragraph.", p);
el!("The `<pre>` element — preformatted text.", pre);
el!("The `<ul>` element — unordered list.", ul);

// ---------------------------------------------------------------------------
// Inline text semantics
// ---------------------------------------------------------------------------

el!("The `<a>` element — hyperlink.", a, { "Link URL." href, "Browsing context." target, "Relationship." rel, "Download hint." download });
el!("The `<abbr>` element — abbreviation.", abbr);
el!("The `<b>` element — bold text.", b);
el!("The `<bdi>` element — bidirectional isolation.", bdi);
el!("The `<bdo>` element — bidirectional override.", bdo);
el!("The `<br>` element — line break.", br);
el!("The `<cite>` element — creative work title.", cite);
el!("The `<code>` element — inline code.", code);
el!("The `<data>` element — machine-readable value.", data, { "Machine-readable value." value });
el!("The `<dfn>` element — defining instance.", dfn);
el!("The `<em>` element — stress emphasis.", em);
el!("The `<i>` element — alternate voice (italic).", i);
el!("The `<kbd>` element — keyboard input.", kbd);
el!("The `<mark>` element — highlighted text.", mark);
el!("The `<q>` element — inline quotation.", q, { "Source URL." cite });
el!("The `<rp>` element — ruby fallback.", rp);
el!("The `<rt>` element — ruby text.", rt);
el!("The `<ruby>` element — ruby annotation.", ruby);
el!("The `<s>` element — strikethrough.", s);
el!("The `<samp>` element — sample output.", samp);
el!("The `<small>` element — side comment.", small);
el!("The `<span>` element — generic inline container.", span);
el!("The `<strong>` element — strong importance.", strong);
el!("The `<sub>` element — subscript.", sub);
el!("The `<sup>` element — superscript.", sup);
el!("The `<time>` element — date/time.", time, { "Machine-readable datetime." datetime });
el!("The `<u>` element — underline.", u);
el!("The `<var>` element — variable name.", var);
el!("The `<wbr>` element — word break opportunity.", wbr);

// ---------------------------------------------------------------------------
// Image and multimedia
// ---------------------------------------------------------------------------

el!("The `<area>` element — image map region.", area);
el!("The `<audio>` element — sound content.", audio, { "Audio URL." src, "Auto-play." autoplay, "Show controls." controls, "Loop playback." r#loop, "Mute audio." muted, "Preload hint." preload });
el!("The `<img>` element — embedded image.", img, { "Image URL." src, "Alt text." alt, "Width." width, "Height." height, "Lazy loading." loading, "Decode timing." decoding, "CORS mode." crossorigin, "Responsive sources." srcset, "Responsive sizes." sizes });
el!("The `<map>` element — image map.", map);
el!("The `<track>` element — media text track.", track, { "Track URL." src, "Track kind." kind, "Track language." srclang, "Track label." label });
el!("The `<video>` element — video content.", video, { "Video URL." src, "Auto-play." autoplay, "Show controls." controls, "Loop playback." r#loop, "Mute audio." muted, "Preview image." poster, "Preload hint." preload, "Width." width, "Height." height });

// ---------------------------------------------------------------------------
// Embedded content
// ---------------------------------------------------------------------------

el!("The `<embed>` element — external content.", embed, { "Resource URL." src, "MIME type." r#type, "Width." width, "Height." height });
el!("The `<iframe>` element — nested page.", iframe, { "Page URL." src, "Inline HTML." srcdoc, "Context name." name, "Sandbox restrictions." sandbox, "Permissions policy." allow, "Width." width, "Height." height, "Lazy loading." loading });
el!("The `<object>` element — external resource.", object);
el!("The `<picture>` element — responsive images.", picture);
el!("The `<portal>` element — page transitions.", portal);
el!("The `<source>` element — media resource.", source, { "Resource URL." src, "MIME type." r#type, "Responsive sources." srcset, "Responsive sizes." sizes, "Media query." media });

// ---------------------------------------------------------------------------
// SVG and MathML
// ---------------------------------------------------------------------------

el!("The `<svg>` element — SVG container.", svg, { "SVG viewport." viewBox, "XML namespace." xmlns, "Fill paint." fill, "Stroke paint." stroke, "Width." width, "Height." height });
el!("The `<math>` element — MathML container.", math);

// ---------------------------------------------------------------------------
// Scripting
// ---------------------------------------------------------------------------

el!("The `<canvas>` element — drawing surface.", canvas, { "Width." width, "Height." height });
el!("The `<noscript>` element — no-JS fallback.", noscript);
el!("The `<script>` element — executable code.", script, { "Script URL." src, "Script type." r#type, "Defer execution." defer, "Async execution." r#async, "CORS mode." crossorigin, "SRI hash." integrity });

// ---------------------------------------------------------------------------
// Demarcating edits
// ---------------------------------------------------------------------------

el!("The `<del>` element — deleted text.", del, { "Source URL." cite, "Datetime." datetime });
el!("The `<ins>` element — inserted text.", ins, { "Source URL." cite, "Datetime." datetime });

// ---------------------------------------------------------------------------
// Table content
// ---------------------------------------------------------------------------

el!("The `<caption>` element — table caption.", caption);
el!("The `<col>` element — table column.", col, { "Column span." span });
el!("The `<colgroup>` element — column group.", colgroup, { "Column span." span });
el!("The `<table>` element — tabular data.", table);
el!("The `<tbody>` element — table body.", tbody);
el!("The `<td>` element — table data cell.", td, { "Columns to span." colspan, "Rows to span." rowspan, "Related headers." headers });
el!("The `<tfoot>` element — table footer.", tfoot);
el!("The `<th>` element — table header cell.", th, { "Columns to span." colspan, "Rows to span." rowspan, "Header scope." scope, "Related headers." headers });
el!("The `<thead>` element — table header.", thead);
el!("The `<tr>` element — table row.", tr);

// ---------------------------------------------------------------------------
// Forms
// ---------------------------------------------------------------------------

el!("The `<button>` element — clickable button.", button, { "Button type." r#type, "Disabled." disabled, "Form name." name, "Submission value." value, "Associated form." form });
el!("The `<datalist>` element — input suggestions.", datalist);
el!("The `<fieldset>` element — control group.", fieldset, { "Disabled." disabled, "Associated form." form, "Name." name });
el!("The `<form>` element — submission controls.", form, { "Submission URL." action, "HTTP method." method, "Encoding type." enctype, "Skip validation." novalidate, "Target context." target, "Auto-fill." autocomplete, "Form name." name });
el!("The `<input>` element — form control.", input, { "Input type." r#type, "Name." name, "Value." value, "Placeholder." placeholder, "Required." required, "Disabled." disabled, "Read-only." readonly, "Pre-checked." checked, "Allow multiple." multiple, "Max length." maxlength, "Min length." minlength, "Minimum." min, "Maximum." max, "Step interval." step, "Validation pattern." pattern, "Auto-fill." autocomplete, "Auto-focus." autofocus, "Associated form." form, "Datalist reference." list, "Accepted file types." accept, "Image URL." src, "Image alt." alt });
el!("The `<label>` element — form control caption.", label, { "Labeled control." r#for });
el!("The `<legend>` element — fieldset caption.", legend);
el!("The `<meter>` element — scalar measurement.", meter, { "Current value." value, "Minimum." min, "Maximum." max, "Low threshold." low, "High threshold." high, "Optimum value." optimum });
el!("The `<optgroup>` element — option group.", optgroup, { "Group label." label, "Disabled." disabled });
el!("The `<option>` element — select item.", option, { "Submission value." value, "Pre-selected." selected, "Disabled." disabled, "Display text." label });
el!("The `<output>` element — calculation result.", output, { "Related controls." r#for, "Associated form." form, "Name." name });
el!("The `<progress>` element — task progress.", progress, { "Current progress." value, "Total." max });
el!("The `<select>` element — drop-down list.", select, { "Name." name, "Allow multi-select." multiple, "Required." required, "Disabled." disabled, "Visible options." size, "Associated form." form });
el!("The `<textarea>` element — multi-line input.", textarea, { "Name." name, "Visible rows." rows, "Visible columns." cols, "Placeholder." placeholder, "Required." required, "Disabled." disabled, "Read-only." readonly, "Max length." maxlength, "Min length." minlength, "Text wrapping." wrap, "Auto-fill." autocomplete, "Auto-focus." autofocus, "Associated form." form });

// ---------------------------------------------------------------------------
// Interactive elements
// ---------------------------------------------------------------------------

el!("The `<details>` element — disclosure widget.", details, { "Initially open." open });
el!("The `<dialog>` element — dialog box.", dialog, { "Visible." open });
el!("The `<summary>` element — details heading.", summary);

// ---------------------------------------------------------------------------
// Web Components
// ---------------------------------------------------------------------------

el!("The `<slot>` element — web component placeholder.", slot, { "Slot name." name });
el!("The `<template>` element — inert HTML template.", template);

// ---------------------------------------------------------------------------
// Common SVG elements
// ---------------------------------------------------------------------------

el!("SVG `<path>` — shape via draw commands.", path, { "Path data." d, "Fill paint." fill, "Stroke paint." stroke, "Stroke width." stroke_width, "Fill rule." fill_rule, "Clip rule." clip_rule, "Transform." transform });
el!("SVG `<circle>` — circle shape.", circle, { "Center X." cx, "Center Y." cy, "Radius." r, "Fill." fill, "Stroke." stroke, "Stroke width." stroke_width });
el!("SVG `<rect>` — rectangle.", rect, { "X position." x, "Y position." y, "Width." width, "Height." height, "Corner radius X." rx, "Corner radius Y." ry, "Fill." fill, "Stroke." stroke });
el!("SVG `<line>` — straight line.", line, { "Start X." x1, "Start Y." y1, "End X." x2, "End Y." y2, "Stroke." stroke, "Stroke width." stroke_width });
el!("SVG `<polyline>` — connected segments.", polyline, { "Points." points, "Fill." fill, "Stroke." stroke });
el!("SVG `<polygon>` — closed polygon.", polygon, { "Points." points, "Fill." fill, "Stroke." stroke });
el!("SVG `<ellipse>` — ellipse shape.", ellipse, { "Center X." cx, "Center Y." cy, "Radius X." rx, "Radius Y." ry, "Fill." fill, "Stroke." stroke });
el!("SVG `<text>` — text rendering.", text, { "X position." x, "Y position." y, "Fill." fill });
el!("SVG `<g>` — group container.", g, { "Transform." transform, "Fill." fill, "Stroke." stroke });
el!("SVG `<defs>` — reusable definitions.", defs);
el!("SVG `<use>` — reuse referenced element.", r#use, { "Reference URL." href, "X position." x, "Y position." y, "Width." width, "Height." height });
el!("SVG `<clipPath>` — clipping region.", clipPath);
el!("SVG `<mask>` — alpha mask.", mask);
el!("SVG `<pattern>` — fill pattern.", pattern);
el!("SVG `<linearGradient>` — linear gradient.", linearGradient, { "Start X." x1, "Start Y." y1, "End X." x2, "End Y." y2 });
el!("SVG `<radialGradient>` — radial gradient.", radialGradient, { "Center X." cx, "Center Y." cy, "Radius." r, "Focus X." fx, "Focus Y." fy });
el!("SVG `<stop>` — gradient color stop.", stop);
el!("SVG `<filter>` — filter effect.", filter);
el!("SVG `<image>` — embedded image in SVG.", image, { "Image URL." href, "X position." x, "Y position." y, "Width." width, "Height." height });
el!("SVG `<symbol>` — reusable graphic template.", symbol, { "SVG viewport." viewBox });
el!("SVG `<animate>` — attribute animation.", animate);
el!(
    "SVG `<animateTransform>` — transform animation.",
    animateTransform
);
el!("SVG `<foreignObject>` — foreign XML (HTML) in SVG.", foreignObject, { "X position." x, "Y position." y, "Width." width, "Height." height });
el!("SVG `<tspan>` — text subspan.", tspan, { "X position." x, "Y position." y });