/** * Theme persistence utilities for FOUC prevention. * * Provides testable implementations of the critical-path logic * used in the blocking inline script (BaseLayout.astro lines 85-118) * and the theme-switching UI script (lines 140-230). */ export { DEFAULT_THEME } from './constants.js'; /** * Resolves the initial theme for FOUC prevention. * * Performs legacy storage migration, reads the stored theme, and validates * it against the provided list of valid theme IDs. Returns the default * theme if the stored value is missing or invalid. * * Mirrors the blocking inline script logic in BaseLayout.astro. */ export declare function resolveInitialTheme(windowObj: Window, validThemes: string[]): string; /** * Sanitizes a base URL to prevent XSS via protocol injection. * Strips leading whitespace and control characters, then rejects * protocol-relative and absolute URLs. Only allows relative paths. */ export declare function sanitizeBaseUrl(raw: string): string; /** * Builds the full CSS href path for a theme. */ export declare function buildThemeCssHref(baseUrl: string, themeId: string): string; /** * Determines if the theme CSS link element needs updating. * * The default theme CSS is pre-loaded in the HTML, so we skip the * update to avoid an unnecessary network request and style flash. */ export declare function needsCssUpdate(themeId: string, defaultTheme?: string): boolean; /** Default fallback icon filename used when no theme-specific icon is found. */ export declare const FALLBACK_ICON_FILE = "catppuccin-logo-macchiato.png"; /** * Builds the theme icon image src path. */ export declare function buildThemeIconSrc(baseUrl: string, themeIcons: Record, themeId: string, fallbackIcon?: string): string; /** * Applies the initial theme to prevent FOUC (Flash of Unstyled Content). * * This is the testable equivalent of the blocking inline script in * BaseLayout.astro. It: * 1. Migrates legacy storage keys * 2. Reads and validates the stored theme * 3. Sets the `data-theme` and `data-appearance` attributes on `` * 4. Sets `window.__INITIAL_THEME__` for downstream scripts * 5. Updates the CSS link href if the theme differs from the default */ export declare function applyInitialTheme(doc: Document, windowObj: Window, validThemes: string[]): string; /** * Updates active theme state on theme option elements. * * Toggles the `active` class on each element based on whether its * `data-theme-id` or `data-theme` attribute matches the given active theme ID. */ export declare function updateActiveTheme(options: ArrayLike, activeTheme: string): void; //# sourceMappingURL=persistence.d.ts.map