UNPKG

mithril-materialized

Version:
73 lines (72 loc) 2.02 kB
import { FactoryComponent } from 'mithril'; export type Theme = 'light' | 'dark' | 'auto'; export interface ThemeSwitcherI18n { /** Label for the theme switcher */ theme?: string; /** Light theme label */ light?: string; /** Dark theme label */ dark?: string; /** Auto theme label */ auto?: string; /** Light theme title/tooltip */ lightTitle?: string; /** Dark theme title/tooltip */ darkTitle?: string; /** Auto theme title/tooltip */ autoTitle?: string; /** Toggle button title when switching to dark */ switchToDark?: string; /** Toggle button title when switching to light */ switchToLight?: string; } export interface ThemeSwitcherAttrs { /** Current theme selection */ theme?: Theme; /** Callback when theme changes */ onThemeChange?: (theme: Theme) => void; /** Show labels on the toggle buttons */ showLabels?: boolean; /** Custom class for the container */ className?: string; /** Internationalization */ i18n?: ThemeSwitcherI18n; } /** * Theme switching utilities and component */ export declare class ThemeManager { private static currentTheme; /** * Set the theme for the entire application */ static setTheme(theme: Theme): void; /** * Get the current theme */ static getTheme(): Theme; /** * Get the effective theme (resolves 'auto' to actual theme) */ static getEffectiveTheme(): 'light' | 'dark'; /** * Initialize theme from localStorage or system preference */ static initialize(): void; /** * Toggle between light and dark themes */ static toggle(): void; } /** * Theme Switcher Component * Provides UI controls for changing themes */ export declare const ThemeSwitcher: FactoryComponent<ThemeSwitcherAttrs>; /** * Simple theme toggle button (just switches between light/dark) */ export declare const ThemeToggle: FactoryComponent<{ className?: string; i18n?: ThemeSwitcherI18n; }>;