style_hooks.ts

The style hook catalog: the custom properties the base styles and the class definitions read without declaring them in default_variables.

A hook is the stable contextual surface - set on an element (a literal class like --flow_margin:0, a component's <style> block) to retune what the rules reading it render there, the way the sized_* composites set --flow_margin and --font_size for their subtree. Hooks have no :root default: a read either carries a var() fallback, which renders when nothing sets the hook, or sits in a rule that declares the hook itself (local), whose own value a consumer overrides on the same element.

Hooks are contextual, not theme variables. A theme's values render on its root, where a local hook never reaches the element that reads it, and an inherited hook retunes every reader at once - which the knobs do with the gates watching - so validate_theme warns on a theme that sets one. The one theme-level hook, heading_font_weight, is a knob in knobs.ts.

view source

Declarations
#

3 declarations

style_hook_by_name
#

style_hooks.ts view source

ReadonlyMap<string, StyleHook>

type ReadonlyMap<string, StyleHook>

import {style_hook_by_name} from '@fuzdev/fuz_css/style_hooks.js';

The catalog indexed by variable name.

style_hooks
#

StyleHook
#

style_hooks.ts view source

StyleHook import type {StyleHook} from '@fuzdev/fuz_css/style_hooks.js';

name

type string

read_by

The base styles and classes whose rules read the hook. A rule that only sets it, like .plain clearing a button's fill, isn't a reader.

type readonly string[]

fallbacks

The distinct var() fallbacks the hook's reads carry - what renders where nothing sets it. Empty for a local hook.

type readonly string[]

local?

True when the rules reading the hook declare it themselves, so a value reaches the reader only from a rule on the same element - an inherited value from an ancestor or a theme's root never does.

type boolean

summary

What setting the hook does, for docs and tooling.

type string

Depends on
#

Imported by
#