export type ThemeBase = 'light' | 'dark'; export type ThemePreference = ThemeBase | 'system'; export type AccessibilityPreference = 'default' | 'accessible' | 'system'; export type ResolvedTheme = 'light' | 'dark' | 'light-accessible' | 'dark-accessible'; export interface UseThemeReturn { /** User's stored base-theme preference, or `'system'` when no override is set. */ theme: ThemePreference; /** User's stored AAA-contrast preference, or `'system'` when no override is set. */ accessibility: AccessibilityPreference; /** The theme actually applied to the DOM once the preferences + OS signals are resolved. */ resolvedTheme: ResolvedTheme; /** Persist a new base-theme preference. Pass `'system'` to clear the override. */ setTheme: (next: ThemePreference) => void; /** Persist a new AAA-contrast preference. Pass `'system'` to clear the override. */ setAccessibility: (next: AccessibilityPreference) => void; } export declare const THEME_STORAGE_KEY = "alfadocs-ui.theme"; export declare const ACCESSIBILITY_STORAGE_KEY = "alfadocs-ui.accessibility"; export declare const THEME_CLASS: { readonly light: "theme-light"; readonly dark: "theme-dark"; readonly accessible: "theme-accessible"; }; /** Marks resolved boot classes so they are not mistaken for host overrides. */ export declare const THEME_BOOT_ATTRIBUTE = "data-alfadocs-theme-boot"; interface ThemeSnapshot { theme: ThemePreference; accessibility: AccessibilityPreference; prefersDark: boolean; prefersMoreContrast: boolean; } export declare function resolveTheme(state: ThemeSnapshot): ResolvedTheme; export declare function themeClassList(resolved: ResolvedTheme): string[]; /** * Inline in before stylesheets to apply preferences before first paint. * ES5, with no imports or runtime dependencies. Existing theme classes belong * to the host and are left untouched. The build writes this same string to * `@alfadocs/ui-kit/theme-boot.js` for hosts that do not import JavaScript. */ export declare const THEME_BOOT_SCRIPT: string; /** * Read and update the DS theme preference. * * - `theme` / `accessibility` are the stored user preferences, with * `'system'` meaning "no override — follow OS". * - `resolvedTheme` composes preferences + live `matchMedia` state into * one of the four concrete themes. * - `setTheme` / `setAccessibility` persist the override to * `localStorage` and re-apply classes to `document.documentElement` * synchronously. Pass `'system'` to clear. * * Singleton under the hood — every hook call shares one `matchMedia` * subscription, so mounting the hook many times does not multiply the * listener count. The hook also listens for cross-tab `storage` events * so a theme change in tab A is reflected in tab B without a reload. */ export declare function useTheme(): UseThemeReturn; export declare function __resetThemeStoreForTests(): void; export {}; //# sourceMappingURL=use-theme.d.ts.map