/** * ThemeDef -- theme primitive for constraint-based adaptive rendering. * * A theme maps a set of token names to variant-keyed values, enabling * coherent multi-variant token resolution. Content-addressed via FNV-1a. * * @module */ import type { ContentAddress } from './brands.js'; interface ThemeDef { readonly _tag: 'ThemeDef'; readonly _version: 1; readonly id: ContentAddress; readonly name: string; readonly variants: V; readonly tokens: Record>; readonly meta?: Record; } interface ThemeFactory { make(config: { readonly name: string; readonly variants: V; readonly tokens: Record>; readonly meta?: ThemeDef['meta']; }): ThemeDef; } /** * Resolve all tokens for a given variant, returning a map of token name to value. * * Iterates the theme's token map and extracts each token's value for the * specified variant. * * @example * ```ts * const theme = Theme.make({ * name: 'brand', * variants: ['light', 'dark'], * tokens: { bg: { light: '#fff', dark: '#111' }, fg: { light: '#000', dark: '#eee' } }, * }); * const darkTokens = Theme.tap(theme, 'dark'); * // darkTokens === { bg: '#111', fg: '#eee' } * ``` */ declare function _tap(theme: ThemeDef, variant: V[number] & string): Record; /** * Theme namespace -- theme primitive for constraint-based adaptive rendering. * * Map token names to variant-keyed values, enabling coherent multi-variant * token resolution (e.g. light/dark themes). Content-addressed via FNV-1a. * * @example * ```ts * import { Theme } from '@czap/core'; * * const theme = Theme.make({ * name: 'brand', * variants: ['light', 'dark'], * tokens: { * bg: { light: '#fff', dark: '#111' }, * fg: { light: '#000', dark: '#eee' }, * }, * }); * const lightTokens = Theme.tap(theme, 'light'); * // lightTokens === { bg: '#fff', fg: '#000' } * ``` */ export declare const Theme: ThemeFactory & { tap: typeof _tap; }; export declare namespace Theme { /** Structural shape of a {@link Theme} definition, parameterized by its variant tuple `V`. */ type Shape = ThemeDef; } export {}; //# sourceMappingURL=theme.d.ts.map