refract v0.1 · beta
Grammar reference / Values

Values — the generic leaf

A value is the atom every field holds. Four leaf forms; each subsystem restricts which it accepts (colours take hex/tuple/CSS-colour, scalars take numbers, …). external is a whole-property passthrough, not a leaf.

value forms
"value"                          // string — a literal value / keyword
0                                // number — a unitless literal; the subsystem gives it meaning
[ 0, 0, 0 ]                        // tuple — fixed-length list (today only the [r,g,b] colour tuple)
{ "[leaf field]": "value" }          // object leaf — flat field map (shadow/transition); an array of these = multi-part

{ external: "[token path]" }          // external — a whole-property passthrough (see below)

References

In composition fields (recipe props) a bare string names a token, ref-first. In a css block it is literal-first — a bare string is raw CSS; mark a token with ref("[path]") or { ref: "[path]" }. See Token paths & naming.

External tokens

An external value aliases a variable a parent theme owns — { external: "[token path]" } lowers to var(--[prefix]-[token-path]) (path form, via extends.prefix), or { external: "--[some var]" } for a literal var (leading --). It replaces the whole property, is referenceable everywhere (including recipes), is never defined locally, and survives override(). See White-labeling.

A var(--…) is not a valid colour leaf — it can't be tonally derived at build. Borrow it as an external token instead.
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.