{"version":3,"file":"ThemeProvider.context.cjs","sources":["../../../src/components/theme-provider/ThemeProvider.context.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\r\nimport type { ThemeValue } from '@components/theme-provider/types/ThemeProvider.props.ts'\r\n\r\nexport interface ThemeContextValue {\r\n    /** Currently active theme name. `'system'` follows the OS preference. */\r\n    theme: ThemeValue\r\n\r\n    /**\r\n     * The concrete resolved theme name, never `'system'`. Useful for\r\n     * conditional rendering that depends on the actual visual state.\r\n     */\r\n    resolvedTheme: string\r\n\r\n    /**\r\n     * Change the active theme.\r\n     * - In **uncontrolled** mode this updates internal state.\r\n     * - In **controlled** mode (`theme` prop is provided) it only fires\r\n     *   `onThemeChange`; the parent is responsible for updating `theme`.\r\n     */\r\n    setTheme: (theme: ThemeValue) => void\r\n}\r\n\r\n/**\r\n * Default context value used when `useTheme` is called outside a\r\n * `ThemeProvider`.  Falls back to `'system'` / `'light'` so the hook is\r\n * always safe to call.\r\n */\r\nconst defaultContext: ThemeContextValue = {\r\n    theme: 'system',\r\n    resolvedTheme: 'light',\r\n    setTheme: () => undefined,\r\n}\r\n\r\nexport const ThemeContext = createContext<ThemeContextValue>(defaultContext)\r\n\r\n/**\r\n * Returns the nearest `ThemeProvider` context.\r\n *\r\n * Safe to call outside a provider — returns `{ theme: 'system', resolvedTheme:\r\n * 'light', setTheme: noop }` as a fallback.\r\n *\r\n * @example\r\n * const { resolvedTheme, setTheme } = useTheme()\r\n */\r\nexport const useTheme = (): ThemeContextValue => useContext(ThemeContext)\r\n"],"names":["defaultContext","ThemeContext","createContext","useTheme","useContext"],"mappings":"yGA2BMA,EAAoC,CACtC,MAAO,SACP,cAAe,QACf,SAAU,IAAA,EACd,EAEaC,EAAeC,EAAAA,cAAiCF,CAAc,EAW9DG,EAAW,IAAyBC,EAAAA,WAAWH,CAAY"}