/** * Theme Script for SSR Flash Prevention * * Provides an inline script that runs before React hydrates to prevent * flash of wrong theme. Mirrors ThemeProvider's light/dark contract. * * @see docs/usage-guide.md * @see docs/adr/008-dark-mode-theme-provider.md */ export type ThemeScriptDefaultTheme = string; export interface ThemeScriptOptions { /** * localStorage key for theme preference * @default 'theme' */ storageKey?: string; /** * Default theme if no preference found * * Use 'light' or 'dark'. Other strings are accepted for legacy callers and * resolve to 'light' unless the value is exactly 'dark'. * * @default 'light' */ defaultTheme?: ThemeScriptDefaultTheme; /** * HTML attribute to set (typically 'class' or 'data-theme') * @default 'class' */ attribute?: string; /** * CSP nonce for inline script tag */ nonce?: string; } /** * Props for ThemeScript React component */ export interface ThemeScriptProps { /** * localStorage key for theme preference * @default 'theme' */ storageKey?: string; /** * Default theme if no preference found * * Use 'light' or 'dark'. Other strings are accepted for legacy callers and * resolve to 'light' unless the value is exactly 'dark'. * * @default 'light' */ defaultTheme?: ThemeScriptDefaultTheme; /** * CSP nonce for inline script tag */ nonce?: string; } /** * Generates inline script for SSR flash prevention * * Usage in Next.js App Router: * ```tsx * * ``` * * Precedence: valid localStorage value > defaultTheme */ export declare function getThemeScript(options?: ThemeScriptOptions): string; /** * ThemeScript component for SSR flash prevention * * Renders an inline script that runs before React hydrates to prevent * flash of wrong theme. Place in of your document. * * @example * ```tsx * // In Next.js layout.tsx * * * * ``` */ export declare function ThemeScript({ storageKey, defaultTheme, nonce, }?: ThemeScriptProps): React.ReactElement;