Expand description
The macro expander: applies catalog/macros.json (plus extension macros)
to a normalized tree until every node is native. Mirrors src/macros.ts;
fixtures/catalog-macros.json locks the output.
Round 1 (docs/round-1-contract.md §1–2): a $if/$any that cannot be
decided at expansion time (a bound input) emits the part WITH visible =
the bound condition; "$slot:name" children splice an author slot in
place and a template slots entry may be a template node; a RESPONSIVE
prop ({base, sm?, md?…}) is expanded per breakpoint into @media (min-width: $breakpoint.<bp>) blocks on every part whose style it
changes; a $set on a part whose macro prop is BOUND adds the set
write-back to that part’s action (two-way binding without a host round
trip); a part’s $a11y becomes the node’s accessibility (role, states,
name: §6).
Statics§
- BREAKPOINTS
- The breakpoint names in ascending order (
tokens.jsonbreakpoint).
Functions§
- expand_
macros - The normalized tree with every macro (core + extensions) expanded into
natives, recipes attached. Pure: the input is not mutated.
Errwhen an expansion nests deeper than 16 macros. Expansion problems are dropped; seeexpand_macros_with_issues. - expand_
macros_ with_ issues expand_macrosplus the expansion problems (an author function that replaces a$setwrite-back), deduplicated per node: the TSexpandMacros(root, {issues}).- is_
responsive_ value {base, sm?, md?, lg?, xl?}: an object withbaseand only breakpoint keys besides.- props_
at - The author’s props with every responsive object replaced by its value at
breakpoint(None= base). - responsive_
at - The value a responsive prop takes at a breakpoint: the nearest defined
key at or below it,
baseunder the first one.None= the base.