theme_validate.ts

validate_theme, the structural lint for themes: the Theme schema, known variable names, and advisory type/range warnings for the knob-tier variables, plus the accent-separation and binding-pairing lints, all read through the resolution core in theme_resolver.ts.

view source

Declarations
#

4 declarations

ACCENT_STATUS_HUE_SEPARATION
#

theme_validate.ts view source

20 import {ACCENT_STATUS_HUE_SEPARATION} from '@fuzdev/fuz_css/theme_validate.js';

How far in degrees the accent hue has to sit from each status hue before validate_theme stops warning. At the chroma links and labels render at, 12 degrees reads as one color with a shift (a red accent beside the default orange caution) while 30 reads as two (a pink accent beside the default red negative), so the threshold sits between them. The defaults' closest accent and status pair, blue and cyan, is 40 degrees apart.

known_theme_variable_names
#

theme_validate.ts view source

ReadonlySet<string>

type ReadonlySet<string>

import {known_theme_variable_names} from '@fuzdev/fuz_css/theme_validate.js';

The variable names a theme may set: the declared defaults plus the hook knobs style.css consumes through var() fallbacks. The authoring-side companion to validate_theme, for tooling that completes or checks names before a theme is assembled.

ThemeIssue
#

theme_validate.ts view source

ThemeIssue import type {ThemeIssue} from '@fuzdev/fuz_css/theme_validate.js';

A structural lint finding. error marks a broken theme (bad shape, unknown variable); warning is advisory (value doesn't match the knob's kind, sits outside its safe range, or is a dark slot on a single-scheme-stanced theme).

level

type "error" | "warning"

message

type string

variable?

type string

validate_theme
#

theme_validate.ts view source

(theme: unknown): ThemeIssue[] import {validate_theme} from '@fuzdev/fuz_css/theme_validate.js';

Lints a theme's structure: the Theme schema (errors), a known name per variable (errors), and advisory type/range warnings for the knob-tier variables - including a pairing warning when an intent hue binds a palette letter whose chroma multiplier differs from the intent's own *_chroma_scale twin (a binding shares only the hue angle, so the slot's chroma character is otherwise silently dropped), and a separation warning when the accent hue lands within ACCENT_STATUS_HUE_SEPARATION of a status hue. Value validation is advisory and never an error. An empty array means the theme is structurally valid.

A shape failure returns on its own: the knob lint reads values the schema hasn't vouched for, so it runs only over a theme that parsed. Takes unknown so untrusted input (a theme restored from storage, a pasted object) needs no cast to be checked.

theme

type unknown

returns

ThemeIssue[]

Depends on
#

Imported by
#