uitheme-web 2.0.0 → 2.1.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.
- package/dist/bootstrap-DjA-_LjB.d.cts +104 -0
- package/dist/chunk-4HBM4JJB.cjs +1 -0
- package/dist/chunk-BYLNELO5.js +1 -0
- package/dist/chunk-DTUGFHPG.js +1 -0
- package/dist/chunk-EVSU6Y3J.cjs +1 -0
- package/dist/chunk-F4BPBR2Y.js +18 -0
- package/dist/chunk-HYVEXQI5.cjs +1 -0
- package/dist/chunk-NDTSXDQI.js +12 -0
- package/dist/chunk-R7KPCTX4.cjs +12 -0
- package/dist/chunk-UW5NJ23X.cjs +18 -0
- package/dist/chunk-ZCKIEEMW.js +1 -0
- package/dist/{constants-PAa1nGZ0.d.ts → constants-CDhU9uhC.d.cts} +2 -2
- package/dist/{constants-9M8X-rnX.d.cts → constants-DgJBS8qt.d.ts} +2 -2
- package/dist/{controller-DnMwV2nl.d.ts → controller-BASaPUJN.d.cts} +3 -1
- package/dist/{controller-83zmHd-p.d.cts → controller-D-S1gr00.d.ts} +3 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/{index-DqlTGyMr.d.cts → index-CT3I4-Jq.d.cts} +3 -3
- package/dist/{index-Dn3XRBX1.d.ts → index-DFVZPt84.d.ts} +3 -3
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.d.cts +3 -3
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +1 -1
- package/dist/react/index.cjs +1 -44
- package/dist/react/index.d.cts +17 -7
- package/dist/react/index.d.ts +17 -7
- package/dist/react/index.js +1 -44
- package/dist/server/index.cjs +1 -14
- package/dist/server/index.js +1 -14
- package/dist/tanstack/index.cjs +1 -1
- package/dist/tanstack/index.d.cts +3 -3
- package/dist/tanstack/index.d.ts +3 -3
- package/dist/tanstack/index.js +1 -1
- package/dist/{types-CrR56NLm.d.cts → types-C2tuWeMB.d.cts} +2 -0
- package/dist/{types-CrR56NLm.d.ts → types-C2tuWeMB.d.ts} +2 -0
- package/dist/vue/bootstrap.cjs +1 -0
- package/dist/vue/bootstrap.d.cts +2 -0
- package/dist/vue/bootstrap.js +1 -1
- package/dist/vue/index.cjs +1 -0
- package/dist/vue/index.d.cts +38 -0
- package/dist/vue/index.js +1 -1
- package/package.json +20 -8
- package/dist/chunk-4UXANDJ5.cjs +0 -26
- package/dist/chunk-C4YNAGUP.js +0 -26
- package/dist/chunk-CY5E6WU4.js +0 -18
- package/dist/chunk-EKVKQZNN.js +0 -12
- package/dist/chunk-EQPK72XK.js +0 -14
- package/dist/chunk-I5GA5T23.cjs +0 -18
- package/dist/chunk-KQSBORXP.cjs +0 -12
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare enum ThemeAnimationType {
|
|
4
|
+
CIRCLE = "circle",
|
|
5
|
+
BLUR_CIRCLE = "blur-circle",
|
|
6
|
+
SLIDE = "slide",
|
|
7
|
+
CLIP_PATH = "clip-path",
|
|
8
|
+
POLYGON_GRADIENT = "polygon-gradient",
|
|
9
|
+
TRIANGLE = "triangle",
|
|
10
|
+
SVG_LOGO = "svg-logo"
|
|
11
|
+
}
|
|
12
|
+
/** Clockwise from the top-left corner. */
|
|
13
|
+
declare const TRANSITION_DIRECTIONS: readonly ["top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left"];
|
|
14
|
+
type TransitionDirection = (typeof TRANSITION_DIRECTIONS)[number];
|
|
15
|
+
type AnimationPosition = TransitionDirection | 'center' | 'trigger';
|
|
16
|
+
interface ThemeAnimationSettings {
|
|
17
|
+
/** Starting edge/corner for polygon wipes. Defaults to top-left. */
|
|
18
|
+
clipPathDirection?: TransitionDirection;
|
|
19
|
+
/** Fixed circle/triangle origin; SVG_LOGO always uses the viewport center. */
|
|
20
|
+
animationPosition?: AnimationPosition;
|
|
21
|
+
/** Stationary logo width in CSS pixels or auto; default is 96 when both are omitted. */
|
|
22
|
+
logoWidth?: number | 'auto';
|
|
23
|
+
/** Logo height in CSS pixels or auto; omitted dimensions preserve the SVG aspect ratio. */
|
|
24
|
+
logoHeight?: number | 'auto';
|
|
25
|
+
/** Gradient wipe feather in CSS pixels; defaults to 80. */
|
|
26
|
+
gradientWidth?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Choose one shared asset, or both destination-specific assets. */
|
|
29
|
+
type ThemeLogoOptions = {
|
|
30
|
+
logo?: string;
|
|
31
|
+
logoLight?: never;
|
|
32
|
+
logoDark?: never;
|
|
33
|
+
} | {
|
|
34
|
+
logo?: never;
|
|
35
|
+
logoLight: string;
|
|
36
|
+
logoDark: string;
|
|
37
|
+
};
|
|
38
|
+
type ThemeAnimationOptions = ThemeAnimationSettings & ThemeLogoOptions;
|
|
39
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
40
|
+
type ColorTheme = string;
|
|
41
|
+
type SlideDirection = 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
42
|
+
type ThemeControlTransitionProps = {
|
|
43
|
+
duration?: number;
|
|
44
|
+
} & ({
|
|
45
|
+
animationType: 'slide';
|
|
46
|
+
slideDirection?: SlideDirection;
|
|
47
|
+
} | {
|
|
48
|
+
animationType?: 'circle' | 'blur-circle' | 'clip-path' | 'polygon-gradient' | 'triangle' | 'svg-logo';
|
|
49
|
+
slideDirection?: never;
|
|
50
|
+
});
|
|
51
|
+
interface ThemeConfig {
|
|
52
|
+
themes?: readonly Theme[];
|
|
53
|
+
colorThemes?: readonly ColorTheme[];
|
|
54
|
+
defaultTheme?: Theme;
|
|
55
|
+
defaultColorTheme?: ColorTheme;
|
|
56
|
+
globalClassName?: string;
|
|
57
|
+
colorThemePrefix?: string;
|
|
58
|
+
storageKey?: string;
|
|
59
|
+
colorStorageKey?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type ThemeBootstrapOptions = Omit<ThemeConfig, 'themes' | 'colorThemes'> & {
|
|
63
|
+
themes?: readonly Theme[];
|
|
64
|
+
colorThemes?: readonly string[];
|
|
65
|
+
storage?: unknown;
|
|
66
|
+
};
|
|
67
|
+
declare function getThemeScript(options?: ThemeBootstrapOptions): string;
|
|
68
|
+
|
|
69
|
+
type ThemeTransitionInput = boolean | {
|
|
70
|
+
element?: Element | null;
|
|
71
|
+
origin?: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
};
|
|
75
|
+
animationOff?: boolean;
|
|
76
|
+
};
|
|
77
|
+
type ThemeTrigger = ThemeTransitionInput | MouseEvent;
|
|
78
|
+
type TransitionOptions = ThemeAnimationOptions & {
|
|
79
|
+
animationType?: ThemeAnimationType | `${ThemeAnimationType}`;
|
|
80
|
+
duration?: number;
|
|
81
|
+
easing?: string;
|
|
82
|
+
blurAmount?: number;
|
|
83
|
+
styleId?: string;
|
|
84
|
+
slideDirection?: SlideDirection;
|
|
85
|
+
slideFromX?: number;
|
|
86
|
+
slideFromY?: number;
|
|
87
|
+
slideToX?: number;
|
|
88
|
+
slideToY?: number;
|
|
89
|
+
};
|
|
90
|
+
interface ThemeStorage {
|
|
91
|
+
getItem(key: string): string | null;
|
|
92
|
+
setItem(key: string, value: string): void;
|
|
93
|
+
}
|
|
94
|
+
type UIThemeOptions = Omit<ThemeConfig, 'themes' | 'colorThemes'> & TransitionOptions & {
|
|
95
|
+
themes?: readonly Theme[];
|
|
96
|
+
colorThemes?: readonly string[];
|
|
97
|
+
storage?: ThemeStorage | false;
|
|
98
|
+
onThemeChange?: (theme: Theme) => void;
|
|
99
|
+
onColorThemeChange?: (theme: string) => void;
|
|
100
|
+
};
|
|
101
|
+
type ReactiveTransitionOptions = MaybeRefOrGetter<TransitionOptions>;
|
|
102
|
+
|
|
103
|
+
export { getThemeScript as j };
|
|
104
|
+
export type { AnimationPosition as A, ColorTheme as C, ReactiveTransitionOptions as R, SlideDirection as S, Theme as T, UIThemeOptions as U, ThemeTrigger as a, ThemeAnimationOptions as b, ThemeConfig as c, ThemeControlTransitionProps as d, ThemeLogoOptions as e, ThemeStorage as f, ThemeTransitionInput as g, TransitionDirection as h, TransitionOptions as i };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var t=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),u='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',c=(e,n,s,r)=>e?s?`(v=g(${t(n)}),${t(s)}.includes(v)?v:${t(r)})`:`g(${t(n)})||${t(r)}`:t(r),d=(e,[n,s,r],[o,g,i],a,l)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${c(e,n,s,r)},p=${c(e,o,g,i)},q=${a};${l}}catch(e){console.warn(e)}})()`;exports.a=t;exports.b=u;exports.c=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c,d,b,a}from'./chunk-CTNYTI5Q.js';var r=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),p='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',u=(e,o,t,s)=>e?t?`(v=g(${r(o)}),${r(t)}.includes(v)?v:${r(s)})`:`g(${r(o)})||${r(s)}`:r(s),f=(e,[o,t,s],[l,m,c],a,n)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${u(e,o,t,s)},p=${u(e,l,m,c)},q=${a};${n}}catch(e){console.warn(e)}})()`;function y(e={}){let o=e.themes??["light","dark","system"],t=e.colorThemes??["default"],s=e.defaultTheme??"system",l=e.defaultColorTheme??t[0],m=e.globalClassName??c,c$1=e.colorThemePrefix??d;if(!o.length||!o.every(n=>["light","dark","system"].includes(n))||!o.includes(s))throw new Error("themes must include defaultTheme and contain light, dark, or system.");if(!l||!t.includes(l)||![m,...t.map(n=>`${c$1}${n}`)].every(n=>n.length>0&&!/\s/.test(n)))throw new Error("Color themes and class names must be valid CSS class tokens.");let a$1=e.storage===void 0;return f(a$1,[e.storageKey??a,o,s],[e.colorStorageKey??b,t,l],p,`l.toggle(${r(m)},q);d.style.colorScheme=q?"dark":"light";${r(t)}.forEach(function(v){l.toggle(${r(c$1)}+v,v==p)})`)}export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),u='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',c=(e,n,s,r)=>e?s?`(v=g(${t(n)}),${t(s)}.includes(v)?v:${t(r)})`:`g(${t(n)})||${t(r)}`:t(r),d=(e,[n,s,r],[o,g,i],a,l)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${c(e,n,s,r)},p=${c(e,o,g,i)},q=${a};${l}}catch(e){console.warn(e)}})()`;export{t as a,u as b,d as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkR7KPCTX4_cjs=require('./chunk-R7KPCTX4.cjs'),chunk4HBM4JJB_cjs=require('./chunk-4HBM4JJB.cjs'),chunkCYGYUQUK_cjs=require('./chunk-CYGYUQUK.cjs'),se=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var se__default=/*#__PURE__*/_interopDefault(se);var ee=t=>{let o;return {controller:chunkR7KPCTX4_cjs.j(t,{commit:e=>reactDom.flushSync(e),getElement:()=>o?.current??null}),connectTrigger:e=>{o=e;}}},B=(t={})=>{let o=se.useRef(null),[r]=se.useState(()=>ee(t)),{controller:e}=r,n=se.useRef(t),h=se.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return se.useLayoutEffect(()=>{let i=Object.fromEntries(Object.keys(n.current).filter(m=>!(m in t)).map(m=>[m,void 0]));e.updateOptions({...i,...t}),n.current=t;}),se.useLayoutEffect(()=>(r.connectTrigger(o),e.mount()),[e,r]),se.useMemo(()=>({...h,ref:o,setTheme:e.setTheme,setColorTheme:e.setColorTheme,switchTheme:e.switchTheme,switchColorTheme:e.switchColorTheme,toggleTheme:e.toggleTheme,toggleLightTheme:e.toggleLightTheme,toggleDarkTheme:e.toggleDarkTheme,toggleColorTheme:e.toggleColorTheme,createColorThemeToggle:e.createColorThemeToggle,isColorThemeActive:e.isColorThemeActive}),[h,e])};var oe=()=>()=>{},re=()=>true,ne=()=>false,$=()=>se.useSyncExternalStore(oe,re,ne);var U=se.createContext(null);var E=se.createContext(void 0),R=se__default.default.memo(({themes:t,colorThemes:o,storageKey:r,colorStorageKey:e,defaultTheme:n,defaultColorTheme:h,attribute:i,globalClassName:m,colorThemePrefix:c,nonce:u})=>{let d=chunk4HBM4JJB_cjs.c(true,[r,t,n],[e,o,h],chunk4HBM4JJB_cjs.b,`${i==="data-theme"?'d.setAttribute("data-theme",q?"dark":"light")':`l.toggle(${chunk4HBM4JJB_cjs.a(m)},q)`};d.style.colorScheme=q?"dark":"light";l.add(${chunk4HBM4JJB_cjs.a(c)}+p)`);return jsxRuntime.jsx("script",{nonce:u,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:d}})});R.displayName="ThemePreHydrationScript";var Ne=({children:t,themes:o=["light","dark","system"],colorThemes:r=["default"],defaultTheme:e="system",defaultColorTheme:n=r[0]??"default",animationType:h="circle",clipPathDirection:i,animationPosition:m,logo:c,logoLight:u,logoDark:d,logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X=400,storageKey:g=chunkCYGYUQUK_cjs.a,colorStorageKey:p=chunkCYGYUQUK_cjs.b,attribute:y="class",globalClassName:C=chunkCYGYUQUK_cjs.c,colorThemePrefix:f=chunkCYGYUQUK_cjs.d,nonce:x,disableAnimationOnInit:N=true,disablePreHydrationScript:b=false})=>{let S=$(),l=B({themes:o,colorThemes:r,defaultTheme:e,defaultColorTheme:n,animationType:h,clipPathDirection:i,animationPosition:m,...chunkR7KPCTX4_cjs.c({logo:c,logoLight:u,logoDark:d}),logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X,storageKey:g,colorStorageKey:p,globalClassName:y==="class"?C:void 0,colorThemePrefix:f,nonce:x}),T=se.useCallback(async(s,P=false)=>{!S&&N?l.setTheme(s):await l.switchTheme(s,P);},[S,N,l]),I=se.useCallback((s,P)=>T(s,{element:P}),[T]),A=se.useMemo(()=>({...l,switchTheme:T,switchThemeFromElement:I}),[l,T,I]);if(!S){let s={themes:o,colorThemes:r,mounted:false,ref:{current:null},theme:e,colorTheme:n,resolvedTheme:e==="dark"?"dark":"light",systemTheme:"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsxRuntime.jsx(E.Provider,{value:s,children:jsxRuntime.jsxs(U.Provider,{value:s,children:[!b&&jsxRuntime.jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})}return jsxRuntime.jsx(E.Provider,{value:A,children:jsxRuntime.jsxs(U.Provider,{value:A,children:[!b&&jsxRuntime.jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})},be=()=>{let t=se.useContext(E);if(t===void 0)throw new Error("useNextUITheme must be used within a NextUIThemeProvider");return t};exports.a=B;exports.b=U;exports.c=$;exports.d=Ne;exports.e=be;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var y=t=>{let e=document.createElement("style");return t&&(e.nonce=t),e};var x=typeof window<"u",W=t=>{if(!x||document.getElementById("ui-theme-base-style"))return;let e=y(t);e.id="ui-theme-base-style",e.textContent=`
|
|
2
|
+
html[data-ui-theme-transition]::view-transition-group(root),
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
4
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
5
|
+
animation: none;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
9
|
+
mix-blend-mode: normal;
|
|
10
|
+
}
|
|
11
|
+
html[data-ui-theme-transition],
|
|
12
|
+
html[data-ui-theme-transition] *,
|
|
13
|
+
html[data-ui-theme-transition] *::before,
|
|
14
|
+
html[data-ui-theme-transition] *::after {
|
|
15
|
+
transition: none !important;
|
|
16
|
+
}
|
|
17
|
+
`,document.head.appendChild(e);},B=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,M=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",H=t=>t==="system"?M():t==="dark"?"dark":"light",I=t=>t==="system"?"system":t==="dark"?"dark":"light",D=()=>x&&document.startViewTransition instanceof Function,F=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},v=t=>t/window.innerWidth*100,A=t=>t/window.innerHeight*100,$=(t,e)=>{let{innerWidth:n,innerHeight:o}=window;return Math.hypot(Math.max(Math.abs(t),Math.abs(n-t)),Math.max(Math.abs(e),Math.abs(o-e)))+1},k=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),{innerWidth:e,innerHeight:n}=window;return {x:(parseFloat(t.width)||e)/e,y:(parseFloat(t.height)||n)/n}},P=t=>{let{innerWidth:e,innerHeight:n}=window;return t/(Math.hypot(e,n)/Math.SQRT2)*100},G=t=>{let e=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,n=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:e,y:n}},R=0,g=(t,e)=>{let n=document.documentElement.animate(e,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=n.effect;if(!(o instanceof KeyframeEffect))return n;let i=o.getKeyframes(),r=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[r]!=="none")return n;let d=n.playState==="paused",c=n.currentTime;n.cancel(),n.finished.catch(()=>{});let s=`ui-theme-reveal-${++R}`,a=y(t.nonce),p=i.map(l=>{let b=Object.entries(l).filter(([f])=>!["offset","computedOffset","easing","composite"].includes(f)).map(([f,w])=>`${f.replace(/[A-Z]/g,S=>`-${S.toLowerCase()}`)}:${w};`).join("");return `${l.computedOffset*100}%{${b}}`}).join("");a.textContent=`@keyframes ${s}{${p}}html[data-ui-theme-transition]::view-transition-new(root){animation:${s} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let h=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,u=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===h);if(!u)throw a.remove(),new Error("Transition pseudo animations are unavailable");return d&&(u.pause(),u.currentTime=c),u.finished.then(()=>a.remove(),()=>a.remove()),u},K=t=>{let e=t.clipPathDirection??"top-left",n={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return g(t,{clipPath:[n[e],o[e]]})},O=t=>{let e=t.clipPathDirection??"top-left",n=k(),o=window.innerWidth*n.x,i=window.innerHeight*n.y,r=e.includes("-"),m=e.includes("left"),d=e.includes("top"),c=e==="left"||e==="right",s=m?0:e.includes("right")?1:.5,a=d?0:e.includes("bottom")?1:.5,p=r||c?o*3:o,h=r||!c?i*3:i,u=r?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",l=r?p*h/Math.hypot(p,h):c?p:h,f=1-Math.max(0,Math.min(t.gradientWidth??80,l*.2))/l,w=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${a*100}" x2="${100*(r?.5:c?1-s:s)}" y2="${100*(r?.5:c?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${f}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${u}" fill="url(#edge)"/></svg>`;return g(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(w)}")`,`url("data:image/svg+xml,${encodeURIComponent(w)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[r?"0px 0px":c?`0px ${h}px`:`${p}px 0px`,`${p}px ${h}px`],maskPosition:[`${s*o}px ${a*i}px`,`${s*(o-p)}px ${a*(i-h)}px`]})},U=t=>{let{x:e,y:n}=t,o=$(e,n),i=Math.sqrt(3)*o,r=(d,c)=>`${v(d)}% ${A(c)}%`,m=r(e,n);return g(t,{clipPath:[`polygon(${m}, ${m}, ${m})`,`polygon(${r(e,n-2*o)}, ${r(e+i,n+o)}, ${r(e-i,n+o)})`]})},z=t=>{let{innerWidth:e,innerHeight:n}=window;return C({...t,x:e/2,y:n/2})},C=t=>{let{x:e,y:n}=t,o=`at ${v(e)}% ${A(n)}%`;return g(t,{clipPath:[`circle(0% ${o})`,`circle(${P($(e,n))}% ${o})`]})},N=t=>{let{a:e=-100,b:n=0,x:o=0,y:i=0}=t;return g(t,{transform:[`translate(${e}%, ${n}%)`,`translate(${o}%, ${i}%)`]})},q=t=>{let{x:e,y:n,blurAmount:o}=t;if(o<=0)return C(t);let i=Math.min(o,20),r=$(e,n)+i,m=k(),[d,c,s,a]=[e*m.x,n*m.y,r*m.x,r*m.y];return g(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${s*2}px ${a*2}px`],maskPosition:[`${d}px ${c}px`,`${d-s}px ${c-a}px`]})};
|
|
18
|
+
export{y as a,W as b,B as c,M as d,H as e,I as f,D as g,F as h,j as i,G as j,K as k,O as l,U as m,z as n,C as o,N as p,q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var r=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),i='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',h=(e,o,t,s)=>e?t?`(v=g(${r(o)}),${r(t)}.includes(v)?v:${r(s)})`:`g(${r(o)})||${r(s)}`:r(s),g=(e,[o,t,s],[c,l,m],a,n)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${h(e,o,t,s)},p=${h(e,c,l,m)},q=${a};${n}}catch(e){console.warn(e)}})()`;var d="theme",p="color-theme",T="dark",u="theme-";function y(e={}){let o=e.themes??["light","dark","system"],t=e.colorThemes??["default"],s=e.defaultTheme??"system",c=e.defaultColorTheme??t[0],l=e.globalClassName??T,m=e.colorThemePrefix??u;if(!o.length||!o.every(n=>["light","dark","system"].includes(n))||!o.includes(s))throw new Error("themes must include defaultTheme and contain light, dark, or system.");if(!c||!t.includes(c)||![l,...t.map(n=>`${m}${n}`)].every(n=>n.length>0&&!/\s/.test(n)))throw new Error("Color themes and class names must be valid CSS class tokens.");let a=e.storage===void 0;return g(a,[e.storageKey??d,o,s],[e.colorStorageKey??p,t,c],i,`l.toggle(${r(l)},q);d.style.colorScheme=q?"dark":"light";${r(t)}.forEach(function(v){l.toggle(${r(m)}+v,v==p)})`)}exports.a=d;exports.b=p;exports.c=T;exports.d=u;exports.e=y;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {g,h,b as b$1,p,q,k,l,m,n,o,d,e,a as a$1,i,j}from'./chunk-F4BPBR2Y.js';import {a,b,c,d as d$1,h as h$1,f}from'./chunk-NDNCNR4X.js';var J=(a=>(a.CIRCLE="circle",a.BLUR_CIRCLE="blur-circle",a.SLIDE="slide",a.CLIP_PATH="clip-path",a.POLYGON_GRADIENT="polygon-gradient",a.TRIANGLE="triangle",a.SVG_LOGO="svg-logo",a))(J||{}),Ke=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=o=>{if(o.logoLight!==void 0||o.logoDark!==void 0){if(!o.logoLight||!o.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(o.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:o.logoLight,logoDark:o.logoDark}}return {logo:o.logo}},Ne=0,xe=o=>{let r=$e(o.logo);if(!r)return;let t=o.logoWidth!=="auto"&&o.logoWidth&&Number.isFinite(o.logoWidth)&&o.logoWidth>0?o.logoWidth:void 0,n=o.logoHeight!=="auto"&&o.logoHeight&&Number.isFinite(o.logoHeight)&&o.logoHeight>0?o.logoHeight:void 0,d=t??(n?n*r.aspectRatio:o.logoWidth==="auto"||o.logoHeight==="auto"?r.naturalWidth:96),m=n??d/r.aspectRatio,c=`ui-theme-logo-${++Ne}`,a=document.createElement("img");a.src=r.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${d/2}px);top:calc(50% - ${m/2}px);width:${d}px;height:${m}px;max-width:none;max-height:none;object-fit:contain;display:block;margin:0;padding:0;border:0;transform:none;pointer-events:none;z-index:2147483647;view-transition-name:${c};`;let T=a$1(o.nonce);return T.setAttribute("data-ui-theme-logo-style",""),T.textContent=`
|
|
2
|
+
@keyframes ${c}-fade { 0%, 85% { opacity:1; } 100% { opacity:0; } }
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-group(${c}) {
|
|
4
|
+
z-index:2;
|
|
5
|
+
animation:${c}-fade ${o.duration}ms linear both;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(${c}) { display:none; }
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(${c}) {
|
|
9
|
+
animation:none; mix-blend-mode:normal;
|
|
10
|
+
}
|
|
11
|
+
`,document.head.appendChild(T),document.documentElement.appendChild(a),{element:a,style:T}},Q=new Map,Oe=o=>{if(typeof window>"u")return Promise.resolve();let r=Q.get(o);if(r)return r.loading;let t={loading:Promise.resolve()};return Q.set(o,t),t.loading=(async()=>{let n=new AbortController,d=setTimeout(()=>n.abort(),2e3);try{let m=await fetch(o,{signal:n.signal});if(!m.ok)return;let c=await m.text(),a=new DOMParser().parseFromString(c,"image/svg+xml");if(a.querySelector("parsererror")||a.documentElement.localName!=="svg"||a.documentElement.namespaceURI!=="http://www.w3.org/2000/svg")return;let T=`data:image/svg+xml,${encodeURIComponent(c)}`,u=new Image;u.src=T,await u.decode(),u.naturalWidth>0&&u.naturalHeight>0&&(t.ready={image:T,naturalWidth:u.naturalWidth,aspectRatio:u.naturalWidth/u.naturalHeight});}catch{}finally{clearTimeout(d);}})(),t.loading},$e=o=>o?Q.get(o)?.ready:void 0;var D=new WeakMap,Ae=async(o$1,r)=>{if(typeof document>"u"){await o$1();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let n$1={updateDone:Promise.resolve()};D.set(document,n$1);let d=()=>{n$1.animation?.cancel(),n$1.logo?.element.remove(),n$1.logo?.style.remove(),D.get(document)===n$1&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};n$1.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==n$1||!r||!g()||h()||document.visibilityState==="hidden"){await o$1();return}b$1(r.nonce),document.documentElement.setAttribute("data-ui-theme-transition",""),r.animationType==="svg-logo"&&(n$1.logo=xe(r));let m;try{m=document.startViewTransition(o$1);}catch{await o$1();return}n$1.transition=m,m.ready.catch(()=>{}),m.finished.then(d,d),await m.updateCallbackDone;})();try{await n$1.updateDone;let m$1=n$1.transition;if(!m$1){d();return}try{await m$1.ready;}catch{d();return}if(D.get(document)!==n$1){m$1.skipTransition();return}if(!r)return;try{n$1.animation=r.animationType==="slide"?p(r):r.animationType==="blur-circle"?q(r):r.animationType==="clip-path"?k(r):r.animationType==="polygon-gradient"?l(r):r.animationType==="triangle"?m(r):r.animationType==="svg-logo"?n(r):o(r),n$1.animation.finished.catch(()=>{});let c=n$1.animation.effect;!(n$1.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m$1.skipTransition(),d());}catch{m$1.skipTransition(),d();}}catch(m){throw d(),m}};var B=typeof window<"u",Ie=(o=a,r=["light","dark","system"],t="system")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return r.find(d=>d===n)??t},De=(o,r=a)=>{B&&localStorage.setItem(r,o);},ke=(o=b,r=["default"],t="default")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return n&&r.includes(n)?n:t},Pe=(o,r=b)=>{B&&localStorage.setItem(r,o);};function G(o){if(!["light","dark","system"].includes(o))throw new Error("Theme must be light, dark, or system.")}function M(o,r){let t=`${r}${o}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(o={}){let r=o.themes??["light","dark","system"],t=o.colorThemes??["default"],n=o.defaultTheme??"system",d=o.defaultColorTheme??t[0],m=o.globalClassName??c,c$1=o.colorThemePrefix??d$1;if(!r.length||!r.every(a=>["light","dark","system"].includes(a))||!r.includes(n))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(d===void 0||!t.includes(d))throw new Error("colorThemes must include the defaultColorTheme.");if(![m,...t.map(a=>`${c$1}${a}`)].every(a=>a.length>0&&!/\s/.test(a)))throw new Error("Theme classes must be nonempty CSS class tokens.");return {themes:Object.freeze([...r]),colorThemes:Object.freeze([...t]),defaultTheme:n,defaultColorTheme:d,globalClassName:m,colorThemePrefix:c$1,storageKey:o.storageKey??a,colorStorageKey:o.colorStorageKey??b}}var Y=(o,r)=>o.length===r.length&&o.every((t,n)=>t===r[n]),Re=o=>o&&o!==true&&"currentTarget"in o?{element:o.currentTarget,animationOff:o.detail===0}:o,ot=(o={},r={})=>{let t=o,n=Z(t);_(t);let d$1=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&M(e.colorTheme,s),e.initialColorTheme!==void 0&&M(e.initialColorTheme,s);};d$1(t,n.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c=()=>{if(t.storage===void 0)return Ie(t.storageKey,n.themes,n.defaultTheme);let e=m(t.storageKey??a);return n.themes.find(s=>s===e)??n.defaultTheme},a$1=()=>{if(t.storage===void 0)return ke(t.colorStorageKey,n.colorThemes,n.defaultColorTheme);let e=m(t.colorStorageKey??b);return n.colorThemes.find(s=>s===e)??n.defaultColorTheme},T=t.initialTheme??c(),u=t.initialColorTheme??a$1(),ee=false,te=false,k=d(),x=false,N=0,w=0,j$1,$,K,W,q=new Set,oe=t.theme??t.initialTheme??n.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??n.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:n.themes,colorThemes:n.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:e(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b$2=l.colorTheme,_e=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=n.globalClassName,h=n.colorThemePrefix;W&&W!==s&&e.classList.remove(W),e.classList.remove("auto","system"),t.systemThemeMode==="css"&&l.theme==="system"?(e.classList.remove(s),e.classList.add("system"),e.style.colorScheme=""):(e.classList.toggle(s,l.resolvedTheme==="dark"),e.style.colorScheme=l.resolvedTheme),W=s,K&&e.classList.remove(K),l.colorThemes.forEach(i=>e.classList.remove(`${h}${i}`)),K=`${h}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,h=n.themes,i=n.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,h)?l.themes:h,colorThemes:Y(l.colorThemes,i)?l.colorThemes:i,mounted:x},y=g.theme!==l.theme||g.colorTheme!==l.colorTheme||g.resolvedTheme!==l.resolvedTheme||g.systemTheme!==l.systemTheme||g.themes!==l.themes||g.colorThemes!==l.colorThemes||g.mounted!==l.mounted;y&&(l=g),_e(),y&&q.forEach(C=>C());},re=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&Oe(e);},ie=e=>{try{e();}catch(s){let h=s instanceof Error?s:new Error(String(s));r.onBrowserStorageError?r.onBrowserStorageError(h):console.warn("Unable to persist the theme preference:",h);}},se=e=>{G(e),t.storage===void 0?ie(()=>De(e,t.storageKey??a)):t.storage&&t.storage.setItem(t.storageKey??a,e),ee=true,O=e,t.theme===void 0&&(T=e),E(),t.onThemeChange?.(e);},ae=e=>{M(e,n.colorThemePrefix),t.storage===void 0?ie(()=>Pe(e,t.colorStorageKey??b)):t.storage&&t.storage.setItem(t.colorStorageKey??b,e),te=true,P=e,t.colorTheme===void 0&&(u=e),E(),t.onColorThemeChange?.(e);},Ge=(e$1=false)=>{let s=e$1===true||e$1===false?{animationOff:e$1}:e$1,h=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,i$1={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};h&&Object.assign(i$1,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(i$1);let g=i$1.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===i$1.animationType)??"circle",C={duration:g,easing:i$1.easing??f,animationType:y,blurAmount:i$1.blurAmount??2,styleId:i$1.styleId??h$1,nonce:t.nonce};if(y==="slide"){let R=i$1.slideFromX!==void 0&&i$1.slideFromY!==void 0?{a:i$1.slideFromX,b:i$1.slideFromY}:i(i$1.slideDirection??"left");return {...C,...R,x:i$1.slideToX??0,y:i$1.slideToY??0}}let A=s.element??r.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f$1=(y==="svg-logo"?j("center"):null)??s.origin??(i$1.animationPosition&&i$1.animationPosition!=="trigger"?j(i$1.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:j("center"));return !f$1||!Number.isFinite(f$1.x)||!Number.isFinite(f$1.y)?null:{...C,...f$1,clipPathDirection:i$1.clipPathDirection??"top-left",animationPosition:i$1.animationPosition,logo:i$1.logoLight!==void 0?e(O)==="light"?i$1.logoLight:i$1.logoDark:i$1.logo,logoWidth:i$1.logoWidth,logoHeight:i$1.logoHeight,gradientWidth:i$1.gradientWidth}},le=async(e,s)=>{let h=Ge(s),i=w,g=()=>{i===w&&e();};N++;try{await Ae(()=>{if(i===w)return r.commit?r.commit(g):g()},h);}finally{i===w&&N--;}},F=async(e,s)=>{if(G(e),!n.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let h=w;try{await le(()=>se(e),s);}catch(i){throw h===w&&p===e&&(p=O),i}},X=async(e,s)=>{if(!n.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b$2)return;b$2=e;let h=w;try{await le(()=>ae(e),s);}catch(i){throw h===w&&b$2===e&&(b$2=P),i}},z=()=>{w++,N=0,j$1?.(),j$1=void 0,$=void 0,x=false,E();};return {getSnapshot:()=>l,getServerSnapshot:()=>ne,subscribe:e=>(q.add(e),()=>{q.delete(e);}),mount:()=>{if(x||typeof window>"u"||typeof document>"u")return z;x=true,!ee&&t.initialTheme===void 0&&(T=c()),!te&&t.initialColorTheme===void 0&&(u=a$1()),O=p=t.theme??T,P=b$2=t.colorTheme??u,k=d();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=d(),E();},h=i=>{if(i.storageArea&&i.storageArea!==window.localStorage)return;let g=n.themes,y=n.colorThemes;if((i.key===null||i.key===(t.storageKey??a))&&t.theme===void 0){let C=i.newValue??n.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((i.key===null||i.key===(t.colorStorageKey??b))&&t.colorTheme===void 0){let C=i.newValue??n.defaultColorTheme;y.includes(C)&&(u=P=b$2=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",h),t.storage===void 0&&window.addEventListener("storage",h);},$(),j$1=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",h);},b$1(t.nonce),re(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,h=l.colorTheme,i={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=i,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);d$1(v,f.colorThemePrefix),!Y(n.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(n.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,n=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),h!==l.colorTheme&&(P=b$2=l.colorTheme)),x&&(re(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b$2=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e$1=>{let s=e(p)==="dark"?"light":"dark",h=n.themes.includes(s)?s:n.themes[(n.themes.indexOf(p)+1)%n.themes.length];return F(h,e$1)},toggleLightTheme:async e$1=>{e(p)!=="light"&&await F("light",e$1);},toggleDarkTheme:async e$1=>{e(p)!=="dark"&&await F("dark",e$1);},toggleColorTheme:async e=>{let s=n.colorThemes;s.length!==0&&await X(s[(s.indexOf(b$2)+1)%s.length],Re(e));},createColorThemeToggle:e=>s=>X(e,Re(s)),isColorThemeActive:e=>l.colorTheme===e}};
|
|
12
|
+
export{J as a,Ke as b,_ as c,Oe as d,Ae as e,Ie as f,De as g,ke as h,Pe as i,ot as j};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';var chunkUW5NJ23X_cjs=require('./chunk-UW5NJ23X.cjs'),chunkCYGYUQUK_cjs=require('./chunk-CYGYUQUK.cjs');var J=(a=>(a.CIRCLE="circle",a.BLUR_CIRCLE="blur-circle",a.SLIDE="slide",a.CLIP_PATH="clip-path",a.POLYGON_GRADIENT="polygon-gradient",a.TRIANGLE="triangle",a.SVG_LOGO="svg-logo",a))(J||{}),Ke=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=o=>{if(o.logoLight!==void 0||o.logoDark!==void 0){if(!o.logoLight||!o.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(o.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:o.logoLight,logoDark:o.logoDark}}return {logo:o.logo}},Ne=0,xe=o=>{let r=$e(o.logo);if(!r)return;let t=o.logoWidth!=="auto"&&o.logoWidth&&Number.isFinite(o.logoWidth)&&o.logoWidth>0?o.logoWidth:void 0,n=o.logoHeight!=="auto"&&o.logoHeight&&Number.isFinite(o.logoHeight)&&o.logoHeight>0?o.logoHeight:void 0,d=t??(n?n*r.aspectRatio:o.logoWidth==="auto"||o.logoHeight==="auto"?r.naturalWidth:96),m=n??d/r.aspectRatio,c=`ui-theme-logo-${++Ne}`,a=document.createElement("img");a.src=r.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${d/2}px);top:calc(50% - ${m/2}px);width:${d}px;height:${m}px;max-width:none;max-height:none;object-fit:contain;display:block;margin:0;padding:0;border:0;transform:none;pointer-events:none;z-index:2147483647;view-transition-name:${c};`;let T=chunkUW5NJ23X_cjs.a(o.nonce);return T.setAttribute("data-ui-theme-logo-style",""),T.textContent=`
|
|
2
|
+
@keyframes ${c}-fade { 0%, 85% { opacity:1; } 100% { opacity:0; } }
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-group(${c}) {
|
|
4
|
+
z-index:2;
|
|
5
|
+
animation:${c}-fade ${o.duration}ms linear both;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(${c}) { display:none; }
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(${c}) {
|
|
9
|
+
animation:none; mix-blend-mode:normal;
|
|
10
|
+
}
|
|
11
|
+
`,document.head.appendChild(T),document.documentElement.appendChild(a),{element:a,style:T}},Q=new Map,Oe=o=>{if(typeof window>"u")return Promise.resolve();let r=Q.get(o);if(r)return r.loading;let t={loading:Promise.resolve()};return Q.set(o,t),t.loading=(async()=>{let n=new AbortController,d=setTimeout(()=>n.abort(),2e3);try{let m=await fetch(o,{signal:n.signal});if(!m.ok)return;let c=await m.text(),a=new DOMParser().parseFromString(c,"image/svg+xml");if(a.querySelector("parsererror")||a.documentElement.localName!=="svg"||a.documentElement.namespaceURI!=="http://www.w3.org/2000/svg")return;let T=`data:image/svg+xml,${encodeURIComponent(c)}`,u=new Image;u.src=T,await u.decode(),u.naturalWidth>0&&u.naturalHeight>0&&(t.ready={image:T,naturalWidth:u.naturalWidth,aspectRatio:u.naturalWidth/u.naturalHeight});}catch{}finally{clearTimeout(d);}})(),t.loading},$e=o=>o?Q.get(o)?.ready:void 0;var D=new WeakMap,Ae=async(o,r)=>{if(typeof document>"u"){await o();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let n={updateDone:Promise.resolve()};D.set(document,n);let d=()=>{n.animation?.cancel(),n.logo?.element.remove(),n.logo?.style.remove(),D.get(document)===n&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};n.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==n||!r||!chunkUW5NJ23X_cjs.g()||chunkUW5NJ23X_cjs.h()||document.visibilityState==="hidden"){await o();return}chunkUW5NJ23X_cjs.b(r.nonce),document.documentElement.setAttribute("data-ui-theme-transition",""),r.animationType==="svg-logo"&&(n.logo=xe(r));let m;try{m=document.startViewTransition(o);}catch{await o();return}n.transition=m,m.ready.catch(()=>{}),m.finished.then(d,d),await m.updateCallbackDone;})();try{await n.updateDone;let m=n.transition;if(!m){d();return}try{await m.ready;}catch{d();return}if(D.get(document)!==n){m.skipTransition();return}if(!r)return;try{n.animation=r.animationType==="slide"?chunkUW5NJ23X_cjs.p(r):r.animationType==="blur-circle"?chunkUW5NJ23X_cjs.q(r):r.animationType==="clip-path"?chunkUW5NJ23X_cjs.k(r):r.animationType==="polygon-gradient"?chunkUW5NJ23X_cjs.l(r):r.animationType==="triangle"?chunkUW5NJ23X_cjs.m(r):r.animationType==="svg-logo"?chunkUW5NJ23X_cjs.n(r):chunkUW5NJ23X_cjs.o(r),n.animation.finished.catch(()=>{});let c=n.animation.effect;!(n.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m.skipTransition(),d());}catch{m.skipTransition(),d();}}catch(m){throw d(),m}};var B=typeof window<"u",Ie=(o=chunkCYGYUQUK_cjs.a,r=["light","dark","system"],t="system")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return r.find(d=>d===n)??t},De=(o,r=chunkCYGYUQUK_cjs.a)=>{B&&localStorage.setItem(r,o);},ke=(o=chunkCYGYUQUK_cjs.b,r=["default"],t="default")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return n&&r.includes(n)?n:t},Pe=(o,r=chunkCYGYUQUK_cjs.b)=>{B&&localStorage.setItem(r,o);};function G(o){if(!["light","dark","system"].includes(o))throw new Error("Theme must be light, dark, or system.")}function M(o,r){let t=`${r}${o}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(o={}){let r=o.themes??["light","dark","system"],t=o.colorThemes??["default"],n=o.defaultTheme??"system",d=o.defaultColorTheme??t[0],m=o.globalClassName??chunkCYGYUQUK_cjs.c,c=o.colorThemePrefix??chunkCYGYUQUK_cjs.d;if(!r.length||!r.every(a=>["light","dark","system"].includes(a))||!r.includes(n))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(d===void 0||!t.includes(d))throw new Error("colorThemes must include the defaultColorTheme.");if(![m,...t.map(a=>`${c}${a}`)].every(a=>a.length>0&&!/\s/.test(a)))throw new Error("Theme classes must be nonempty CSS class tokens.");return {themes:Object.freeze([...r]),colorThemes:Object.freeze([...t]),defaultTheme:n,defaultColorTheme:d,globalClassName:m,colorThemePrefix:c,storageKey:o.storageKey??chunkCYGYUQUK_cjs.a,colorStorageKey:o.colorStorageKey??chunkCYGYUQUK_cjs.b}}var Y=(o,r)=>o.length===r.length&&o.every((t,n)=>t===r[n]),Re=o=>o&&o!==true&&"currentTarget"in o?{element:o.currentTarget,animationOff:o.detail===0}:o,ot=(o={},r={})=>{let t=o,n=Z(t);_(t);let d=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&M(e.colorTheme,s),e.initialColorTheme!==void 0&&M(e.initialColorTheme,s);};d(t,n.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c=()=>{if(t.storage===void 0)return Ie(t.storageKey,n.themes,n.defaultTheme);let e=m(t.storageKey??chunkCYGYUQUK_cjs.a);return n.themes.find(s=>s===e)??n.defaultTheme},a=()=>{if(t.storage===void 0)return ke(t.colorStorageKey,n.colorThemes,n.defaultColorTheme);let e=m(t.colorStorageKey??chunkCYGYUQUK_cjs.b);return n.colorThemes.find(s=>s===e)??n.defaultColorTheme},T=t.initialTheme??c(),u=t.initialColorTheme??a(),ee=false,te=false,k=chunkUW5NJ23X_cjs.d(),x=false,N=0,w=0,j,$,K,W,q=new Set,oe=t.theme??t.initialTheme??n.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??n.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:n.themes,colorThemes:n.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:chunkUW5NJ23X_cjs.e(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b=l.colorTheme,_e=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=n.globalClassName,h=n.colorThemePrefix;W&&W!==s&&e.classList.remove(W),e.classList.remove("auto","system"),t.systemThemeMode==="css"&&l.theme==="system"?(e.classList.remove(s),e.classList.add("system"),e.style.colorScheme=""):(e.classList.toggle(s,l.resolvedTheme==="dark"),e.style.colorScheme=l.resolvedTheme),W=s,K&&e.classList.remove(K),l.colorThemes.forEach(i=>e.classList.remove(`${h}${i}`)),K=`${h}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,h=n.themes,i=n.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,h)?l.themes:h,colorThemes:Y(l.colorThemes,i)?l.colorThemes:i,mounted:x},y=g.theme!==l.theme||g.colorTheme!==l.colorTheme||g.resolvedTheme!==l.resolvedTheme||g.systemTheme!==l.systemTheme||g.themes!==l.themes||g.colorThemes!==l.colorThemes||g.mounted!==l.mounted;y&&(l=g),_e(),y&&q.forEach(C=>C());},re=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&Oe(e);},ie=e=>{try{e();}catch(s){let h=s instanceof Error?s:new Error(String(s));r.onBrowserStorageError?r.onBrowserStorageError(h):console.warn("Unable to persist the theme preference:",h);}},se=e=>{G(e),t.storage===void 0?ie(()=>De(e,t.storageKey??chunkCYGYUQUK_cjs.a)):t.storage&&t.storage.setItem(t.storageKey??chunkCYGYUQUK_cjs.a,e),ee=true,O=e,t.theme===void 0&&(T=e),E(),t.onThemeChange?.(e);},ae=e=>{M(e,n.colorThemePrefix),t.storage===void 0?ie(()=>Pe(e,t.colorStorageKey??chunkCYGYUQUK_cjs.b)):t.storage&&t.storage.setItem(t.colorStorageKey??chunkCYGYUQUK_cjs.b,e),te=true,P=e,t.colorTheme===void 0&&(u=e),E(),t.onColorThemeChange?.(e);},Ge=(e=false)=>{let s=e===true||e===false?{animationOff:e}:e,h=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,i={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};h&&Object.assign(i,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(i);let g=i.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===i.animationType)??"circle",C={duration:g,easing:i.easing??chunkCYGYUQUK_cjs.f,animationType:y,blurAmount:i.blurAmount??2,styleId:i.styleId??chunkCYGYUQUK_cjs.h,nonce:t.nonce};if(y==="slide"){let R=i.slideFromX!==void 0&&i.slideFromY!==void 0?{a:i.slideFromX,b:i.slideFromY}:chunkUW5NJ23X_cjs.i(i.slideDirection??"left");return {...C,...R,x:i.slideToX??0,y:i.slideToY??0}}let A=s.element??r.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f=(y==="svg-logo"?chunkUW5NJ23X_cjs.j("center"):null)??s.origin??(i.animationPosition&&i.animationPosition!=="trigger"?chunkUW5NJ23X_cjs.j(i.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:chunkUW5NJ23X_cjs.j("center"));return !f||!Number.isFinite(f.x)||!Number.isFinite(f.y)?null:{...C,...f,clipPathDirection:i.clipPathDirection??"top-left",animationPosition:i.animationPosition,logo:i.logoLight!==void 0?chunkUW5NJ23X_cjs.e(O)==="light"?i.logoLight:i.logoDark:i.logo,logoWidth:i.logoWidth,logoHeight:i.logoHeight,gradientWidth:i.gradientWidth}},le=async(e,s)=>{let h=Ge(s),i=w,g=()=>{i===w&&e();};N++;try{await Ae(()=>{if(i===w)return r.commit?r.commit(g):g()},h);}finally{i===w&&N--;}},F=async(e,s)=>{if(G(e),!n.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let h=w;try{await le(()=>se(e),s);}catch(i){throw h===w&&p===e&&(p=O),i}},X=async(e,s)=>{if(!n.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b)return;b=e;let h=w;try{await le(()=>ae(e),s);}catch(i){throw h===w&&b===e&&(b=P),i}},z=()=>{w++,N=0,j?.(),j=void 0,$=void 0,x=false,E();};return {getSnapshot:()=>l,getServerSnapshot:()=>ne,subscribe:e=>(q.add(e),()=>{q.delete(e);}),mount:()=>{if(x||typeof window>"u"||typeof document>"u")return z;x=true,!ee&&t.initialTheme===void 0&&(T=c()),!te&&t.initialColorTheme===void 0&&(u=a()),O=p=t.theme??T,P=b=t.colorTheme??u,k=chunkUW5NJ23X_cjs.d();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=chunkUW5NJ23X_cjs.d(),E();},h=i=>{if(i.storageArea&&i.storageArea!==window.localStorage)return;let g=n.themes,y=n.colorThemes;if((i.key===null||i.key===(t.storageKey??chunkCYGYUQUK_cjs.a))&&t.theme===void 0){let C=i.newValue??n.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((i.key===null||i.key===(t.colorStorageKey??chunkCYGYUQUK_cjs.b))&&t.colorTheme===void 0){let C=i.newValue??n.defaultColorTheme;y.includes(C)&&(u=P=b=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",h),t.storage===void 0&&window.addEventListener("storage",h);},$(),j=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",h);},chunkUW5NJ23X_cjs.b(t.nonce),re(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,h=l.colorTheme,i={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=i,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);d(v,f.colorThemePrefix),!Y(n.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(n.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,n=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),h!==l.colorTheme&&(P=b=l.colorTheme)),x&&(re(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e=>{let s=chunkUW5NJ23X_cjs.e(p)==="dark"?"light":"dark",h=n.themes.includes(s)?s:n.themes[(n.themes.indexOf(p)+1)%n.themes.length];return F(h,e)},toggleLightTheme:async e=>{chunkUW5NJ23X_cjs.e(p)!=="light"&&await F("light",e);},toggleDarkTheme:async e=>{chunkUW5NJ23X_cjs.e(p)!=="dark"&&await F("dark",e);},toggleColorTheme:async e=>{let s=n.colorThemes;s.length!==0&&await X(s[(s.indexOf(b)+1)%s.length],Re(e));},createColorThemeToggle:e=>s=>X(e,Re(s)),isColorThemeActive:e=>l.colorTheme===e}};
|
|
12
|
+
exports.a=J;exports.b=Ke;exports.c=_;exports.d=Oe;exports.e=Ae;exports.f=Ie;exports.g=De;exports.h=ke;exports.i=Pe;exports.j=ot;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';var y=t=>{let e=document.createElement("style");return t&&(e.nonce=t),e};var x=typeof window<"u",W=t=>{if(!x||document.getElementById("ui-theme-base-style"))return;let e=y(t);e.id="ui-theme-base-style",e.textContent=`
|
|
2
|
+
html[data-ui-theme-transition]::view-transition-group(root),
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
4
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
5
|
+
animation: none;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
9
|
+
mix-blend-mode: normal;
|
|
10
|
+
}
|
|
11
|
+
html[data-ui-theme-transition],
|
|
12
|
+
html[data-ui-theme-transition] *,
|
|
13
|
+
html[data-ui-theme-transition] *::before,
|
|
14
|
+
html[data-ui-theme-transition] *::after {
|
|
15
|
+
transition: none !important;
|
|
16
|
+
}
|
|
17
|
+
`,document.head.appendChild(e);},B=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,M=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",H=t=>t==="system"?M():t==="dark"?"dark":"light",I=t=>t==="system"?"system":t==="dark"?"dark":"light",D=()=>x&&document.startViewTransition instanceof Function,F=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},v=t=>t/window.innerWidth*100,A=t=>t/window.innerHeight*100,$=(t,e)=>{let{innerWidth:n,innerHeight:o}=window;return Math.hypot(Math.max(Math.abs(t),Math.abs(n-t)),Math.max(Math.abs(e),Math.abs(o-e)))+1},k=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),{innerWidth:e,innerHeight:n}=window;return {x:(parseFloat(t.width)||e)/e,y:(parseFloat(t.height)||n)/n}},P=t=>{let{innerWidth:e,innerHeight:n}=window;return t/(Math.hypot(e,n)/Math.SQRT2)*100},G=t=>{let e=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,n=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:e,y:n}},R=0,g=(t,e)=>{let n=document.documentElement.animate(e,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=n.effect;if(!(o instanceof KeyframeEffect))return n;let i=o.getKeyframes(),r=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[r]!=="none")return n;let d=n.playState==="paused",c=n.currentTime;n.cancel(),n.finished.catch(()=>{});let s=`ui-theme-reveal-${++R}`,a=y(t.nonce),p=i.map(l=>{let b=Object.entries(l).filter(([f])=>!["offset","computedOffset","easing","composite"].includes(f)).map(([f,w])=>`${f.replace(/[A-Z]/g,S=>`-${S.toLowerCase()}`)}:${w};`).join("");return `${l.computedOffset*100}%{${b}}`}).join("");a.textContent=`@keyframes ${s}{${p}}html[data-ui-theme-transition]::view-transition-new(root){animation:${s} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let h=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,u=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===h);if(!u)throw a.remove(),new Error("Transition pseudo animations are unavailable");return d&&(u.pause(),u.currentTime=c),u.finished.then(()=>a.remove(),()=>a.remove()),u},K=t=>{let e=t.clipPathDirection??"top-left",n={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return g(t,{clipPath:[n[e],o[e]]})},O=t=>{let e=t.clipPathDirection??"top-left",n=k(),o=window.innerWidth*n.x,i=window.innerHeight*n.y,r=e.includes("-"),m=e.includes("left"),d=e.includes("top"),c=e==="left"||e==="right",s=m?0:e.includes("right")?1:.5,a=d?0:e.includes("bottom")?1:.5,p=r||c?o*3:o,h=r||!c?i*3:i,u=r?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",l=r?p*h/Math.hypot(p,h):c?p:h,f=1-Math.max(0,Math.min(t.gradientWidth??80,l*.2))/l,w=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${a*100}" x2="${100*(r?.5:c?1-s:s)}" y2="${100*(r?.5:c?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${f}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${u}" fill="url(#edge)"/></svg>`;return g(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(w)}")`,`url("data:image/svg+xml,${encodeURIComponent(w)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[r?"0px 0px":c?`0px ${h}px`:`${p}px 0px`,`${p}px ${h}px`],maskPosition:[`${s*o}px ${a*i}px`,`${s*(o-p)}px ${a*(i-h)}px`]})},U=t=>{let{x:e,y:n}=t,o=$(e,n),i=Math.sqrt(3)*o,r=(d,c)=>`${v(d)}% ${A(c)}%`,m=r(e,n);return g(t,{clipPath:[`polygon(${m}, ${m}, ${m})`,`polygon(${r(e,n-2*o)}, ${r(e+i,n+o)}, ${r(e-i,n+o)})`]})},z=t=>{let{innerWidth:e,innerHeight:n}=window;return C({...t,x:e/2,y:n/2})},C=t=>{let{x:e,y:n}=t,o=`at ${v(e)}% ${A(n)}%`;return g(t,{clipPath:[`circle(0% ${o})`,`circle(${P($(e,n))}% ${o})`]})},N=t=>{let{a:e=-100,b:n=0,x:o=0,y:i=0}=t;return g(t,{transform:[`translate(${e}%, ${n}%)`,`translate(${o}%, ${i}%)`]})},q=t=>{let{x:e,y:n,blurAmount:o}=t;if(o<=0)return C(t);let i=Math.min(o,20),r=$(e,n)+i,m=k(),[d,c,s,a]=[e*m.x,n*m.y,r*m.x,r*m.y];return g(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${s*2}px ${a*2}px`],maskPosition:[`${d}px ${c}px`,`${d-s}px ${c-a}px`]})};
|
|
18
|
+
exports.a=y;exports.b=W;exports.c=B;exports.d=M;exports.e=H;exports.f=I;exports.g=D;exports.h=F;exports.i=j;exports.j=G;exports.k=K;exports.l=O;exports.m=U;exports.n=z;exports.o=C;exports.p=N;exports.q=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c as c$2,j}from'./chunk-NDTSXDQI.js';import {c,b,a}from'./chunk-DTUGFHPG.js';import {d,c as c$1,b as b$1,a as a$1}from'./chunk-NDNCNR4X.js';import se,{createContext,useRef,useState,useSyncExternalStore,useLayoutEffect,useMemo,useCallback,useContext}from'react';import {flushSync}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var ee=t=>{let o;return {controller:j(t,{commit:e=>flushSync(e),getElement:()=>o?.current??null}),connectTrigger:e=>{o=e;}}},B=(t={})=>{let o=useRef(null),[r]=useState(()=>ee(t)),{controller:e}=r,n=useRef(t),h=useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return useLayoutEffect(()=>{let i=Object.fromEntries(Object.keys(n.current).filter(m=>!(m in t)).map(m=>[m,void 0]));e.updateOptions({...i,...t}),n.current=t;}),useLayoutEffect(()=>(r.connectTrigger(o),e.mount()),[e,r]),useMemo(()=>({...h,ref:o,setTheme:e.setTheme,setColorTheme:e.setColorTheme,switchTheme:e.switchTheme,switchColorTheme:e.switchColorTheme,toggleTheme:e.toggleTheme,toggleLightTheme:e.toggleLightTheme,toggleDarkTheme:e.toggleDarkTheme,toggleColorTheme:e.toggleColorTheme,createColorThemeToggle:e.createColorThemeToggle,isColorThemeActive:e.isColorThemeActive}),[h,e])};var oe=()=>()=>{},re=()=>true,ne=()=>false,$=()=>useSyncExternalStore(oe,re,ne);var U=createContext(null);var E=createContext(void 0),R=se.memo(({themes:t,colorThemes:o,storageKey:r,colorStorageKey:e,defaultTheme:n,defaultColorTheme:h,attribute:i,globalClassName:m,colorThemePrefix:c$1,nonce:u})=>{let d=c(true,[r,t,n],[e,o,h],b,`${i==="data-theme"?'d.setAttribute("data-theme",q?"dark":"light")':`l.toggle(${a(m)},q)`};d.style.colorScheme=q?"dark":"light";l.add(${a(c$1)}+p)`);return jsx("script",{nonce:u,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:d}})});R.displayName="ThemePreHydrationScript";var Ne=({children:t,themes:o=["light","dark","system"],colorThemes:r=["default"],defaultTheme:e="system",defaultColorTheme:n=r[0]??"default",animationType:h="circle",clipPathDirection:i,animationPosition:m,logo:c,logoLight:u,logoDark:d$1,logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X=400,storageKey:g=a$1,colorStorageKey:p=b$1,attribute:y="class",globalClassName:C=c$1,colorThemePrefix:f=d,nonce:x,disableAnimationOnInit:N=true,disablePreHydrationScript:b=false})=>{let S=$(),l=B({themes:o,colorThemes:r,defaultTheme:e,defaultColorTheme:n,animationType:h,clipPathDirection:i,animationPosition:m,...c$2({logo:c,logoLight:u,logoDark:d$1}),logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X,storageKey:g,colorStorageKey:p,globalClassName:y==="class"?C:void 0,colorThemePrefix:f,nonce:x}),T=useCallback(async(s,P=false)=>{!S&&N?l.setTheme(s):await l.switchTheme(s,P);},[S,N,l]),I=useCallback((s,P)=>T(s,{element:P}),[T]),A=useMemo(()=>({...l,switchTheme:T,switchThemeFromElement:I}),[l,T,I]);if(!S){let s={themes:o,colorThemes:r,mounted:false,ref:{current:null},theme:e,colorTheme:n,resolvedTheme:e==="dark"?"dark":"light",systemTheme:"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsx(E.Provider,{value:s,children:jsxs(U.Provider,{value:s,children:[!b&&jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})}return jsx(E.Provider,{value:A,children:jsxs(U.Provider,{value:A,children:[!b&&jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})},be=()=>{let t=useContext(E);if(t===void 0)throw new Error("useNextUITheme must be used within a NextUIThemeProvider");return t};export{B as a,U as b,$ as c,Ne as d,be as e};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-
|
|
1
|
+
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-C2tuWeMB.cjs';
|
|
2
2
|
|
|
3
3
|
/** Injects styles scoped to transitions owned by this library. */
|
|
4
|
-
declare const injectBaseStyles: () => void;
|
|
4
|
+
declare const injectBaseStyles: (nonce?: string) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Creates an SVG blur circle mask for animations
|
|
7
7
|
* @param blur - Blur amount for the gaussian filter
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-
|
|
1
|
+
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-C2tuWeMB.js';
|
|
2
2
|
|
|
3
3
|
/** Injects styles scoped to transitions owned by this library. */
|
|
4
|
-
declare const injectBaseStyles: () => void;
|
|
4
|
+
declare const injectBaseStyles: (nonce?: string) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Creates an SVG blur circle mask for animations
|
|
7
7
|
* @param blur - Blur amount for the gaussian filter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-
|
|
1
|
+
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-C2tuWeMB.cjs';
|
|
2
2
|
|
|
3
3
|
type SystemThemeMode = 'css' | 'js';
|
|
4
4
|
type ThemeTransitionSettings = ThemeAnimationOptions & {
|
|
@@ -40,6 +40,8 @@ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
|
|
|
40
40
|
initialTheme?: Theme;
|
|
41
41
|
initialColorTheme?: string;
|
|
42
42
|
systemThemeMode?: SystemThemeMode;
|
|
43
|
+
/** CSP nonce for the `<style>` elements injected for transitions. */
|
|
44
|
+
nonce?: string;
|
|
43
45
|
};
|
|
44
46
|
interface ThemeControllerSnapshot extends ThemeState {
|
|
45
47
|
readonly systemTheme: 'light' | 'dark';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-
|
|
1
|
+
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-C2tuWeMB.js';
|
|
2
2
|
|
|
3
3
|
type SystemThemeMode = 'css' | 'js';
|
|
4
4
|
type ThemeTransitionSettings = ThemeAnimationOptions & {
|
|
@@ -40,6 +40,8 @@ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
|
|
|
40
40
|
initialTheme?: Theme;
|
|
41
41
|
initialColorTheme?: string;
|
|
42
42
|
systemThemeMode?: SystemThemeMode;
|
|
43
|
+
/** CSP nonce for the `<style>` elements injected for transitions. */
|
|
44
|
+
nonce?: string;
|
|
43
45
|
};
|
|
44
46
|
interface ThemeControllerSnapshot extends ThemeState {
|
|
45
47
|
readonly systemTheme: 'light' | 'dark';
|
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkR7KPCTX4_cjs=require('../chunk-R7KPCTX4.cjs'),chunkUW5NJ23X_cjs=require('../chunk-UW5NJ23X.cjs'),chunkCYGYUQUK_cjs=require('../chunk-CYGYUQUK.cjs');Object.defineProperty(exports,"TRANSITION_DIRECTIONS",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.b}});Object.defineProperty(exports,"ThemeAnimationType",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.a}});Object.defineProperty(exports,"createThemeController",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.j}});Object.defineProperty(exports,"getStoredColorTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.h}});Object.defineProperty(exports,"getStoredTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.f}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.d}});Object.defineProperty(exports,"runThemeTransition",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.e}});Object.defineProperty(exports,"setStoredColorTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.i}});Object.defineProperty(exports,"setStoredTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.g}});Object.defineProperty(exports,"createBlurCircleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.q}});Object.defineProperty(exports,"createBlurCircleMask",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.c}});Object.defineProperty(exports,"createCircleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.o}});Object.defineProperty(exports,"createClipPathAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.k}});Object.defineProperty(exports,"createPolygonGradientAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.l}});Object.defineProperty(exports,"createSlideAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.p}});Object.defineProperty(exports,"createSvgLogoAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.n}});Object.defineProperty(exports,"createTriangleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.m}});Object.defineProperty(exports,"getAnimationPosition",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.j}});Object.defineProperty(exports,"getSlideFromCoords",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.i}});Object.defineProperty(exports,"getSystemTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.d}});Object.defineProperty(exports,"injectBaseStyles",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.b}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.h}});Object.defineProperty(exports,"resolveTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.e}});Object.defineProperty(exports,"supportsViewTransitions",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.g}});Object.defineProperty(exports,"COLOR_STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.b}});Object.defineProperty(exports,"COLOR_THEME_PREFIX",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.d}});Object.defineProperty(exports,"DEFAULT_BLUR_AMOUNT",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.g}});Object.defineProperty(exports,"DEFAULT_DURATION",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.e}});Object.defineProperty(exports,"DEFAULT_EASING",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.f}});Object.defineProperty(exports,"DEFAULT_STYLE_ID",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.h}});Object.defineProperty(exports,"GLOBAL_CLASS_NAME",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.c}});Object.defineProperty(exports,"STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.a}});
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-
|
|
2
|
-
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-
|
|
3
|
-
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-
|
|
4
|
-
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-
|
|
1
|
+
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-C2tuWeMB.cjs';
|
|
2
|
+
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-C2tuWeMB.cjs';
|
|
3
|
+
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-CDhU9uhC.cjs';
|
|
4
|
+
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-BASaPUJN.cjs';
|
|
5
5
|
export { p as preloadThemeLogo } from '../logo-DtwtRv4y.cjs';
|
|
6
6
|
|
|
7
7
|
/** Latest request wins visually; every requested state update still runs once. */
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-
|
|
2
|
-
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-
|
|
3
|
-
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-
|
|
4
|
-
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-
|
|
1
|
+
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-C2tuWeMB.js';
|
|
2
|
+
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-C2tuWeMB.js';
|
|
3
|
+
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-DgJBS8qt.js';
|
|
4
|
+
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-D-S1gr00.js';
|
|
5
5
|
export { p as preloadThemeLogo } from '../logo-DtwtRv4y.js';
|
|
6
6
|
|
|
7
7
|
/** Latest request wins visually; every requested state update still runs once. */
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as TRANSITION_DIRECTIONS,a as ThemeAnimationType,j as createThemeController,h as getStoredColorTheme,f as getStoredTheme,d as preloadThemeLogo,e as runThemeTransition,i as setStoredColorTheme,g as setStoredTheme}from'../chunk-
|
|
1
|
+
export{b as TRANSITION_DIRECTIONS,a as ThemeAnimationType,j as createThemeController,h as getStoredColorTheme,f as getStoredTheme,d as preloadThemeLogo,e as runThemeTransition,i as setStoredColorTheme,g as setStoredTheme}from'../chunk-NDTSXDQI.js';export{q as createBlurCircleAnimation,c as createBlurCircleMask,o as createCircleAnimation,k as createClipPathAnimation,l as createPolygonGradientAnimation,p as createSlideAnimation,n as createSvgLogoAnimation,m as createTriangleAnimation,j as getAnimationPosition,i as getSlideFromCoords,d as getSystemTheme,b as injectBaseStyles,h as prefersReducedMotion,e as resolveTheme,g as supportsViewTransitions}from'../chunk-F4BPBR2Y.js';export{b as COLOR_STORAGE_KEY,d as COLOR_THEME_PREFIX,g as DEFAULT_BLUR_AMOUNT,e as DEFAULT_DURATION,f as DEFAULT_EASING,h as DEFAULT_STYLE_ID,c as GLOBAL_CLASS_NAME,a as STORAGE_KEY}from'../chunk-NDNCNR4X.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { RefObject, ReactNode } from 'react';
|
|
2
|
-
import { c as Theme, C as ColorTheme, T as ThemeAnimationOptions, a as ThemeAnimationType } from './types-
|
|
3
|
-
import { d as ThemeControllerSnapshot, f as ThemeTransitionInput, C as ColorThemeToggle, c as ThemeControllerOptions } from './controller-
|
|
2
|
+
import { c as Theme, C as ColorTheme, T as ThemeAnimationOptions, a as ThemeAnimationType } from './types-C2tuWeMB.cjs';
|
|
3
|
+
import { d as ThemeControllerSnapshot, f as ThemeTransitionInput, C as ColorThemeToggle, c as ThemeControllerOptions } from './controller-BASaPUJN.cjs';
|
|
4
4
|
|
|
5
5
|
type UseThemeProps = ThemeControllerOptions;
|
|
6
6
|
interface UseThemeReturn extends ThemeControllerSnapshot {
|
|
@@ -71,7 +71,7 @@ type NextUIThemeProviderProps = ThemeAnimationOptions & {
|
|
|
71
71
|
globalClassName?: string;
|
|
72
72
|
/** Prefix for color theme classes */
|
|
73
73
|
colorThemePrefix?: string;
|
|
74
|
-
/** CSP nonce for inline script
|
|
74
|
+
/** CSP nonce for the inline script and the injected transition styles */
|
|
75
75
|
nonce?: string;
|
|
76
76
|
/** Skip animation during initial hydration */
|
|
77
77
|
disableAnimationOnInit?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { RefObject, ReactNode } from 'react';
|
|
2
|
-
import { c as Theme, C as ColorTheme, T as ThemeAnimationOptions, a as ThemeAnimationType } from './types-
|
|
3
|
-
import { d as ThemeControllerSnapshot, f as ThemeTransitionInput, C as ColorThemeToggle, c as ThemeControllerOptions } from './controller-
|
|
2
|
+
import { c as Theme, C as ColorTheme, T as ThemeAnimationOptions, a as ThemeAnimationType } from './types-C2tuWeMB.js';
|
|
3
|
+
import { d as ThemeControllerSnapshot, f as ThemeTransitionInput, C as ColorThemeToggle, c as ThemeControllerOptions } from './controller-D-S1gr00.js';
|
|
4
4
|
|
|
5
5
|
type UseThemeProps = ThemeControllerOptions;
|
|
6
6
|
interface UseThemeReturn extends ThemeControllerSnapshot {
|
|
@@ -71,7 +71,7 @@ type NextUIThemeProviderProps = ThemeAnimationOptions & {
|
|
|
71
71
|
globalClassName?: string;
|
|
72
72
|
/** Prefix for color theme classes */
|
|
73
73
|
colorThemePrefix?: string;
|
|
74
|
-
/** CSP nonce for inline script
|
|
74
|
+
/** CSP nonce for the inline script and the injected transition styles */
|
|
75
75
|
nonce?: string;
|
|
76
76
|
/** Skip animation during initial hydration */
|
|
77
77
|
disableAnimationOnInit?: boolean;
|
package/dist/next/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkEVSU6Y3J_cjs=require('../chunk-EVSU6Y3J.cjs');require('../chunk-R7KPCTX4.cjs'),require('../chunk-4HBM4JJB.cjs'),require('../chunk-UW5NJ23X.cjs'),require('../chunk-CYGYUQUK.cjs');Object.defineProperty(exports,"NextUIThemeProvider",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.d}});Object.defineProperty(exports,"useNextUITheme",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.e}});
|
package/dist/next/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NextUIThemeContextType, b as NextUIThemeProvider, c as NextUIThemeProviderProps, u as useNextUITheme } from '../index-
|
|
1
|
+
export { N as NextUIThemeContextType, b as NextUIThemeProvider, c as NextUIThemeProviderProps, u as useNextUITheme } from '../index-CT3I4-Jq.cjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../types-
|
|
4
|
-
import '../controller-
|
|
3
|
+
import '../types-C2tuWeMB.cjs';
|
|
4
|
+
import '../controller-BASaPUJN.cjs';
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NextUIThemeContextType, b as NextUIThemeProvider, c as NextUIThemeProviderProps, u as useNextUITheme } from '../index-
|
|
1
|
+
export { N as NextUIThemeContextType, b as NextUIThemeProvider, c as NextUIThemeProviderProps, u as useNextUITheme } from '../index-DFVZPt84.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../types-
|
|
4
|
-
import '../controller-
|
|
3
|
+
import '../types-C2tuWeMB.js';
|
|
4
|
+
import '../controller-D-S1gr00.js';
|
package/dist/next/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{
|
|
2
|
+
export{d as NextUIThemeProvider,e as useNextUITheme}from'../chunk-ZCKIEEMW.js';import'../chunk-NDTSXDQI.js';import'../chunk-DTUGFHPG.js';import'../chunk-F4BPBR2Y.js';import'../chunk-NDNCNR4X.js';
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,45 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var chunk4UXANDJ5_cjs=require('../chunk-4UXANDJ5.cjs'),chunkKQSBORXP_cjs=require('../chunk-KQSBORXP.cjs'),chunkI5GA5T23_cjs=require('../chunk-I5GA5T23.cjs'),chunkCYGYUQUK_cjs=require('../chunk-CYGYUQUK.cjs'),Pe=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pe__default=/*#__PURE__*/_interopDefault(Pe);var J=async(t,h,o)=>{try{await t?.(h);}catch(i){let r=i instanceof Error?i:new Error(String(i));try{o?o(r):console.error("Theme server notification failed:",r);}catch(c){console.error("Theme server error handler failed:",c);}}};var Q=Pe.createContext(void 0),Le=(t,h,o,i,r,c,u)=>`
|
|
3
|
-
(function() {
|
|
4
|
-
try {
|
|
5
|
-
var theme = localStorage.getItem(${chunk4UXANDJ5_cjs.b(t)}) || ${chunk4UXANDJ5_cjs.b(o)};
|
|
6
|
-
var colorTheme = localStorage.getItem(${chunk4UXANDJ5_cjs.b(h)}) || ${chunk4UXANDJ5_cjs.b(i)};
|
|
7
|
-
var el = document.documentElement;
|
|
8
|
-
var resolved;
|
|
9
|
-
if (theme === 'system') {
|
|
10
|
-
if (${chunk4UXANDJ5_cjs.b(u)} === 'css') {
|
|
11
|
-
el.classList.remove(${chunk4UXANDJ5_cjs.b(r)});
|
|
12
|
-
el.classList.remove('auto');
|
|
13
|
-
el.classList.remove('system');
|
|
14
|
-
el.classList.add('system');
|
|
15
|
-
el.style.colorScheme = '';
|
|
16
|
-
} else {
|
|
17
|
-
resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
18
|
-
if (resolved === 'dark') {
|
|
19
|
-
el.classList.add(${chunk4UXANDJ5_cjs.b(r)});
|
|
20
|
-
} else {
|
|
21
|
-
el.classList.remove(${chunk4UXANDJ5_cjs.b(r)});
|
|
22
|
-
}
|
|
23
|
-
el.classList.remove('system');
|
|
24
|
-
el.classList.remove('auto');
|
|
25
|
-
el.style.colorScheme = resolved;
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
resolved = theme;
|
|
29
|
-
el.classList.remove('system');
|
|
30
|
-
el.classList.remove('auto');
|
|
31
|
-
if (resolved === 'dark') {
|
|
32
|
-
el.classList.add(${chunk4UXANDJ5_cjs.b(r)});
|
|
33
|
-
} else {
|
|
34
|
-
el.classList.remove(${chunk4UXANDJ5_cjs.b(r)});
|
|
35
|
-
}
|
|
36
|
-
el.style.colorScheme = resolved;
|
|
37
|
-
}
|
|
38
|
-
if (colorTheme && colorTheme !== 'default') {
|
|
39
|
-
el.classList.add(${chunk4UXANDJ5_cjs.b(c)} + colorTheme);
|
|
40
|
-
}
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.warn('Theme pre-hydration script failed:', e);
|
|
43
|
-
}
|
|
44
|
-
})();
|
|
45
|
-
`,ne=Pe__default.default.memo(({storageKey:t=chunkCYGYUQUK_cjs.a,colorStorageKey:h=chunkCYGYUQUK_cjs.b,defaultTheme:o="system",defaultColorTheme:i="default",globalClassName:r=chunkCYGYUQUK_cjs.c,colorThemePrefix:c=chunkCYGYUQUK_cjs.d,nonce:u,systemThemeMode:v="js"})=>{let S=Le(t,h,o,i,r,c,v);return jsxRuntime.jsx("script",{nonce:u,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:S}})});ne.displayName="TanStackStartThemeScript";var Re=({children:t,themes:h=["light","dark","system"],colorThemes:o=["default"],defaultTheme:i="system",defaultColorTheme:r=o[0]??"default",animationType:c="circle",clipPathDirection:u,animationPosition:v,logo:S,logoLight:L,logoDark:R,logoWidth:O,logoHeight:_,gradientWidth:D,duration:F=400,storageKey:I=chunkCYGYUQUK_cjs.a,colorStorageKey:C=chunkCYGYUQUK_cjs.b,globalClassName:V=chunkCYGYUQUK_cjs.c,colorThemePrefix:P=chunkCYGYUQUK_cjs.d,serverTheme:g,serverColorTheme:d,systemThemeMode:n="css",onServerThemeChange:a,onServerColorThemeChange:X,onServerError:N})=>{let w=chunk4UXANDJ5_cjs.d(),k=g!==void 0,x=k?g==="system"?"system":g:void 0,T=chunk4UXANDJ5_cjs.a({themes:h,colorThemes:o,defaultTheme:i,defaultColorTheme:r,animationType:c,clipPathDirection:u,animationPosition:v,...chunkKQSBORXP_cjs.c({logo:S,logoLight:L,logoDark:R}),logoWidth:O,logoHeight:_,gradientWidth:D,duration:F,storageKey:I,colorStorageKey:C,globalClassName:V,colorThemePrefix:P,systemThemeMode:n,initialTheme:x,initialColorTheme:d,onThemeChange:e=>{J(a,e,N);},onColorThemeChange:e=>{J(X,e,N);}}),$=Pe.useRef(false);Pe.useEffect(()=>{if(!(!k||!w||$.current)){$.current=true;try{x&&chunkKQSBORXP_cjs.g(x,I),d&&chunkKQSBORXP_cjs.i(d,C);}catch(e){console.warn("Unable to persist the initial server theme:",e);}}},[k,w,x,d,I,C]);let p=T.setTheme,m=T.setColorTheme,s=(e=false)=>w?e:e===true||e===false?true:{...e,animationOff:true},K=(e,y)=>T.switchTheme(e,s(y)),he=e=>T.toggleTheme(s(e)),ae=e=>T.toggleLightTheme(s(e)),Te=e=>T.toggleDarkTheme(s(e)),Z=(e,y)=>T.switchColorTheme(e,s(y)),le=(e,y)=>K(e,{element:y}),j=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",ee=k?g==="dark"?"dark":g==="system"?j:"light":i==="dark"?"dark":"light";if(!w){let e={themes:h,colorThemes:o,mounted:false,ref:{current:null},theme:x??i,colorTheme:d??r,resolvedTheme:ee,systemTheme:"light",isHydrated:false,setTheme:p,setColorTheme:m,switchTheme:async y=>p(y),switchThemeFromElement:async y=>p(y),switchColorTheme:Z,toggleTheme:async()=>{p(ee==="dark"?"light":"dark");},toggleLightTheme:async()=>p("light"),toggleDarkTheme:async()=>p("dark"),toggleColorTheme:T.toggleColorTheme,createColorThemeToggle:T.createColorThemeToggle,isColorThemeActive:T.isColorThemeActive};return jsxRuntime.jsx(Q.Provider,{value:e,children:jsxRuntime.jsx(chunk4UXANDJ5_cjs.c.Provider,{value:e,children:t})})}let te={...T,systemTheme:j,isHydrated:true,setTheme:p,setColorTheme:m,switchTheme:K,switchThemeFromElement:le,switchColorTheme:Z,toggleTheme:he,toggleLightTheme:ae,toggleDarkTheme:Te};return jsxRuntime.jsx(Q.Provider,{value:te,children:jsxRuntime.jsx(chunk4UXANDJ5_cjs.c.Provider,{value:te,children:t})})},Oe=()=>{let t=Pe.useContext(Q);if(t===void 0)throw new Error("useTanStackUITheme must be used within a TanStackUIThemeProvider");return t};var ie=Pe.createContext(void 0),Fe=({children:t,themes:h=["light","dark","system"],colorThemes:o=["default"],defaultTheme:i="system",defaultColorTheme:r=o[0]??"default",animationType:c="circle",clipPathDirection:u,animationPosition:v,logo:S,logoLight:L,logoDark:R,logoWidth:O,logoHeight:_,gradientWidth:D,duration:F=400,attribute:I="class",disableTransitionOnChange:C=false,storageKey:V="ui-theme",colorStorageKey:P="ui-color-theme",globalClassName:g="dark",colorThemePrefix:d="theme-"})=>{let n=chunk4UXANDJ5_cjs.a({themes:h,colorThemes:o,defaultTheme:i,defaultColorTheme:r,animationType:c,clipPathDirection:u,animationPosition:v,...chunkKQSBORXP_cjs.c({logo:S,logoLight:L,logoDark:R}),logoWidth:O,logoHeight:_,gradientWidth:D,duration:F,storageKey:V,colorStorageKey:P,globalClassName:I==="class"?g:void 0,colorThemePrefix:d}),a=Pe.useCallback(()=>{if(!C)return ()=>{};let m=document.createElement("style");return m.textContent="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}",document.head.appendChild(m),window.getComputedStyle(document.body),()=>{setTimeout(()=>{document.head.removeChild(m);},1);}},[C]),X=Pe.useCallback(m=>{let s=a();n.setTheme(m),s();},[n,a]),N=Pe.useCallback(async(m,s=false)=>{let K=a();try{await n.switchTheme(m,s);}finally{K();}},[n,a]),w=Pe.useCallback(async(m=false)=>{let s=a();try{await n.toggleTheme(m);}finally{s();}},[n,a]),k=Pe.useCallback(async(m=false)=>{let s=a();try{await n.toggleLightTheme(m);}finally{s();}},[n,a]),x=Pe.useCallback(async(m=false)=>{let s=a();try{await n.toggleDarkTheme(m);}finally{s();}},[n,a]),T=(m,s)=>N(m,{element:s}),$=chunkI5GA5T23_cjs.c(),p={...n,systemTheme:$,setTheme:X,switchTheme:N,switchThemeFromElement:T,toggleTheme:w,toggleLightTheme:k,toggleDarkTheme:x};return jsxRuntime.jsx(ie.Provider,{value:p,children:jsxRuntime.jsx(chunk4UXANDJ5_cjs.c.Provider,{value:p,children:t})})},Ve=()=>{let t=Pe.useContext(ie);if(t===void 0)throw new Error("useViteUITheme must be used within a ViteUIThemeProvider");return t};var se=Pe.createContext(void 0),Me=({children:t,themes:h=["light","dark","system"],colorThemes:o=["default"],defaultTheme:i="system",defaultColorTheme:r=o[0]??"default",animationType:c="circle",clipPathDirection:u,animationPosition:v,logo:S,logoLight:L,logoDark:R,logoWidth:O,logoHeight:_,gradientWidth:D,duration:F=400,storageKey:I,colorStorageKey:C})=>{let V=chunk4UXANDJ5_cjs.d(),P=chunk4UXANDJ5_cjs.a({themes:h,colorThemes:o,defaultTheme:i,defaultColorTheme:r,animationType:c,clipPathDirection:u,animationPosition:v,...chunkKQSBORXP_cjs.c({logo:S,logoLight:L,logoDark:R}),logoWidth:O,logoHeight:_,gradientWidth:D,duration:F,storageKey:I,colorStorageKey:C}),g=(n,a)=>P.switchTheme(n,{element:a});if(!V){let n={themes:h,colorThemes:o,mounted:false,systemTheme:"light",ref:{current:null},theme:i,colorTheme:r,resolvedTheme:i==="dark"?"dark":"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsxRuntime.jsx(se.Provider,{value:n,children:jsxRuntime.jsx(chunk4UXANDJ5_cjs.c.Provider,{value:n,children:t})})}let d={...P,switchThemeFromElement:g};return jsxRuntime.jsx(se.Provider,{value:d,children:jsxRuntime.jsx(chunk4UXANDJ5_cjs.c.Provider,{value:d,children:t})})},be=()=>{let t=Pe.useContext(chunk4UXANDJ5_cjs.c);if(t===null)throw new Error("useUITheme must be used within a UIThemeProvider");return {...t,switchThemeFromElement:(h,o)=>t.switchTheme(h,{element:o})}};Object.defineProperty(exports,"NextUIThemeProvider",{enumerable:true,get:function(){return chunk4UXANDJ5_cjs.e}});Object.defineProperty(exports,"useHydrated",{enumerable:true,get:function(){return chunk4UXANDJ5_cjs.d}});Object.defineProperty(exports,"useNextUITheme",{enumerable:true,get:function(){return chunk4UXANDJ5_cjs.f}});Object.defineProperty(exports,"useTheme",{enumerable:true,get:function(){return chunk4UXANDJ5_cjs.a}});Object.defineProperty(exports,"TRANSITION_DIRECTIONS",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.b}});Object.defineProperty(exports,"ThemeAnimationType",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.a}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.d}});Object.defineProperty(exports,"getSystemTheme",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.c}});Object.defineProperty(exports,"injectBaseStyles",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.a}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.g}});Object.defineProperty(exports,"resolveTheme",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.d}});Object.defineProperty(exports,"resolveThemeForServer",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.e}});Object.defineProperty(exports,"supportsViewTransitions",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.f}});Object.defineProperty(exports,"COLOR_STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.b}});Object.defineProperty(exports,"COLOR_THEME_PREFIX",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.d}});Object.defineProperty(exports,"DEFAULT_BLUR_AMOUNT",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.g}});Object.defineProperty(exports,"DEFAULT_DURATION",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.e}});Object.defineProperty(exports,"DEFAULT_EASING",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.f}});Object.defineProperty(exports,"DEFAULT_STYLE_ID",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.h}});Object.defineProperty(exports,"GLOBAL_CLASS_NAME",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.c}});Object.defineProperty(exports,"STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.a}});exports.TanStackStartThemeScript=ne;exports.TanStackUIThemeProvider=Re;exports.UIThemeProvider=Me;exports.ViteUIThemeProvider=Fe;exports.useTanStackUITheme=Oe;exports.useUITheme=be;exports.useViteUITheme=Ve;
|
|
2
|
+
'use strict';var chunkEVSU6Y3J_cjs=require('../chunk-EVSU6Y3J.cjs'),chunkR7KPCTX4_cjs=require('../chunk-R7KPCTX4.cjs'),chunk4HBM4JJB_cjs=require('../chunk-4HBM4JJB.cjs'),chunkUW5NJ23X_cjs=require('../chunk-UW5NJ23X.cjs'),chunkCYGYUQUK_cjs=require('../chunk-CYGYUQUK.cjs'),Ue=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ue__default=/*#__PURE__*/_interopDefault(Ue);var J=async(e,s,r)=>{try{await e?.(s);}catch(T){let a=T instanceof Error?T:new Error(String(T));try{r?r(a):console.error("Theme server notification failed:",a);}catch(u){console.error("Theme server error handler failed:",u);}}};var Q=Ue.createContext(void 0),me=Ue__default.default.memo(({themes:e=["light","dark","system"],colorThemes:s,storageKey:r=chunkCYGYUQUK_cjs.a,colorStorageKey:T=chunkCYGYUQUK_cjs.b,defaultTheme:a="system",defaultColorTheme:u="default",globalClassName:I=chunkCYGYUQUK_cjs.c,colorThemePrefix:x=chunkCYGYUQUK_cjs.d,nonce:v,systemThemeMode:U="js"})=>{let g=U==="css",P=chunk4HBM4JJB_cjs.c(true,[r,e,a],[T,s??null,u],g?'t=="dark"':chunk4HBM4JJB_cjs.b,`l.toggle(${chunk4HBM4JJB_cjs.a(I)},q);l.remove("auto","system");${g?'t=="system"&&l.add("system");d.style.colorScheme=t=="system"?"":q?"dark":"light"':'d.style.colorScheme=q?"dark":"light"'};p!="default"&&l.add(${chunk4HBM4JJB_cjs.a(x)}+p)`);return jsxRuntime.jsx("script",{nonce:v,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:P}})});me.displayName="TanStackStartThemeScript";var Re=({children:e,themes:s=["light","dark","system"],colorThemes:r=["default"],defaultTheme:T="system",defaultColorTheme:a=r[0]??"default",animationType:u="circle",clipPathDirection:I,animationPosition:x,logo:v,logoLight:U,logoDark:g,logoWidth:P,logoHeight:O,gradientWidth:N,duration:_=400,storageKey:k=chunkCYGYUQUK_cjs.a,colorStorageKey:f=chunkCYGYUQUK_cjs.b,globalClassName:D=chunkCYGYUQUK_cjs.c,colorThemePrefix:F=chunkCYGYUQUK_cjs.d,serverTheme:c,serverColorTheme:d,systemThemeMode:p="css",onServerThemeChange:n,onServerColorThemeChange:l,onServerError:V,nonce:b})=>{let C=chunkEVSU6Y3J_cjs.c(),E=c!==void 0,S=E?c==="system"?"system":c:void 0,m=chunkEVSU6Y3J_cjs.a({themes:s,colorThemes:r,defaultTheme:T,defaultColorTheme:a,animationType:u,clipPathDirection:I,animationPosition:x,...chunkR7KPCTX4_cjs.c({logo:v,logoLight:U,logoDark:g}),logoWidth:P,logoHeight:O,gradientWidth:N,duration:_,storageKey:k,colorStorageKey:f,globalClassName:D,colorThemePrefix:F,systemThemeMode:p,initialTheme:S,initialColorTheme:d,nonce:b,onThemeChange:h=>{J(n,h,V);},onColorThemeChange:h=>{J(l,h,V);}}),t=Ue.useRef(false);Ue.useEffect(()=>{if(!(!E||!C||t.current)){t.current=true;try{S&&chunkR7KPCTX4_cjs.g(S,k),d&&chunkR7KPCTX4_cjs.i(d,f);}catch(h){console.warn("Unable to persist the initial server theme:",h);}}},[E,C,S,d,k,f]);let o=m.setTheme,X=m.setColorTheme,z=Ue.useMemo(()=>{let h=(i=false)=>C?i:i===true||i===false?true:{...i,animationOff:true},w=(i,M)=>m.switchTheme(i,h(M));return {...m,isHydrated:true,switchTheme:w,switchThemeFromElement:(i,M)=>w(i,{element:M}),switchColorTheme:(i,M)=>m.switchColorTheme(i,h(M)),toggleTheme:i=>m.toggleTheme(h(i)),toggleLightTheme:i=>m.toggleLightTheme(h(i)),toggleDarkTheme:i=>m.toggleDarkTheme(h(i))}},[m,C]),{systemTheme:se}=m,Z=E?c==="dark"?"dark":c==="system"?se:"light":T==="dark"?"dark":"light";if(!C){let h={themes:s,colorThemes:r,mounted:false,ref:{current:null},theme:S??T,colorTheme:d??a,resolvedTheme:Z,systemTheme:"light",isHydrated:false,setTheme:o,setColorTheme:X,switchTheme:async w=>o(w),switchThemeFromElement:async w=>o(w),switchColorTheme:z.switchColorTheme,toggleTheme:async()=>{o(Z==="dark"?"light":"dark");},toggleLightTheme:async()=>o("light"),toggleDarkTheme:async()=>o("dark"),toggleColorTheme:m.toggleColorTheme,createColorThemeToggle:m.createColorThemeToggle,isColorThemeActive:m.isColorThemeActive};return jsxRuntime.jsx(Q.Provider,{value:h,children:jsxRuntime.jsx(chunkEVSU6Y3J_cjs.b.Provider,{value:h,children:e})})}return jsxRuntime.jsx(Q.Provider,{value:z,children:jsxRuntime.jsx(chunkEVSU6Y3J_cjs.b.Provider,{value:z,children:e})})},Le=()=>{let e=Ue.useContext(Q);if(e===void 0)throw new Error("useTanStackUITheme must be used within a TanStackUIThemeProvider");return e};var Te=Ue.createContext(void 0),De=({children:e,themes:s=["light","dark","system"],colorThemes:r=["default"],defaultTheme:T="system",defaultColorTheme:a=r[0]??"default",animationType:u="circle",clipPathDirection:I,animationPosition:x,logo:v,logoLight:U,logoDark:g,logoWidth:P,logoHeight:O,gradientWidth:N,duration:_=400,attribute:k="class",disableTransitionOnChange:f=false,storageKey:D="ui-theme",colorStorageKey:F="ui-color-theme",globalClassName:c="dark",colorThemePrefix:d="theme-",nonce:p})=>{let n=chunkEVSU6Y3J_cjs.a({themes:s,colorThemes:r,defaultTheme:T,defaultColorTheme:a,animationType:u,clipPathDirection:I,animationPosition:x,...chunkR7KPCTX4_cjs.c({logo:v,logoLight:U,logoDark:g}),logoWidth:P,logoHeight:O,gradientWidth:N,duration:_,storageKey:D,colorStorageKey:F,globalClassName:k==="class"?c:void 0,colorThemePrefix:d,nonce:p}),l=Ue.useCallback(()=>{if(!f)return ()=>{};let t=chunkUW5NJ23X_cjs.a(p);return t.textContent="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}",document.head.appendChild(t),window.getComputedStyle(document.body),()=>{setTimeout(()=>{document.head.removeChild(t);},1);}},[f,p]),V=Ue.useCallback(t=>{let o=l();n.setTheme(t),o();},[n,l]),b=Ue.useCallback(async(t,o=false)=>{let X=l();try{await n.switchTheme(t,o);}finally{X();}},[n,l]),C=Ue.useCallback(async(t=false)=>{let o=l();try{await n.toggleTheme(t);}finally{o();}},[n,l]),E=Ue.useCallback(async(t=false)=>{let o=l();try{await n.toggleLightTheme(t);}finally{o();}},[n,l]),S=Ue.useCallback(async(t=false)=>{let o=l();try{await n.toggleDarkTheme(t);}finally{o();}},[n,l]),m=Ue.useMemo(()=>({...n,setTheme:V,switchTheme:b,switchThemeFromElement:(t,o)=>b(t,{element:o}),toggleTheme:C,toggleLightTheme:E,toggleDarkTheme:S}),[n,V,b,C,E,S]);return jsxRuntime.jsx(Te.Provider,{value:m,children:jsxRuntime.jsx(chunkEVSU6Y3J_cjs.b.Provider,{value:m,children:e})})},Fe=()=>{let e=Ue.useContext(Te);if(e===void 0)throw new Error("useViteUITheme must be used within a ViteUIThemeProvider");return e};var he=Ue.createContext(void 0),He=({children:e,themes:s=["light","dark","system"],colorThemes:r=["default"],defaultTheme:T="system",defaultColorTheme:a=r[0]??"default",animationType:u="circle",clipPathDirection:I,animationPosition:x,logo:v,logoLight:U,logoDark:g,logoWidth:P,logoHeight:O,gradientWidth:N,duration:_=400,storageKey:k,colorStorageKey:f,nonce:D})=>{let F=chunkEVSU6Y3J_cjs.c(),c=chunkEVSU6Y3J_cjs.a({themes:s,colorThemes:r,defaultTheme:T,defaultColorTheme:a,animationType:u,clipPathDirection:I,animationPosition:x,...chunkR7KPCTX4_cjs.c({logo:v,logoLight:U,logoDark:g}),logoWidth:P,logoHeight:O,gradientWidth:N,duration:_,storageKey:k,colorStorageKey:f,nonce:D}),d=Ue.useMemo(()=>({...c,switchThemeFromElement:(p,n)=>c.switchTheme(p,{element:n})}),[c]);if(!F){let p={themes:s,colorThemes:r,mounted:false,systemTheme:"light",ref:{current:null},theme:T,colorTheme:a,resolvedTheme:T==="dark"?"dark":"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsxRuntime.jsx(he.Provider,{value:p,children:jsxRuntime.jsx(chunkEVSU6Y3J_cjs.b.Provider,{value:p,children:e})})}return jsxRuntime.jsx(he.Provider,{value:d,children:jsxRuntime.jsx(chunkEVSU6Y3J_cjs.b.Provider,{value:d,children:e})})},Ke=()=>{let e=Ue.useContext(chunkEVSU6Y3J_cjs.b);if(e===null)throw new Error("useUITheme must be used within a UIThemeProvider");return {...e,switchThemeFromElement:(s,r)=>e.switchTheme(s,{element:r})}};Object.defineProperty(exports,"NextUIThemeProvider",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.d}});Object.defineProperty(exports,"useHydrated",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.c}});Object.defineProperty(exports,"useNextUITheme",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.e}});Object.defineProperty(exports,"useTheme",{enumerable:true,get:function(){return chunkEVSU6Y3J_cjs.a}});Object.defineProperty(exports,"TRANSITION_DIRECTIONS",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.b}});Object.defineProperty(exports,"ThemeAnimationType",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.a}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.d}});Object.defineProperty(exports,"getSystemTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.d}});Object.defineProperty(exports,"injectBaseStyles",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.b}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.h}});Object.defineProperty(exports,"resolveTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.e}});Object.defineProperty(exports,"resolveThemeForServer",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.f}});Object.defineProperty(exports,"supportsViewTransitions",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.g}});Object.defineProperty(exports,"COLOR_STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.b}});Object.defineProperty(exports,"COLOR_THEME_PREFIX",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.d}});Object.defineProperty(exports,"DEFAULT_BLUR_AMOUNT",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.g}});Object.defineProperty(exports,"DEFAULT_DURATION",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.e}});Object.defineProperty(exports,"DEFAULT_EASING",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.f}});Object.defineProperty(exports,"DEFAULT_STYLE_ID",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.h}});Object.defineProperty(exports,"GLOBAL_CLASS_NAME",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.c}});Object.defineProperty(exports,"STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.a}});exports.TanStackStartThemeScript=me;exports.TanStackUIThemeProvider=Re;exports.UIThemeProvider=He;exports.ViteUIThemeProvider=De;exports.useTanStackUITheme=Le;exports.useUITheme=Ke;exports.useViteUITheme=Fe;
|