uitheme-web 1.0.0

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.
@@ -0,0 +1,1793 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactDom = require('react-dom');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var SelectPrimitive = require('@radix-ui/react-select');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__default = /*#__PURE__*/_interopDefault(React);
29
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
30
+
31
+ // src/core/types.ts
32
+ var ThemeAnimationType = /* @__PURE__ */ ((ThemeAnimationType2) => {
33
+ ThemeAnimationType2["CIRCLE"] = "circle";
34
+ ThemeAnimationType2["BLUR_CIRCLE"] = "blur-circle";
35
+ ThemeAnimationType2["SLIDE"] = "slide";
36
+ return ThemeAnimationType2;
37
+ })(ThemeAnimationType || {});
38
+
39
+ // src/core/constants.ts
40
+ var STORAGE_KEY = "theme";
41
+ var COLOR_STORAGE_KEY = "color-theme";
42
+ var GLOBAL_CLASS_NAME = "dark";
43
+ var COLOR_THEME_PREFIX = "theme-";
44
+ var DEFAULT_DURATION = 750;
45
+ var DEFAULT_EASING = "ease-in-out";
46
+ var DEFAULT_BLUR_AMOUNT = 2;
47
+ var DEFAULT_STYLE_ID = "ui-theme-style";
48
+
49
+ // src/core/animations.ts
50
+ var isBrowser = typeof window !== "undefined";
51
+ var getIsHighResolution = () => {
52
+ if (!isBrowser) return false;
53
+ return window.innerWidth >= 3e3 || window.innerHeight >= 2e3;
54
+ };
55
+ var injectBaseStyles = () => {
56
+ if (!isBrowser) return;
57
+ const styleId = "ui-theme-base-style";
58
+ if (document.getElementById(styleId)) return;
59
+ const style = document.createElement("style");
60
+ style.id = styleId;
61
+ const isHighResolution = getIsHighResolution();
62
+ style.textContent = `
63
+ ::view-transition-old(root),
64
+ ::view-transition-new(root) {
65
+ animation: none;
66
+ mix-blend-mode: normal;
67
+ ${isHighResolution ? "transform: translateZ(0);" : ""}
68
+ }
69
+
70
+ ${isHighResolution ? `
71
+ ::view-transition-group(root),
72
+ ::view-transition-image-pair(root),
73
+ ::view-transition-old(root),
74
+ ::view-transition-new(root) {
75
+ backface-visibility: hidden;
76
+ perspective: 1000px;
77
+ transform: translate3d(0, 0, 0);
78
+ }
79
+ ` : ""}
80
+ `;
81
+ document.head.appendChild(style);
82
+ };
83
+ var createBlurCircleMask = (blur) => {
84
+ const isHighResolution = getIsHighResolution();
85
+ const blurFilter = `<filter id="blur"><feGaussianBlur stdDeviation="${blur}" /></filter>`;
86
+ const circleRadius = isHighResolution ? 20 : 25;
87
+ 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>')`;
88
+ };
89
+ var getSystemTheme = () => {
90
+ if (!isBrowser) return "light";
91
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
92
+ };
93
+ var resolveTheme = (theme) => {
94
+ if (theme === "system") {
95
+ return getSystemTheme();
96
+ }
97
+ return theme === "dark" ? "dark" : "light";
98
+ };
99
+ var resolveThemeForServer = (theme) => {
100
+ if (theme === "system") {
101
+ return "system";
102
+ }
103
+ return theme === "dark" ? "dark" : "light";
104
+ };
105
+ var supportsViewTransitions = () => {
106
+ return isBrowser && "startViewTransition" in document;
107
+ };
108
+ var prefersReducedMotion = () => {
109
+ return isBrowser && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
110
+ };
111
+ var getSlideFromCoords = (direction) => {
112
+ switch (direction) {
113
+ case "left":
114
+ return { a: -100, b: 0 };
115
+ case "right":
116
+ return { a: 100, b: 0 };
117
+ case "top":
118
+ return { a: 0, b: -100 };
119
+ case "bottom":
120
+ return { a: 0, b: 100 };
121
+ case "top-left":
122
+ return { a: -100, b: -100 };
123
+ case "top-right":
124
+ return { a: 100, b: -100 };
125
+ case "bottom-left":
126
+ return { a: -100, b: 100 };
127
+ case "bottom-right":
128
+ return { a: 100, b: 100 };
129
+ default:
130
+ return { a: -100, b: 0 };
131
+ }
132
+ };
133
+ var createCircleAnimation = (config) => {
134
+ const { x, y, duration, easing } = config;
135
+ const topLeft = Math.hypot(x, y);
136
+ const topRight = Math.hypot(window.innerWidth - x, y);
137
+ const bottomLeft = Math.hypot(x, window.innerHeight - y);
138
+ const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);
139
+ const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);
140
+ document.documentElement.animate(
141
+ {
142
+ clipPath: [
143
+ `circle(0px at ${x}px ${y}px)`,
144
+ `circle(${maxRadius}px at ${x}px ${y}px)`
145
+ ]
146
+ },
147
+ {
148
+ duration,
149
+ easing,
150
+ pseudoElement: "::view-transition-new(root)"
151
+ }
152
+ );
153
+ };
154
+ var createSlideAnimation = (config) => {
155
+ const {
156
+ a = -100,
157
+ b = 0,
158
+ x = 0,
159
+ y = 0,
160
+ duration,
161
+ styleId = DEFAULT_STYLE_ID
162
+ } = config;
163
+ const styleElement = document.createElement("style");
164
+ styleElement.id = styleId;
165
+ styleElement.textContent = `
166
+ ::view-transition-old(root) {
167
+ animation-delay: ${duration}ms;
168
+ }
169
+
170
+ ::view-transition-new(root) {
171
+ animation: move-in ${duration}ms;
172
+ animation-timing-function: cubic-bezier(0.66, 0, 0.34, 1);
173
+ }
174
+
175
+ @keyframes move-in {
176
+ from {
177
+ translate: ${a}% ${b}%;
178
+ }
179
+ to {
180
+ translate: ${x}% ${y}%;
181
+ }
182
+ }
183
+ `;
184
+ document.head.appendChild(styleElement);
185
+ setTimeout(() => {
186
+ const el = document.getElementById(styleId);
187
+ if (el) {
188
+ el.remove();
189
+ }
190
+ }, duration);
191
+ };
192
+ var createBlurCircleAnimation = (config) => {
193
+ const {
194
+ x,
195
+ y,
196
+ duration,
197
+ easing,
198
+ blurAmount,
199
+ styleId = DEFAULT_STYLE_ID
200
+ } = config;
201
+ const existingStyle = document.getElementById(styleId);
202
+ if (existingStyle) {
203
+ existingStyle.remove();
204
+ }
205
+ const isHighResolution = getIsHighResolution();
206
+ const viewportSize = Math.max(window.innerWidth, window.innerHeight) + 200;
207
+ const scaleFactor = isHighResolution ? 2.5 : 4;
208
+ const optimalMaskSize = isHighResolution ? Math.min(viewportSize * scaleFactor, 5e3) : viewportSize * scaleFactor;
209
+ const topLeft = Math.hypot(x, y);
210
+ const topRight = Math.hypot(window.innerWidth - x, y);
211
+ const bottomLeft = Math.hypot(x, window.innerHeight - y);
212
+ const bottomRight = Math.hypot(window.innerWidth - x, window.innerHeight - y);
213
+ const maxRadius = Math.max(topLeft, topRight, bottomLeft, bottomRight);
214
+ const styleElement = document.createElement("style");
215
+ styleElement.id = styleId;
216
+ const blurFactor = isHighResolution ? 1.5 : 1.2;
217
+ const finalMaskSize = Math.max(optimalMaskSize, maxRadius * 2.5);
218
+ styleElement.textContent = `
219
+ ::view-transition-group(root) {
220
+ animation-duration: ${duration}ms;
221
+ animation-timing-function: ${isHighResolution ? "cubic-bezier(0.2, 0, 0.2, 1)" : "linear(0 0%, 0.2342 12.49%, 0.4374 24.99%,0.6093 37.49%, 0.6835 43.74%,0.7499 49.99%, 0.8086 56.25%,0.8593 62.5%, 0.9023 68.75%, 0.9375 75%,0.9648 81.25%, 0.9844 87.5%,0.9961 93.75%, 1 100%)"};
222
+ will-change: transform;
223
+ }
224
+
225
+ ::view-transition-new(root) {
226
+ mask: ${createBlurCircleMask(blurAmount * blurFactor)} 0 0 / 100% 100% no-repeat;
227
+ mask-position: ${x}px ${y}px;
228
+ animation: ui-theme-mask-scale ${duration}ms ${easing};
229
+ transform-origin: ${x}px ${y}px;
230
+ will-change: mask-size, mask-position;
231
+ }
232
+
233
+ ::view-transition-old(root),
234
+ .dark::view-transition-old(root) {
235
+ animation: ui-theme-mask-scale ${duration}ms ${easing};
236
+ transform-origin: ${x}px ${y}px;
237
+ z-index: -1;
238
+ will-change: mask-size, mask-position;
239
+ }
240
+
241
+ @keyframes ui-theme-mask-scale {
242
+ 0% {
243
+ mask-size: 0px;
244
+ mask-position: ${x}px ${y}px;
245
+ }
246
+ 100% {
247
+ mask-size: ${finalMaskSize}px;
248
+ mask-position: ${x - finalMaskSize / 2}px ${y - finalMaskSize / 2}px;
249
+ }
250
+ }
251
+ `;
252
+ document.head.appendChild(styleElement);
253
+ setTimeout(() => {
254
+ const el = document.getElementById(styleId);
255
+ if (el) {
256
+ el.remove();
257
+ }
258
+ }, duration);
259
+ };
260
+
261
+ // src/core/storage.ts
262
+ var isBrowser2 = typeof window !== "undefined";
263
+ var getStoredTheme = (key = STORAGE_KEY, validThemes = ["light", "dark", "system"], defaultTheme = "system") => {
264
+ if (!isBrowser2) return defaultTheme;
265
+ const saved = localStorage.getItem(key);
266
+ return saved && validThemes.includes(saved) ? saved : defaultTheme;
267
+ };
268
+ var setStoredTheme = (theme, key = STORAGE_KEY) => {
269
+ if (!isBrowser2) return;
270
+ localStorage.setItem(key, theme);
271
+ };
272
+ var getStoredColorTheme = (key = COLOR_STORAGE_KEY, validColorThemes = ["default"], defaultColorTheme = "default") => {
273
+ if (!isBrowser2) return defaultColorTheme;
274
+ const saved = localStorage.getItem(key);
275
+ return saved && validColorThemes.includes(saved) ? saved : defaultColorTheme;
276
+ };
277
+ var setStoredColorTheme = (colorTheme, key = COLOR_STORAGE_KEY) => {
278
+ if (!isBrowser2) return;
279
+ localStorage.setItem(key, colorTheme);
280
+ };
281
+
282
+ // src/react/hooks/use-theme.ts
283
+ var isBrowser3 = typeof window !== "undefined";
284
+ var useTheme = (props = {}) => {
285
+ const {
286
+ duration: propsDuration = DEFAULT_DURATION,
287
+ easing = DEFAULT_EASING,
288
+ animationType = "circle" /* CIRCLE */,
289
+ blurAmount = DEFAULT_BLUR_AMOUNT,
290
+ styleId = DEFAULT_STYLE_ID,
291
+ themes = ["light", "dark", "system"],
292
+ colorThemes = ["default"],
293
+ defaultTheme = "system",
294
+ defaultColorTheme = "default",
295
+ globalClassName = GLOBAL_CLASS_NAME,
296
+ colorThemePrefix = COLOR_THEME_PREFIX,
297
+ storageKey = STORAGE_KEY,
298
+ colorStorageKey = COLOR_STORAGE_KEY,
299
+ theme: externalTheme,
300
+ colorTheme: externalColorTheme,
301
+ onThemeChange,
302
+ onColorThemeChange,
303
+ slideDirection = "left",
304
+ slideFromX,
305
+ slideFromY,
306
+ slideToX = 0,
307
+ slideToY = 0,
308
+ initialTheme,
309
+ initialColorTheme,
310
+ systemThemeMode = "js"
311
+ } = props;
312
+ const isHighResolution = isBrowser3 && (window.innerWidth >= 3e3 || window.innerHeight >= 2e3);
313
+ const duration = isHighResolution ? Math.max(propsDuration * 0.8, 500) : propsDuration;
314
+ const [mounted, setMounted] = React.useState(false);
315
+ React.useEffect(() => {
316
+ injectBaseStyles();
317
+ setMounted(true);
318
+ }, []);
319
+ const [internalTheme, setInternalTheme] = React.useState(() => {
320
+ if (initialTheme !== void 0) return initialTheme;
321
+ return getStoredTheme(storageKey, themes, defaultTheme);
322
+ });
323
+ const [internalColorTheme, setInternalColorTheme] = React.useState(() => {
324
+ if (initialColorTheme !== void 0) return initialColorTheme;
325
+ return getStoredColorTheme(colorStorageKey, colorThemes, defaultColorTheme);
326
+ });
327
+ const currentTheme = externalTheme ?? internalTheme;
328
+ const currentColorTheme = externalColorTheme ?? internalColorTheme;
329
+ const [, setSystemTheme] = React.useState(() => getSystemTheme());
330
+ const resolvedTheme = resolveTheme(currentTheme);
331
+ React.useEffect(() => {
332
+ if (!isBrowser3) return;
333
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
334
+ const handleChange = () => setSystemTheme(getSystemTheme());
335
+ mediaQuery.addEventListener("change", handleChange);
336
+ return () => mediaQuery.removeEventListener("change", handleChange);
337
+ }, []);
338
+ React.useEffect(() => {
339
+ if (!isBrowser3 || !mounted) return;
340
+ const el = document.documentElement;
341
+ if (systemThemeMode === "css" && currentTheme === "system") {
342
+ el.classList.remove(globalClassName);
343
+ el.classList.remove("auto");
344
+ el.classList.remove("system");
345
+ el.classList.add("system");
346
+ el.style.colorScheme = "";
347
+ } else {
348
+ el.classList.remove("system");
349
+ el.classList.remove("auto");
350
+ if (resolvedTheme === "dark") {
351
+ el.classList.add(globalClassName);
352
+ } else {
353
+ el.classList.remove(globalClassName);
354
+ }
355
+ el.style.colorScheme = resolvedTheme;
356
+ }
357
+ colorThemes.forEach((theme) => {
358
+ el.classList.remove(`${colorThemePrefix}${theme}`);
359
+ });
360
+ el.classList.add(`${colorThemePrefix}${currentColorTheme}`);
361
+ }, [
362
+ resolvedTheme,
363
+ currentTheme,
364
+ currentColorTheme,
365
+ globalClassName,
366
+ colorThemePrefix,
367
+ colorThemes,
368
+ mounted,
369
+ systemThemeMode
370
+ ]);
371
+ const ref = React.useRef(null);
372
+ const setTheme = React.useCallback(
373
+ (newTheme) => {
374
+ setStoredTheme(newTheme, storageKey);
375
+ if (externalTheme === void 0) {
376
+ setInternalTheme(newTheme);
377
+ }
378
+ if (onThemeChange) {
379
+ onThemeChange(newTheme);
380
+ }
381
+ },
382
+ [onThemeChange, externalTheme, storageKey]
383
+ );
384
+ const setColorTheme = React.useCallback(
385
+ (newColorTheme) => {
386
+ setStoredColorTheme(newColorTheme, colorStorageKey);
387
+ if (externalColorTheme === void 0) {
388
+ setInternalColorTheme(newColorTheme);
389
+ }
390
+ if (onColorThemeChange) {
391
+ onColorThemeChange(newColorTheme);
392
+ }
393
+ },
394
+ [onColorThemeChange, externalColorTheme, colorStorageKey]
395
+ );
396
+ const switchTheme = React.useCallback(
397
+ async (newTheme, animationOff = false) => {
398
+ if (!ref.current || !supportsViewTransitions() || prefersReducedMotion() || animationOff) {
399
+ setTheme(newTheme);
400
+ return;
401
+ }
402
+ let animationConfig;
403
+ if (animationType === "slide" /* SLIDE */) {
404
+ const fromCoords = slideFromX !== void 0 && slideFromY !== void 0 ? { a: slideFromX, b: slideFromY } : getSlideFromCoords(slideDirection);
405
+ animationConfig = {
406
+ a: fromCoords.a,
407
+ b: fromCoords.b,
408
+ x: slideToX,
409
+ y: slideToY,
410
+ duration,
411
+ easing,
412
+ animationType,
413
+ blurAmount,
414
+ styleId
415
+ };
416
+ } else {
417
+ const { top, left, width, height } = ref.current.getBoundingClientRect();
418
+ const x = left + width / 2;
419
+ const y = top + height / 2;
420
+ animationConfig = {
421
+ x,
422
+ y,
423
+ duration,
424
+ easing,
425
+ animationType,
426
+ blurAmount,
427
+ styleId
428
+ };
429
+ }
430
+ if (animationType === "blur-circle" /* BLUR_CIRCLE */) {
431
+ createBlurCircleAnimation(animationConfig);
432
+ }
433
+ if (animationType === "slide" /* SLIDE */) {
434
+ createSlideAnimation(animationConfig);
435
+ }
436
+ await document.startViewTransition(() => {
437
+ reactDom.flushSync(() => {
438
+ setTheme(newTheme);
439
+ });
440
+ }).ready;
441
+ if (animationType === "circle" /* CIRCLE */) {
442
+ createCircleAnimation(animationConfig);
443
+ }
444
+ },
445
+ [
446
+ setTheme,
447
+ duration,
448
+ easing,
449
+ animationType,
450
+ blurAmount,
451
+ styleId,
452
+ slideDirection,
453
+ slideFromX,
454
+ slideFromY,
455
+ slideToX,
456
+ slideToY
457
+ ]
458
+ );
459
+ const switchColorTheme = React.useCallback(
460
+ (newColorTheme) => {
461
+ if (colorThemes.indexOf(newColorTheme) === -1) {
462
+ console.warn(
463
+ `Color theme "${newColorTheme}" not found in available themes`
464
+ );
465
+ return;
466
+ }
467
+ setColorTheme(newColorTheme);
468
+ },
469
+ [colorThemes, setColorTheme]
470
+ );
471
+ const toggleTheme = React.useCallback(
472
+ async (animationOff = false) => {
473
+ const newTheme = resolvedTheme === "dark" ? "light" : "dark";
474
+ await switchTheme(newTheme, animationOff);
475
+ },
476
+ [resolvedTheme, switchTheme]
477
+ );
478
+ const toggleLightTheme = React.useCallback(
479
+ async (animationOff = false) => {
480
+ if (resolvedTheme === "light") return;
481
+ await switchTheme("light", animationOff);
482
+ },
483
+ [resolvedTheme, switchTheme]
484
+ );
485
+ const toggleDarkTheme = React.useCallback(
486
+ async (animationOff = false) => {
487
+ if (resolvedTheme === "dark") return;
488
+ await switchTheme("dark", animationOff);
489
+ },
490
+ [resolvedTheme, switchTheme]
491
+ );
492
+ const toggleColorTheme = React.useCallback(() => {
493
+ const currentIndex = colorThemes.indexOf(currentColorTheme);
494
+ const nextIndex = (currentIndex + 1) % colorThemes.length;
495
+ const nextColorTheme = colorThemes[nextIndex];
496
+ setColorTheme(nextColorTheme);
497
+ }, [currentColorTheme, colorThemes, setColorTheme]);
498
+ const createColorThemeToggle = React.useCallback(
499
+ (targetColorTheme) => {
500
+ return () => {
501
+ if (colorThemes.indexOf(targetColorTheme) === -1) {
502
+ console.warn(
503
+ `Color theme "${targetColorTheme}" not found in available themes`
504
+ );
505
+ return;
506
+ }
507
+ setColorTheme(targetColorTheme);
508
+ };
509
+ },
510
+ [colorThemes, setColorTheme]
511
+ );
512
+ const isColorThemeActive = React.useCallback(
513
+ (targetColorTheme) => {
514
+ return currentColorTheme === targetColorTheme;
515
+ },
516
+ [currentColorTheme]
517
+ );
518
+ return {
519
+ ref,
520
+ theme: currentTheme,
521
+ colorTheme: currentColorTheme,
522
+ resolvedTheme,
523
+ setTheme,
524
+ setColorTheme,
525
+ switchTheme,
526
+ switchColorTheme,
527
+ toggleTheme,
528
+ toggleLightTheme,
529
+ toggleDarkTheme,
530
+ toggleColorTheme,
531
+ createColorThemeToggle,
532
+ isColorThemeActive
533
+ };
534
+ };
535
+ var NextUIThemeContext = React.createContext(
536
+ void 0
537
+ );
538
+ var generatePreHydrationScript = (storageKey, colorStorageKey, defaultTheme, defaultColorTheme, attribute, globalClassName, colorThemePrefix) => {
539
+ return `
540
+ (function() {
541
+ try {
542
+ var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';
543
+ var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';
544
+ var resolved = theme === 'system'
545
+ ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
546
+ : theme;
547
+
548
+ if ('${attribute}' === 'class') {
549
+ if (resolved === 'dark') {
550
+ document.documentElement.classList.add('${globalClassName}');
551
+ } else {
552
+ document.documentElement.classList.remove('${globalClassName}');
553
+ }
554
+ } else {
555
+ document.documentElement.setAttribute('data-theme', resolved);
556
+ }
557
+
558
+ document.documentElement.style.colorScheme = resolved;
559
+ document.documentElement.classList.add('${colorThemePrefix}' + colorTheme);
560
+ } catch (e) {
561
+ console.warn('Theme pre-hydration script failed:', e);
562
+ }
563
+ })();
564
+ `;
565
+ };
566
+ var ThemePreHydrationScript = React__default.default.memo(
567
+ ({
568
+ storageKey,
569
+ colorStorageKey,
570
+ defaultTheme,
571
+ defaultColorTheme,
572
+ attribute,
573
+ globalClassName,
574
+ colorThemePrefix,
575
+ nonce
576
+ }) => {
577
+ const scriptContent = generatePreHydrationScript(
578
+ storageKey,
579
+ colorStorageKey,
580
+ defaultTheme,
581
+ defaultColorTheme,
582
+ attribute,
583
+ globalClassName,
584
+ colorThemePrefix
585
+ );
586
+ return /* @__PURE__ */ jsxRuntime.jsx(
587
+ "script",
588
+ {
589
+ nonce,
590
+ suppressHydrationWarning: true,
591
+ dangerouslySetInnerHTML: { __html: scriptContent }
592
+ }
593
+ );
594
+ }
595
+ );
596
+ ThemePreHydrationScript.displayName = "ThemePreHydrationScript";
597
+ var NextUIThemeProvider = ({
598
+ children,
599
+ themes = ["light", "dark", "system"],
600
+ colorThemes = ["default"],
601
+ defaultTheme = "system",
602
+ defaultColorTheme = "default",
603
+ animationType = "circle" /* CIRCLE */,
604
+ duration = 750,
605
+ storageKey = STORAGE_KEY,
606
+ colorStorageKey = COLOR_STORAGE_KEY,
607
+ attribute = "class",
608
+ globalClassName = GLOBAL_CLASS_NAME,
609
+ colorThemePrefix = COLOR_THEME_PREFIX,
610
+ nonce,
611
+ disableAnimationOnInit = true,
612
+ disablePreHydrationScript = false
613
+ }) => {
614
+ const [mounted, setMounted] = React.useState(false);
615
+ const themeState = useTheme({
616
+ themes,
617
+ colorThemes,
618
+ defaultTheme,
619
+ defaultColorTheme,
620
+ animationType,
621
+ duration,
622
+ storageKey,
623
+ colorStorageKey,
624
+ globalClassName: attribute === "class" ? globalClassName : void 0,
625
+ colorThemePrefix
626
+ });
627
+ React.useEffect(() => {
628
+ setMounted(true);
629
+ }, []);
630
+ const switchThemeWithHydrationAwareness = React.useCallback(
631
+ async (theme, animationOff = false) => {
632
+ if (!mounted && disableAnimationOnInit) {
633
+ themeState.setTheme(theme);
634
+ } else {
635
+ await themeState.switchTheme(theme, animationOff);
636
+ }
637
+ },
638
+ [mounted, disableAnimationOnInit, themeState]
639
+ );
640
+ const switchThemeFromElement = React.useCallback(
641
+ async (theme, element) => {
642
+ if (!mounted && disableAnimationOnInit) {
643
+ themeState.setTheme(theme);
644
+ return;
645
+ }
646
+ if (themeState.ref.current) {
647
+ const originalRef = themeState.ref.current;
648
+ Object.defineProperty(themeState.ref, "current", {
649
+ value: element,
650
+ writable: true,
651
+ configurable: true
652
+ });
653
+ await themeState.switchTheme(theme);
654
+ Object.defineProperty(themeState.ref, "current", {
655
+ value: originalRef,
656
+ writable: true,
657
+ configurable: true
658
+ });
659
+ } else {
660
+ Object.defineProperty(themeState.ref, "current", {
661
+ value: element,
662
+ writable: true,
663
+ configurable: true
664
+ });
665
+ await themeState.switchTheme(theme);
666
+ }
667
+ },
668
+ [mounted, disableAnimationOnInit, themeState]
669
+ );
670
+ const systemTheme = typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
671
+ if (!mounted) {
672
+ const loadingContextValue = {
673
+ ref: { current: null },
674
+ theme: defaultTheme,
675
+ colorTheme: defaultColorTheme,
676
+ resolvedTheme: defaultTheme === "dark" ? "dark" : "light",
677
+ systemTheme: "light",
678
+ setTheme: () => {
679
+ },
680
+ setColorTheme: () => {
681
+ },
682
+ switchTheme: async () => {
683
+ },
684
+ switchThemeFromElement: async () => {
685
+ },
686
+ switchColorTheme: () => {
687
+ },
688
+ toggleTheme: async () => {
689
+ },
690
+ toggleLightTheme: async () => {
691
+ },
692
+ toggleDarkTheme: async () => {
693
+ },
694
+ toggleColorTheme: () => {
695
+ },
696
+ createColorThemeToggle: () => () => {
697
+ },
698
+ isColorThemeActive: () => false
699
+ };
700
+ return /* @__PURE__ */ jsxRuntime.jsxs(NextUIThemeContext.Provider, { value: loadingContextValue, children: [
701
+ !disablePreHydrationScript && /* @__PURE__ */ jsxRuntime.jsx(
702
+ ThemePreHydrationScript,
703
+ {
704
+ storageKey,
705
+ colorStorageKey,
706
+ defaultTheme,
707
+ defaultColorTheme,
708
+ attribute,
709
+ globalClassName,
710
+ colorThemePrefix,
711
+ nonce
712
+ }
713
+ ),
714
+ children
715
+ ] });
716
+ }
717
+ const contextValue = {
718
+ ref: themeState.ref,
719
+ theme: themeState.theme,
720
+ colorTheme: themeState.colorTheme,
721
+ resolvedTheme: themeState.resolvedTheme,
722
+ systemTheme,
723
+ setTheme: themeState.setTheme,
724
+ setColorTheme: themeState.setColorTheme,
725
+ switchTheme: switchThemeWithHydrationAwareness,
726
+ switchThemeFromElement,
727
+ switchColorTheme: themeState.switchColorTheme,
728
+ toggleTheme: themeState.toggleTheme,
729
+ toggleLightTheme: themeState.toggleLightTheme,
730
+ toggleDarkTheme: themeState.toggleDarkTheme,
731
+ toggleColorTheme: themeState.toggleColorTheme,
732
+ createColorThemeToggle: themeState.createColorThemeToggle,
733
+ isColorThemeActive: themeState.isColorThemeActive
734
+ };
735
+ return /* @__PURE__ */ jsxRuntime.jsxs(NextUIThemeContext.Provider, { value: contextValue, children: [
736
+ !disablePreHydrationScript && /* @__PURE__ */ jsxRuntime.jsx(
737
+ ThemePreHydrationScript,
738
+ {
739
+ storageKey,
740
+ colorStorageKey,
741
+ defaultTheme,
742
+ defaultColorTheme,
743
+ attribute,
744
+ globalClassName,
745
+ colorThemePrefix,
746
+ nonce
747
+ }
748
+ ),
749
+ children
750
+ ] });
751
+ };
752
+ var useNextUITheme = () => {
753
+ const context = React.useContext(NextUIThemeContext);
754
+ if (context === void 0) {
755
+ throw new Error("useNextUITheme must be used within a NextUIThemeProvider");
756
+ }
757
+ return context;
758
+ };
759
+ var TanStackUIThemeContext = React.createContext(void 0);
760
+ var generateTanStackPreHydrationScript = (storageKey, colorStorageKey, defaultTheme, defaultColorTheme, globalClassName, colorThemePrefix, systemThemeMode) => {
761
+ return `
762
+ (function() {
763
+ try {
764
+ var theme = localStorage.getItem('${storageKey}') || '${defaultTheme}';
765
+ var colorTheme = localStorage.getItem('${colorStorageKey}') || '${defaultColorTheme}';
766
+ var el = document.documentElement;
767
+ var resolved;
768
+ if (theme === 'system') {
769
+ if ('${systemThemeMode}' === 'css') {
770
+ el.classList.remove('${globalClassName}');
771
+ el.classList.remove('auto');
772
+ el.classList.remove('system');
773
+ el.classList.add('system');
774
+ el.style.colorScheme = '';
775
+ } else {
776
+ resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
777
+ if (resolved === 'dark') {
778
+ el.classList.add('${globalClassName}');
779
+ } else {
780
+ el.classList.remove('${globalClassName}');
781
+ }
782
+ el.classList.remove('system');
783
+ el.classList.remove('auto');
784
+ el.style.colorScheme = resolved;
785
+ }
786
+ } else {
787
+ resolved = theme;
788
+ el.classList.remove('system');
789
+ el.classList.remove('auto');
790
+ if (resolved === 'dark') {
791
+ el.classList.add('${globalClassName}');
792
+ } else {
793
+ el.classList.remove('${globalClassName}');
794
+ }
795
+ el.style.colorScheme = resolved;
796
+ }
797
+ if (colorTheme && colorTheme !== 'default') {
798
+ el.classList.add('${colorThemePrefix}' + colorTheme);
799
+ }
800
+ } catch (e) {
801
+ console.warn('Theme pre-hydration script failed:', e);
802
+ }
803
+ })();
804
+ `;
805
+ };
806
+ var TanStackStartThemeScript = React__default.default.memo(
807
+ ({
808
+ storageKey = STORAGE_KEY,
809
+ colorStorageKey = COLOR_STORAGE_KEY,
810
+ defaultTheme = "system",
811
+ defaultColorTheme = "default",
812
+ globalClassName = GLOBAL_CLASS_NAME,
813
+ colorThemePrefix = COLOR_THEME_PREFIX,
814
+ nonce,
815
+ systemThemeMode = "js"
816
+ }) => {
817
+ const scriptContent = generateTanStackPreHydrationScript(
818
+ storageKey,
819
+ colorStorageKey,
820
+ defaultTheme,
821
+ defaultColorTheme,
822
+ globalClassName,
823
+ colorThemePrefix,
824
+ systemThemeMode
825
+ );
826
+ return /* @__PURE__ */ jsxRuntime.jsx(
827
+ "script",
828
+ {
829
+ nonce,
830
+ suppressHydrationWarning: true,
831
+ dangerouslySetInnerHTML: { __html: scriptContent }
832
+ }
833
+ );
834
+ }
835
+ );
836
+ TanStackStartThemeScript.displayName = "TanStackStartThemeScript";
837
+ var useHydrated = () => {
838
+ return React.useSyncExternalStore(
839
+ () => () => {
840
+ },
841
+ () => true,
842
+ () => false
843
+ );
844
+ };
845
+ var TanStackUIThemeProvider = ({
846
+ children,
847
+ themes = ["light", "dark", "system"],
848
+ colorThemes = ["default"],
849
+ defaultTheme = "system",
850
+ defaultColorTheme = "default",
851
+ animationType = "circle" /* CIRCLE */,
852
+ duration = 750,
853
+ storageKey = STORAGE_KEY,
854
+ colorStorageKey = COLOR_STORAGE_KEY,
855
+ globalClassName = GLOBAL_CLASS_NAME,
856
+ colorThemePrefix = COLOR_THEME_PREFIX,
857
+ serverTheme,
858
+ serverColorTheme,
859
+ systemThemeMode = "css",
860
+ onServerThemeChange,
861
+ onServerColorThemeChange
862
+ }) => {
863
+ const isHydrated = useHydrated();
864
+ const hasServerTheme = serverTheme !== void 0;
865
+ const initialTheme = hasServerTheme ? serverTheme === "system" ? "system" : serverTheme : void 0;
866
+ const themeState = useTheme({
867
+ themes,
868
+ colorThemes,
869
+ defaultTheme,
870
+ defaultColorTheme,
871
+ animationType,
872
+ duration,
873
+ storageKey,
874
+ colorStorageKey,
875
+ globalClassName,
876
+ colorThemePrefix,
877
+ systemThemeMode,
878
+ initialTheme,
879
+ initialColorTheme: serverColorTheme
880
+ });
881
+ React.useEffect(() => {
882
+ if (!hasServerTheme) return;
883
+ if (initialTheme) {
884
+ setStoredTheme(initialTheme, storageKey);
885
+ }
886
+ if (serverColorTheme) {
887
+ setStoredColorTheme(serverColorTheme, colorStorageKey);
888
+ }
889
+ }, []);
890
+ const setThemeWithServer = React.useCallback(
891
+ (newTheme) => {
892
+ themeState.setTheme(newTheme);
893
+ if (onServerThemeChange) {
894
+ onServerThemeChange(newTheme);
895
+ }
896
+ },
897
+ [themeState, onServerThemeChange]
898
+ );
899
+ const setColorThemeWithServer = React.useCallback(
900
+ (newColorTheme) => {
901
+ themeState.setColorTheme(newColorTheme);
902
+ if (onServerColorThemeChange) {
903
+ onServerColorThemeChange(newColorTheme);
904
+ }
905
+ },
906
+ [themeState, onServerColorThemeChange]
907
+ );
908
+ const switchThemeWithHydrationAwareness = React.useCallback(
909
+ async (theme, animationOff = false) => {
910
+ if (!isHydrated) {
911
+ setThemeWithServer(theme);
912
+ } else {
913
+ await themeState.switchTheme(theme, animationOff);
914
+ if (onServerThemeChange) {
915
+ onServerThemeChange(theme);
916
+ }
917
+ }
918
+ },
919
+ [isHydrated, themeState, setThemeWithServer, onServerThemeChange]
920
+ );
921
+ const toggleThemeWithHydrationAwareness = React.useCallback(
922
+ async (animationOff = false) => {
923
+ if (!isHydrated) {
924
+ const nextTheme = themeState.resolvedTheme === "dark" ? "light" : "dark";
925
+ setThemeWithServer(nextTheme);
926
+ } else {
927
+ await themeState.toggleTheme(animationOff);
928
+ const nextTheme = themeState.resolvedTheme === "dark" ? "light" : "dark";
929
+ if (onServerThemeChange) {
930
+ onServerThemeChange(nextTheme);
931
+ }
932
+ }
933
+ },
934
+ [isHydrated, themeState, setThemeWithServer, onServerThemeChange]
935
+ );
936
+ const toggleLightThemeWithHydrationAwareness = React.useCallback(
937
+ async (animationOff = false) => {
938
+ if (!isHydrated) {
939
+ setThemeWithServer("light");
940
+ } else {
941
+ await themeState.toggleLightTheme(animationOff);
942
+ if (onServerThemeChange) {
943
+ onServerThemeChange("light");
944
+ }
945
+ }
946
+ },
947
+ [isHydrated, themeState, setThemeWithServer, onServerThemeChange]
948
+ );
949
+ const toggleDarkThemeWithHydrationAwareness = React.useCallback(
950
+ async (animationOff = false) => {
951
+ if (!isHydrated) {
952
+ setThemeWithServer("dark");
953
+ } else {
954
+ await themeState.toggleDarkTheme(animationOff);
955
+ if (onServerThemeChange) {
956
+ onServerThemeChange("dark");
957
+ }
958
+ }
959
+ },
960
+ [isHydrated, themeState, setThemeWithServer, onServerThemeChange]
961
+ );
962
+ const switchColorThemeWithServer = React.useCallback(
963
+ (newColorTheme) => {
964
+ themeState.switchColorTheme(newColorTheme);
965
+ if (onServerColorThemeChange) {
966
+ onServerColorThemeChange(newColorTheme);
967
+ }
968
+ },
969
+ [themeState, onServerColorThemeChange]
970
+ );
971
+ const switchThemeFromElement = React.useCallback(
972
+ async (theme, element) => {
973
+ if (!isHydrated) {
974
+ setThemeWithServer(theme);
975
+ return;
976
+ }
977
+ if (themeState.ref.current) {
978
+ const originalRef = themeState.ref.current;
979
+ Object.defineProperty(themeState.ref, "current", {
980
+ value: element,
981
+ writable: true,
982
+ configurable: true
983
+ });
984
+ await themeState.switchTheme(theme);
985
+ Object.defineProperty(themeState.ref, "current", {
986
+ value: originalRef,
987
+ writable: true,
988
+ configurable: true
989
+ });
990
+ } else {
991
+ Object.defineProperty(themeState.ref, "current", {
992
+ value: element,
993
+ writable: true,
994
+ configurable: true
995
+ });
996
+ await themeState.switchTheme(theme);
997
+ }
998
+ if (onServerThemeChange) {
999
+ onServerThemeChange(theme);
1000
+ }
1001
+ },
1002
+ [isHydrated, themeState, setThemeWithServer, onServerThemeChange]
1003
+ );
1004
+ const systemTheme = typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1005
+ const serverResolvedTheme = (() => {
1006
+ if (hasServerTheme) {
1007
+ if (serverTheme === "dark") return "dark";
1008
+ if (serverTheme === "system") return systemTheme;
1009
+ return "light";
1010
+ }
1011
+ return defaultTheme === "dark" ? "dark" : "light";
1012
+ })();
1013
+ if (!isHydrated) {
1014
+ const loadingContextValue = {
1015
+ ref: { current: null },
1016
+ theme: initialTheme ?? defaultTheme,
1017
+ colorTheme: serverColorTheme ?? defaultColorTheme,
1018
+ resolvedTheme: serverResolvedTheme,
1019
+ systemTheme: "light",
1020
+ isHydrated: false,
1021
+ setTheme: setThemeWithServer,
1022
+ setColorTheme: setColorThemeWithServer,
1023
+ switchTheme: async (theme) => setThemeWithServer(theme),
1024
+ switchThemeFromElement: async (theme) => setThemeWithServer(theme),
1025
+ switchColorTheme: switchColorThemeWithServer,
1026
+ toggleTheme: async () => {
1027
+ const nextTheme = serverResolvedTheme === "dark" ? "light" : "dark";
1028
+ setThemeWithServer(nextTheme);
1029
+ },
1030
+ toggleLightTheme: async () => setThemeWithServer("light"),
1031
+ toggleDarkTheme: async () => setThemeWithServer("dark"),
1032
+ toggleColorTheme: themeState.toggleColorTheme,
1033
+ createColorThemeToggle: themeState.createColorThemeToggle,
1034
+ isColorThemeActive: themeState.isColorThemeActive
1035
+ };
1036
+ return /* @__PURE__ */ jsxRuntime.jsx(TanStackUIThemeContext.Provider, { value: loadingContextValue, children });
1037
+ }
1038
+ const contextValue = {
1039
+ ref: themeState.ref,
1040
+ theme: themeState.theme,
1041
+ colorTheme: themeState.colorTheme,
1042
+ resolvedTheme: themeState.resolvedTheme,
1043
+ systemTheme,
1044
+ isHydrated: true,
1045
+ setTheme: setThemeWithServer,
1046
+ setColorTheme: setColorThemeWithServer,
1047
+ switchTheme: switchThemeWithHydrationAwareness,
1048
+ switchThemeFromElement,
1049
+ switchColorTheme: switchColorThemeWithServer,
1050
+ toggleTheme: toggleThemeWithHydrationAwareness,
1051
+ toggleLightTheme: toggleLightThemeWithHydrationAwareness,
1052
+ toggleDarkTheme: toggleDarkThemeWithHydrationAwareness,
1053
+ toggleColorTheme: themeState.toggleColorTheme,
1054
+ createColorThemeToggle: themeState.createColorThemeToggle,
1055
+ isColorThemeActive: themeState.isColorThemeActive
1056
+ };
1057
+ return /* @__PURE__ */ jsxRuntime.jsx(TanStackUIThemeContext.Provider, { value: contextValue, children });
1058
+ };
1059
+ var useTanStackUITheme = () => {
1060
+ const context = React.useContext(TanStackUIThemeContext);
1061
+ if (context === void 0) {
1062
+ throw new Error(
1063
+ "useTanStackUITheme must be used within a TanStackUIThemeProvider"
1064
+ );
1065
+ }
1066
+ return context;
1067
+ };
1068
+ var ViteUIThemeContext = React.createContext(
1069
+ void 0
1070
+ );
1071
+ var ViteUIThemeProvider = ({
1072
+ children,
1073
+ themes = ["light", "dark", "system"],
1074
+ colorThemes = ["default"],
1075
+ defaultTheme = "system",
1076
+ defaultColorTheme = "default",
1077
+ animationType = "circle" /* CIRCLE */,
1078
+ duration = 750,
1079
+ attribute = "class",
1080
+ disableTransitionOnChange = false,
1081
+ storageKey = "ui-theme",
1082
+ colorStorageKey = "ui-color-theme",
1083
+ globalClassName = "dark",
1084
+ colorThemePrefix = "theme-"
1085
+ }) => {
1086
+ const themeState = useTheme({
1087
+ themes,
1088
+ colorThemes,
1089
+ defaultTheme,
1090
+ defaultColorTheme,
1091
+ animationType,
1092
+ duration,
1093
+ storageKey,
1094
+ colorStorageKey,
1095
+ globalClassName: attribute === "class" ? globalClassName : void 0,
1096
+ colorThemePrefix
1097
+ });
1098
+ const applyTransitionDisable = React.useCallback(() => {
1099
+ if (!disableTransitionOnChange) return () => {
1100
+ };
1101
+ const css = document.createElement("style");
1102
+ css.textContent = `*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;
1103
+ document.head.appendChild(css);
1104
+ window.getComputedStyle(document.body);
1105
+ return () => {
1106
+ setTimeout(() => {
1107
+ document.head.removeChild(css);
1108
+ }, 1);
1109
+ };
1110
+ }, [disableTransitionOnChange]);
1111
+ const wrappedSetTheme = React.useCallback(
1112
+ (theme) => {
1113
+ const cleanup = applyTransitionDisable();
1114
+ themeState.setTheme(theme);
1115
+ cleanup();
1116
+ },
1117
+ [themeState.setTheme, applyTransitionDisable]
1118
+ );
1119
+ const wrappedSwitchTheme = React.useCallback(
1120
+ async (theme, animationOff = false) => {
1121
+ const cleanup = applyTransitionDisable();
1122
+ await themeState.switchTheme(theme, animationOff);
1123
+ cleanup();
1124
+ },
1125
+ [themeState.switchTheme, applyTransitionDisable]
1126
+ );
1127
+ const wrappedToggleTheme = React.useCallback(
1128
+ async (animationOff = false) => {
1129
+ const cleanup = applyTransitionDisable();
1130
+ await themeState.toggleTheme(animationOff);
1131
+ cleanup();
1132
+ },
1133
+ [themeState.toggleTheme, applyTransitionDisable]
1134
+ );
1135
+ const wrappedToggleLightTheme = React.useCallback(
1136
+ async (animationOff = false) => {
1137
+ const cleanup = applyTransitionDisable();
1138
+ await themeState.toggleLightTheme(animationOff);
1139
+ cleanup();
1140
+ },
1141
+ [themeState.toggleLightTheme, applyTransitionDisable]
1142
+ );
1143
+ const wrappedToggleDarkTheme = React.useCallback(
1144
+ async (animationOff = false) => {
1145
+ const cleanup = applyTransitionDisable();
1146
+ await themeState.toggleDarkTheme(animationOff);
1147
+ cleanup();
1148
+ },
1149
+ [themeState.toggleDarkTheme, applyTransitionDisable]
1150
+ );
1151
+ const switchThemeFromElement = async (theme, element) => {
1152
+ const cleanup = applyTransitionDisable();
1153
+ if (themeState.ref.current) {
1154
+ const originalRef = themeState.ref.current;
1155
+ Object.defineProperty(themeState.ref, "current", {
1156
+ value: element,
1157
+ writable: true,
1158
+ configurable: true
1159
+ });
1160
+ await themeState.switchTheme(theme);
1161
+ Object.defineProperty(themeState.ref, "current", {
1162
+ value: originalRef,
1163
+ writable: true,
1164
+ configurable: true
1165
+ });
1166
+ } else {
1167
+ Object.defineProperty(themeState.ref, "current", {
1168
+ value: element,
1169
+ writable: true,
1170
+ configurable: true
1171
+ });
1172
+ await themeState.switchTheme(theme);
1173
+ }
1174
+ cleanup();
1175
+ };
1176
+ const systemTheme = getSystemTheme();
1177
+ const contextValue = {
1178
+ ref: themeState.ref,
1179
+ theme: themeState.theme,
1180
+ colorTheme: themeState.colorTheme,
1181
+ resolvedTheme: themeState.resolvedTheme,
1182
+ systemTheme,
1183
+ setTheme: wrappedSetTheme,
1184
+ setColorTheme: themeState.setColorTheme,
1185
+ switchTheme: wrappedSwitchTheme,
1186
+ switchThemeFromElement,
1187
+ switchColorTheme: themeState.switchColorTheme,
1188
+ toggleTheme: wrappedToggleTheme,
1189
+ toggleLightTheme: wrappedToggleLightTheme,
1190
+ toggleDarkTheme: wrappedToggleDarkTheme,
1191
+ toggleColorTheme: themeState.toggleColorTheme,
1192
+ createColorThemeToggle: themeState.createColorThemeToggle,
1193
+ isColorThemeActive: themeState.isColorThemeActive
1194
+ };
1195
+ return /* @__PURE__ */ jsxRuntime.jsx(ViteUIThemeContext.Provider, { value: contextValue, children });
1196
+ };
1197
+ var useViteUITheme = () => {
1198
+ const context = React.useContext(ViteUIThemeContext);
1199
+ if (context === void 0) {
1200
+ throw new Error("useViteUITheme must be used within a ViteUIThemeProvider");
1201
+ }
1202
+ return context;
1203
+ };
1204
+ var UIThemeContext = React.createContext(void 0);
1205
+ var UIThemeProvider = ({
1206
+ children,
1207
+ themes = ["light", "dark", "system"],
1208
+ colorThemes = ["default"],
1209
+ defaultTheme = "system",
1210
+ defaultColorTheme = "default",
1211
+ animationType = "circle" /* CIRCLE */,
1212
+ duration = 750,
1213
+ storageKey,
1214
+ colorStorageKey
1215
+ }) => {
1216
+ const [mounted, setMounted] = React.useState(false);
1217
+ const themeState = useTheme({
1218
+ themes,
1219
+ colorThemes,
1220
+ defaultTheme,
1221
+ defaultColorTheme,
1222
+ animationType,
1223
+ duration,
1224
+ storageKey,
1225
+ colorStorageKey
1226
+ });
1227
+ React.useEffect(() => {
1228
+ setMounted(true);
1229
+ }, []);
1230
+ const switchThemeFromElement = async (theme, element) => {
1231
+ if (themeState.ref.current) {
1232
+ const originalRef = themeState.ref.current;
1233
+ Object.defineProperty(themeState.ref, "current", {
1234
+ value: element,
1235
+ writable: true,
1236
+ configurable: true
1237
+ });
1238
+ await themeState.switchTheme(theme);
1239
+ Object.defineProperty(themeState.ref, "current", {
1240
+ value: originalRef,
1241
+ writable: true,
1242
+ configurable: true
1243
+ });
1244
+ } else {
1245
+ Object.defineProperty(themeState.ref, "current", {
1246
+ value: element,
1247
+ writable: true,
1248
+ configurable: true
1249
+ });
1250
+ await themeState.switchTheme(theme);
1251
+ }
1252
+ };
1253
+ if (!mounted) {
1254
+ const loadingContextValue = {
1255
+ ref: { current: null },
1256
+ theme: defaultTheme,
1257
+ colorTheme: defaultColorTheme,
1258
+ resolvedTheme: defaultTheme === "dark" ? "dark" : "light",
1259
+ setTheme: () => {
1260
+ },
1261
+ setColorTheme: () => {
1262
+ },
1263
+ switchTheme: async () => {
1264
+ },
1265
+ switchThemeFromElement: async () => {
1266
+ },
1267
+ switchColorTheme: () => {
1268
+ },
1269
+ toggleTheme: async () => {
1270
+ },
1271
+ toggleLightTheme: async () => {
1272
+ },
1273
+ toggleDarkTheme: async () => {
1274
+ },
1275
+ toggleColorTheme: () => {
1276
+ },
1277
+ createColorThemeToggle: () => () => {
1278
+ },
1279
+ isColorThemeActive: () => false
1280
+ };
1281
+ return /* @__PURE__ */ jsxRuntime.jsx(UIThemeContext.Provider, { value: loadingContextValue, children });
1282
+ }
1283
+ const contextValue = {
1284
+ ref: themeState.ref,
1285
+ theme: themeState.theme,
1286
+ colorTheme: themeState.colorTheme,
1287
+ resolvedTheme: themeState.resolvedTheme,
1288
+ setTheme: themeState.setTheme,
1289
+ setColorTheme: themeState.setColorTheme,
1290
+ switchTheme: themeState.switchTheme,
1291
+ switchThemeFromElement,
1292
+ switchColorTheme: themeState.switchColorTheme,
1293
+ toggleTheme: themeState.toggleTheme,
1294
+ toggleLightTheme: themeState.toggleLightTheme,
1295
+ toggleDarkTheme: themeState.toggleDarkTheme,
1296
+ toggleColorTheme: themeState.toggleColorTheme,
1297
+ createColorThemeToggle: themeState.createColorThemeToggle,
1298
+ isColorThemeActive: themeState.isColorThemeActive
1299
+ };
1300
+ return /* @__PURE__ */ jsxRuntime.jsx(UIThemeContext.Provider, { value: contextValue, children });
1301
+ };
1302
+ var useUITheme = () => {
1303
+ const context = React.useContext(UIThemeContext);
1304
+ if (context === void 0) {
1305
+ throw new Error("useUITheme must be used within a UIThemeProvider");
1306
+ }
1307
+ return context;
1308
+ };
1309
+ var SunIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
1310
+ "svg",
1311
+ {
1312
+ width: "16",
1313
+ height: "16",
1314
+ viewBox: "0 0 24 24",
1315
+ fill: "none",
1316
+ stroke: "currentColor",
1317
+ strokeWidth: "2",
1318
+ strokeLinecap: "round",
1319
+ strokeLinejoin: "round",
1320
+ children: [
1321
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "5" }),
1322
+ /* @__PURE__ */ jsxRuntime.jsx("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" })
1323
+ ]
1324
+ }
1325
+ );
1326
+ var MoonIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
1327
+ "svg",
1328
+ {
1329
+ width: "16",
1330
+ height: "16",
1331
+ viewBox: "0 0 24 24",
1332
+ fill: "none",
1333
+ stroke: "currentColor",
1334
+ strokeWidth: "2",
1335
+ strokeLinecap: "round",
1336
+ strokeLinejoin: "round",
1337
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
1338
+ }
1339
+ );
1340
+ var MonitorIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
1341
+ "svg",
1342
+ {
1343
+ width: "16",
1344
+ height: "16",
1345
+ viewBox: "0 0 24 24",
1346
+ fill: "none",
1347
+ stroke: "currentColor",
1348
+ strokeWidth: "2",
1349
+ strokeLinecap: "round",
1350
+ strokeLinejoin: "round",
1351
+ children: [
1352
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
1353
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
1354
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
1355
+ ]
1356
+ }
1357
+ );
1358
+ var ThemeOption = ({
1359
+ icon,
1360
+ value,
1361
+ isActive,
1362
+ isHovered,
1363
+ onClick,
1364
+ onMouseEnter,
1365
+ onMouseLeave,
1366
+ buttonRef
1367
+ }) => {
1368
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1369
+ "button",
1370
+ {
1371
+ ref: isActive ? buttonRef : void 0,
1372
+ className: `
1373
+ relative flex h-9 w-12 cursor-pointer items-center justify-center
1374
+ text-muted-foreground hover:text-foreground
1375
+ ${isActive ? "text-foreground font-medium" : ""}
1376
+ `,
1377
+ role: "radio",
1378
+ "aria-checked": isActive,
1379
+ "aria-label": `Switch to ${value} theme`,
1380
+ onClick: (event) => onClick(value, event),
1381
+ onMouseEnter,
1382
+ onMouseLeave,
1383
+ style: {
1384
+ borderRadius: "var(--radius)"
1385
+ },
1386
+ children: [
1387
+ isHovered && /* @__PURE__ */ jsxRuntime.jsx(
1388
+ "div",
1389
+ {
1390
+ className: "absolute inset-0 bg-muted",
1391
+ style: {
1392
+ borderRadius: "var(--radius)",
1393
+ transition: "all 0.2s ease"
1394
+ }
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_svg]:size-4", children: icon }) }),
1398
+ isActive && /* @__PURE__ */ jsxRuntime.jsx(
1399
+ "div",
1400
+ {
1401
+ className: "absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full",
1402
+ style: {
1403
+ backgroundColor: "hsl(var(--primary))"
1404
+ }
1405
+ }
1406
+ )
1407
+ ]
1408
+ }
1409
+ );
1410
+ };
1411
+ var THEME_OPTIONS = [
1412
+ { icon: /* @__PURE__ */ jsxRuntime.jsx(MonitorIcon, {}), value: "system" },
1413
+ { icon: /* @__PURE__ */ jsxRuntime.jsx(SunIcon, {}), value: "light" },
1414
+ { icon: /* @__PURE__ */ jsxRuntime.jsx(MoonIcon, {}), value: "dark" }
1415
+ ];
1416
+ var UIThemeSwitcher = ({
1417
+ themes = ["light", "dark", "system"],
1418
+ currentTheme,
1419
+ onThemeChange,
1420
+ animationType,
1421
+ duration,
1422
+ className
1423
+ }) => {
1424
+ let contextTheme = null;
1425
+ try {
1426
+ contextTheme = useUITheme();
1427
+ } catch {
1428
+ }
1429
+ const standaloneHook = useTheme({
1430
+ animationType,
1431
+ duration,
1432
+ themes,
1433
+ ...currentTheme !== void 0 && { theme: currentTheme },
1434
+ onThemeChange
1435
+ });
1436
+ const isControlled = contextTheme !== null;
1437
+ const { ref, theme, switchTheme } = isControlled && contextTheme ? {
1438
+ ref: contextTheme.ref,
1439
+ theme: contextTheme.theme,
1440
+ switchTheme: contextTheme.switchTheme
1441
+ } : standaloneHook;
1442
+ const [isMounted, setIsMounted] = React.useState(false);
1443
+ const [hoveredTheme, setHoveredTheme] = React.useState(null);
1444
+ React.useEffect(() => {
1445
+ setIsMounted(true);
1446
+ }, []);
1447
+ const handleThemeChange = async (newTheme, event) => {
1448
+ if (isControlled && contextTheme?.switchThemeFromElement && event) {
1449
+ await contextTheme.switchThemeFromElement(
1450
+ newTheme,
1451
+ event.currentTarget
1452
+ );
1453
+ if (onThemeChange) {
1454
+ onThemeChange(newTheme);
1455
+ }
1456
+ } else {
1457
+ await switchTheme(newTheme);
1458
+ }
1459
+ };
1460
+ const filteredOptions = THEME_OPTIONS.filter(
1461
+ (option) => themes.includes(option.value)
1462
+ );
1463
+ return /* @__PURE__ */ jsxRuntime.jsx(
1464
+ "div",
1465
+ {
1466
+ className: `
1467
+ inline-flex h-9 items-center overflow-hidden bg-background shadow-sm border border-border
1468
+ ${isMounted ? "opacity-100" : "opacity-0"}
1469
+ ${className || ""}
1470
+ `,
1471
+ style: {
1472
+ borderRadius: "var(--radius)",
1473
+ backgroundColor: "hsl(var(--background))"
1474
+ },
1475
+ role: "radiogroup",
1476
+ onMouseLeave: () => setHoveredTheme(null),
1477
+ children: filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1478
+ ThemeOption,
1479
+ {
1480
+ icon: option.icon,
1481
+ value: option.value,
1482
+ isActive: theme === option.value,
1483
+ isHovered: hoveredTheme === option.value,
1484
+ onClick: handleThemeChange,
1485
+ onMouseEnter: () => setHoveredTheme(option.value),
1486
+ onMouseLeave: () => {
1487
+ },
1488
+ buttonRef: theme === option.value ? ref : void 0
1489
+ },
1490
+ option.value
1491
+ ))
1492
+ }
1493
+ );
1494
+ };
1495
+ var ChevronDownIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
1496
+ "svg",
1497
+ {
1498
+ width: "16",
1499
+ height: "16",
1500
+ viewBox: "0 0 24 24",
1501
+ fill: "none",
1502
+ stroke: "currentColor",
1503
+ strokeWidth: "2",
1504
+ strokeLinecap: "round",
1505
+ strokeLinejoin: "round",
1506
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" })
1507
+ }
1508
+ );
1509
+ var ChevronUpIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
1510
+ "svg",
1511
+ {
1512
+ width: "16",
1513
+ height: "16",
1514
+ viewBox: "0 0 24 24",
1515
+ fill: "none",
1516
+ stroke: "currentColor",
1517
+ strokeWidth: "2",
1518
+ strokeLinecap: "round",
1519
+ strokeLinejoin: "round",
1520
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m18 15-6-6-6 6" })
1521
+ }
1522
+ );
1523
+ var CheckIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
1524
+ "svg",
1525
+ {
1526
+ width: "16",
1527
+ height: "16",
1528
+ viewBox: "0 0 24 24",
1529
+ fill: "none",
1530
+ stroke: "currentColor",
1531
+ strokeWidth: "2",
1532
+ strokeLinecap: "round",
1533
+ strokeLinejoin: "round",
1534
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6 9 17l-5-5" })
1535
+ }
1536
+ );
1537
+ function UISelect({
1538
+ ...props
1539
+ }) {
1540
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "ui-select", ...props });
1541
+ }
1542
+ function UISelectGroup({
1543
+ ...props
1544
+ }) {
1545
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Group, { "data-slot": "ui-select-group", ...props });
1546
+ }
1547
+ function UISelectValue({
1548
+ ...props
1549
+ }) {
1550
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "ui-select-value", ...props });
1551
+ }
1552
+ function UISelectTrigger({
1553
+ className,
1554
+ size = "default",
1555
+ children,
1556
+ ...props
1557
+ }) {
1558
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1559
+ SelectPrimitive__namespace.Trigger,
1560
+ {
1561
+ "data-slot": "ui-select-trigger",
1562
+ "data-size": size,
1563
+ className: `
1564
+ border-input data-[placeholder]:text-muted-foreground
1565
+ [&_svg:not([class*='text-'])]:text-muted-foreground
1566
+ focus-visible:border-ring focus-visible:ring-ring/50
1567
+ aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40
1568
+ aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50
1569
+ flex w-fit items-center justify-between gap-2 rounded-md border
1570
+ bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs
1571
+ transition-[color,box-shadow] outline-none focus-visible:ring-[3px]
1572
+ disabled:cursor-not-allowed disabled:opacity-50
1573
+ data-[size=default]:h-9 data-[size=sm]:h-8
1574
+ *:data-[slot=ui-select-value]:line-clamp-1
1575
+ *:data-[slot=ui-select-value]:flex
1576
+ *:data-[slot=ui-select-value]:items-center
1577
+ *:data-[slot=ui-select-value]:gap-2
1578
+ [&_svg]:pointer-events-none [&_svg]:shrink-0
1579
+ [&_svg:not([class*='size-'])]:size-4
1580
+ ${className || ""}
1581
+ `,
1582
+ ...props,
1583
+ children: [
1584
+ children,
1585
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {}) })
1586
+ ]
1587
+ }
1588
+ );
1589
+ }
1590
+ function UISelectContent({
1591
+ className,
1592
+ children,
1593
+ position = "popper",
1594
+ ...props
1595
+ }) {
1596
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1597
+ SelectPrimitive__namespace.Content,
1598
+ {
1599
+ "data-slot": "ui-select-content",
1600
+ className: `
1601
+ bg-popover text-popover-foreground
1602
+ data-[state=open]:animate-in data-[state=closed]:animate-out
1603
+ data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
1604
+ data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
1605
+ data-[side=bottom]:slide-in-from-top-2
1606
+ data-[side=left]:slide-in-from-right-2
1607
+ data-[side=right]:slide-in-from-left-2
1608
+ data-[side=top]:slide-in-from-bottom-2
1609
+ relative z-50 max-h-[var(--radix-select-content-available-height)]
1610
+ min-w-[8rem] origin-[var(--radix-select-content-transform-origin)]
1611
+ overflow-x-hidden overflow-y-auto rounded-md border shadow-md
1612
+ ${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" : ""}
1613
+ ${className || ""}
1614
+ `,
1615
+ position,
1616
+ ...props,
1617
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1618
+ SelectPrimitive__namespace.Viewport,
1619
+ {
1620
+ className: `
1621
+ p-1
1622
+ ${position === "popper" ? "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]" : ""}
1623
+ `,
1624
+ children
1625
+ }
1626
+ )
1627
+ }
1628
+ ) });
1629
+ }
1630
+ function UISelectLabel({
1631
+ className,
1632
+ ...props
1633
+ }) {
1634
+ return /* @__PURE__ */ jsxRuntime.jsx(
1635
+ SelectPrimitive__namespace.Label,
1636
+ {
1637
+ "data-slot": "ui-select-label",
1638
+ className: `py-1.5 pl-8 pr-2 text-sm font-semibold ${className || ""}`,
1639
+ ...props
1640
+ }
1641
+ );
1642
+ }
1643
+ function UISelectItem({
1644
+ className,
1645
+ children,
1646
+ ...props
1647
+ }) {
1648
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1649
+ SelectPrimitive__namespace.Item,
1650
+ {
1651
+ "data-slot": "ui-select-item",
1652
+ className: `
1653
+ focus:bg-accent focus:text-accent-foreground
1654
+ [&_svg:not([class*='text-'])]:text-muted-foreground
1655
+ relative flex w-full cursor-default items-center gap-2
1656
+ rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none
1657
+ data-[disabled]:pointer-events-none data-[disabled]:opacity-50
1658
+ [&_svg]:pointer-events-none [&_svg]:shrink-0
1659
+ [&_svg:not([class*='size-'])]:size-4
1660
+ *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2
1661
+ ${className || ""}
1662
+ `,
1663
+ ...props,
1664
+ children: [
1665
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) }) }),
1666
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
1667
+ ]
1668
+ }
1669
+ );
1670
+ }
1671
+ function UISelectSeparator({
1672
+ className,
1673
+ ...props
1674
+ }) {
1675
+ return /* @__PURE__ */ jsxRuntime.jsx(
1676
+ SelectPrimitive__namespace.Separator,
1677
+ {
1678
+ "data-slot": "ui-select-separator",
1679
+ className: `-mx-1 my-1 h-px bg-muted ${className || ""}`,
1680
+ ...props
1681
+ }
1682
+ );
1683
+ }
1684
+ function UISelectScrollUpButton({
1685
+ className,
1686
+ ...props
1687
+ }) {
1688
+ return /* @__PURE__ */ jsxRuntime.jsx(
1689
+ SelectPrimitive__namespace.ScrollUpButton,
1690
+ {
1691
+ "data-slot": "ui-select-scroll-up-button",
1692
+ className: `flex cursor-default items-center justify-center py-1 ${className || ""}`,
1693
+ ...props,
1694
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronUpIcon, {})
1695
+ }
1696
+ );
1697
+ }
1698
+ function UISelectScrollDownButton({
1699
+ className,
1700
+ ...props
1701
+ }) {
1702
+ return /* @__PURE__ */ jsxRuntime.jsx(
1703
+ SelectPrimitive__namespace.ScrollDownButton,
1704
+ {
1705
+ "data-slot": "ui-select-scroll-down-button",
1706
+ className: `flex cursor-default items-center justify-center py-1 ${className || ""}`,
1707
+ ...props,
1708
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {})
1709
+ }
1710
+ );
1711
+ }
1712
+ var UIThemeSelector = ({
1713
+ themes = ["light", "dark", "system"],
1714
+ colorThemes = ["default"],
1715
+ currentColorTheme,
1716
+ onColorThemeChange,
1717
+ animationType,
1718
+ duration,
1719
+ className,
1720
+ placeholder = "Choose a color theme"
1721
+ }) => {
1722
+ let contextTheme = null;
1723
+ try {
1724
+ contextTheme = useUITheme();
1725
+ } catch {
1726
+ }
1727
+ const standaloneHook = useTheme({
1728
+ animationType,
1729
+ duration,
1730
+ themes,
1731
+ colorThemes,
1732
+ ...currentColorTheme !== void 0 && { colorTheme: currentColorTheme },
1733
+ onColorThemeChange
1734
+ });
1735
+ const isControlled = contextTheme !== null;
1736
+ const { colorTheme, setColorTheme } = isControlled && contextTheme ? {
1737
+ colorTheme: contextTheme.colorTheme,
1738
+ setColorTheme: contextTheme.setColorTheme
1739
+ } : standaloneHook;
1740
+ const handleColorThemeChange = (newColorTheme) => {
1741
+ setColorTheme(newColorTheme);
1742
+ if (onColorThemeChange) {
1743
+ onColorThemeChange(newColorTheme);
1744
+ }
1745
+ };
1746
+ if (colorThemes.length <= 1) {
1747
+ return null;
1748
+ }
1749
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex flex-col gap-2 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs(UISelect, { value: colorTheme, onValueChange: handleColorThemeChange, children: [
1750
+ /* @__PURE__ */ jsxRuntime.jsx(UISelectTrigger, { className: "capitalize", children: /* @__PURE__ */ jsxRuntime.jsx(UISelectValue, { placeholder }) }),
1751
+ /* @__PURE__ */ jsxRuntime.jsx(UISelectContent, { children: colorThemes.map((theme) => /* @__PURE__ */ jsxRuntime.jsx(UISelectItem, { className: "capitalize", value: theme, children: theme }, theme)) })
1752
+ ] }) });
1753
+ };
1754
+
1755
+ exports.COLOR_STORAGE_KEY = COLOR_STORAGE_KEY;
1756
+ exports.COLOR_THEME_PREFIX = COLOR_THEME_PREFIX;
1757
+ exports.DEFAULT_BLUR_AMOUNT = DEFAULT_BLUR_AMOUNT;
1758
+ exports.DEFAULT_DURATION = DEFAULT_DURATION;
1759
+ exports.DEFAULT_EASING = DEFAULT_EASING;
1760
+ exports.DEFAULT_STYLE_ID = DEFAULT_STYLE_ID;
1761
+ exports.GLOBAL_CLASS_NAME = GLOBAL_CLASS_NAME;
1762
+ exports.NextUIThemeProvider = NextUIThemeProvider;
1763
+ exports.STORAGE_KEY = STORAGE_KEY;
1764
+ exports.TanStackStartThemeScript = TanStackStartThemeScript;
1765
+ exports.TanStackUIThemeProvider = TanStackUIThemeProvider;
1766
+ exports.ThemeAnimationType = ThemeAnimationType;
1767
+ exports.UISelect = UISelect;
1768
+ exports.UISelectContent = UISelectContent;
1769
+ exports.UISelectGroup = UISelectGroup;
1770
+ exports.UISelectItem = UISelectItem;
1771
+ exports.UISelectLabel = UISelectLabel;
1772
+ exports.UISelectScrollDownButton = UISelectScrollDownButton;
1773
+ exports.UISelectScrollUpButton = UISelectScrollUpButton;
1774
+ exports.UISelectSeparator = UISelectSeparator;
1775
+ exports.UISelectTrigger = UISelectTrigger;
1776
+ exports.UISelectValue = UISelectValue;
1777
+ exports.UIThemeProvider = UIThemeProvider;
1778
+ exports.UIThemeSelector = UIThemeSelector;
1779
+ exports.UIThemeSwitcher = UIThemeSwitcher;
1780
+ exports.ViteUIThemeProvider = ViteUIThemeProvider;
1781
+ exports.getSystemTheme = getSystemTheme;
1782
+ exports.injectBaseStyles = injectBaseStyles;
1783
+ exports.prefersReducedMotion = prefersReducedMotion;
1784
+ exports.resolveTheme = resolveTheme;
1785
+ exports.resolveThemeForServer = resolveThemeForServer;
1786
+ exports.supportsViewTransitions = supportsViewTransitions;
1787
+ exports.useNextUITheme = useNextUITheme;
1788
+ exports.useTanStackUITheme = useTanStackUITheme;
1789
+ exports.useTheme = useTheme;
1790
+ exports.useUITheme = useUITheme;
1791
+ exports.useViteUITheme = useViteUITheme;
1792
+ //# sourceMappingURL=index.cjs.map
1793
+ //# sourceMappingURL=index.cjs.map