//#region src/themes.d.ts /** * Browser-safe theme-enumeration + naming helpers. Exported through the * `@unpunnyfuns/swatchbook-core/themes` subpath so the addon's preset * codegen, the addon's preview decorator, the MCP server's tuple lookup, * and the blocks-side display name share one implementation. Same set * of "themes a project surfaces" (default + per-axis singletons + * presets) consumers iterate over; same `tupleToName` join everyone * uses for the `data--theme` attribute. * * Pure functions over structural input types — no `Project` import, no * Terrazzo parser, no Node deps. */ /** One named theme produced by enumeration — the canonical name + the tuple it resolves to. */ interface ThemeEntry { readonly name: string; readonly tuple: Readonly>; } /** Minimal axis shape `enumerateThemes` and `tupleToName` need. */ interface ThemeEnumAxis { readonly name: string; readonly default: string; readonly contexts: readonly string[]; } /** Minimal preset shape `enumerateThemes` needs. */ interface ThemeEnumPreset { readonly name: string; readonly axes: Partial>; } /** * Synthesize the canonical theme name from a tuple — axis values joined * by ` · ` in axis declaration order. Same form the * `data--theme` attribute holds. Falls back to each axis's * `default` when the tuple omits it. * * Not interchangeable with `permutationID` (types.ts): this is the * axis-order display name that fills omitted axes from defaults, whereas * `permutationID` is the insertion-order internal wire key with no default * fallback. */ declare function tupleToName(axes: readonly { readonly name: string; readonly default: string; }[], tuple: Readonly>): string; /** * Enumerate every theme a project surfaces: * * 1. The default tuple (axes at their defaults), always first. * 2. Per-axis non-default singletons (`{...defaults, [axis]: ctx}`) * for each `(axis, non-default-context)` pair. * 3. Presets — fill omitted axes from defaults. * * Deduped by name (presets pointing at a singleton or the default tuple * collapse into the singleton entry). Order matches the loader's own * singleton enumeration: default → per-axis singletons → presets. */ declare function enumerateThemes(input: { readonly axes: readonly ThemeEnumAxis[]; readonly presets: readonly ThemeEnumPreset[]; readonly defaultTuple: Readonly>; }): ThemeEntry[]; //#endregion export { ThemeEntry, ThemeEnumAxis, ThemeEnumPreset, enumerateThemes, tupleToName }; //# sourceMappingURL=themes.d.mts.map