/** * `@token` CSS block parser and compiler. * * Parses custom `@token name { prop: value; ... }` blocks from CSS * source and compiles them into CSS custom properties plus * `@property` registrations using resolved `TokenDef` definitions. * * @module */ import type { Token } from '@czap/core'; /** * Parsed `@token` block: the token to emit and any inline overrides. */ export interface TokenBlock { /** Named token (resolved against exported `TokenDef` values). */ readonly tokenName: string; /** Inline overrides (`{ cssProp: value }`). */ readonly declarations: Record; /** Absolute source file path. */ readonly sourceFile: string; /** 1-based line where the block begins. */ readonly line: number; } /** * Parse every `@token` 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 * @token name { * property: 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. */ export declare function parseTokenBlocks(css: string, sourceFile: string): readonly TokenBlock[]; /** * Compile a parsed {@link TokenBlock} plus a resolved `TokenDef` into * CSS custom property declarations. Delegates to the canonical * `TokenCSSCompiler` to avoid duplicating token-to-CSS logic. */ export declare function compileTokenBlock(block: TokenBlock, token: Token.Shape): string; //# sourceMappingURL=token-transform.d.ts.map