/** * `@theme` CSS block parser and compiler. * * Parses custom `@theme name { token: value; ... }` blocks from CSS * source and compiles them into `html[data-theme]` selector blocks * plus transition declarations using resolved `ThemeDef` definitions. * * @module */ import type { Theme } from '@czap/core'; /** * Parsed `@theme` block: the theme to apply and any inline token * overrides declared on the block itself. */ export interface ThemeBlock { /** Named theme (resolved against exported `ThemeDef` values). */ readonly themeName: string; /** Inline token overrides (`{ tokenName: value }`). */ readonly declarations: Record; /** Absolute source file path. */ readonly sourceFile: string; /** 1-based line where the block begins. */ readonly line: number; } /** * Parse every `@theme` block from CSS source text. * * Grammar (the block may collapse onto a single line and may sit * mid-line, e.g. inside compiler-re-serialized CSS): * * ```css * @theme name { * tokenName: value; * } * ``` * * At-rule markers are located on a comment- and string-blanked copy of * the source (same offsets) so neither commented-out blocks nor marker * text inside string values or data URLs ever match; declarations are * parsed character-by-character from the original source, so real * string values are preserved. Token names additionally accept * underscores (e.g. `accent_color`). */ export declare function parseThemeBlocks(css: string, sourceFile: string): readonly ThemeBlock[]; /** * Compile a parsed {@link ThemeBlock} plus a resolved `ThemeDef` into * `html[data-theme]` selector blocks and transition declarations. * Delegates to the canonical `ThemeCSSCompiler` to avoid duplicating * theme-to-CSS logic. */ export declare function compileThemeBlock(block: ThemeBlock, theme: Theme.Shape): string; //# sourceMappingURL=theme-transform.d.ts.map