theme_compile.ts

The compile step for a theme: everything derived from it - the stance mirror and the recomputed chroma caps - with the gates and the lint run over that rendering, in one call. The build-time bake (bake_theme) compiles over the configured variable set the same way.

Apart from theme_check.ts so the gates and the caps stay importable without the lint (validate_theme) and the schemas it parses with.

view source

Declarations
#

3 declarations

compile_theme
#

theme_compile.ts view source

(theme: { name: string; variables: { name: string; dark?: string | undefined; base?: string | undefined; summary?: string | undefined; }[]; summary?: string | undefined; scheme?: "light" | "dark" | "dual" | undefined; }, options?: CompileThemeOptions): CompiledTheme import {compile_theme} from '@fuzdev/fuz_css/theme_compile.js';

Compiles a theme: computes its stance mirror and its recomputed chroma caps (compute_theme_caps), re-checks the gates with the caps, and lints it. The theme comes back as the same reference and never carries the derived data, so compiling the same theme again gives the same result.

theme

the theme to compile

type Theme

options?

the variable set the theme overlays, when it isn't the defaults

optional default {}

returns

CompiledTheme

the theme with its mirror, caps, gate report, and lint

CompiledTheme
#

theme_compile.ts view source

CompiledTheme import type {CompiledTheme} from '@fuzdev/fuz_css/theme_compile.js';

The output of compile_theme: the input theme with everything derived from it - the stance mirror and the recomputed caps - plus the gate report and lint over that rendering. Renders as render_theme_style(c.theme, c).

inheritance

extends: ResolvedTheme

theme

The input theme, the same reference - compiling never edits it.

type Theme

scheme_mirror

The stance mirror for a single-scheme theme, undefined for a dual one.

type StyleVariable[] | undefined

caps

The _palette_chroma_NN caps recomputed where the baked ones no longer fit the theme's hues and lightness (compute_theme_caps) - empty when they all still fit.

type StyleVariable[]

report

The gates over the theme with its caps, from check_theme.

type ThemeCheckReport

issues

The theme's lint, from validate_theme.

type ThemeIssue[]

CompileThemeOptions
#

theme_compile.ts view source

CompileThemeOptions import type {CompileThemeOptions} from '@fuzdev/fuz_css/theme_compile.js';

Options for compile_theme.

variables?

The variable set the theme overlays, when it isn't the defaults - a build's configured variables. The stance mirror re-slots this set rather than the defaults, and each knob-tier value (theme_knobs) it changes from the default is folded in beneath the theme's own (re-slotted for a stance as the mirror re-slots it), so the caps and the gates measure what renders. A folded value the gates can't read lands in unchecked. The theme comes back unfolded. A partial set mirrors only what it contains, and the gates still measure the default for anything it leaves out.

type StyleVariable[]

Depends on
#

Imported by
#