Malachi. UI. TokenGen
(malachi v0.22.7)
View Source
One token file, four generated outputs, and the gates that prove the three interfaces share it.
docs/design/design-tokens.json is the single source of every color, type, spacing, density,
motion and easing value the web console, the terminal interface and any server rendered page use
(operator-interfaces.md section 4). From it this generates:
| Output | For |
|---|---|
assets/src/styles/tokens.css | The web console (#231) |
tui/src/theme/generated.rs | The terminal interface (#233) |
lib/malachi/ui/tokens.ex | Malachi.UI.Tokens, any server rendered page |
docs/design/tokens.snapshot.json | The cross language contract tests |
The pipeline is Malachi.UI.TokenGen.Source (parse and validate the file), then
Malachi.UI.TokenGen.Model (compute every value once), then Malachi.UI.TokenGen.Gates (gamut,
contrast, color vision, colors kept apart, terminal distinctness), then Malachi.UI.TokenGen.Emit. Nothing is
written unless every step passes. check/1 is what CI runs, through mix malachi.tokens --check.
Summary
Functions
Every reason the repository under root does not match its token file: an output that is missing
or differs from what the token file generates, a committed output that breaks the cross language
contract, and a raw color literal in an interface source. An empty list means the gate passes.
Generates every output from the text of a token file, or returns every error that prevents it.
The raw color literal hits under root.
The generated files, relative to the repository root, in the order they are written.
The token file, relative to the repository root.
Functions
Every reason the repository under root does not match its token file: an output that is missing
or differs from what the token file generates, a committed output that breaks the cross language
contract, and a raw color literal in an interface source. An empty list means the gate passes.
Generates every output from the text of a token file, or returns every error that prevents it.
@spec lint(Path.t()) :: [Malachi.UI.TokenGen.Lint.hit()]
The raw color literal hits under root.
@spec outputs() :: [String.t()]
The generated files, relative to the repository root, in the order they are written.
@spec source() :: String.t()
The token file, relative to the repository root.