/** * The **Photon Theme Engine** — the facade that composes every theme service and * implements the public {@link PhotonThemeApi} exposed as `gridApi.photonAI`. It * owns the current theme, history, and live-preview wiring; each capability is * delegated to a focused single-responsibility service. * * LLM-backed methods (generate/modify/optimize/explain) require a configured * provider and reject with a {@link PhotonThemeError} otherwise; preview, apply, * export, import, history and registry access all work fully offline. * * @packageDocumentation */ import type { EventBus } from '../../event-bus/event-bus'; import type { ThemeManager } from '../../theme/theme-manager'; import type { PhotonAIProvider } from '../provider/ai-provider.types'; import type { GeneratedTheme, PhotonThemeApi, ThemeExplanation, ThemeExportFormat, ThemeGenerateParams, ThemeGenerationResult, ThemeHistoryEntry, ThemeModifyParams, ThemeOptimizeOptions, ThemeVariableRegistryReader } from '../../types/theme-ai.types'; import { ThemeVariableRegistry } from './theme-variable-registry'; export { PhotonThemeError } from './theme-llm-client'; /** Composition root + public facade for the AI Theme Engine. */ export declare class PhotonThemeEngine implements PhotonThemeApi { private readonly eventBus; private readonly registry; private readonly client; private readonly generator; private readonly modifier; private readonly optimizer; private readonly explainer; private readonly history; private readonly exporter; private readonly importer; private readonly preview; private currentTheme; constructor(provider: PhotonAIProvider | null, themeManager: ThemeManager, containerEl: HTMLElement, eventBus: EventBus, registry?: ThemeVariableRegistry); generateTheme(params: ThemeGenerateParams): Promise; modifyTheme(params: ThemeModifyParams): Promise; optimizeTheme(options: ThemeOptimizeOptions): Promise; explainTheme(theme?: GeneratedTheme, signal?: AbortSignal): Promise; previewTheme(theme: GeneratedTheme): void; applyTheme(theme: GeneratedTheme): void; clearPreview(): void; exportTheme(format?: ThemeExportFormat, theme?: GeneratedTheme): string; importTheme(source: string | GeneratedTheme): GeneratedTheme; undo(): GeneratedTheme | null; redo(): GeneratedTheme | null; reset(): void; restore(index: number): GeneratedTheme | null; getHistory(): readonly ThemeHistoryEntry[]; getRegistry(): ThemeVariableRegistryReader; getCurrentTheme(): GeneratedTheme | null; hasProvider(): boolean; /** * Routes a Photon AI panel message to the theme engine when it is a theming * request, generating or modifying the theme and applying it live. Returns * `{ handled: false }` for non-theme messages so the caller falls back to the * grid-command AI. Classification is a lightweight lexical gate — the actual * theme design is fully LLM-driven, never keyword-derived. */ handlePanelCommand(text: string, signal?: AbortSignal): Promise<{ handled: boolean; message: string; }>; /** Runs a generation, optionally applies it, and reports errors as an event. */ private runGeneration; /** Applies a history navigation result (theme or `null` = base) to the grid. */ private applyHistoryState; } //# sourceMappingURL=photon-theme-engine.d.ts.map