/** * SSR Theme Provider - Framework-agnostic SSR-optimized theme provider. * * Uses {@link CookieStorageAdapter} for cookie-based persistence so the * server can read theme preferences on the first request. * Works with any React SSR framework (Next.js, TanStack Start, Remix, etc.). * * @module ssr/ssr-provider */ import { type ReactNode } from 'react'; import { ThemeManager, type ThemeConfig } from '@mks2508/shadcn-basecoat-theme-manager'; /** Value exposed by {@link SSRThemeProvider} via React context. */ export interface ISSRThemeContextValue { /** The underlying ThemeManager instance (null until initialized). */ themeManager: ThemeManager | null; /** Current theme id (e.g. `'synthwave84'`). */ currentTheme: string; /** Current mode preference. */ currentMode: 'light' | 'dark' | 'auto'; /** All registered themes. */ themes: ThemeConfig[]; /** `true` once ThemeCore has finished initializing. */ initialized: boolean; /** `true` while initialization is in progress. */ loading: boolean; /** Error message if initialization failed, otherwise `null`. */ error: string | null; /** Switch to a different theme and/or mode. */ setTheme: (theme: string, mode?: 'light' | 'dark' | 'auto') => Promise; /** Cycle to the next theme in the registry. */ toggleTheme: () => void; /** Cycle through light → dark → auto. */ toggleMode: () => void; } /** Props for {@link SSRThemeProvider}. */ export interface ISSRThemeProviderProps { children: ReactNode; /** Fallback theme id when nothing is persisted. @default 'default' */ defaultTheme?: string; /** Fallback mode when nothing is persisted. @default 'auto' */ defaultMode?: 'light' | 'dark' | 'auto'; /** URL to the theme registry JSON. @default '/themes/registry.json' */ registryUrl?: string; } /** * SSR-optimized theme provider with cookie persistence. * * Wraps your app and provides theme state + methods via context. * Uses a mount guard to prevent hydration mismatches. * * @example * ```tsx * // TanStack Start __root.tsx or Next.js layout.tsx * * {children} * * ``` */ export declare function SSRThemeProvider({ children, defaultTheme, defaultMode, registryUrl, }: ISSRThemeProviderProps): import("react/jsx-runtime").JSX.Element; /** * Access the SSR theme context. * * @throws If called outside an {@link SSRThemeProvider}. * @returns The current theme state and methods. */ export declare function useSSRTheme(): ISSRThemeContextValue;