uitheme-web 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -268,5 +268,3 @@ exports.resolveTheme = resolveTheme;
268
268
  exports.setStoredColorTheme = setStoredColorTheme;
269
269
  exports.setStoredTheme = setStoredTheme;
270
270
  exports.supportsViewTransitions = supportsViewTransitions;
271
- //# sourceMappingURL=index.cjs.map
272
- //# sourceMappingURL=index.cjs.map
@@ -244,5 +244,3 @@ var setStoredColorTheme = (colorTheme, key = COLOR_STORAGE_KEY) => {
244
244
  };
245
245
 
246
246
  export { COLOR_STORAGE_KEY, COLOR_THEME_PREFIX, DEFAULT_BLUR_AMOUNT, DEFAULT_DURATION, DEFAULT_EASING, DEFAULT_STYLE_ID, GLOBAL_CLASS_NAME, STORAGE_KEY, ThemeAnimationType, createBlurCircleAnimation, createBlurCircleMask, createCircleAnimation, createSlideAnimation, getSlideFromCoords, getStoredColorTheme, getStoredTheme, getSystemTheme, injectBaseStyles, prefersReducedMotion, resolveTheme, setStoredColorTheme, setStoredTheme, supportsViewTransitions };
247
- //# sourceMappingURL=index.js.map
248
- //# sourceMappingURL=index.js.map
@@ -1789,5 +1789,3 @@ exports.useTanStackUITheme = useTanStackUITheme;
1789
1789
  exports.useTheme = useTheme;
1790
1790
  exports.useUITheme = useUITheme;
1791
1791
  exports.useViteUITheme = useViteUITheme;
1792
- //# sourceMappingURL=index.cjs.map
1793
- //# sourceMappingURL=index.cjs.map
@@ -1728,5 +1728,3 @@ var UIThemeSelector = ({
1728
1728
  };
1729
1729
 
1730
1730
  export { COLOR_STORAGE_KEY, COLOR_THEME_PREFIX, DEFAULT_BLUR_AMOUNT, DEFAULT_DURATION, DEFAULT_EASING, DEFAULT_STYLE_ID, GLOBAL_CLASS_NAME, NextUIThemeProvider, STORAGE_KEY, TanStackStartThemeScript, TanStackUIThemeProvider, ThemeAnimationType, UISelect, UISelectContent, UISelectGroup, UISelectItem, UISelectLabel, UISelectScrollDownButton, UISelectScrollUpButton, UISelectSeparator, UISelectTrigger, UISelectValue, UIThemeProvider, UIThemeSelector, UIThemeSwitcher, ViteUIThemeProvider, getSystemTheme, injectBaseStyles, prefersReducedMotion, resolveTheme, resolveThemeForServer, supportsViewTransitions, useNextUITheme, useTanStackUITheme, useTheme, useUITheme, useViteUITheme };
1731
- //# sourceMappingURL=index.js.map
1732
- //# sourceMappingURL=index.js.map
@@ -28,5 +28,3 @@ exports.COLOR_STORAGE_KEY = COLOR_STORAGE_KEY;
28
28
  exports.STORAGE_KEY = STORAGE_KEY;
29
29
  exports.buildServerThemeData = buildServerThemeData;
30
30
  exports.resolveThemeForServer = resolveThemeForServer;
31
- //# sourceMappingURL=index.cjs.map
32
- //# sourceMappingURL=index.cjs.map
@@ -23,5 +23,3 @@ function buildServerThemeData(themeCookie, colorThemeCookie, options = {}) {
23
23
  }
24
24
 
25
25
  export { COLOR_STORAGE_KEY, STORAGE_KEY, buildServerThemeData, resolveThemeForServer };
26
- //# sourceMappingURL=index.js.map
27
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uitheme-web",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Cross-framework UI theme switching library",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -67,23 +67,10 @@
67
67
  "README.md",
68
68
  "LICENSE"
69
69
  ],
70
- "scripts": {
71
- "build": "tsup",
72
- "dev": "tsup --watch",
73
- "typecheck": "tsc --noEmit",
74
- "test": "vitest run",
75
- "test:watch": "vitest",
76
- "clean": "rm -rf dist",
77
- "prepublishOnly": "npm run build"
78
- },
79
70
  "peerDependencies": {
80
- "@angular/common": ">=18.0.0",
81
- "@angular/core": ">=18.0.0",
82
71
  "@radix-ui/react-select": ">=2.0.0",
83
72
  "react": ">=18.0.0",
84
- "react-dom": ">=18.0.0",
85
- "svelte": ">=4.0.0 || >=5.0.0",
86
- "vue": ">=3.3.0"
73
+ "react-dom": ">=18.0.0"
87
74
  },
88
75
  "peerDependenciesMeta": {
89
76
  "react": {
@@ -91,21 +78,6 @@
91
78
  },
92
79
  "react-dom": {
93
80
  "optional": true
94
- },
95
- "@radix-ui/react-select": {
96
- "optional": true
97
- },
98
- "vue": {
99
- "optional": true
100
- },
101
- "@angular/core": {
102
- "optional": true
103
- },
104
- "@angular/common": {
105
- "optional": true
106
- },
107
- "svelte": {
108
- "optional": true
109
81
  }
110
82
  },
111
83
  "devDependencies": {
@@ -118,5 +90,13 @@
118
90
  "react-dom": "^19.0.0",
119
91
  "svelte": "^5.0.0",
120
92
  "vue": "^3.5.0"
93
+ },
94
+ "scripts": {
95
+ "build": "tsup",
96
+ "dev": "tsup --watch",
97
+ "typecheck": "tsc --noEmit",
98
+ "test": "vitest run --passWithNoTests",
99
+ "test:watch": "vitest",
100
+ "clean": "rm -rf dist"
121
101
  }
122
- }
102
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/types.ts","../../src/core/constants.ts","../../src/core/animations.ts","../../src/core/storage.ts"],"names":["ThemeAnimationType","isBrowser"],"mappings":";;;AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AAHE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA;;;ACAL,IAAM,WAAA,GAAc;AACpB,IAAM,iBAAA,GAAoB;AAC1B,IAAM,iBAAA,GAAoB;AAC1B,IAAM,kBAAA,GAAqB;AAC3B,IAAM,gBAAA,GAAmB;AACzB,IAAM,cAAA,GAAiB;AACvB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,gBAAA,GAAmB;;;ACJhC,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AAKpC,IAAM,sBAAsB,MA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,GAAgC,SAAA,KACjB;AACf,EAAA,IAAI,CAACA,YAAW,OAAO,iBAAA;AAEvB,EAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,OAAA,CAAQ,GAAG,CAAA;AACtC,EAAA,OAAO,KAAA,IAAS,gBAAA,CAAiB,QAAA,CAAS,KAAK,IAAI,KAAA,GAAQ,iBAAA;AAC7D;AAOO,IAAM,mBAAA,GAAsB,CACjC,UAAA,EACA,GAAA,GAAc,iBAAA,KACL;AACT,EAAA,IAAI,CAACA,UAAAA,EAAW;AAChB,EAAA,YAAA,CAAa,OAAA,CAAQ,KAAK,UAAU,CAAA;AACtC","file":"index.cjs","sourcesContent":["export enum ThemeAnimationType {\n CIRCLE = 'circle',\n BLUR_CIRCLE = 'blur-circle',\n SLIDE = 'slide',\n}\n\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ColorTheme = string;\n\nexport type SlideDirection =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface AnimationConfig {\n a?: number;\n b?: number;\n x: number;\n y: number;\n duration: number;\n easing: string;\n animationType: ThemeAnimationType;\n blurAmount: number;\n styleId: string;\n}\n\nexport interface ThemeConfig {\n themes?: Theme[];\n colorThemes?: ColorTheme[];\n defaultTheme?: Theme;\n defaultColorTheme?: ColorTheme;\n globalClassName?: string;\n colorThemePrefix?: string;\n storageKey?: string;\n colorStorageKey?: string;\n}\n\nexport interface ThemeState {\n theme: Theme;\n colorTheme: ColorTheme;\n resolvedTheme: 'light' | 'dark';\n}\n","export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { Theme, ColorTheme } from './types';\nimport { STORAGE_KEY, COLOR_STORAGE_KEY } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Gets the stored theme from localStorage\n * @param key - Storage key for the theme\n * @param validThemes - Array of valid theme values\n * @param defaultTheme - Default theme if stored value is invalid\n * @returns The stored theme or default\n */\nexport const getStoredTheme = (\n key: string = STORAGE_KEY,\n validThemes: Theme[] = ['light', 'dark', 'system'],\n defaultTheme: Theme = 'system'\n): Theme => {\n if (!isBrowser) return defaultTheme;\n\n const saved = localStorage.getItem(key) as Theme | null;\n return saved && validThemes.includes(saved) ? saved : defaultTheme;\n};\n\n/**\n * Stores theme in localStorage\n * @param theme - Theme to store\n * @param key - Storage key for the theme\n */\nexport const setStoredTheme = (\n theme: Theme,\n key: string = STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, theme);\n};\n\n/**\n * Gets the stored color theme from localStorage\n * @param key - Storage key for the color theme\n * @param validColorThemes - Array of valid color theme values\n * @param defaultColorTheme - Default color theme if stored value is invalid\n * @returns The stored color theme or default\n */\nexport const getStoredColorTheme = (\n key: string = COLOR_STORAGE_KEY,\n validColorThemes: ColorTheme[] = ['default'],\n defaultColorTheme: ColorTheme = 'default'\n): ColorTheme => {\n if (!isBrowser) return defaultColorTheme;\n\n const saved = localStorage.getItem(key);\n return saved && validColorThemes.includes(saved) ? saved : defaultColorTheme;\n};\n\n/**\n * Stores color theme in localStorage\n * @param colorTheme - Color theme to store\n * @param key - Storage key for the color theme\n */\nexport const setStoredColorTheme = (\n colorTheme: ColorTheme,\n key: string = COLOR_STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, colorTheme);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/types.ts","../../src/core/constants.ts","../../src/core/animations.ts","../../src/core/storage.ts"],"names":["ThemeAnimationType","isBrowser"],"mappings":";AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AAHE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA;;;ACAL,I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AA,GAAQ,YAAA;AACxD;AAOO,IAAM,cAAA,GAAiB,CAC5B,KAAA,EACA,GAAA,GAAc,WAAA,KACL;AACT,EAAA,IAAI,CAACA,UAAAA,EAAW;AAChB,EAAA,YAAA,CAAa,OAAA,CAAQ,KAAK,KAAK,CAAA;AACjC;AASO,IAAM,mBAAA,GAAsB,CACjC,GAAA,GAAc,iBAAA,EACd,mBAAiC,CAAC,SAAS,CAAA,EAC3C,iBAAA,GAAgC,SAAA,KACjB;AACf,EAAA,IAAI,CAACA,YAAW,OAAO,iBAAA;AAEvB,EAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,OAAA,CAAQ,GAAG,CAAA;AACtC,EAAA,OAAO,KAAA,IAAS,gBAAA,CAAiB,QAAA,CAAS,KAAK,IAAI,KAAA,GAAQ,iBAAA;AAC7D;AAOO,IAAM,mBAAA,GAAsB,CACjC,UAAA,EACA,GAAA,GAAc,iBAAA,KACL;AACT,EAAA,IAAI,CAACA,UAAAA,EAAW;AAChB,EAAA,YAAA,CAAa,OAAA,CAAQ,KAAK,UAAU,CAAA;AACtC","file":"index.js","sourcesContent":["export enum ThemeAnimationType {\n CIRCLE = 'circle',\n BLUR_CIRCLE = 'blur-circle',\n SLIDE = 'slide',\n}\n\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ColorTheme = string;\n\nexport type SlideDirection =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface AnimationConfig {\n a?: number;\n b?: number;\n x: number;\n y: number;\n duration: number;\n easing: string;\n animationType: ThemeAnimationType;\n blurAmount: number;\n styleId: string;\n}\n\nexport interface ThemeConfig {\n themes?: Theme[];\n colorThemes?: ColorTheme[];\n defaultTheme?: Theme;\n defaultColorTheme?: ColorTheme;\n globalClassName?: string;\n colorThemePrefix?: string;\n storageKey?: string;\n colorStorageKey?: string;\n}\n\nexport interface ThemeState {\n theme: Theme;\n colorTheme: ColorTheme;\n resolvedTheme: 'light' | 'dark';\n}\n","export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { Theme, ColorTheme } from './types';\nimport { STORAGE_KEY, COLOR_STORAGE_KEY } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Gets the stored theme from localStorage\n * @param key - Storage key for the theme\n * @param validThemes - Array of valid theme values\n * @param defaultTheme - Default theme if stored value is invalid\n * @returns The stored theme or default\n */\nexport const getStoredTheme = (\n key: string = STORAGE_KEY,\n validThemes: Theme[] = ['light', 'dark', 'system'],\n defaultTheme: Theme = 'system'\n): Theme => {\n if (!isBrowser) return defaultTheme;\n\n const saved = localStorage.getItem(key) as Theme | null;\n return saved && validThemes.includes(saved) ? saved : defaultTheme;\n};\n\n/**\n * Stores theme in localStorage\n * @param theme - Theme to store\n * @param key - Storage key for the theme\n */\nexport const setStoredTheme = (\n theme: Theme,\n key: string = STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, theme);\n};\n\n/**\n * Gets the stored color theme from localStorage\n * @param key - Storage key for the color theme\n * @param validColorThemes - Array of valid color theme values\n * @param defaultColorTheme - Default color theme if stored value is invalid\n * @returns The stored color theme or default\n */\nexport const getStoredColorTheme = (\n key: string = COLOR_STORAGE_KEY,\n validColorThemes: ColorTheme[] = ['default'],\n defaultColorTheme: ColorTheme = 'default'\n): ColorTheme => {\n if (!isBrowser) return defaultColorTheme;\n\n const saved = localStorage.getItem(key);\n return saved && validColorThemes.includes(saved) ? saved : defaultColorTheme;\n};\n\n/**\n * Stores color theme in localStorage\n * @param colorTheme - Color theme to store\n * @param key - Storage key for the color theme\n */\nexport const setStoredColorTheme = (\n colorTheme: ColorTheme,\n key: string = COLOR_STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, colorTheme);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/types.ts","../../src/core/constants.ts","../../src/core/animations.ts","../../src/core/storage.ts","../../src/react/hooks/use-theme.ts","../../src/react/components/NextUIThemeProvider.tsx","../../src/react/components/TanStackUIThemeProvider.tsx","../../src/react/components/ViteUIThemeProvider.tsx","../../src/react/components/UIThemeProvider.tsx","../../src/react/components/UIThemeSwitcher.tsx","../../src/react/components/ui/UISelect.tsx","../../src/react/components/UIThemeSelector.tsx"],"names":["ThemeAnimationType","isBrowser","useState","useEffect","useRef","useCallback","flushSync","createContext","React","jsx","jsxs","useContext","useSyncExternalStore","SelectPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AAHE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA;;;ACAL,IAAM,WAAA,GAAc;AACpB,IAAM,iBAAA,GAAoB;AAC1B,IAAM,iBAAA,GAAoB;AAC1B,IAAM,kBAAA,GAAqB;AAC3B,IAAM,gBAAA,GAAmB;AACzB,IAAM,cAAA,GAAiB;AACvB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,gBAAA,GAAmB;;;ACJhC,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AAKpC,IAAM,sBAAsB,MAAe;AACzC,EAAA,IAAI,CAAC,WAAW,OAAO,KAAA;AACvB,EAAA,OAAO,MAAA,CAAO,UAAA,IAAc,GAAA,IAAQ,MAAA,CAAO,WAAA,IAAe,GAAA;AAC5D,CAAA;AAKO,IAAM,mBAAmB,MAAY;AAC1C,EAAA,IAAI,CAAC,SAAA,EAAW;AAEhB,EAAA,MAAM,OAAA,GAAU,qBAAA;AAChB,EAAA,IAAI,QAAA,CAAS,cAAA,CAAe,OAAO,CAAA,EAAG;AAEtC,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,a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AA,CAAa;AAAA,GAC9B,GACA,cAAA;AAEN,EAAA,MAAM,sBAAA,GAAyB,CAAC,aAAA,KAA0B;AACxD,IAAA,aAAA,CAAc,aAA2B,CAAA;AACzC,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,kBAAA,CAAmB,aAA2B,CAAA;AAAA,IAChD;AAAA,EACF,CAAA;AAEA,EAAA,IAAI,WAAA,CAAY,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACEA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,uBAAuB,SAAA,IAAa,EAAE,CAAA,CAAA,EACpD,QAAA,kBAAAC,eAAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAO,UAAA,EAAY,eAAe,sBAAA,EAC1C,QAAA,EAAA;AAAA,oBAAAD,cAAAA,CAAC,mBAAgB,SAAA,EAAU,YAAA,EACzB,0BAAAA,cAAAA,CAAC,aAAA,EAAA,EAAc,aAA0B,CAAA,EAC3C,CAAA;AAAA,oBACAA,cAAAA,CAAC,eAAA,EAAA,EACE,QAAA,EAAA,WAAA,CAAY,GAAA,CAAI,CAAC,KAAA,qBAChBA,cAAAA,CAAC,YAAA,EAAA,EAAyB,WAAU,YAAA,EAAa,KAAA,EAAO,OACrD,QAAA,EAAA,KAAA,EAAA,EADgB,KAEnB,CACD,CAAA,EACH;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ","file":"index.cjs","sourcesContent":["export enum ThemeAnimationType {\n CIRCLE = 'circle',\n BLUR_CIRCLE = 'blur-circle',\n SLIDE = 'slide',\n}\n\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ColorTheme = string;\n\nexport type SlideDirection =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface AnimationConfig {\n a?: number;\n b?: number;\n x: number;\n y: number;\n duration: number;\n easing: string;\n animationType: ThemeAnimationType;\n blurAmount: number;\n styleId: string;\n}\n\nexport interface ThemeConfig {\n themes?: Theme[];\n colorThemes?: ColorTheme[];\n defaultTheme?: Theme;\n defaultColorTheme?: ColorTheme;\n globalClassName?: string;\n colorThemePrefix?: string;\n storageKey?: string;\n colorStorageKey?: string;\n}\n\nexport interface ThemeState {\n theme: Theme;\n colorTheme: ColorTheme;\n resolvedTheme: 'light' | 'dark';\n}\n","export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { Theme, ColorTheme } from './types';\nimport { STORAGE_KEY, COLOR_STORAGE_KEY } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Gets the stored theme from localStorage\n * @param key - Storage key for the theme\n * @param validThemes - Array of valid theme values\n * @param defaultTheme - Default theme if stored value is invalid\n * @returns The stored theme or default\n */\nexport const getStoredTheme = (\n key: string = STORAGE_KEY,\n validThemes: Theme[] = ['light', 'dark', 'system'],\n defaultTheme: Theme = 'system'\n): Theme => {\n if (!isBrowser) return defaultTheme;\n\n const saved = localStorage.getItem(key) as Theme | null;\n return saved && validThemes.includes(saved) ? saved : defaultTheme;\n};\n\n/**\n * Stores theme in localStorage\n * @param theme - Theme to store\n * @param key - Storage key for the theme\n */\nexport const setStoredTheme = (\n theme: Theme,\n key: string = STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, theme);\n};\n\n/**\n * Gets the stored color theme from localStorage\n * @param key - Storage key for the color theme\n * @param validColorThemes - Array of valid color theme values\n * @param defaultColorTheme - Default color theme if stored value is invalid\n * @returns The stored color theme or default\n */\nexport const getStoredColorTheme = (\n key: string = COLOR_STORAGE_KEY,\n validColorThemes: ColorTheme[] = ['default'],\n defaultColorTheme: ColorTheme = 'default'\n): ColorTheme => {\n if (!isBrowser) return defaultColorTheme;\n\n const saved = localStorage.getItem(key);\n return saved && validColorThemes.includes(saved) ? saved : defaultColorTheme;\n};\n\n/**\n * Stores color theme in localStorage\n * @param colorTheme - Color theme to store\n * @param key - Storage key for the color theme\n */\nexport const setStoredColorTheme = (\n colorTheme: ColorTheme,\n key: string = COLOR_STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, colorTheme);\n};\n","import { useEffect, useRef, useState, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\nimport { ThemeAnimationType, Theme, AnimationConfig } from '../../core/types';\nimport {\n injectBaseStyles,\n resolveTheme,\n getSystemTheme,\n supportsViewTransitions,\n prefersReducedMotion,\n createCircleAnimation,\n createBlurCircleAnimation,\n createSlideAnimation,\n getSlideFromCoords,\n} from '../../core/animations';\nimport {\n getStoredTheme,\n setStoredTheme,\n getStoredColorTheme,\n setStoredColorTheme,\n} from '../../core/storage';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n DEFAULT_DURATION,\n DEFAULT_EASING,\n DEFAULT_BLUR_AMOUNT,\n DEFAULT_STYLE_ID,\n} from '../../core/constants';\nimport { UseThemeProps, UseThemeReturn } from '../types';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * React hook for theme switching with View Transitions API animations\n * @param props - Configuration options for the theme animation\n * @returns Theme state and control functions\n */\nexport const useTheme = (props: UseThemeProps = {}): UseThemeReturn => {\n const {\n duration: propsDuration = DEFAULT_DURATION,\n easing = DEFAULT_EASING,\n animationType = ThemeAnimationType.CIRCLE,\n blurAmount = DEFAULT_BLUR_AMOUNT,\n styleId = DEFAULT_STYLE_ID,\n\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n\n theme: externalTheme,\n colorTheme: externalColorTheme,\n\n onThemeChange,\n onColorThemeChange,\n\n slideDirection = 'left',\n slideFromX,\n slideFromY,\n slideToX = 0,\n slideToY = 0,\n\n initialTheme,\n initialColorTheme,\n systemThemeMode = 'js',\n } = props;\n\n const isHighResolution =\n isBrowser && (window.innerWidth >= 3000 || window.innerHeight >= 2000);\n const duration = isHighResolution\n ? Math.max(propsDuration * 0.8, 500)\n : propsDuration;\n\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n injectBaseStyles();\n setMounted(true);\n }, []);\n\n const [internalTheme, setInternalTheme] = useState<Theme>(() => {\n if (initialTheme !== undefined) return initialTheme;\n return getStoredTheme(storageKey, themes, defaultTheme);\n });\n\n const [internalColorTheme, setInternalColorTheme] = useState(() => {\n if (initialColorTheme !== undefined) return initialColorTheme;\n return getStoredColorTheme(colorStorageKey, colorThemes, defaultColorTheme);\n });\n\n const currentTheme = externalTheme ?? internalTheme;\n const currentColorTheme = externalColorTheme ?? internalColorTheme;\n\n const [, setSystemTheme] = useState<'light' | 'dark'>(() => getSystemTheme());\n const resolvedTheme = resolveTheme(currentTheme);\n\n useEffect(() => {\n if (!isBrowser) return;\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handleChange = () => setSystemTheme(getSystemTheme());\n\n mediaQuery.addEventListener('change', handleChange);\n return () => mediaQuery.removeEventListener('change', handleChange);\n }, []);\n\n useEffect(() => {\n if (!isBrowser || !mounted) return;\n\n const el = document.documentElement;\n\n if (systemThemeMode === 'css' && currentTheme === 'system') {\n // CSS mode: use 'system' class, let CSS @media handle dark/light\n el.classList.remove(globalClassName);\n el.classList.remove('auto');\n el.classList.remove('system');\n el.classList.add('system');\n el.style.colorScheme = '';\n } else {\n // JS mode or explicit light/dark: resolve and apply\n el.classList.remove('system');\n el.classList.remove('auto');\n if (resolvedTheme === 'dark') {\n el.classList.add(globalClassName);\n } else {\n el.classList.remove(globalClassName);\n }\n el.style.colorScheme = resolvedTheme;\n }\n\n colorThemes.forEach((theme) => {\n el.classList.remove(`${colorThemePrefix}${theme}`);\n });\n el.classList.add(`${colorThemePrefix}${currentColorTheme}`);\n }, [\n resolvedTheme,\n currentTheme,\n currentColorTheme,\n globalClassName,\n colorThemePrefix,\n colorThemes,\n mounted,\n systemThemeMode,\n ]);\n\n const ref = useRef<HTMLButtonElement>(null);\n\n const setTheme = useCallback(\n (newTheme: Theme) => {\n setStoredTheme(newTheme, storageKey);\n\n if (externalTheme === undefined) {\n setInternalTheme(newTheme);\n }\n\n if (onThemeChange) {\n onThemeChange(newTheme);\n }\n },\n [onThemeChange, externalTheme, storageKey]\n );\n\n const setColorTheme = useCallback(\n (newColorTheme: string) => {\n setStoredColorTheme(newColorTheme, colorStorageKey);\n\n if (externalColorTheme === undefined) {\n setInternalColorTheme(newColorTheme);\n }\n\n if (onColorThemeChange) {\n onColorThemeChange(newColorTheme);\n }\n },\n [onColorThemeChange, externalColorTheme, colorStorageKey]\n );\n\n const switchTheme = useCallback(\n async (newTheme: Theme, animationOff: boolean = false) => {\n if (\n !ref.current ||\n !supportsViewTransitions() ||\n prefersReducedMotion() ||\n animationOff\n ) {\n setTheme(newTheme);\n return;\n }\n\n let animationConfig: AnimationConfig;\n\n if (animationType === ThemeAnimationType.SLIDE) {\n const fromCoords =\n slideFromX !== undefined && slideFromY !== undefined\n ? { a: slideFromX, b: slideFromY }\n : getSlideFromCoords(slideDirection);\n\n animationConfig = {\n a: fromCoords.a,\n b: fromCoords.b,\n x: slideToX,\n y: slideToY,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n };\n } else {\n const { top, left, width, height } =\n ref.current.getBoundingClientRect();\n const x = left + width / 2;\n const y = top + height / 2;\n\n animationConfig = {\n x,\n y,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n };\n }\n\n if (animationType === ThemeAnimationType.BLUR_CIRCLE) {\n createBlurCircleAnimation(animationConfig);\n }\n\n if (animationType === ThemeAnimationType.SLIDE) {\n createSlideAnimation(animationConfig);\n }\n\n await (document as Document).startViewTransition(() => {\n flushSync(() => {\n setTheme(newTheme);\n });\n }).ready;\n\n if (animationType === ThemeAnimationType.CIRCLE) {\n createCircleAnimation(animationConfig);\n }\n },\n [\n setTheme,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n slideDirection,\n slideFromX,\n slideFromY,\n slideToX,\n slideToY,\n ]\n );\n\n const switchColorTheme = useCallback(\n (newColorTheme: string) => {\n if (colorThemes.indexOf(newColorTheme) === -1) {\n console.warn(\n `Color theme \"${newColorTheme}\" not found in available themes`\n );\n return;\n }\n setColorTheme(newColorTheme);\n },\n [colorThemes, setColorTheme]\n );\n\n const toggleTheme = useCallback(\n async (animationOff: boolean = false) => {\n const newTheme: Theme = resolvedTheme === 'dark' ? 'light' : 'dark';\n await switchTheme(newTheme, animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleLightTheme = useCallback(\n async (animationOff: boolean = false) => {\n if (resolvedTheme === 'light') return;\n await switchTheme('light', animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleDarkTheme = useCallback(\n async (animationOff: boolean = false) => {\n if (resolvedTheme === 'dark') return;\n await switchTheme('dark', animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleColorTheme = useCallback(() => {\n const currentIndex = colorThemes.indexOf(currentColorTheme);\n const nextIndex = (currentIndex + 1) % colorThemes.length;\n const nextColorTheme = colorThemes[nextIndex];\n setColorTheme(nextColorTheme);\n }, [currentColorTheme, colorThemes, setColorTheme]);\n\n const createColorThemeToggle = useCallback(\n (targetColorTheme: string) => {\n return () => {\n if (colorThemes.indexOf(targetColorTheme) === -1) {\n console.warn(\n `Color theme \"${targetColorTheme}\" not found in available themes`\n );\n return;\n }\n setColorTheme(targetColorTheme);\n };\n },\n [colorThemes, setColorTheme]\n );\n\n const isColorThemeActive = useCallback(\n (targetColorTheme: string) => {\n return currentColorTheme === targetColorTheme;\n },\n [currentColorTheme]\n );\n\n return {\n ref,\n theme: currentTheme,\n colorTheme: currentColorTheme,\n resolvedTheme,\n setTheme,\n setColorTheme,\n switchTheme,\n switchColorTheme,\n toggleTheme,\n toggleLightTheme,\n toggleDarkTheme,\n toggleColorTheme,\n createColorThemeToggle,\n isColorThemeActive,\n };\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useState,\n useEffect,\n useCallback,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n} from '../../core/constants';\n\n/**\n * Context type for the Next.js UI Theme Provider\n */\nexport interface NextUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst NextUIThemeContext = createContext<NextUIThemeContextType | undefined>(\n undefined\n);\n\n/**\n * Props for the Next.js UI Theme Provider\n */\nexport interface NextUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme preference */\n storageKey?: string;\n /** Storage key for color theme preference */\n colorStorageKey?: string;\n /** HTML attribute to use for theme ('class' or 'data-theme') */\n attribute?: 'class' | 'data-theme';\n /** Class name for dark theme (when using 'class' attribute) */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /** CSP nonce for inline script (SSR apps) */\n nonce?: string;\n /** Skip animation during initial hydration */\n disableAnimationOnInit?: boolean;\n /** Disable flash prevention script (for SPAs without SSR) */\n disablePreHydrationScript?: boolean;\n}\n\n/**\n * Pre-hydration script content generator\n * This script runs BEFORE React hydrates to prevent flash of wrong theme\n */\nconst generatePreHydrationScript = (\n storageKey: string,\n colorStorageKey: string,\n defaultTheme: Theme,\n defaultColorTheme: ColorTheme,\n attribute: 'class' | 'data-theme',\n globalClassName: string,\n colorThemePrefix: string\n): string => {\n return `\n(function() {\n try {\n var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';\n var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';\n var resolved = theme === 'system' \n ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n : theme;\n \n if ('${attribute}' === 'class') {\n if (resolved === 'dark') {\n document.documentElement.classList.add('${globalClassName}');\n } else {\n document.documentElement.classList.remove('${globalClassName}');\n }\n } else {\n document.documentElement.setAttribute('data-theme', resolved);\n }\n \n document.documentElement.style.colorScheme = resolved;\n document.documentElement.classList.add('${colorThemePrefix}' + colorTheme);\n } catch (e) {\n console.warn('Theme pre-hydration script failed:', e);\n }\n})();\n`;\n};\n\n/**\n * Pre-hydration script component\n * Injects inline script before React hydration to prevent theme flash\n */\nconst ThemePreHydrationScript: React.FC<{\n storageKey: string;\n colorStorageKey: string;\n defaultTheme: Theme;\n defaultColorTheme: ColorTheme;\n attribute: 'class' | 'data-theme';\n globalClassName: string;\n colorThemePrefix: string;\n nonce?: string;\n}> = React.memo(\n ({\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n attribute,\n globalClassName,\n colorThemePrefix,\n nonce,\n }) => {\n const scriptContent = generatePreHydrationScript(\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n attribute,\n globalClassName,\n colorThemePrefix\n );\n\n return (\n <script\n nonce={nonce}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: scriptContent }}\n />\n );\n }\n);\n\nThemePreHydrationScript.displayName = 'ThemePreHydrationScript';\n\n/**\n * Next.js UI Theme Provider - Universal React theme management with animations\n *\n * This provider works with Next.js and provides flash prevention\n * via pre-hydration script injection.\n *\n * Features:\n * - Pre-hydration script for flash prevention (SSR apps)\n * - Animated theme transitions via View Transitions API\n * - Multi-dimensional theming (theme + colorTheme)\n * - System theme detection\n * - CSP support via nonce prop\n *\n * @param props - Provider configuration options\n */\nexport const NextUIThemeProvider: React.FC<NextUIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n attribute = 'class',\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n nonce,\n disableAnimationOnInit = true,\n disablePreHydrationScript = false,\n}) => {\n const [mounted, setMounted] = useState(false);\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName: attribute === 'class' ? globalClassName : undefined,\n colorThemePrefix,\n });\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const switchThemeWithHydrationAwareness = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n if (!mounted && disableAnimationOnInit) {\n themeState.setTheme(theme);\n } else {\n await themeState.switchTheme(theme, animationOff);\n }\n },\n [mounted, disableAnimationOnInit, themeState]\n );\n\n const switchThemeFromElement = useCallback(\n async (theme: Theme, element: HTMLButtonElement) => {\n if (!mounted && disableAnimationOnInit) {\n themeState.setTheme(theme);\n return;\n }\n\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n },\n [mounted, disableAnimationOnInit, themeState]\n );\n\n const systemTheme =\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\n if (!mounted) {\n const loadingContextValue: NextUIThemeContextType = {\n ref: { current: null },\n theme: defaultTheme,\n colorTheme: defaultColorTheme,\n resolvedTheme: defaultTheme === 'dark' ? 'dark' : 'light',\n systemTheme: 'light',\n setTheme: () => {},\n setColorTheme: () => {},\n switchTheme: async () => {},\n switchThemeFromElement: async () => {},\n switchColorTheme: () => {},\n toggleTheme: async () => {},\n toggleLightTheme: async () => {},\n toggleDarkTheme: async () => {},\n toggleColorTheme: () => {},\n createColorThemeToggle: () => () => {},\n isColorThemeActive: () => false,\n };\n\n return (\n <NextUIThemeContext.Provider value={loadingContextValue}>\n {!disablePreHydrationScript && (\n <ThemePreHydrationScript\n storageKey={storageKey}\n colorStorageKey={colorStorageKey}\n defaultTheme={defaultTheme}\n defaultColorTheme={defaultColorTheme}\n attribute={attribute}\n globalClassName={globalClassName}\n colorThemePrefix={colorThemePrefix}\n nonce={nonce}\n />\n )}\n {children}\n </NextUIThemeContext.Provider>\n );\n }\n\n const contextValue: NextUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n setTheme: themeState.setTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: switchThemeWithHydrationAwareness,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: themeState.toggleTheme,\n toggleLightTheme: themeState.toggleLightTheme,\n toggleDarkTheme: themeState.toggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <NextUIThemeContext.Provider value={contextValue}>\n {!disablePreHydrationScript && (\n <ThemePreHydrationScript\n storageKey={storageKey}\n colorStorageKey={colorStorageKey}\n defaultTheme={defaultTheme}\n defaultColorTheme={defaultColorTheme}\n attribute={attribute}\n globalClassName={globalClassName}\n colorThemePrefix={colorThemePrefix}\n nonce={nonce}\n />\n )}\n {children}\n </NextUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the Next.js UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of NextUIThemeProvider\n */\nexport const useNextUITheme = (): NextUIThemeContextType => {\n const context = useContext(NextUIThemeContext);\n if (context === undefined) {\n throw new Error('useNextUITheme must be used within a NextUIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useCallback,\n useEffect,\n useSyncExternalStore,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n} from '../../core/constants';\nimport { setStoredTheme, setStoredColorTheme } from '../../core/storage';\nimport type { SystemThemeMode } from '../types';\n\n/**\n * Context type for the TanStack Start UI Theme Provider\n */\nexport interface TanStackUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Whether the component is hydrated */\n isHydrated: boolean;\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst TanStackUIThemeContext = createContext<\n TanStackUIThemeContextType | undefined\n>(undefined);\n\n/**\n * Props for the TanStack Start UI Theme Provider\n */\nexport interface TanStackUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme preference */\n storageKey?: string;\n /** Storage key for color theme preference */\n colorStorageKey?: string;\n /** Class name for dark theme */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /**\n * Server-resolved theme class from cookie (e.g., 'light', 'dark', 'system').\n * When provided, prevents flash by using this as the initial value during SSR.\n * Typically obtained via `getThemeServerFn()` in `beforeLoad`.\n */\n serverTheme?: 'light' | 'dark' | 'system';\n /**\n * Server-resolved color theme from cookie.\n * When provided, prevents color theme flash during SSR.\n */\n serverColorTheme?: string;\n /**\n * How to handle 'system' theme resolution.\n * - 'css': Apply 'system' class on <html>, let CSS @media queries handle it (zero flash, requires CSS setup)\n * - 'js': Resolve via matchMedia in JS (works with existing CSS, may flash briefly)\n * @default 'css'\n */\n systemThemeMode?: SystemThemeMode;\n /**\n * Callback to persist theme to server (cookie).\n * Called alongside localStorage updates when user changes theme.\n * Typically `setThemeServerFn` from `createThemeServerFns()`.\n */\n onServerThemeChange?: (theme: Theme) => Promise<void> | void;\n /**\n * Callback to persist color theme to server (cookie).\n * Called alongside localStorage updates when user changes color theme.\n * Typically `setColorThemeServerFn` from `createThemeServerFns()`.\n */\n onServerColorThemeChange?: (colorTheme: string) => Promise<void> | void;\n}\n\n/**\n * Props for the TanStackStartThemeScript component\n */\nexport interface TanStackStartThemeScriptProps {\n /** Storage key for theme preference in localStorage */\n storageKey?: string;\n /** Storage key for color theme preference in localStorage */\n colorStorageKey?: string;\n /** Default theme when nothing is stored */\n defaultTheme?: Theme;\n /** Default color theme when nothing is stored */\n defaultColorTheme?: ColorTheme;\n /** Class name for dark theme */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /** CSP nonce for the inline script */\n nonce?: string;\n /**\n * How to handle 'system' theme.\n * - 'css': Apply 'system' class (let CSS handle dark via media query)\n * - 'js': Resolve via matchMedia and apply 'dark' or remove class\n * @default 'js'\n */\n systemThemeMode?: SystemThemeMode;\n}\n\n/**\n * Generates the pre-hydration script content for flash prevention.\n * This script runs synchronously before React hydrates.\n */\nconst generateTanStackPreHydrationScript = (\n storageKey: string,\n colorStorageKey: string,\n defaultTheme: Theme,\n defaultColorTheme: ColorTheme,\n globalClassName: string,\n colorThemePrefix: string,\n systemThemeMode: SystemThemeMode\n): string => {\n return `\n(function() {\n try {\n var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';\n var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';\n var el = document.documentElement;\n var resolved;\n if (theme === 'system') {\n if ('${systemThemeMode}' === 'css') {\n el.classList.remove('${globalClassName}');\n el.classList.remove('auto');\n el.classList.remove('system');\n el.classList.add('system');\n el.style.colorScheme = '';\n } else {\n resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n if (resolved === 'dark') {\n el.classList.add('${globalClassName}');\n } else {\n el.classList.remove('${globalClassName}');\n }\n el.classList.remove('system');\n el.classList.remove('auto');\n el.style.colorScheme = resolved;\n }\n } else {\n resolved = theme;\n el.classList.remove('system');\n el.classList.remove('auto');\n if (resolved === 'dark') {\n el.classList.add('${globalClassName}');\n } else {\n el.classList.remove('${globalClassName}');\n }\n el.style.colorScheme = resolved;\n }\n if (colorTheme && colorTheme !== 'default') {\n el.classList.add('${colorThemePrefix}' + colorTheme);\n }\n } catch (e) {\n console.warn('Theme pre-hydration script failed:', e);\n }\n})();\n`;\n};\n\n/**\n * Pre-hydration script for TanStack Start applications.\n *\n * Place this in the `<head>` of your `shellComponent` to prevent theme flash\n * when not using the cookie-based approach.\n *\n * Reads the theme preference from localStorage and applies the correct classes\n * and colorScheme to `<html>` before React hydrates.\n *\n * @example\n * ```tsx\n * function RootDocument({ children }: { children: React.ReactNode }) {\n * return (\n * <html lang=\"en\" suppressHydrationWarning>\n * <head>\n * <TanStackStartThemeScript />\n * <HeadContent />\n * </head>\n * <body>{children}<Scripts /></body>\n * </html>\n * );\n * }\n * ```\n */\nexport const TanStackStartThemeScript: React.FC<TanStackStartThemeScriptProps> =\n React.memo(\n ({\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n nonce,\n systemThemeMode = 'js',\n }) => {\n const scriptContent = generateTanStackPreHydrationScript(\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n globalClassName,\n colorThemePrefix,\n systemThemeMode\n );\n\n return (\n <script\n nonce={nonce}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: scriptContent }}\n />\n );\n }\n );\n\nTanStackStartThemeScript.displayName = 'TanStackStartThemeScript';\n\n/**\n * Custom hook to detect hydration state\n * Compatible with TanStack Start's isomorphic model\n */\nconst useHydrated = (): boolean => {\n return useSyncExternalStore(\n () => () => {},\n () => true,\n () => false\n );\n};\n\n/**\n * TanStack Start UI Theme Provider - Flash-free dark mode for TanStack Start\n *\n * Supports two approaches for preventing theme flash:\n *\n * **Option A — Cookie-based (recommended, zero flash):**\n * Pass `serverTheme` and `serverColorTheme` from route context (obtained via\n * `getThemeServerFn()` in `beforeLoad`). The server renders the correct classes\n * on `<html>`, and this provider syncs localStorage on the client.\n *\n * **Option B — Pre-hydration script:**\n * Use `<TanStackStartThemeScript>` in your shellComponent's `<head>`.\n * Reads from localStorage before React hydrates.\n *\n * Both approaches support `systemThemeMode`:\n * - `'css'`: Applies 'system' class, CSS media queries handle dark mode\n * - `'js'`: Resolves system theme via matchMedia in JS\n *\n * @param props - Provider configuration options\n */\nexport const TanStackUIThemeProvider: React.FC<\n TanStackUIThemeProviderProps\n> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n serverTheme,\n serverColorTheme,\n systemThemeMode = 'css',\n onServerThemeChange,\n onServerColorThemeChange,\n}) => {\n const isHydrated = useHydrated();\n const hasServerTheme = serverTheme !== undefined;\n\n // Derive initialTheme from serverTheme for the useTheme hook\n const initialTheme: Theme | undefined = hasServerTheme\n ? serverTheme === 'system'\n ? 'system'\n : serverTheme\n : undefined;\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName,\n colorThemePrefix,\n systemThemeMode,\n initialTheme,\n initialColorTheme: serverColorTheme,\n });\n\n // Sync localStorage with server-provided values on first hydration\n useEffect(() => {\n if (!hasServerTheme) return;\n if (initialTheme) {\n setStoredTheme(initialTheme, storageKey);\n }\n if (serverColorTheme) {\n setStoredColorTheme(serverColorTheme, colorStorageKey);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps -- only on mount\n\n // Wrap setTheme to also call server callback\n const setThemeWithServer = useCallback(\n (newTheme: Theme) => {\n themeState.setTheme(newTheme);\n if (onServerThemeChange) {\n onServerThemeChange(newTheme);\n }\n },\n [themeState, onServerThemeChange]\n );\n\n // Wrap setColorTheme to also call server callback\n const setColorThemeWithServer = useCallback(\n (newColorTheme: string) => {\n themeState.setColorTheme(newColorTheme);\n if (onServerColorThemeChange) {\n onServerColorThemeChange(newColorTheme);\n }\n },\n [themeState, onServerColorThemeChange]\n );\n\n const switchThemeWithHydrationAwareness = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer(theme);\n } else {\n await themeState.switchTheme(theme, animationOff);\n if (onServerThemeChange) {\n onServerThemeChange(theme);\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n const nextTheme =\n themeState.resolvedTheme === 'dark' ? 'light' : 'dark';\n setThemeWithServer(nextTheme);\n } else {\n await themeState.toggleTheme(animationOff);\n const nextTheme =\n themeState.resolvedTheme === 'dark' ? 'light' : 'dark';\n if (onServerThemeChange) {\n onServerThemeChange(nextTheme);\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleLightThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer('light');\n } else {\n await themeState.toggleLightTheme(animationOff);\n if (onServerThemeChange) {\n onServerThemeChange('light');\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleDarkThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer('dark');\n } else {\n await themeState.toggleDarkTheme(animationOff);\n if (onServerThemeChange) {\n onServerThemeChange('dark');\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const switchColorThemeWithServer = useCallback(\n (newColorTheme: string) => {\n themeState.switchColorTheme(newColorTheme);\n if (onServerColorThemeChange) {\n onServerColorThemeChange(newColorTheme);\n }\n },\n [themeState, onServerColorThemeChange]\n );\n\n const switchThemeFromElement = useCallback(\n async (theme: Theme, element: HTMLButtonElement) => {\n if (!isHydrated) {\n setThemeWithServer(theme);\n return;\n }\n\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n if (onServerThemeChange) {\n onServerThemeChange(theme);\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const systemTheme =\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\n // Compute the resolvedTheme for the server (pre-hydration) context\n const serverResolvedTheme: 'light' | 'dark' = (() => {\n if (hasServerTheme) {\n if (serverTheme === 'dark') return 'dark';\n if (serverTheme === 'system') return systemTheme;\n return 'light';\n }\n return defaultTheme === 'dark' ? 'dark' : 'light';\n })();\n\n if (!isHydrated) {\n const loadingContextValue: TanStackUIThemeContextType = {\n ref: { current: null },\n theme: initialTheme ?? defaultTheme,\n colorTheme: serverColorTheme ?? defaultColorTheme,\n resolvedTheme: serverResolvedTheme,\n systemTheme: 'light',\n isHydrated: false,\n setTheme: setThemeWithServer,\n setColorTheme: setColorThemeWithServer,\n switchTheme: async (theme: Theme) => setThemeWithServer(theme),\n switchThemeFromElement: async (theme: Theme) => setThemeWithServer(theme),\n switchColorTheme: switchColorThemeWithServer,\n toggleTheme: async () => {\n const nextTheme = serverResolvedTheme === 'dark' ? 'light' : 'dark';\n setThemeWithServer(nextTheme);\n },\n toggleLightTheme: async () => setThemeWithServer('light'),\n toggleDarkTheme: async () => setThemeWithServer('dark'),\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <TanStackUIThemeContext.Provider value={loadingContextValue}>\n {children}\n </TanStackUIThemeContext.Provider>\n );\n }\n\n const contextValue: TanStackUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n isHydrated: true,\n setTheme: setThemeWithServer,\n setColorTheme: setColorThemeWithServer,\n switchTheme: switchThemeWithHydrationAwareness,\n switchThemeFromElement,\n switchColorTheme: switchColorThemeWithServer,\n toggleTheme: toggleThemeWithHydrationAwareness,\n toggleLightTheme: toggleLightThemeWithHydrationAwareness,\n toggleDarkTheme: toggleDarkThemeWithHydrationAwareness,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <TanStackUIThemeContext.Provider value={contextValue}>\n {children}\n </TanStackUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the TanStack UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of TanStackUIThemeProvider\n */\nexport const useTanStackUITheme = (): TanStackUIThemeContextType => {\n const context = useContext(TanStackUIThemeContext);\n if (context === undefined) {\n throw new Error(\n 'useTanStackUITheme must be used within a TanStackUIThemeProvider'\n );\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useCallback,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport { getSystemTheme } from '../../core/animations';\n\n/**\n * Context type for the Vite UI Theme Provider\n */\nexport interface ViteUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst ViteUIThemeContext = createContext<ViteUIThemeContextType | undefined>(\n undefined\n);\n\n/**\n * Props for the Vite UI Theme Provider\n */\nexport interface ViteUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Attribute to use for theme ('class' or 'data-theme') */\n attribute?: 'class' | 'data-theme';\n /** Disable transitions during theme change */\n disableTransitionOnChange?: boolean;\n /** Storage key for theme */\n storageKey?: string;\n /** Storage key for color theme */\n colorStorageKey?: string;\n /** Class name for dark mode */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n}\n\n/**\n * Vite UI Theme Provider - Theme provider optimized for Vite/SPA applications\n *\n * This provider includes additional features like transition disabling\n * and system theme tracking that are useful in client-side applications.\n *\n * Note: For flash prevention on initial load, add a script to your index.html\n * or inject it via Vite plugin to apply theme before React loads.\n *\n * @param props - Provider configuration options\n */\nexport const ViteUIThemeProvider: React.FC<ViteUIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n attribute = 'class',\n disableTransitionOnChange = false,\n storageKey = 'ui-theme',\n colorStorageKey = 'ui-color-theme',\n globalClassName = 'dark',\n colorThemePrefix = 'theme-',\n}) => {\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName: attribute === 'class' ? globalClassName : undefined,\n colorThemePrefix,\n });\n\n const applyTransitionDisable = useCallback(() => {\n if (!disableTransitionOnChange) return () => {};\n\n const css = document.createElement('style');\n css.textContent = `*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;\n document.head.appendChild(css);\n\n window.getComputedStyle(document.body);\n\n return () => {\n setTimeout(() => {\n document.head.removeChild(css);\n }, 1);\n };\n }, [disableTransitionOnChange]);\n\n const wrappedSetTheme = useCallback(\n (theme: Theme) => {\n const cleanup = applyTransitionDisable();\n themeState.setTheme(theme);\n cleanup();\n },\n [themeState.setTheme, applyTransitionDisable]\n );\n\n const wrappedSwitchTheme = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.switchTheme(theme, animationOff);\n cleanup();\n },\n [themeState.switchTheme, applyTransitionDisable]\n );\n\n const wrappedToggleTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleTheme(animationOff);\n cleanup();\n },\n [themeState.toggleTheme, applyTransitionDisable]\n );\n\n const wrappedToggleLightTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleLightTheme(animationOff);\n cleanup();\n },\n [themeState.toggleLightTheme, applyTransitionDisable]\n );\n\n const wrappedToggleDarkTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleDarkTheme(animationOff);\n cleanup();\n },\n [themeState.toggleDarkTheme, applyTransitionDisable]\n );\n\n const switchThemeFromElement = async (\n theme: Theme,\n element: HTMLButtonElement\n ) => {\n const cleanup = applyTransitionDisable();\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n cleanup();\n };\n\n const systemTheme = getSystemTheme();\n\n const contextValue: ViteUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n setTheme: wrappedSetTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: wrappedSwitchTheme,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: wrappedToggleTheme,\n toggleLightTheme: wrappedToggleLightTheme,\n toggleDarkTheme: wrappedToggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <ViteUIThemeContext.Provider value={contextValue}>\n {children}\n </ViteUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the Vite UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of ViteUIThemeProvider\n */\nexport const useViteUITheme = (): ViteUIThemeContextType => {\n const context = useContext(ViteUIThemeContext);\n if (context === undefined) {\n throw new Error('useViteUITheme must be used within a ViteUIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useState,\n useEffect,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\n\n/**\n * Context type for the UI Theme Provider\n */\nexport interface UIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst UIThemeContext = createContext<UIThemeContextType | undefined>(undefined);\n\n/**\n * Props for the UI Theme Provider\n */\nexport interface UIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme */\n storageKey?: string;\n /** Storage key for color theme */\n colorStorageKey?: string;\n}\n\n/**\n * UI Theme Provider - Provides centralized theme state management\n *\n * This provider creates a single source of truth for theme state using the useTheme hook.\n * All theme-related components should consume from this context to ensure synchronization.\n *\n * @param props - Provider configuration options\n */\nexport const UIThemeProvider: React.FC<UIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey,\n colorStorageKey,\n}) => {\n const [mounted, setMounted] = useState(false);\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n });\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const switchThemeFromElement = async (\n theme: Theme,\n element: HTMLButtonElement\n ) => {\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n };\n\n if (!mounted) {\n const loadingContextValue: UIThemeContextType = {\n ref: { current: null },\n theme: defaultTheme,\n colorTheme: defaultColorTheme,\n resolvedTheme: defaultTheme === 'dark' ? 'dark' : 'light',\n setTheme: () => {},\n setColorTheme: () => {},\n switchTheme: async () => {},\n switchThemeFromElement: async () => {},\n switchColorTheme: () => {},\n toggleTheme: async () => {},\n toggleLightTheme: async () => {},\n toggleDarkTheme: async () => {},\n toggleColorTheme: () => {},\n createColorThemeToggle: () => () => {},\n isColorThemeActive: () => false,\n };\n\n return (\n <UIThemeContext.Provider value={loadingContextValue}>\n {children}\n </UIThemeContext.Provider>\n );\n }\n\n const contextValue: UIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n setTheme: themeState.setTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: themeState.switchTheme,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: themeState.toggleTheme,\n toggleLightTheme: themeState.toggleLightTheme,\n toggleDarkTheme: themeState.toggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <UIThemeContext.Provider value={contextValue}>\n {children}\n </UIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of UIThemeProvider\n */\nexport const useUITheme = (): UIThemeContextType => {\n const context = useContext(UIThemeContext);\n if (context === undefined) {\n throw new Error('useUITheme must be used within a UIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, { type JSX, useEffect, useState } from 'react';\nimport { Theme } from '../../core/types';\nimport { useTheme } from '../hooks/use-theme';\nimport { useUITheme, UIThemeContextType } from './UIThemeProvider';\nimport { UIThemeSwitcherProps } from '../types';\n\nconst SunIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"5\" />\n <path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\" />\n </svg>\n);\n\nconst MoonIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\" />\n </svg>\n);\n\nconst MonitorIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\" />\n <line x1=\"8\" x2=\"16\" y1=\"21\" y2=\"21\" />\n <line x1=\"12\" x2=\"12\" y1=\"17\" y2=\"21\" />\n </svg>\n);\n\ninterface ThemeOptionProps {\n icon: JSX.Element;\n value: string;\n isActive?: boolean;\n isHovered?: boolean;\n onClick: (value: string, event?: React.MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter: () => void;\n onMouseLeave: () => void;\n buttonRef?: React.RefObject<HTMLButtonElement | null>;\n}\n\nconst ThemeOption: React.FC<ThemeOptionProps> = ({\n icon,\n value,\n isActive,\n isHovered,\n onClick,\n onMouseEnter,\n onMouseLeave,\n buttonRef,\n}) => {\n return (\n <button\n ref={\n isActive ? (buttonRef as React.RefObject<HTMLButtonElement>) : undefined\n }\n className={`\n relative flex h-9 w-12 cursor-pointer items-center justify-center\n text-muted-foreground hover:text-foreground\n ${isActive ? 'text-foreground font-medium' : ''}\n `}\n role=\"radio\"\n aria-checked={isActive}\n aria-label={`Switch to ${value} theme`}\n onClick={(event) => onClick(value, event)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n style={{\n borderRadius: 'var(--radius)',\n }}\n >\n {isHovered && (\n <div\n className=\"absolute inset-0 bg-muted\"\n style={{\n borderRadius: 'var(--radius)',\n transition: 'all 0.2s ease',\n }}\n />\n )}\n\n <div className=\"relative z-10 flex items-center justify-center\">\n <div className=\"[&_svg]:size-4\">{icon}</div>\n </div>\n\n {isActive && (\n <div\n className=\"absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full\"\n style={{\n backgroundColor: 'hsl(var(--primary))',\n }}\n />\n )}\n </button>\n );\n};\n\nconst THEME_OPTIONS = [\n { icon: <MonitorIcon />, value: 'system' },\n { icon: <SunIcon />, value: 'light' },\n { icon: <MoonIcon />, value: 'dark' },\n];\n\n/**\n * UI Theme Switcher - A button group for switching between themes\n *\n * Can work both with UIThemeProvider context or standalone.\n * When used with UIThemeProvider, it automatically syncs theme state.\n */\nexport const UIThemeSwitcher: React.FC<UIThemeSwitcherProps> = ({\n themes = ['light', 'dark', 'system'],\n currentTheme,\n onThemeChange,\n animationType,\n duration,\n className,\n}) => {\n let contextTheme: UIThemeContextType | null = null;\n try {\n contextTheme = useUITheme();\n } catch {\n // Context not available, use standalone mode\n }\n\n const standaloneHook = useTheme({\n animationType,\n duration,\n themes,\n ...(currentTheme !== undefined && { theme: currentTheme }),\n onThemeChange,\n });\n\n const isControlled = contextTheme !== null;\n const { ref, theme, switchTheme } =\n isControlled && contextTheme\n ? {\n ref: contextTheme.ref,\n theme: contextTheme.theme,\n switchTheme: contextTheme.switchTheme,\n }\n : standaloneHook;\n\n const [isMounted, setIsMounted] = useState(false);\n const [hoveredTheme, setHoveredTheme] = useState<string | null>(null);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n const handleThemeChange = async (\n newTheme: string,\n event?: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (isControlled && contextTheme?.switchThemeFromElement && event) {\n await contextTheme.switchThemeFromElement(\n newTheme as Theme,\n event.currentTarget\n );\n if (onThemeChange) {\n onThemeChange(newTheme as Theme);\n }\n } else {\n await switchTheme(newTheme as Theme);\n }\n };\n\n const filteredOptions = THEME_OPTIONS.filter((option) =>\n themes.includes(option.value as Theme)\n );\n\n return (\n <div\n className={`\n inline-flex h-9 items-center overflow-hidden bg-background shadow-sm border border-border\n ${isMounted ? 'opacity-100' : 'opacity-0'}\n ${className || ''}\n `}\n style={{\n borderRadius: 'var(--radius)',\n backgroundColor: 'hsl(var(--background))',\n }}\n role=\"radiogroup\"\n onMouseLeave={() => setHoveredTheme(null)}\n >\n {filteredOptions.map((option) => (\n <ThemeOption\n key={option.value}\n icon={option.icon}\n value={option.value}\n isActive={theme === option.value}\n isHovered={hoveredTheme === option.value}\n onClick={handleThemeChange}\n onMouseEnter={() => setHoveredTheme(option.value)}\n onMouseLeave={() => {}}\n buttonRef={theme === option.value ? ref : undefined}\n />\n ))}\n </div>\n );\n};\n","'use client';\n\nimport * as React from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\n\nconst ChevronDownIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n);\n\nconst ChevronUpIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n);\n\nconst CheckIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n);\n\nfunction UISelect({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"ui-select\" {...props} />;\n}\n\nfunction UISelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"ui-select-group\" {...props} />;\n}\n\nfunction UISelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"ui-select-value\" {...props} />;\n}\n\nfunction UISelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"ui-select-trigger\"\n data-size={size}\n className={`\n border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50\n data-[size=default]:h-9 data-[size=sm]:h-8\n *:data-[slot=ui-select-value]:line-clamp-1\n *:data-[slot=ui-select-value]:flex\n *:data-[slot=ui-select-value]:items-center\n *:data-[slot=ui-select-value]:gap-2\n [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4\n ${className || ''}\n `}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction UISelectContent({\n className,\n children,\n position = 'popper',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"ui-select-content\"\n className={`\n bg-popover text-popover-foreground\n data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\n data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n relative z-50 max-h-[var(--radix-select-content-available-height)]\n min-w-[8rem] origin-[var(--radix-select-content-transform-origin)]\n overflow-x-hidden overflow-y-auto rounded-md border shadow-md\n ${position === 'popper' ? 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1' : ''}\n ${className || ''}\n `}\n position={position}\n {...props}\n >\n <SelectPrimitive.Viewport\n className={`\n p-1\n ${position === 'popper' ? 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]' : ''}\n `}\n >\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction UISelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"ui-select-label\"\n className={`py-1.5 pl-8 pr-2 text-sm font-semibold ${className || ''}`}\n {...props}\n />\n );\n}\n\nfunction UISelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"ui-select-item\"\n className={`\n focus:bg-accent focus:text-accent-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n relative flex w-full cursor-default items-center gap-2\n rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none\n data-[disabled]:pointer-events-none data-[disabled]:opacity-50\n [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4\n *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\n ${className || ''}\n `}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction UISelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"ui-select-separator\"\n className={`-mx-1 my-1 h-px bg-muted ${className || ''}`}\n {...props}\n />\n );\n}\n\nfunction UISelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"ui-select-scroll-up-button\"\n className={`flex cursor-default items-center justify-center py-1 ${className || ''}`}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction UISelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"ui-select-scroll-down-button\"\n className={`flex cursor-default items-center justify-center py-1 ${className || ''}`}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n UISelect,\n UISelectContent,\n UISelectGroup,\n UISelectItem,\n UISelectLabel,\n UISelectScrollDownButton,\n UISelectScrollUpButton,\n UISelectSeparator,\n UISelectTrigger,\n UISelectValue,\n};\n","'use client';\n\nimport React from 'react';\nimport { ColorTheme } from '../../core/types';\nimport { useTheme } from '../hooks/use-theme';\nimport { useUITheme, UIThemeContextType } from './UIThemeProvider';\nimport { UIThemeSelectorProps } from '../types';\nimport {\n UISelect,\n UISelectContent,\n UISelectItem,\n UISelectTrigger,\n UISelectValue,\n} from './ui/UISelect';\n\n/**\n * UI Theme Selector - A dropdown selector for color themes\n *\n * Can work both with UIThemeProvider context or standalone.\n * When used with UIThemeProvider, it automatically syncs theme state.\n */\nexport const UIThemeSelector: React.FC<UIThemeSelectorProps> = ({\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n currentColorTheme,\n onColorThemeChange,\n animationType,\n duration,\n className,\n placeholder = 'Choose a color theme',\n}) => {\n let contextTheme: UIThemeContextType | null = null;\n try {\n contextTheme = useUITheme();\n } catch {\n // Context not available, use standalone mode\n }\n\n const standaloneHook = useTheme({\n animationType,\n duration,\n themes,\n colorThemes,\n ...(currentColorTheme !== undefined && { colorTheme: currentColorTheme }),\n onColorThemeChange,\n });\n\n const isControlled = contextTheme !== null;\n const { colorTheme, setColorTheme } =\n isControlled && contextTheme\n ? {\n colorTheme: contextTheme.colorTheme,\n setColorTheme: contextTheme.setColorTheme,\n }\n : standaloneHook;\n\n const handleColorThemeChange = (newColorTheme: string) => {\n setColorTheme(newColorTheme as ColorTheme);\n if (onColorThemeChange) {\n onColorThemeChange(newColorTheme as ColorTheme);\n }\n };\n\n if (colorThemes.length <= 1) {\n return null;\n }\n\n return (\n <div className={`flex flex-col gap-2 ${className || ''}`}>\n <UISelect value={colorTheme} onValueChange={handleColorThemeChange}>\n <UISelectTrigger className=\"capitalize\">\n <UISelectValue placeholder={placeholder} />\n </UISelectTrigger>\n <UISelectContent>\n {colorThemes.map((theme) => (\n <UISelectItem key={theme} className=\"capitalize\" value={theme}>\n {theme}\n </UISelectItem>\n ))}\n </UISelectContent>\n </UISelect>\n </div>\n );\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/types.ts","../../src/core/constants.ts","../../src/core/animations.ts","../../src/core/storage.ts","../../src/react/hooks/use-theme.ts","../../src/react/components/NextUIThemeProvider.tsx","../../src/react/components/TanStackUIThemeProvider.tsx","../../src/react/components/ViteUIThemeProvider.tsx","../../src/react/components/UIThemeProvider.tsx","../../src/react/components/UIThemeSwitcher.tsx","../../src/react/components/ui/UISelect.tsx","../../src/react/components/UIThemeSelector.tsx"],"names":["ThemeAnimationType","isBrowser","useState","useEffect","useCallback","createContext","React","jsx","useContext","jsxs"],"mappings":";;;;;;AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AAHE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA;;;ACAL,IAAM,WAAA,GAAc;AACpB,IAAM,iBAAA,GAAoB;AAC1B,IAAM,iBAAA,GAAoB;AAC1B,IAAM,kBAAA,GAAqB;AAC3B,IAAM,gBAAA,GAAmB;AACzB,IAAM,cAAA,GAAiB;AACvB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,gBAAA,GAAmB;;;ACJhC,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AAKpC,IAAM,sBAAsB,MAAe;AACzC,EAAA,IAAI,CAAC,WAAW,OAAO,KAAA;AACvB,EAAA,OAAO,MAAA,CAAO,UAAA,IAAc,GAAA,IAAQ,MAAA,CAAO,WAAA,IAAe,GAAA;AAC5D,CAAA;AAKO,IAAM,mBAAmB,MAAY;AAC1C,EAAA,IAAI,CAAC,SAAA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,IACzB,eAAe,YAAA,CAAa;AAAA,GAC9B,GACA,cAAA;AAEN,EAAA,MAAM,sBAAA,GAAyB,CAAC,aAAA,KAA0B;AACxD,IAAA,aAAA,CAAc,aAA2B,CAAA;AACzC,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,kBAAA,CAAmB,aAA2B,CAAA;AAAA,IAChD;AAAA,EACF,CAAA;AAEA,EAAA,IAAI,WAAA,CAAY,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACEA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,uBAAuB,SAAA,IAAa,EAAE,CAAA,CAAA,EACpD,QAAA,kBAAAE,IAAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAO,UAAA,EAAY,eAAe,sBAAA,EAC1C,QAAA,EAAA;AAAA,oBAAAF,GAAAA,CAAC,mBAAgB,SAAA,EAAU,YAAA,EACzB,0BAAAA,GAAAA,CAAC,aAAA,EAAA,EAAc,aAA0B,CAAA,EAC3C,CAAA;AAAA,oBACAA,GAAAA,CAAC,eAAA,EAAA,EACE,QAAA,EAAA,WAAA,CAAY,GAAA,CAAI,CAAC,KAAA,qBAChBA,GAAAA,CAAC,YAAA,EAAA,EAAyB,WAAU,YAAA,EAAa,KAAA,EAAO,OACrD,QAAA,EAAA,KAAA,EAAA,EADgB,KAEnB,CACD,CAAA,EACH;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["export enum ThemeAnimationType {\n CIRCLE = 'circle',\n BLUR_CIRCLE = 'blur-circle',\n SLIDE = 'slide',\n}\n\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ColorTheme = string;\n\nexport type SlideDirection =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface AnimationConfig {\n a?: number;\n b?: number;\n x: number;\n y: number;\n duration: number;\n easing: string;\n animationType: ThemeAnimationType;\n blurAmount: number;\n styleId: string;\n}\n\nexport interface ThemeConfig {\n themes?: Theme[];\n colorThemes?: ColorTheme[];\n defaultTheme?: Theme;\n defaultColorTheme?: ColorTheme;\n globalClassName?: string;\n colorThemePrefix?: string;\n storageKey?: string;\n colorStorageKey?: string;\n}\n\nexport interface ThemeState {\n theme: Theme;\n colorTheme: ColorTheme;\n resolvedTheme: 'light' | 'dark';\n}\n","export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { Theme, ColorTheme } from './types';\nimport { STORAGE_KEY, COLOR_STORAGE_KEY } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Gets the stored theme from localStorage\n * @param key - Storage key for the theme\n * @param validThemes - Array of valid theme values\n * @param defaultTheme - Default theme if stored value is invalid\n * @returns The stored theme or default\n */\nexport const getStoredTheme = (\n key: string = STORAGE_KEY,\n validThemes: Theme[] = ['light', 'dark', 'system'],\n defaultTheme: Theme = 'system'\n): Theme => {\n if (!isBrowser) return defaultTheme;\n\n const saved = localStorage.getItem(key) as Theme | null;\n return saved && validThemes.includes(saved) ? saved : defaultTheme;\n};\n\n/**\n * Stores theme in localStorage\n * @param theme - Theme to store\n * @param key - Storage key for the theme\n */\nexport const setStoredTheme = (\n theme: Theme,\n key: string = STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, theme);\n};\n\n/**\n * Gets the stored color theme from localStorage\n * @param key - Storage key for the color theme\n * @param validColorThemes - Array of valid color theme values\n * @param defaultColorTheme - Default color theme if stored value is invalid\n * @returns The stored color theme or default\n */\nexport const getStoredColorTheme = (\n key: string = COLOR_STORAGE_KEY,\n validColorThemes: ColorTheme[] = ['default'],\n defaultColorTheme: ColorTheme = 'default'\n): ColorTheme => {\n if (!isBrowser) return defaultColorTheme;\n\n const saved = localStorage.getItem(key);\n return saved && validColorThemes.includes(saved) ? saved : defaultColorTheme;\n};\n\n/**\n * Stores color theme in localStorage\n * @param colorTheme - Color theme to store\n * @param key - Storage key for the color theme\n */\nexport const setStoredColorTheme = (\n colorTheme: ColorTheme,\n key: string = COLOR_STORAGE_KEY\n): void => {\n if (!isBrowser) return;\n localStorage.setItem(key, colorTheme);\n};\n","import { useEffect, useRef, useState, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\nimport { ThemeAnimationType, Theme, AnimationConfig } from '../../core/types';\nimport {\n injectBaseStyles,\n resolveTheme,\n getSystemTheme,\n supportsViewTransitions,\n prefersReducedMotion,\n createCircleAnimation,\n createBlurCircleAnimation,\n createSlideAnimation,\n getSlideFromCoords,\n} from '../../core/animations';\nimport {\n getStoredTheme,\n setStoredTheme,\n getStoredColorTheme,\n setStoredColorTheme,\n} from '../../core/storage';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n DEFAULT_DURATION,\n DEFAULT_EASING,\n DEFAULT_BLUR_AMOUNT,\n DEFAULT_STYLE_ID,\n} from '../../core/constants';\nimport { UseThemeProps, UseThemeReturn } from '../types';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * React hook for theme switching with View Transitions API animations\n * @param props - Configuration options for the theme animation\n * @returns Theme state and control functions\n */\nexport const useTheme = (props: UseThemeProps = {}): UseThemeReturn => {\n const {\n duration: propsDuration = DEFAULT_DURATION,\n easing = DEFAULT_EASING,\n animationType = ThemeAnimationType.CIRCLE,\n blurAmount = DEFAULT_BLUR_AMOUNT,\n styleId = DEFAULT_STYLE_ID,\n\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n\n theme: externalTheme,\n colorTheme: externalColorTheme,\n\n onThemeChange,\n onColorThemeChange,\n\n slideDirection = 'left',\n slideFromX,\n slideFromY,\n slideToX = 0,\n slideToY = 0,\n\n initialTheme,\n initialColorTheme,\n systemThemeMode = 'js',\n } = props;\n\n const isHighResolution =\n isBrowser && (window.innerWidth >= 3000 || window.innerHeight >= 2000);\n const duration = isHighResolution\n ? Math.max(propsDuration * 0.8, 500)\n : propsDuration;\n\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n injectBaseStyles();\n setMounted(true);\n }, []);\n\n const [internalTheme, setInternalTheme] = useState<Theme>(() => {\n if (initialTheme !== undefined) return initialTheme;\n return getStoredTheme(storageKey, themes, defaultTheme);\n });\n\n const [internalColorTheme, setInternalColorTheme] = useState(() => {\n if (initialColorTheme !== undefined) return initialColorTheme;\n return getStoredColorTheme(colorStorageKey, colorThemes, defaultColorTheme);\n });\n\n const currentTheme = externalTheme ?? internalTheme;\n const currentColorTheme = externalColorTheme ?? internalColorTheme;\n\n const [, setSystemTheme] = useState<'light' | 'dark'>(() => getSystemTheme());\n const resolvedTheme = resolveTheme(currentTheme);\n\n useEffect(() => {\n if (!isBrowser) return;\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handleChange = () => setSystemTheme(getSystemTheme());\n\n mediaQuery.addEventListener('change', handleChange);\n return () => mediaQuery.removeEventListener('change', handleChange);\n }, []);\n\n useEffect(() => {\n if (!isBrowser || !mounted) return;\n\n const el = document.documentElement;\n\n if (systemThemeMode === 'css' && currentTheme === 'system') {\n // CSS mode: use 'system' class, let CSS @media handle dark/light\n el.classList.remove(globalClassName);\n el.classList.remove('auto');\n el.classList.remove('system');\n el.classList.add('system');\n el.style.colorScheme = '';\n } else {\n // JS mode or explicit light/dark: resolve and apply\n el.classList.remove('system');\n el.classList.remove('auto');\n if (resolvedTheme === 'dark') {\n el.classList.add(globalClassName);\n } else {\n el.classList.remove(globalClassName);\n }\n el.style.colorScheme = resolvedTheme;\n }\n\n colorThemes.forEach((theme) => {\n el.classList.remove(`${colorThemePrefix}${theme}`);\n });\n el.classList.add(`${colorThemePrefix}${currentColorTheme}`);\n }, [\n resolvedTheme,\n currentTheme,\n currentColorTheme,\n globalClassName,\n colorThemePrefix,\n colorThemes,\n mounted,\n systemThemeMode,\n ]);\n\n const ref = useRef<HTMLButtonElement>(null);\n\n const setTheme = useCallback(\n (newTheme: Theme) => {\n setStoredTheme(newTheme, storageKey);\n\n if (externalTheme === undefined) {\n setInternalTheme(newTheme);\n }\n\n if (onThemeChange) {\n onThemeChange(newTheme);\n }\n },\n [onThemeChange, externalTheme, storageKey]\n );\n\n const setColorTheme = useCallback(\n (newColorTheme: string) => {\n setStoredColorTheme(newColorTheme, colorStorageKey);\n\n if (externalColorTheme === undefined) {\n setInternalColorTheme(newColorTheme);\n }\n\n if (onColorThemeChange) {\n onColorThemeChange(newColorTheme);\n }\n },\n [onColorThemeChange, externalColorTheme, colorStorageKey]\n );\n\n const switchTheme = useCallback(\n async (newTheme: Theme, animationOff: boolean = false) => {\n if (\n !ref.current ||\n !supportsViewTransitions() ||\n prefersReducedMotion() ||\n animationOff\n ) {\n setTheme(newTheme);\n return;\n }\n\n let animationConfig: AnimationConfig;\n\n if (animationType === ThemeAnimationType.SLIDE) {\n const fromCoords =\n slideFromX !== undefined && slideFromY !== undefined\n ? { a: slideFromX, b: slideFromY }\n : getSlideFromCoords(slideDirection);\n\n animationConfig = {\n a: fromCoords.a,\n b: fromCoords.b,\n x: slideToX,\n y: slideToY,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n };\n } else {\n const { top, left, width, height } =\n ref.current.getBoundingClientRect();\n const x = left + width / 2;\n const y = top + height / 2;\n\n animationConfig = {\n x,\n y,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n };\n }\n\n if (animationType === ThemeAnimationType.BLUR_CIRCLE) {\n createBlurCircleAnimation(animationConfig);\n }\n\n if (animationType === ThemeAnimationType.SLIDE) {\n createSlideAnimation(animationConfig);\n }\n\n await (document as Document).startViewTransition(() => {\n flushSync(() => {\n setTheme(newTheme);\n });\n }).ready;\n\n if (animationType === ThemeAnimationType.CIRCLE) {\n createCircleAnimation(animationConfig);\n }\n },\n [\n setTheme,\n duration,\n easing,\n animationType,\n blurAmount,\n styleId,\n slideDirection,\n slideFromX,\n slideFromY,\n slideToX,\n slideToY,\n ]\n );\n\n const switchColorTheme = useCallback(\n (newColorTheme: string) => {\n if (colorThemes.indexOf(newColorTheme) === -1) {\n console.warn(\n `Color theme \"${newColorTheme}\" not found in available themes`\n );\n return;\n }\n setColorTheme(newColorTheme);\n },\n [colorThemes, setColorTheme]\n );\n\n const toggleTheme = useCallback(\n async (animationOff: boolean = false) => {\n const newTheme: Theme = resolvedTheme === 'dark' ? 'light' : 'dark';\n await switchTheme(newTheme, animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleLightTheme = useCallback(\n async (animationOff: boolean = false) => {\n if (resolvedTheme === 'light') return;\n await switchTheme('light', animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleDarkTheme = useCallback(\n async (animationOff: boolean = false) => {\n if (resolvedTheme === 'dark') return;\n await switchTheme('dark', animationOff);\n },\n [resolvedTheme, switchTheme]\n );\n\n const toggleColorTheme = useCallback(() => {\n const currentIndex = colorThemes.indexOf(currentColorTheme);\n const nextIndex = (currentIndex + 1) % colorThemes.length;\n const nextColorTheme = colorThemes[nextIndex];\n setColorTheme(nextColorTheme);\n }, [currentColorTheme, colorThemes, setColorTheme]);\n\n const createColorThemeToggle = useCallback(\n (targetColorTheme: string) => {\n return () => {\n if (colorThemes.indexOf(targetColorTheme) === -1) {\n console.warn(\n `Color theme \"${targetColorTheme}\" not found in available themes`\n );\n return;\n }\n setColorTheme(targetColorTheme);\n };\n },\n [colorThemes, setColorTheme]\n );\n\n const isColorThemeActive = useCallback(\n (targetColorTheme: string) => {\n return currentColorTheme === targetColorTheme;\n },\n [currentColorTheme]\n );\n\n return {\n ref,\n theme: currentTheme,\n colorTheme: currentColorTheme,\n resolvedTheme,\n setTheme,\n setColorTheme,\n switchTheme,\n switchColorTheme,\n toggleTheme,\n toggleLightTheme,\n toggleDarkTheme,\n toggleColorTheme,\n createColorThemeToggle,\n isColorThemeActive,\n };\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useState,\n useEffect,\n useCallback,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n} from '../../core/constants';\n\n/**\n * Context type for the Next.js UI Theme Provider\n */\nexport interface NextUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst NextUIThemeContext = createContext<NextUIThemeContextType | undefined>(\n undefined\n);\n\n/**\n * Props for the Next.js UI Theme Provider\n */\nexport interface NextUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme preference */\n storageKey?: string;\n /** Storage key for color theme preference */\n colorStorageKey?: string;\n /** HTML attribute to use for theme ('class' or 'data-theme') */\n attribute?: 'class' | 'data-theme';\n /** Class name for dark theme (when using 'class' attribute) */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /** CSP nonce for inline script (SSR apps) */\n nonce?: string;\n /** Skip animation during initial hydration */\n disableAnimationOnInit?: boolean;\n /** Disable flash prevention script (for SPAs without SSR) */\n disablePreHydrationScript?: boolean;\n}\n\n/**\n * Pre-hydration script content generator\n * This script runs BEFORE React hydrates to prevent flash of wrong theme\n */\nconst generatePreHydrationScript = (\n storageKey: string,\n colorStorageKey: string,\n defaultTheme: Theme,\n defaultColorTheme: ColorTheme,\n attribute: 'class' | 'data-theme',\n globalClassName: string,\n colorThemePrefix: string\n): string => {\n return `\n(function() {\n try {\n var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';\n var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';\n var resolved = theme === 'system' \n ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n : theme;\n \n if ('${attribute}' === 'class') {\n if (resolved === 'dark') {\n document.documentElement.classList.add('${globalClassName}');\n } else {\n document.documentElement.classList.remove('${globalClassName}');\n }\n } else {\n document.documentElement.setAttribute('data-theme', resolved);\n }\n \n document.documentElement.style.colorScheme = resolved;\n document.documentElement.classList.add('${colorThemePrefix}' + colorTheme);\n } catch (e) {\n console.warn('Theme pre-hydration script failed:', e);\n }\n})();\n`;\n};\n\n/**\n * Pre-hydration script component\n * Injects inline script before React hydration to prevent theme flash\n */\nconst ThemePreHydrationScript: React.FC<{\n storageKey: string;\n colorStorageKey: string;\n defaultTheme: Theme;\n defaultColorTheme: ColorTheme;\n attribute: 'class' | 'data-theme';\n globalClassName: string;\n colorThemePrefix: string;\n nonce?: string;\n}> = React.memo(\n ({\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n attribute,\n globalClassName,\n colorThemePrefix,\n nonce,\n }) => {\n const scriptContent = generatePreHydrationScript(\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n attribute,\n globalClassName,\n colorThemePrefix\n );\n\n return (\n <script\n nonce={nonce}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: scriptContent }}\n />\n );\n }\n);\n\nThemePreHydrationScript.displayName = 'ThemePreHydrationScript';\n\n/**\n * Next.js UI Theme Provider - Universal React theme management with animations\n *\n * This provider works with Next.js and provides flash prevention\n * via pre-hydration script injection.\n *\n * Features:\n * - Pre-hydration script for flash prevention (SSR apps)\n * - Animated theme transitions via View Transitions API\n * - Multi-dimensional theming (theme + colorTheme)\n * - System theme detection\n * - CSP support via nonce prop\n *\n * @param props - Provider configuration options\n */\nexport const NextUIThemeProvider: React.FC<NextUIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n attribute = 'class',\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n nonce,\n disableAnimationOnInit = true,\n disablePreHydrationScript = false,\n}) => {\n const [mounted, setMounted] = useState(false);\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName: attribute === 'class' ? globalClassName : undefined,\n colorThemePrefix,\n });\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const switchThemeWithHydrationAwareness = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n if (!mounted && disableAnimationOnInit) {\n themeState.setTheme(theme);\n } else {\n await themeState.switchTheme(theme, animationOff);\n }\n },\n [mounted, disableAnimationOnInit, themeState]\n );\n\n const switchThemeFromElement = useCallback(\n async (theme: Theme, element: HTMLButtonElement) => {\n if (!mounted && disableAnimationOnInit) {\n themeState.setTheme(theme);\n return;\n }\n\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n },\n [mounted, disableAnimationOnInit, themeState]\n );\n\n const systemTheme =\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\n if (!mounted) {\n const loadingContextValue: NextUIThemeContextType = {\n ref: { current: null },\n theme: defaultTheme,\n colorTheme: defaultColorTheme,\n resolvedTheme: defaultTheme === 'dark' ? 'dark' : 'light',\n systemTheme: 'light',\n setTheme: () => {},\n setColorTheme: () => {},\n switchTheme: async () => {},\n switchThemeFromElement: async () => {},\n switchColorTheme: () => {},\n toggleTheme: async () => {},\n toggleLightTheme: async () => {},\n toggleDarkTheme: async () => {},\n toggleColorTheme: () => {},\n createColorThemeToggle: () => () => {},\n isColorThemeActive: () => false,\n };\n\n return (\n <NextUIThemeContext.Provider value={loadingContextValue}>\n {!disablePreHydrationScript && (\n <ThemePreHydrationScript\n storageKey={storageKey}\n colorStorageKey={colorStorageKey}\n defaultTheme={defaultTheme}\n defaultColorTheme={defaultColorTheme}\n attribute={attribute}\n globalClassName={globalClassName}\n colorThemePrefix={colorThemePrefix}\n nonce={nonce}\n />\n )}\n {children}\n </NextUIThemeContext.Provider>\n );\n }\n\n const contextValue: NextUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n setTheme: themeState.setTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: switchThemeWithHydrationAwareness,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: themeState.toggleTheme,\n toggleLightTheme: themeState.toggleLightTheme,\n toggleDarkTheme: themeState.toggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <NextUIThemeContext.Provider value={contextValue}>\n {!disablePreHydrationScript && (\n <ThemePreHydrationScript\n storageKey={storageKey}\n colorStorageKey={colorStorageKey}\n defaultTheme={defaultTheme}\n defaultColorTheme={defaultColorTheme}\n attribute={attribute}\n globalClassName={globalClassName}\n colorThemePrefix={colorThemePrefix}\n nonce={nonce}\n />\n )}\n {children}\n </NextUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the Next.js UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of NextUIThemeProvider\n */\nexport const useNextUITheme = (): NextUIThemeContextType => {\n const context = useContext(NextUIThemeContext);\n if (context === undefined) {\n throw new Error('useNextUITheme must be used within a NextUIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useCallback,\n useEffect,\n useSyncExternalStore,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport {\n STORAGE_KEY,\n COLOR_STORAGE_KEY,\n GLOBAL_CLASS_NAME,\n COLOR_THEME_PREFIX,\n} from '../../core/constants';\nimport { setStoredTheme, setStoredColorTheme } from '../../core/storage';\nimport type { SystemThemeMode } from '../types';\n\n/**\n * Context type for the TanStack Start UI Theme Provider\n */\nexport interface TanStackUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Whether the component is hydrated */\n isHydrated: boolean;\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst TanStackUIThemeContext = createContext<\n TanStackUIThemeContextType | undefined\n>(undefined);\n\n/**\n * Props for the TanStack Start UI Theme Provider\n */\nexport interface TanStackUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme preference */\n storageKey?: string;\n /** Storage key for color theme preference */\n colorStorageKey?: string;\n /** Class name for dark theme */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /**\n * Server-resolved theme class from cookie (e.g., 'light', 'dark', 'system').\n * When provided, prevents flash by using this as the initial value during SSR.\n * Typically obtained via `getThemeServerFn()` in `beforeLoad`.\n */\n serverTheme?: 'light' | 'dark' | 'system';\n /**\n * Server-resolved color theme from cookie.\n * When provided, prevents color theme flash during SSR.\n */\n serverColorTheme?: string;\n /**\n * How to handle 'system' theme resolution.\n * - 'css': Apply 'system' class on <html>, let CSS @media queries handle it (zero flash, requires CSS setup)\n * - 'js': Resolve via matchMedia in JS (works with existing CSS, may flash briefly)\n * @default 'css'\n */\n systemThemeMode?: SystemThemeMode;\n /**\n * Callback to persist theme to server (cookie).\n * Called alongside localStorage updates when user changes theme.\n * Typically `setThemeServerFn` from `createThemeServerFns()`.\n */\n onServerThemeChange?: (theme: Theme) => Promise<void> | void;\n /**\n * Callback to persist color theme to server (cookie).\n * Called alongside localStorage updates when user changes color theme.\n * Typically `setColorThemeServerFn` from `createThemeServerFns()`.\n */\n onServerColorThemeChange?: (colorTheme: string) => Promise<void> | void;\n}\n\n/**\n * Props for the TanStackStartThemeScript component\n */\nexport interface TanStackStartThemeScriptProps {\n /** Storage key for theme preference in localStorage */\n storageKey?: string;\n /** Storage key for color theme preference in localStorage */\n colorStorageKey?: string;\n /** Default theme when nothing is stored */\n defaultTheme?: Theme;\n /** Default color theme when nothing is stored */\n defaultColorTheme?: ColorTheme;\n /** Class name for dark theme */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n /** CSP nonce for the inline script */\n nonce?: string;\n /**\n * How to handle 'system' theme.\n * - 'css': Apply 'system' class (let CSS handle dark via media query)\n * - 'js': Resolve via matchMedia and apply 'dark' or remove class\n * @default 'js'\n */\n systemThemeMode?: SystemThemeMode;\n}\n\n/**\n * Generates the pre-hydration script content for flash prevention.\n * This script runs synchronously before React hydrates.\n */\nconst generateTanStackPreHydrationScript = (\n storageKey: string,\n colorStorageKey: string,\n defaultTheme: Theme,\n defaultColorTheme: ColorTheme,\n globalClassName: string,\n colorThemePrefix: string,\n systemThemeMode: SystemThemeMode\n): string => {\n return `\n(function() {\n try {\n var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';\n var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';\n var el = document.documentElement;\n var resolved;\n if (theme === 'system') {\n if ('${systemThemeMode}' === 'css') {\n el.classList.remove('${globalClassName}');\n el.classList.remove('auto');\n el.classList.remove('system');\n el.classList.add('system');\n el.style.colorScheme = '';\n } else {\n resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n if (resolved === 'dark') {\n el.classList.add('${globalClassName}');\n } else {\n el.classList.remove('${globalClassName}');\n }\n el.classList.remove('system');\n el.classList.remove('auto');\n el.style.colorScheme = resolved;\n }\n } else {\n resolved = theme;\n el.classList.remove('system');\n el.classList.remove('auto');\n if (resolved === 'dark') {\n el.classList.add('${globalClassName}');\n } else {\n el.classList.remove('${globalClassName}');\n }\n el.style.colorScheme = resolved;\n }\n if (colorTheme && colorTheme !== 'default') {\n el.classList.add('${colorThemePrefix}' + colorTheme);\n }\n } catch (e) {\n console.warn('Theme pre-hydration script failed:', e);\n }\n})();\n`;\n};\n\n/**\n * Pre-hydration script for TanStack Start applications.\n *\n * Place this in the `<head>` of your `shellComponent` to prevent theme flash\n * when not using the cookie-based approach.\n *\n * Reads the theme preference from localStorage and applies the correct classes\n * and colorScheme to `<html>` before React hydrates.\n *\n * @example\n * ```tsx\n * function RootDocument({ children }: { children: React.ReactNode }) {\n * return (\n * <html lang=\"en\" suppressHydrationWarning>\n * <head>\n * <TanStackStartThemeScript />\n * <HeadContent />\n * </head>\n * <body>{children}<Scripts /></body>\n * </html>\n * );\n * }\n * ```\n */\nexport const TanStackStartThemeScript: React.FC<TanStackStartThemeScriptProps> =\n React.memo(\n ({\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n nonce,\n systemThemeMode = 'js',\n }) => {\n const scriptContent = generateTanStackPreHydrationScript(\n storageKey,\n colorStorageKey,\n defaultTheme,\n defaultColorTheme,\n globalClassName,\n colorThemePrefix,\n systemThemeMode\n );\n\n return (\n <script\n nonce={nonce}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: scriptContent }}\n />\n );\n }\n );\n\nTanStackStartThemeScript.displayName = 'TanStackStartThemeScript';\n\n/**\n * Custom hook to detect hydration state\n * Compatible with TanStack Start's isomorphic model\n */\nconst useHydrated = (): boolean => {\n return useSyncExternalStore(\n () => () => {},\n () => true,\n () => false\n );\n};\n\n/**\n * TanStack Start UI Theme Provider - Flash-free dark mode for TanStack Start\n *\n * Supports two approaches for preventing theme flash:\n *\n * **Option A — Cookie-based (recommended, zero flash):**\n * Pass `serverTheme` and `serverColorTheme` from route context (obtained via\n * `getThemeServerFn()` in `beforeLoad`). The server renders the correct classes\n * on `<html>`, and this provider syncs localStorage on the client.\n *\n * **Option B — Pre-hydration script:**\n * Use `<TanStackStartThemeScript>` in your shellComponent's `<head>`.\n * Reads from localStorage before React hydrates.\n *\n * Both approaches support `systemThemeMode`:\n * - `'css'`: Applies 'system' class, CSS media queries handle dark mode\n * - `'js'`: Resolves system theme via matchMedia in JS\n *\n * @param props - Provider configuration options\n */\nexport const TanStackUIThemeProvider: React.FC<\n TanStackUIThemeProviderProps\n> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey = STORAGE_KEY,\n colorStorageKey = COLOR_STORAGE_KEY,\n globalClassName = GLOBAL_CLASS_NAME,\n colorThemePrefix = COLOR_THEME_PREFIX,\n serverTheme,\n serverColorTheme,\n systemThemeMode = 'css',\n onServerThemeChange,\n onServerColorThemeChange,\n}) => {\n const isHydrated = useHydrated();\n const hasServerTheme = serverTheme !== undefined;\n\n // Derive initialTheme from serverTheme for the useTheme hook\n const initialTheme: Theme | undefined = hasServerTheme\n ? serverTheme === 'system'\n ? 'system'\n : serverTheme\n : undefined;\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName,\n colorThemePrefix,\n systemThemeMode,\n initialTheme,\n initialColorTheme: serverColorTheme,\n });\n\n // Sync localStorage with server-provided values on first hydration\n useEffect(() => {\n if (!hasServerTheme) return;\n if (initialTheme) {\n setStoredTheme(initialTheme, storageKey);\n }\n if (serverColorTheme) {\n setStoredColorTheme(serverColorTheme, colorStorageKey);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps -- only on mount\n\n // Wrap setTheme to also call server callback\n const setThemeWithServer = useCallback(\n (newTheme: Theme) => {\n themeState.setTheme(newTheme);\n if (onServerThemeChange) {\n onServerThemeChange(newTheme);\n }\n },\n [themeState, onServerThemeChange]\n );\n\n // Wrap setColorTheme to also call server callback\n const setColorThemeWithServer = useCallback(\n (newColorTheme: string) => {\n themeState.setColorTheme(newColorTheme);\n if (onServerColorThemeChange) {\n onServerColorThemeChange(newColorTheme);\n }\n },\n [themeState, onServerColorThemeChange]\n );\n\n const switchThemeWithHydrationAwareness = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer(theme);\n } else {\n await themeState.switchTheme(theme, animationOff);\n if (onServerThemeChange) {\n onServerThemeChange(theme);\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n const nextTheme =\n themeState.resolvedTheme === 'dark' ? 'light' : 'dark';\n setThemeWithServer(nextTheme);\n } else {\n await themeState.toggleTheme(animationOff);\n const nextTheme =\n themeState.resolvedTheme === 'dark' ? 'light' : 'dark';\n if (onServerThemeChange) {\n onServerThemeChange(nextTheme);\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleLightThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer('light');\n } else {\n await themeState.toggleLightTheme(animationOff);\n if (onServerThemeChange) {\n onServerThemeChange('light');\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const toggleDarkThemeWithHydrationAwareness = useCallback(\n async (animationOff: boolean = false) => {\n if (!isHydrated) {\n setThemeWithServer('dark');\n } else {\n await themeState.toggleDarkTheme(animationOff);\n if (onServerThemeChange) {\n onServerThemeChange('dark');\n }\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const switchColorThemeWithServer = useCallback(\n (newColorTheme: string) => {\n themeState.switchColorTheme(newColorTheme);\n if (onServerColorThemeChange) {\n onServerColorThemeChange(newColorTheme);\n }\n },\n [themeState, onServerColorThemeChange]\n );\n\n const switchThemeFromElement = useCallback(\n async (theme: Theme, element: HTMLButtonElement) => {\n if (!isHydrated) {\n setThemeWithServer(theme);\n return;\n }\n\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n if (onServerThemeChange) {\n onServerThemeChange(theme);\n }\n },\n [isHydrated, themeState, setThemeWithServer, onServerThemeChange]\n );\n\n const systemTheme =\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\n // Compute the resolvedTheme for the server (pre-hydration) context\n const serverResolvedTheme: 'light' | 'dark' = (() => {\n if (hasServerTheme) {\n if (serverTheme === 'dark') return 'dark';\n if (serverTheme === 'system') return systemTheme;\n return 'light';\n }\n return defaultTheme === 'dark' ? 'dark' : 'light';\n })();\n\n if (!isHydrated) {\n const loadingContextValue: TanStackUIThemeContextType = {\n ref: { current: null },\n theme: initialTheme ?? defaultTheme,\n colorTheme: serverColorTheme ?? defaultColorTheme,\n resolvedTheme: serverResolvedTheme,\n systemTheme: 'light',\n isHydrated: false,\n setTheme: setThemeWithServer,\n setColorTheme: setColorThemeWithServer,\n switchTheme: async (theme: Theme) => setThemeWithServer(theme),\n switchThemeFromElement: async (theme: Theme) => setThemeWithServer(theme),\n switchColorTheme: switchColorThemeWithServer,\n toggleTheme: async () => {\n const nextTheme = serverResolvedTheme === 'dark' ? 'light' : 'dark';\n setThemeWithServer(nextTheme);\n },\n toggleLightTheme: async () => setThemeWithServer('light'),\n toggleDarkTheme: async () => setThemeWithServer('dark'),\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <TanStackUIThemeContext.Provider value={loadingContextValue}>\n {children}\n </TanStackUIThemeContext.Provider>\n );\n }\n\n const contextValue: TanStackUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n isHydrated: true,\n setTheme: setThemeWithServer,\n setColorTheme: setColorThemeWithServer,\n switchTheme: switchThemeWithHydrationAwareness,\n switchThemeFromElement,\n switchColorTheme: switchColorThemeWithServer,\n toggleTheme: toggleThemeWithHydrationAwareness,\n toggleLightTheme: toggleLightThemeWithHydrationAwareness,\n toggleDarkTheme: toggleDarkThemeWithHydrationAwareness,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <TanStackUIThemeContext.Provider value={contextValue}>\n {children}\n </TanStackUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the TanStack UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of TanStackUIThemeProvider\n */\nexport const useTanStackUITheme = (): TanStackUIThemeContextType => {\n const context = useContext(TanStackUIThemeContext);\n if (context === undefined) {\n throw new Error(\n 'useTanStackUITheme must be used within a TanStackUIThemeProvider'\n );\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useCallback,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\nimport { getSystemTheme } from '../../core/animations';\n\n/**\n * Context type for the Vite UI Theme Provider\n */\nexport interface ViteUIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** System theme preference */\n systemTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst ViteUIThemeContext = createContext<ViteUIThemeContextType | undefined>(\n undefined\n);\n\n/**\n * Props for the Vite UI Theme Provider\n */\nexport interface ViteUIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Attribute to use for theme ('class' or 'data-theme') */\n attribute?: 'class' | 'data-theme';\n /** Disable transitions during theme change */\n disableTransitionOnChange?: boolean;\n /** Storage key for theme */\n storageKey?: string;\n /** Storage key for color theme */\n colorStorageKey?: string;\n /** Class name for dark mode */\n globalClassName?: string;\n /** Prefix for color theme classes */\n colorThemePrefix?: string;\n}\n\n/**\n * Vite UI Theme Provider - Theme provider optimized for Vite/SPA applications\n *\n * This provider includes additional features like transition disabling\n * and system theme tracking that are useful in client-side applications.\n *\n * Note: For flash prevention on initial load, add a script to your index.html\n * or inject it via Vite plugin to apply theme before React loads.\n *\n * @param props - Provider configuration options\n */\nexport const ViteUIThemeProvider: React.FC<ViteUIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n attribute = 'class',\n disableTransitionOnChange = false,\n storageKey = 'ui-theme',\n colorStorageKey = 'ui-color-theme',\n globalClassName = 'dark',\n colorThemePrefix = 'theme-',\n}) => {\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n globalClassName: attribute === 'class' ? globalClassName : undefined,\n colorThemePrefix,\n });\n\n const applyTransitionDisable = useCallback(() => {\n if (!disableTransitionOnChange) return () => {};\n\n const css = document.createElement('style');\n css.textContent = `*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;\n document.head.appendChild(css);\n\n window.getComputedStyle(document.body);\n\n return () => {\n setTimeout(() => {\n document.head.removeChild(css);\n }, 1);\n };\n }, [disableTransitionOnChange]);\n\n const wrappedSetTheme = useCallback(\n (theme: Theme) => {\n const cleanup = applyTransitionDisable();\n themeState.setTheme(theme);\n cleanup();\n },\n [themeState.setTheme, applyTransitionDisable]\n );\n\n const wrappedSwitchTheme = useCallback(\n async (theme: Theme, animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.switchTheme(theme, animationOff);\n cleanup();\n },\n [themeState.switchTheme, applyTransitionDisable]\n );\n\n const wrappedToggleTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleTheme(animationOff);\n cleanup();\n },\n [themeState.toggleTheme, applyTransitionDisable]\n );\n\n const wrappedToggleLightTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleLightTheme(animationOff);\n cleanup();\n },\n [themeState.toggleLightTheme, applyTransitionDisable]\n );\n\n const wrappedToggleDarkTheme = useCallback(\n async (animationOff: boolean = false) => {\n const cleanup = applyTransitionDisable();\n await themeState.toggleDarkTheme(animationOff);\n cleanup();\n },\n [themeState.toggleDarkTheme, applyTransitionDisable]\n );\n\n const switchThemeFromElement = async (\n theme: Theme,\n element: HTMLButtonElement\n ) => {\n const cleanup = applyTransitionDisable();\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n cleanup();\n };\n\n const systemTheme = getSystemTheme();\n\n const contextValue: ViteUIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n systemTheme,\n setTheme: wrappedSetTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: wrappedSwitchTheme,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: wrappedToggleTheme,\n toggleLightTheme: wrappedToggleLightTheme,\n toggleDarkTheme: wrappedToggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <ViteUIThemeContext.Provider value={contextValue}>\n {children}\n </ViteUIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the Vite UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of ViteUIThemeProvider\n */\nexport const useViteUITheme = (): ViteUIThemeContextType => {\n const context = useContext(ViteUIThemeContext);\n if (context === undefined) {\n throw new Error('useViteUITheme must be used within a ViteUIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n ReactNode,\n useState,\n useEffect,\n} from 'react';\nimport { useTheme } from '../hooks/use-theme';\nimport { Theme, ColorTheme, ThemeAnimationType } from '../../core/types';\n\n/**\n * Context type for the UI Theme Provider\n */\nexport interface UIThemeContextType {\n /** Ref to attach to the trigger button */\n ref: React.RefObject<HTMLButtonElement | null>;\n /** Current theme value */\n theme: Theme;\n /** Current color theme value */\n colorTheme: ColorTheme;\n /** Resolved theme (light or dark) */\n resolvedTheme: 'light' | 'dark';\n /** Set theme without animation */\n setTheme: (theme: Theme) => void;\n /** Set color theme */\n setColorTheme: (colorTheme: ColorTheme) => void;\n /** Switch theme with animation */\n switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;\n /** Switch color theme */\n switchColorTheme: (colorTheme: string) => void;\n /** Toggle between light and dark */\n toggleTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to light theme with animation */\n toggleLightTheme: (animationOff?: boolean) => Promise<void>;\n /** Switch to dark theme with animation */\n toggleDarkTheme: (animationOff?: boolean) => Promise<void>;\n /** Cycle through color themes */\n toggleColorTheme: () => void;\n /** Create a toggle function for a specific color theme */\n createColorThemeToggle: (targetColorTheme: string) => () => void;\n /** Check if a color theme is active */\n isColorThemeActive: (targetColorTheme: string) => boolean;\n /** Switch theme from a specific element (for animation origin) */\n switchThemeFromElement: (\n theme: Theme,\n element: HTMLButtonElement\n ) => Promise<void>;\n}\n\nconst UIThemeContext = createContext<UIThemeContextType | undefined>(undefined);\n\n/**\n * Props for the UI Theme Provider\n */\nexport interface UIThemeProviderProps {\n /** React children to wrap with theme context */\n children: ReactNode;\n /** Available theme options */\n themes?: Theme[];\n /** Available color theme options */\n colorThemes?: ColorTheme[];\n /** Default theme to use */\n defaultTheme?: Theme;\n /** Default color theme to use */\n defaultColorTheme?: ColorTheme;\n /** Animation type for theme transitions */\n animationType?: ThemeAnimationType;\n /** Animation duration in milliseconds */\n duration?: number;\n /** Storage key for theme */\n storageKey?: string;\n /** Storage key for color theme */\n colorStorageKey?: string;\n}\n\n/**\n * UI Theme Provider - Provides centralized theme state management\n *\n * This provider creates a single source of truth for theme state using the useTheme hook.\n * All theme-related components should consume from this context to ensure synchronization.\n *\n * @param props - Provider configuration options\n */\nexport const UIThemeProvider: React.FC<UIThemeProviderProps> = ({\n children,\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n animationType = ThemeAnimationType.CIRCLE,\n duration = 750,\n storageKey,\n colorStorageKey,\n}) => {\n const [mounted, setMounted] = useState(false);\n\n const themeState = useTheme({\n themes,\n colorThemes,\n defaultTheme,\n defaultColorTheme,\n animationType,\n duration,\n storageKey,\n colorStorageKey,\n });\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const switchThemeFromElement = async (\n theme: Theme,\n element: HTMLButtonElement\n ) => {\n if (themeState.ref.current) {\n const originalRef = themeState.ref.current;\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n Object.defineProperty(themeState.ref, 'current', {\n value: originalRef,\n writable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(themeState.ref, 'current', {\n value: element,\n writable: true,\n configurable: true,\n });\n await themeState.switchTheme(theme);\n }\n };\n\n if (!mounted) {\n const loadingContextValue: UIThemeContextType = {\n ref: { current: null },\n theme: defaultTheme,\n colorTheme: defaultColorTheme,\n resolvedTheme: defaultTheme === 'dark' ? 'dark' : 'light',\n setTheme: () => {},\n setColorTheme: () => {},\n switchTheme: async () => {},\n switchThemeFromElement: async () => {},\n switchColorTheme: () => {},\n toggleTheme: async () => {},\n toggleLightTheme: async () => {},\n toggleDarkTheme: async () => {},\n toggleColorTheme: () => {},\n createColorThemeToggle: () => () => {},\n isColorThemeActive: () => false,\n };\n\n return (\n <UIThemeContext.Provider value={loadingContextValue}>\n {children}\n </UIThemeContext.Provider>\n );\n }\n\n const contextValue: UIThemeContextType = {\n ref: themeState.ref,\n theme: themeState.theme,\n colorTheme: themeState.colorTheme,\n resolvedTheme: themeState.resolvedTheme,\n setTheme: themeState.setTheme,\n setColorTheme: themeState.setColorTheme,\n switchTheme: themeState.switchTheme,\n switchThemeFromElement,\n switchColorTheme: themeState.switchColorTheme,\n toggleTheme: themeState.toggleTheme,\n toggleLightTheme: themeState.toggleLightTheme,\n toggleDarkTheme: themeState.toggleDarkTheme,\n toggleColorTheme: themeState.toggleColorTheme,\n createColorThemeToggle: themeState.createColorThemeToggle,\n isColorThemeActive: themeState.isColorThemeActive,\n };\n\n return (\n <UIThemeContext.Provider value={contextValue}>\n {children}\n </UIThemeContext.Provider>\n );\n};\n\n/**\n * Hook to consume the UI Theme context\n *\n * @returns Theme context value with all theme state and methods\n * @throws Error if used outside of UIThemeProvider\n */\nexport const useUITheme = (): UIThemeContextType => {\n const context = useContext(UIThemeContext);\n if (context === undefined) {\n throw new Error('useUITheme must be used within a UIThemeProvider');\n }\n return context;\n};\n","'use client';\n\nimport React, { type JSX, useEffect, useState } from 'react';\nimport { Theme } from '../../core/types';\nimport { useTheme } from '../hooks/use-theme';\nimport { useUITheme, UIThemeContextType } from './UIThemeProvider';\nimport { UIThemeSwitcherProps } from '../types';\n\nconst SunIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"5\" />\n <path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\" />\n </svg>\n);\n\nconst MoonIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\" />\n </svg>\n);\n\nconst MonitorIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\" />\n <line x1=\"8\" x2=\"16\" y1=\"21\" y2=\"21\" />\n <line x1=\"12\" x2=\"12\" y1=\"17\" y2=\"21\" />\n </svg>\n);\n\ninterface ThemeOptionProps {\n icon: JSX.Element;\n value: string;\n isActive?: boolean;\n isHovered?: boolean;\n onClick: (value: string, event?: React.MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter: () => void;\n onMouseLeave: () => void;\n buttonRef?: React.RefObject<HTMLButtonElement | null>;\n}\n\nconst ThemeOption: React.FC<ThemeOptionProps> = ({\n icon,\n value,\n isActive,\n isHovered,\n onClick,\n onMouseEnter,\n onMouseLeave,\n buttonRef,\n}) => {\n return (\n <button\n ref={\n isActive ? (buttonRef as React.RefObject<HTMLButtonElement>) : undefined\n }\n className={`\n relative flex h-9 w-12 cursor-pointer items-center justify-center\n text-muted-foreground hover:text-foreground\n ${isActive ? 'text-foreground font-medium' : ''}\n `}\n role=\"radio\"\n aria-checked={isActive}\n aria-label={`Switch to ${value} theme`}\n onClick={(event) => onClick(value, event)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n style={{\n borderRadius: 'var(--radius)',\n }}\n >\n {isHovered && (\n <div\n className=\"absolute inset-0 bg-muted\"\n style={{\n borderRadius: 'var(--radius)',\n transition: 'all 0.2s ease',\n }}\n />\n )}\n\n <div className=\"relative z-10 flex items-center justify-center\">\n <div className=\"[&_svg]:size-4\">{icon}</div>\n </div>\n\n {isActive && (\n <div\n className=\"absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full\"\n style={{\n backgroundColor: 'hsl(var(--primary))',\n }}\n />\n )}\n </button>\n );\n};\n\nconst THEME_OPTIONS = [\n { icon: <MonitorIcon />, value: 'system' },\n { icon: <SunIcon />, value: 'light' },\n { icon: <MoonIcon />, value: 'dark' },\n];\n\n/**\n * UI Theme Switcher - A button group for switching between themes\n *\n * Can work both with UIThemeProvider context or standalone.\n * When used with UIThemeProvider, it automatically syncs theme state.\n */\nexport const UIThemeSwitcher: React.FC<UIThemeSwitcherProps> = ({\n themes = ['light', 'dark', 'system'],\n currentTheme,\n onThemeChange,\n animationType,\n duration,\n className,\n}) => {\n let contextTheme: UIThemeContextType | null = null;\n try {\n contextTheme = useUITheme();\n } catch {\n // Context not available, use standalone mode\n }\n\n const standaloneHook = useTheme({\n animationType,\n duration,\n themes,\n ...(currentTheme !== undefined && { theme: currentTheme }),\n onThemeChange,\n });\n\n const isControlled = contextTheme !== null;\n const { ref, theme, switchTheme } =\n isControlled && contextTheme\n ? {\n ref: contextTheme.ref,\n theme: contextTheme.theme,\n switchTheme: contextTheme.switchTheme,\n }\n : standaloneHook;\n\n const [isMounted, setIsMounted] = useState(false);\n const [hoveredTheme, setHoveredTheme] = useState<string | null>(null);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n const handleThemeChange = async (\n newTheme: string,\n event?: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (isControlled && contextTheme?.switchThemeFromElement && event) {\n await contextTheme.switchThemeFromElement(\n newTheme as Theme,\n event.currentTarget\n );\n if (onThemeChange) {\n onThemeChange(newTheme as Theme);\n }\n } else {\n await switchTheme(newTheme as Theme);\n }\n };\n\n const filteredOptions = THEME_OPTIONS.filter((option) =>\n themes.includes(option.value as Theme)\n );\n\n return (\n <div\n className={`\n inline-flex h-9 items-center overflow-hidden bg-background shadow-sm border border-border\n ${isMounted ? 'opacity-100' : 'opacity-0'}\n ${className || ''}\n `}\n style={{\n borderRadius: 'var(--radius)',\n backgroundColor: 'hsl(var(--background))',\n }}\n role=\"radiogroup\"\n onMouseLeave={() => setHoveredTheme(null)}\n >\n {filteredOptions.map((option) => (\n <ThemeOption\n key={option.value}\n icon={option.icon}\n value={option.value}\n isActive={theme === option.value}\n isHovered={hoveredTheme === option.value}\n onClick={handleThemeChange}\n onMouseEnter={() => setHoveredTheme(option.value)}\n onMouseLeave={() => {}}\n buttonRef={theme === option.value ? ref : undefined}\n />\n ))}\n </div>\n );\n};\n","'use client';\n\nimport * as React from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\n\nconst ChevronDownIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n);\n\nconst ChevronUpIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n);\n\nconst CheckIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n);\n\nfunction UISelect({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"ui-select\" {...props} />;\n}\n\nfunction UISelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"ui-select-group\" {...props} />;\n}\n\nfunction UISelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"ui-select-value\" {...props} />;\n}\n\nfunction UISelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"ui-select-trigger\"\n data-size={size}\n className={`\n border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50\n data-[size=default]:h-9 data-[size=sm]:h-8\n *:data-[slot=ui-select-value]:line-clamp-1\n *:data-[slot=ui-select-value]:flex\n *:data-[slot=ui-select-value]:items-center\n *:data-[slot=ui-select-value]:gap-2\n [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4\n ${className || ''}\n `}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction UISelectContent({\n className,\n children,\n position = 'popper',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"ui-select-content\"\n className={`\n bg-popover text-popover-foreground\n data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\n data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n relative z-50 max-h-[var(--radix-select-content-available-height)]\n min-w-[8rem] origin-[var(--radix-select-content-transform-origin)]\n overflow-x-hidden overflow-y-auto rounded-md border shadow-md\n ${position === 'popper' ? 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1' : ''}\n ${className || ''}\n `}\n position={position}\n {...props}\n >\n <SelectPrimitive.Viewport\n className={`\n p-1\n ${position === 'popper' ? 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]' : ''}\n `}\n >\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction UISelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"ui-select-label\"\n className={`py-1.5 pl-8 pr-2 text-sm font-semibold ${className || ''}`}\n {...props}\n />\n );\n}\n\nfunction UISelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"ui-select-item\"\n className={`\n focus:bg-accent focus:text-accent-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n relative flex w-full cursor-default items-center gap-2\n rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none\n data-[disabled]:pointer-events-none data-[disabled]:opacity-50\n [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4\n *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\n ${className || ''}\n `}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction UISelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"ui-select-separator\"\n className={`-mx-1 my-1 h-px bg-muted ${className || ''}`}\n {...props}\n />\n );\n}\n\nfunction UISelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"ui-select-scroll-up-button\"\n className={`flex cursor-default items-center justify-center py-1 ${className || ''}`}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction UISelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"ui-select-scroll-down-button\"\n className={`flex cursor-default items-center justify-center py-1 ${className || ''}`}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n UISelect,\n UISelectContent,\n UISelectGroup,\n UISelectItem,\n UISelectLabel,\n UISelectScrollDownButton,\n UISelectScrollUpButton,\n UISelectSeparator,\n UISelectTrigger,\n UISelectValue,\n};\n","'use client';\n\nimport React from 'react';\nimport { ColorTheme } from '../../core/types';\nimport { useTheme } from '../hooks/use-theme';\nimport { useUITheme, UIThemeContextType } from './UIThemeProvider';\nimport { UIThemeSelectorProps } from '../types';\nimport {\n UISelect,\n UISelectContent,\n UISelectItem,\n UISelectTrigger,\n UISelectValue,\n} from './ui/UISelect';\n\n/**\n * UI Theme Selector - A dropdown selector for color themes\n *\n * Can work both with UIThemeProvider context or standalone.\n * When used with UIThemeProvider, it automatically syncs theme state.\n */\nexport const UIThemeSelector: React.FC<UIThemeSelectorProps> = ({\n themes = ['light', 'dark', 'system'],\n colorThemes = ['default'],\n currentColorTheme,\n onColorThemeChange,\n animationType,\n duration,\n className,\n placeholder = 'Choose a color theme',\n}) => {\n let contextTheme: UIThemeContextType | null = null;\n try {\n contextTheme = useUITheme();\n } catch {\n // Context not available, use standalone mode\n }\n\n const standaloneHook = useTheme({\n animationType,\n duration,\n themes,\n colorThemes,\n ...(currentColorTheme !== undefined && { colorTheme: currentColorTheme }),\n onColorThemeChange,\n });\n\n const isControlled = contextTheme !== null;\n const { colorTheme, setColorTheme } =\n isControlled && contextTheme\n ? {\n colorTheme: contextTheme.colorTheme,\n setColorTheme: contextTheme.setColorTheme,\n }\n : standaloneHook;\n\n const handleColorThemeChange = (newColorTheme: string) => {\n setColorTheme(newColorTheme as ColorTheme);\n if (onColorThemeChange) {\n onColorThemeChange(newColorTheme as ColorTheme);\n }\n };\n\n if (colorThemes.length <= 1) {\n return null;\n }\n\n return (\n <div className={`flex flex-col gap-2 ${className || ''}`}>\n <UISelect value={colorTheme} onValueChange={handleColorThemeChange}>\n <UISelectTrigger className=\"capitalize\">\n <UISelectValue placeholder={placeholder} />\n </UISelectTrigger>\n <UISelectContent>\n {colorThemes.map((theme) => (\n <UISelectItem key={theme} className=\"capitalize\" value={theme}>\n {theme}\n </UISelectItem>\n ))}\n </UISelectContent>\n </UISelect>\n </div>\n );\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/constants.ts","../../src/core/animations.ts","../../src/tanstack/index.ts"],"names":[],"mappings":";;;AAAO,IAAM,WAAA,GAAc;AACpB,IAAM,iBAAA,GAAoB;;;AC2F1B,IAAM,qBAAA,GAAwB,CACnC,KAAA,KACgC;AAChC,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,QAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA,KAAU,SAAS,MAAA,GAAS,OAAA;AACrC;;;AC1DO,SAAS,oBAAA,CACd,WAAA,EACA,gBAAA,EACA,OAAA,GAAgE,EAAC,EAChD;AACjB,EAAA,MAAM,EAAE,YAAA,GAAe,QAAA,EAAU,iBAAA,GAAoB,WAAU,GAAI,OAAA;AACnE,EAAA,MAAM,kBAAmB,WAAA,IAAyB,YAAA;AAClD,EAAA,MAAM,aAAa,gBAAA,IAAoB,iBAAA;AACvC,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,sBAAsB,eAAe,CAAA;AAAA,IAC5C,eAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { resolveThemeForServer } from '../core/animations';\nimport type { Theme } from '../core/types';\n\n// Re-export helpers for use inside user-defined createServerFn handlers.\n// IMPORTANT: createServerFn() calls must live in application source code,\n// not inside a pre-built library, because TanStack Start's Vite plugin\n// needs to transform them at build time.\n\nexport { STORAGE_KEY, COLOR_STORAGE_KEY } from '../core/constants';\nexport { resolveThemeForServer } from '../core/animations';\nexport type { Theme, ColorTheme } from '../core/types';\n\n/** Resolved theme class to apply on <html> */\nexport type ServerResolvedTheme = 'light' | 'dark' | 'system';\n\n/** Return type from a theme getter server function */\nexport interface ServerThemeData {\n /** The resolved theme class to use on <html> */\n theme: ServerResolvedTheme;\n /** The stored theme preference (light/dark/system) */\n themePreference: Theme;\n /** The color theme to apply */\n colorTheme: string;\n}\n\n/**\n * Builds ServerThemeData from raw cookie values.\n * Call this inside your own `createServerFn().handler()` with cookie values\n * from `getCookie()`.\n *\n * @example\n * ```ts\n * import { createServerFn } from '@tanstack/react-start';\n * import { getCookie, setCookie } from '@tanstack/react-start/server';\n * import { buildServerThemeData, STORAGE_KEY, COLOR_STORAGE_KEY } from 'uitheme-web/tanstack';\n *\n * export const getThemeServerFn = createServerFn().handler(() =>\n * buildServerThemeData(getCookie(STORAGE_KEY), getCookie(COLOR_STORAGE_KEY))\n * );\n * ```\n */\nexport function buildServerThemeData(\n themeCookie: string | undefined,\n colorThemeCookie: string | undefined,\n options: { defaultTheme?: Theme; defaultColorTheme?: string } = {}\n): ServerThemeData {\n const { defaultTheme = 'system', defaultColorTheme = 'default' } = options;\n const themePreference = (themeCookie as Theme) ?? defaultTheme;\n const colorTheme = colorThemeCookie ?? defaultColorTheme;\n return {\n theme: resolveThemeForServer(themePreference) as ServerResolvedTheme,\n themePreference,\n colorTheme,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/constants.ts","../../src/core/animations.ts","../../src/tanstack/index.ts"],"names":[],"mappings":";AAAO,IAAM,WAAA,GAAc;AACpB,IAAM,iBAAA,GAAoB;;;AC2F1B,IAAM,qBAAA,GAAwB,CACnC,KAAA,KACgC;AAChC,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,QAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA,KAAU,SAAS,MAAA,GAAS,OAAA;AACrC;;;AC1DO,SAAS,oBAAA,CACd,WAAA,EACA,gBAAA,EACA,OAAA,GAAgE,EAAC,EAChD;AACjB,EAAA,MAAM,EAAE,YAAA,GAAe,QAAA,EAAU,iBAAA,GAAoB,WAAU,GAAI,OAAA;AACnE,EAAA,MAAM,kBAAmB,WAAA,IAAyB,YAAA;AAClD,EAAA,MAAM,aAAa,gBAAA,IAAoB,iBAAA;AACvC,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,sBAAsB,eAAe,CAAA;AAAA,IAC5C,eAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.js","sourcesContent":["export const STORAGE_KEY = 'theme';\nexport const COLOR_STORAGE_KEY = 'color-theme';\nexport const GLOBAL_CLASS_NAME = 'dark';\nexport const COLOR_THEME_PREFIX = 'theme-';\nexport const DEFAULT_DURATION = 750;\nexport const DEFAULT_EASING = 'ease-in-out';\nexport const DEFAULT_BLUR_AMOUNT = 2;\nexport const DEFAULT_STYLE_ID = 'ui-theme-style';\n","import { AnimationConfig, SlideDirection } from './types';\nimport { DEFAULT_STYLE_ID } from './constants';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Checks if the current display is high resolution\n */\nconst getIsHighResolution = (): boolean => {\n if (!isBrowser) return false;\n return window.innerWidth >= 3000 || window.innerHeight >= 2000;\n};\n\n/**\n * Injects base styles required for view transitions\n */\nexport const injectBaseStyles = (): void => {\n if (!isBrowser) return;\n\n const styleId = 'ui-theme-base-style';\n if (document.getElementById(styleId)) return;\n\n const style = document.createElement('style');\n style.id = styleId;\n const isHighResolution = getIsHighResolution();\n\n style.textContent = `\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n ${isHighResolution ? 'transform: translateZ(0);' : ''}\n }\n \n ${\n isHighResolution\n ? `\n ::view-transition-group(root),\n ::view-transition-image-pair(root),\n ::view-transition-old(root),\n ::view-transition-new(root) {\n backface-visibility: hidden;\n perspective: 1000px;\n transform: translate3d(0, 0, 0);\n }\n `\n : ''\n }\n `;\n document.head.appendChild(style);\n};\n\n/**\n * Creates an SVG blur circle mask for animations\n * @param blur - Blur amount for the gaussian filter\n * @returns Data URI string for the SVG mask\n */\nexport const createBlurCircleMask = (blur: number): string => {\n const isHighResolution = getIsHighResolution();\n const blurFilter = `<filter id=\"blur\"><feGaussianBlur stdDeviation=\"${blur}\" /></filter>`;\n const circleRadius = isHighResolution ? 20 : 25;\n\n return `url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-50 -50 100 100\"><defs>${blurFilter}</defs><circle cx=\"0\" cy=\"0\" r=\"${circleRadius}\" fill=\"white\" filter=\"url(%23blur)\"/></svg>')`;\n};\n\n/**\n * Gets the system theme preference\n * @returns 'light' or 'dark' based on system preference\n */\nexport const getSystemTheme = (): 'light' | 'dark' => {\n if (!isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n};\n\n/**\n * Resolves a theme value to its actual light/dark value\n * @param theme - Theme to resolve ('light', 'dark', or 'system')\n * @returns Resolved theme ('light' or 'dark')\n */\nexport const resolveTheme = (theme: string): 'light' | 'dark' => {\n if (theme === 'system') {\n return getSystemTheme();\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Resolves a stored theme to the server-side class to apply on <html>.\n * CSS mode uses the 'system' class so media queries can respond before hydration.\n */\nexport const resolveThemeForServer = (\n theme: string\n): 'light' | 'dark' | 'system' => {\n if (theme === 'system') {\n return 'system';\n }\n return theme === 'dark' ? 'dark' : 'light';\n};\n\n/**\n * Checks if the browser supports View Transitions API\n * @returns true if view transitions are supported\n */\nexport const supportsViewTransitions = (): boolean => {\n return isBrowser && 'startViewTransition' in document;\n};\n\n/**\n * Checks if user prefers reduced motion\n * @returns true if user prefers reduced motion\n */\nexport const prefersReducedMotion = (): boolean => {\n return (\n isBrowser && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n};\n\n/**\n * Converts a slide direction to from coordinates\n * @param direction - Slide direction\n * @returns Object with a (x) and b (y) coordinates\n */\nexport const getSlideFromCoords = (\n direction: SlideDirection\n): { a: number; b: number } => {\n switch (direction) {\n case 'left':\n return { a: -100, b: 0 };\n case 'right':\n return { a: 100, b: 0 };\n case 'top':\n return { a: 0, b: -100 };\n case 'bottom':\n return { a: 0, b: 100 };\n case 'top-left':\n return { a: -100, b: -100 };\n case 'top-right':\n return { a: 100, b: -100 };\n case 'bottom-left':\n return { a: -100, b: 100 };\n case 'bottom-right':\n return { a: 100, b: 100 };\n default:\n return { a: -100, b: 0 };\n }\n};\n\n/**\n * Creates a circle expanding animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createCircleAnimation = (config: AnimationConfig): void => {\n const { x, y, duration, easing } = config;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n document.documentElement.animate(\n {\n clipPath: [\n `circle(0px at ${x}px ${y}px)`,\n `circle(${maxRadius}px at ${x}px ${y}px)`,\n ],\n },\n {\n duration,\n easing,\n pseudoElement: '::view-transition-new(root)',\n }\n );\n};\n\n/**\n * Creates a slide animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createSlideAnimation = (config: AnimationConfig): void => {\n const {\n a = -100,\n b = 0,\n x = 0,\n y = 0,\n duration,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n styleElement.textContent = `\n ::view-transition-old(root) {\n animation-delay: ${duration}ms;\n }\n \n ::view-transition-new(root) {\n animation: move-in ${duration}ms;\n animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);\n }\n \n @keyframes move-in {\n from {\n translate: ${a}% ${b}%;\n }\n to {\n translate: ${x}% ${y}%;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n\n/**\n * Creates a blur circle animation for theme transitions\n * @param config - Animation configuration\n */\nexport const createBlurCircleAnimation = (config: AnimationConfig): void => {\n const {\n x,\n y,\n duration,\n easing,\n blurAmount,\n styleId = DEFAULT_STYLE_ID,\n } = config;\n\n const existingStyle = document.getElementById(styleId);\n if (existingStyle) {\n existingStyle.remove();\n }\n\n const isHighResolution = getIsHighResolution();\n const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;\n const scaleFactor = isHighResolution ? 2.5 : 4;\n const optimalMaskSize = isHighResolution\n ? Math.min(viewportSize * scaleFactor, 5000)\n : viewportSize * scaleFactor;\n\n const topLeft = Math.hypot(x, y);\n const topRight = Math.hypot(window.innerWidth - x, y);\n const bottomLeft = Math.hypot(x, window.innerHeight - y);\n const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);\n const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n\n const blurFactor = isHighResolution ? 1.5 : 1.2;\n const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);\n\n styleElement.textContent = `\n ::view-transition-group(root) {\n animation-duration: ${duration}ms;\n animation-timing-function: ${\n isHighResolution\n ? 'cubic-bezier(0.2, 0, 0.2, 1)'\n : 'linear(' +\n '0 0%, 0.2342 12.49%, 0.4374 24.99%,' +\n '0.6093 37.49%, 0.6835 43.74%,' +\n '0.7499 49.99%, 0.8086 56.25%,' +\n '0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,' +\n '0.9648 81.25%, 0.9844 87.5%,' +\n '0.9961 93.75%, 1 100%' +\n ')'\n };\n will-change: transform;\n }\n \n ::view-transition-new(root) {\n mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;\n mask-position: ${x}px ${y}px;\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n will-change: mask-size, mask-position;\n }\n \n ::view-transition-old(root),\n .dark::view-transition-old(root) {\n animation: ui-theme-mask-scale ${duration}ms ${easing};\n transform-origin: ${x}px ${y}px;\n z-index: -1;\n will-change: mask-size, mask-position;\n }\n \n @keyframes ui-theme-mask-scale {\n 0% {\n mask-size: 0px;\n mask-position: ${x}px ${y}px;\n }\n 100% {\n mask-size: ${finalMaskSize}px;\n mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;\n }\n }\n `;\n\n document.head.appendChild(styleElement);\n\n setTimeout(() => {\n const el = document.getElementById(styleId);\n if (el) {\n el.remove();\n }\n }, duration);\n};\n","import { resolveThemeForServer } from '../core/animations';\nimport type { Theme } from '../core/types';\n\n// Re-export helpers for use inside user-defined createServerFn handlers.\n// IMPORTANT: createServerFn() calls must live in application source code,\n// not inside a pre-built library, because TanStack Start's Vite plugin\n// needs to transform them at build time.\n\nexport { STORAGE_KEY, COLOR_STORAGE_KEY } from '../core/constants';\nexport { resolveThemeForServer } from '../core/animations';\nexport type { Theme, ColorTheme } from '../core/types';\n\n/** Resolved theme class to apply on <html> */\nexport type ServerResolvedTheme = 'light' | 'dark' | 'system';\n\n/** Return type from a theme getter server function */\nexport interface ServerThemeData {\n /** The resolved theme class to use on <html> */\n theme: ServerResolvedTheme;\n /** The stored theme preference (light/dark/system) */\n themePreference: Theme;\n /** The color theme to apply */\n colorTheme: string;\n}\n\n/**\n * Builds ServerThemeData from raw cookie values.\n * Call this inside your own `createServerFn().handler()` with cookie values\n * from `getCookie()`.\n *\n * @example\n * ```ts\n * import { createServerFn } from '@tanstack/react-start';\n * import { getCookie, setCookie } from '@tanstack/react-start/server';\n * import { buildServerThemeData, STORAGE_KEY, COLOR_STORAGE_KEY } from 'uitheme-web/tanstack';\n *\n * export const getThemeServerFn = createServerFn().handler(() =>\n * buildServerThemeData(getCookie(STORAGE_KEY), getCookie(COLOR_STORAGE_KEY))\n * );\n * ```\n */\nexport function buildServerThemeData(\n themeCookie: string | undefined,\n colorThemeCookie: string | undefined,\n options: { defaultTheme?: Theme; defaultColorTheme?: string } = {}\n): ServerThemeData {\n const { defaultTheme = 'system', defaultColorTheme = 'default' } = options;\n const themePreference = (themeCookie as Theme) ?? defaultTheme;\n const colorTheme = colorThemeCookie ?? defaultColorTheme;\n return {\n theme: resolveThemeForServer(themePreference) as ServerResolvedTheme,\n themePreference,\n colorTheme,\n };\n}\n"]}