Skip to main content

Crate maud_extensions

Crate maud_extensions 

Source
Expand description

Proc macros for Maud views with component-scoped helpers and runtime assets.

Supported workflows:

  • js!, css!, and component! for file-scoped components
  • inline_js!, inline_css!, js_file!, and css_file! for direct asset injection
  • surreal_scope_inline!() for the bundled surreal.js and css-scope-inline.js
  • signals_inline!() and surreal_scope_signals_inline!() for bundled Signals helpers
  • font_face! and font_faces! for embedding font files as data URLs

Support policy:

  • MSRV: Rust 1.85
  • Supported Maud version: 0.27

Important limits:

  • component! accepts exactly one top-level Maud element with a body block. It doesn’t accept control-flow roots or every possible Maud token pattern.
  • inline_js! parses the emitted JavaScript with SWC before generating markup.
  • inline_css! performs a lightweight syntax check before forwarding the stylesheet as written.
  • Signals support stays JS-first: markup provides anchors, while js! owns signals and DOM binding.
  • Slot helpers live in the companion maud-extensions-runtime crate.

Macros§

component
Wraps a single top-level Maud element and injects the local js! and css! helpers inside that root element.
css
Generates a local CSS helper for Maud markup.
css_file
Emits a <style> tag from a file path accepted by include_str!.
font_face
Embeds a font file as a single @font-face block.
font_faces
Embeds multiple font files as adjacent @font-face blocks.
inline_css
Emits a <style> tag directly from a CSS string literal or token block.
inline_js
Emits a <script> tag directly from a JavaScript string literal or token block.
js
Generates a local fn js() -> maud::Markup helper for component!.
js_file
Emits a <script> tag from a file path accepted by include_str!.
signals_inline
Emits the bundled Signals core runtime plus the Maud adapter helpers.
surreal_scope_inline
Emits the bundled surreal.js and css-scope-inline.js runtime helpers.
surreal_scope_signals_inline
Emits the bundled surreal.js, css-scope-inline.js, Signals core, and Maud Signals adapter.

Derive Macros§

ComponentBuilder
Derives a typed builder for a named component struct.