refract v0.1 · beta
Grammar reference / Recipes

Recipes

A subsystem's recipes block bundles declarations that reference tokens (recipes never define tokens). Two levels: group → item, each item → one class. Its axes mirror a property, one level up.

a recipe group
recipes: {
  "[group name]": {                             // group
    "[item name]": {                            // item → one class
      "[recipe prop]": "[variant name]",          // REF-FIRST props (name a variant)
      states:     [ { state: "[state name]", target: "[recipe variant]", /* prop deltas */ } ],
      responsive: [ { breakpoint: "[breakpoint name]", state: "[state name]", /* prop deltas */ } ],
      variants:   { "[recipe variant]": { /* prop deltas */ } },  // → sibling recipe [item]-[recipe variant]
    },
  },
}
  • states / responsive are lists of override entries ({ state, target?, … } / routing) — same spine as property modes. See States.
  • variants desugars each modifier into a flat sibling [item]-[variant] (a new class), so a state/responsive target scopes onto it. See Recipe variants.
  • components compose. A component item references OTHER subsystems' recipes and adds its own css delta — see Components.
components — composition
components: { recipes: { "[group name]": {
  "[item name]": {
    "[subsystem]": "[group.item]",             // reference another subsystem's recipe (REF-FIRST)
    css: { "[css prop]": "value", "[css prop]": { ref: "[token path]" } }, // LITERAL-FIRST; ref for tokens
  },
} } }
Technical documentation for @theme-registry/refract · all output is compiled client-side by the real library (CSS adapter). The chrome is theme-aware; the render panes carry each preset's own world. · MIT licensed.