/** * JSON-first theme pack — one config object themes UI, dashboard, and diagram. * * @example Scene JSON * ```json * { * "theme": { * "preset": "dark", * "primary": "#0ea5e9", * "series": ["#0ea5e9", "#f43f5e", "#22c55e", "#f59e0b"], * "dashboard": { "chartGrid": "#1e293b" } * }, * "type": "group", * "children": [ ... ] * } * ``` */ import type { UiThemeInput, UiThemeTokens } from '../components/uiTheme'; import type { DashboardTheme } from '../dashboard/theme'; /** Flat diagram overrides commonly set from JSON (top-level DIAGRAM keys). */ export interface DiagramThemePack { canvasBg?: string; surface?: string; surfaceElevated?: string; nodeFill?: string; nodeStroke?: string; nodeText?: string; nodeTextMuted?: string; edge?: string; edgeMuted?: string; [key: string]: unknown; } /** * Full theme pack — preset + brand tokens + optional module packs. * Flat brand keys (`primary`, `surface`, …) match `UiThemeInput` for drop-in use. */ export interface ThemePack extends UiThemeInput { /** * Chart series palette (2–8 colors). Applied to dashboard `series` * (and series[0] still tracks `primary` when omitted). */ series?: string[]; /** Dashboard token overrides after UI→dashboard remap. */ dashboard?: Partial; /** Diagram top-level color overrides after UI→diagram remap. */ diagram?: DiagramThemePack; /** * Default automotive HMI preset for widgets that omit `props.theme`. * Does not retint existing clusters — use `updateAutoWidgetProps`. */ automotive?: 'classic' | 'sport' | 'digital'; /** * Optional stage background override (solid color). Prefer putting image paths * in `preset` instead — e.g. `{ preset: './bg.png' }`. */ background?: string; } /** Split a theme pack into UI input + module packs. */ export declare function splitThemePack(pack: ThemePack | UiThemeInput | Record): { ui: UiThemeInput; series?: string[]; dashboard?: Partial; diagram?: DiagramThemePack; automotive?: 'classic' | 'sport' | 'digital'; background?: string; }; /** Shallow-merge theme packs (module objects merge; series replaces when provided). */ export declare function mergeThemePacks(base: ThemePack, patch: ThemePack): ThemePack; /** Normalize unknown JSON into a ThemePack (accepts nested `tokens` object). */ export declare function normalizeThemePack(raw: unknown): ThemePack; /** * Extract `theme` from scene JSON and return the scene without it. * Supports root `{ theme, type, children }` or `{ theme, children }`. */ export declare function extractSceneTheme(data: Record): { theme: ThemePack | null; scene: Record; }; /** Build stored pack from split parts (for getTheme / export). */ export declare function composeThemePack(ui: UiThemeInput, modules?: { series?: string[]; dashboard?: Partial; diagram?: DiagramThemePack; automotive?: 'classic' | 'sport' | 'digital'; background?: string; }): ThemePack; /** True when pack has any user intent (not empty). */ export declare function isThemePackEmpty(pack: ThemePack): boolean; export type { UiThemeTokens };