knobs.ts

The theme knob catalog: typed metadata for the style variables that themes are expected to turn, keyed by variable name.

This is a side catalog over variables.ts - StyleVariable stays the authored and rendered value form, and the catalog adds the metadata that value form can't carry: what kind of value a knob takes (which widget edits it), which axis of the theme space it moves, how much leverage it has (its control size in the editor), and which tier of the two-tier theme policy it belongs to. Defaults and base/dark slots are not duplicated here - join against default_variables by name.

The catalog deliberately covers only the knob tier, not every variable: the internal ramp intermediates, color stops, and tokens stay out, and the contextual hooks the base styles read have their own catalog in style_hooks.ts. A catalog entry may be a hook (hook: true) consumed by style.css with per-site fallbacks rather than a declared variable - it exists here so themes can set it without tripping the no-invented-variables check.

view source

Declarations
#

10 declarations

HUE_BINDING_MATCHER
#

knobs.ts view source

RegExp import {HUE_BINDING_MATCHER} from '@fuzdev/fuz_css/knobs.js';

Matches a var(--hue_X) palette-letter binding, capturing the letter - the value form bindable hue knobs default to. It accepts the whitespace the theme checks do when they follow a binding, so a value the gates read as bound to a letter reads that way here too.

KnobAxis
#

knobs.ts view source

KnobAxis

type "color" | "shape" | "density" | "depth" | "typography" | "motion" | "decoration"

import type {KnobAxis} from '@fuzdev/fuz_css/knobs.js';

The axis of the theme-space taxonomy a knob moves.

KnobKind
#

knobs.ts view source

KnobKind

type "hue" | "number" | "percent" | "length" | "time" | "color" | "font_stack" | "enum" | "shadow" | "text"

import type {KnobKind} from '@fuzdev/fuz_css/knobs.js';

The value kind of a knob, determining the editor widget and how the value validates. text is the unenriched fallback kind.

KnobLeverage
#

knobs.ts view source

KnobLeverage

type "lg" | "md" | "sm"

import type {KnobLeverage} from '@fuzdev/fuz_css/knobs.js';

Leverage tier: how much of the system a knob reshapes, which the editor renders as control size through the matching sized_* composite (lg headline knobs down to sm escape hatches).

KnobTier
#

knobs.ts view source

KnobTier

type "semantic" | "palette"

import type {KnobTier} from '@fuzdev/fuz_css/knobs.js';

The two-tier theme policy: semantic-tier knobs (intent bindings + levers) are safe for registry themes; palette-tier knobs (the letter hues) mark a theme as an exemplar.

theme_knob_axes
#

knobs.ts view source

readonly { axis: KnobAxis; title: string; }[] import {theme_knob_axes} from '@fuzdev/fuz_css/knobs.js';

The theme-space axes in editor display order, with display titles.

theme_knob_by_name
#

knobs.ts view source

ReadonlyMap<string, ThemeKnob>

type ReadonlyMap<string, ThemeKnob>

import {theme_knob_by_name} from '@fuzdev/fuz_css/knobs.js';

The catalog indexed by variable name.

theme_knob_hook_names
#

knobs.ts view source

ReadonlySet<string>

type ReadonlySet<string>

import {theme_knob_hook_names} from '@fuzdev/fuz_css/knobs.js';

Names of hook knobs - consumed by style.css via fallbacks, not declared in default_variables. Theme validation unions these with the declared variable names.

theme_knobs
#

knobs.ts view source

readonly ThemeKnob[]

type readonly ThemeKnob[]

import {theme_knobs} from '@fuzdev/fuz_css/knobs.js';

The theme knobs in editor display order: by axis, high leverage first, with the palette tier last within the color axis.

ThemeKnob
#

knobs.ts view source

ThemeKnob import type {ThemeKnob} from '@fuzdev/fuz_css/knobs.js';

name

type string

kind

type KnobKind

axis

type KnobAxis

leverage

type KnobLeverage

tier

type KnobTier

range?

The safe envelope for scalar kinds - editor sliders clamp to it, while direct numeric entry may exceed it knowingly.

type [number, number]

step?

type number

values?

Allowed values for the enum kind.

type string[]

hook?

True for knobs consumed by style.css via var() fallbacks instead of being declared in default_variables. Only for knobs whose fallbacks differ per site, so no single declared default exists - heading_font_weight, whose per-tier fallbacks flatten when set.

type boolean

bindable?

True for hue knobs whose default is a palette-letter binding (var(--hue_X)) - the intent and neutral hues. Editors render these as a letter picker with a custom-angle escape, and edits may write either a binding or a literal angle.

type boolean

Depends on
#

Imported by
#