uitheme-web 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +56 -314
  2. package/dist/chunk-4UXANDJ5.cjs +26 -0
  3. package/dist/chunk-C4YNAGUP.js +26 -0
  4. package/dist/chunk-CTNYTI5Q.js +1 -0
  5. package/dist/{chunk-WFG34KG5.js → chunk-CY5E6WU4.js} +3 -3
  6. package/dist/chunk-CYGYUQUK.cjs +1 -0
  7. package/dist/chunk-EKVKQZNN.js +12 -0
  8. package/dist/chunk-EQPK72XK.js +14 -0
  9. package/dist/{chunk-W4YFUPGE.cjs → chunk-I5GA5T23.cjs} +3 -3
  10. package/dist/chunk-KQSBORXP.cjs +12 -0
  11. package/dist/chunk-NDNCNR4X.js +1 -0
  12. package/dist/chunk-SO3CO44A.js +1 -0
  13. package/dist/{constants-DmZ7yAIL.d.cts → constants-9M8X-rnX.d.cts} +2 -68
  14. package/dist/{constants-DmZ7yAIL.d.ts → constants-PAa1nGZ0.d.ts} +2 -68
  15. package/dist/controller-83zmHd-p.d.cts +76 -0
  16. package/dist/controller-DnMwV2nl.d.ts +76 -0
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.d.cts +7 -5
  19. package/dist/core/index.d.ts +7 -5
  20. package/dist/core/index.js +1 -1
  21. package/dist/index-Dn3XRBX1.d.ts +106 -0
  22. package/dist/index-DqlTGyMr.d.cts +106 -0
  23. package/dist/next/index.cjs +2 -0
  24. package/dist/next/index.d.cts +4 -0
  25. package/dist/next/index.d.ts +4 -0
  26. package/dist/next/index.js +2 -0
  27. package/dist/nuxt.d.ts +10 -0
  28. package/dist/nuxt.js +34 -0
  29. package/dist/react/index.cjs +11 -89
  30. package/dist/react/index.d.cts +23 -279
  31. package/dist/react/index.d.ts +23 -279
  32. package/dist/react/index.js +11 -89
  33. package/dist/server/index.cjs +14 -0
  34. package/dist/server/index.d.cts +11 -0
  35. package/dist/server/index.d.ts +11 -0
  36. package/dist/server/index.js +14 -0
  37. package/dist/tanstack/index.cjs +1 -1
  38. package/dist/tanstack/index.d.cts +5 -3
  39. package/dist/tanstack/index.d.ts +5 -3
  40. package/dist/tanstack/index.js +1 -1
  41. package/dist/types-CrR56NLm.d.cts +79 -0
  42. package/dist/types-CrR56NLm.d.ts +79 -0
  43. package/dist/types-Dd4EU8V9.d.ts +96 -0
  44. package/dist/vue/bootstrap.d.ts +13 -0
  45. package/dist/vue/bootstrap.js +1 -0
  46. package/dist/vue/index.d.ts +39 -0
  47. package/dist/vue/index.js +1 -0
  48. package/package.json +68 -17
  49. package/dist/chunk-DFJEYTIW.js +0 -12
  50. package/dist/chunk-V3LMT5IJ.cjs +0 -12
  51. package/dist/cli/index.js +0 -39
@@ -1,4 +1,4 @@
1
- 'use strict';var x=typeof window<"u",k=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
1
+ 'use strict';var x=typeof window<"u",S=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
2
2
  html[data-ui-theme-transition]::view-transition-group(root),
3
3
  html[data-ui-theme-transition]::view-transition-old(root),
4
4
  html[data-ui-theme-transition]::view-transition-new(root) {
@@ -14,5 +14,5 @@
14
14
  html[data-ui-theme-transition] *::after {
15
15
  transition: none !important;
16
16
  }
17
- `,document.head.appendChild(t);},E=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>')`,C=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",M=t=>t==="system"?C():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",T=()=>x&&document.startViewTransition instanceof Function,P=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,D=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}}},y=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},w=(t,n)=>{let{width:e,height:o}=y();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},L=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},S=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(c=>"clipPath"in c)?"clipPath":i.some(c=>"maskImage"in c)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let l=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let a=`ui-theme-reveal-${++S}`,r=document.createElement("style"),m=i.map(c=>{let $=Object.entries(c).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,A])=>`${u.replace(/[A-Z]/g,v=>`-${v.toLowerCase()}`)}:${A};`).join("");return `${c.computedOffset*100}%{${$}}`}).join("");r.textContent=`@keyframes ${a}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${a} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(r);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(c=>c instanceof CSSAnimation&&c.animationName===f);if(!p)throw r.remove(),new Error("Transition pseudo animations are unavailable");return l&&(p.pause(),p.currentTime=s),p.finished.then(()=>r.remove(),()=>r.remove()),p},O=t=>{let n=t.clipPathDirection??"top-left",e={"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 h(t,{clipPath:[e[n],o[n]]})},_=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=y(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),l=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,a=g?0:n.includes("bottom")?1:.5,r=i||l?e*3:e,m=i||!l?o*3:o,f=i?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",p=i?r*m/Math.hypot(r,m):l?r:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<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*(i?.5:l?1-s:s)}" y2="${100*(i?.5:l?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":l?`0px ${m}px`:`${r}px 0px`,`${r}px ${m}px`],maskPosition:[`${s*e}px ${a*o}px`,`${s*(e-r)}px ${a*(o-m)}px`]})},F=t=>{let{x:n,y:e}=t,o=w(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},I=t=>{let{width:n,height:e}=y();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${w(n,e)}px at ${n}px ${e}px)`]})},U=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},B=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=w(n,e)+i,g=d*2;return h(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",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};var N="theme",K="color-theme",z="dark",j="theme-",H=400,W="cubic-bezier(0.32, 0.72, 0, 1)",Y=2,q="ui-theme-style";
18
- exports.a=k;exports.b=E;exports.c=C;exports.d=M;exports.e=R;exports.f=T;exports.g=P;exports.h=D;exports.i=L;exports.j=O;exports.k=_;exports.l=F;exports.m=I;exports.n=b;exports.o=U;exports.p=B;exports.q=N;exports.r=K;exports.s=z;exports.t=j;exports.u=H;exports.v=W;exports.w=Y;exports.x=q;
17
+ `,document.head.appendChild(t);},M=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>')`,k=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",P=t=>t==="system"?k():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",E=()=>x&&document.startViewTransition instanceof Function,T=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=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}}},w=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},y=(t,n)=>{let{width:e,height:o}=w();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},I=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},C=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let c=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let r=`ui-theme-reveal-${++C}`,a=document.createElement("style"),m=i.map(l=>{let $=Object.entries(l).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,v])=>`${u.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`)}:${v};`).join("");return `${l.computedOffset*100}%{${$}}`}).join("");a.textContent=`@keyframes ${r}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${r} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===f);if(!p)throw a.remove(),new Error("Transition pseudo animations are unavailable");return c&&(p.pause(),p.currentTime=s),p.finished.then(()=>a.remove(),()=>a.remove()),p},D=t=>{let n=t.clipPathDirection??"top-left",e={"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 h(t,{clipPath:[e[n],o[n]]})},F=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=w(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),c=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,r=g?0:n.includes("bottom")?1:.5,a=i||c?e*3:e,m=i||!c?o*3:o,f=i?`${s*100},${r*100} ${(1-s)*100},${r*100} ${s*100},${(1-r)*100}`:"0,0 100,0 100,100 0,100",p=i?a*m/Math.hypot(a,m):c?a:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${r*100}" x2="${100*(i?.5:c?1-s:s)}" y2="${100*(i?.5:c?r:1-r)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":c?`0px ${m}px`:`${a}px 0px`,`${a}px ${m}px`],maskPosition:[`${s*e}px ${r*o}px`,`${s*(e-a)}px ${r*(o-m)}px`]})},j=t=>{let{x:n,y:e}=t,o=y(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},z=t=>{let{width:n,height:e}=w();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${y(n,e)}px at ${n}px ${e}px)`]})},G=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},K=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=y(n,e)+i,g=d*2;return h(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",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};
18
+ exports.a=S;exports.b=M;exports.c=k;exports.d=P;exports.e=R;exports.f=E;exports.g=T;exports.h=B;exports.i=I;exports.j=D;exports.k=F;exports.l=j;exports.m=z;exports.n=b;exports.o=G;exports.p=K;
@@ -0,0 +1,12 @@
1
+ 'use strict';var chunkI5GA5T23_cjs=require('./chunk-I5GA5T23.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||{}),$e=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=n=>{if(n.logoLight!==void 0||n.logoDark!==void 0){if(!n.logoLight||!n.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(n.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:n.logoLight,logoDark:n.logoDark}}return {logo:n.logo}},Ge=0,Ee=n=>{let i=Ne(n.logo);if(!i)return;let t=n.logoWidth!=="auto"&&n.logoWidth&&Number.isFinite(n.logoWidth)&&n.logoWidth>0?n.logoWidth:void 0,o=n.logoHeight!=="auto"&&n.logoHeight&&Number.isFinite(n.logoHeight)&&n.logoHeight>0?n.logoHeight:void 0,h=t??(o?o*i.aspectRatio:n.logoWidth==="auto"||n.logoHeight==="auto"?i.naturalWidth:96),m=o??h/i.aspectRatio,c=`ui-theme-logo-${++Ge}`,a=document.createElement("img");a.src=i.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${h/2}px);top:calc(50% - ${m/2}px);width:${h}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=document.createElement("style");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 ${n.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,xe=n=>{if(typeof window>"u")return Promise.resolve();let i=Q.get(n);if(i)return i.loading;let t={loading:Promise.resolve()};return Q.set(n,t),t.loading=(async()=>{let o=new AbortController,h=setTimeout(()=>o.abort(),2e3);try{let m=await fetch(n,{signal:o.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(h);}})(),t.loading},Ne=n=>n?Q.get(n)?.ready:void 0;var D=new WeakMap,Oe=async(n,i)=>{if(typeof document>"u"){await n();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let o={updateDone:Promise.resolve()};D.set(document,o);let h=()=>{o.animation?.cancel(),o.logo?.element.remove(),o.logo?.style.remove(),D.get(document)===o&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};o.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==o||!i||!chunkI5GA5T23_cjs.f()||chunkI5GA5T23_cjs.g()||document.visibilityState==="hidden"){await n();return}chunkI5GA5T23_cjs.a(),document.documentElement.setAttribute("data-ui-theme-transition",""),i.animationType==="svg-logo"&&(o.logo=Ee(i));let m;try{m=document.startViewTransition(n);}catch{await n();return}o.transition=m,m.ready.catch(()=>{}),m.finished.then(h,h),await m.updateCallbackDone;})();try{await o.updateDone;let m=o.transition;if(!m){h();return}try{await m.ready;}catch{h();return}if(D.get(document)!==o){m.skipTransition();return}if(!i)return;try{o.animation=i.animationType==="slide"?chunkI5GA5T23_cjs.o(i):i.animationType==="blur-circle"?chunkI5GA5T23_cjs.p(i):i.animationType==="clip-path"?chunkI5GA5T23_cjs.j(i):i.animationType==="polygon-gradient"?chunkI5GA5T23_cjs.k(i):i.animationType==="triangle"?chunkI5GA5T23_cjs.l(i):i.animationType==="svg-logo"?chunkI5GA5T23_cjs.m(i):chunkI5GA5T23_cjs.n(i),o.animation.finished.catch(()=>{});let c=o.animation.effect;!(o.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m.skipTransition(),h());}catch{m.skipTransition(),h();}}catch(m){throw h(),m}};var M=typeof window<"u",Ae=(n=chunkCYGYUQUK_cjs.a,i=["light","dark","system"],t="system")=>{if(!M)return t;let o;try{o=localStorage.getItem(n);}catch{return t}return i.find(h=>h===o)??t},Ie=(n,i=chunkCYGYUQUK_cjs.a)=>{M&&localStorage.setItem(i,n);},De=(n=chunkCYGYUQUK_cjs.b,i=["default"],t="default")=>{if(!M)return t;let o;try{o=localStorage.getItem(n);}catch{return t}return o&&i.includes(o)?o:t},ke=(n,i=chunkCYGYUQUK_cjs.b)=>{M&&localStorage.setItem(i,n);};function G(n){if(!["light","dark","system"].includes(n))throw new Error("Theme must be light, dark, or system.")}function U(n,i){let t=`${i}${n}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(n={}){let i=n.themes??["light","dark","system"],t=n.colorThemes??["default"],o=n.defaultTheme??"system",h=n.defaultColorTheme??t[0],m=n.globalClassName??chunkCYGYUQUK_cjs.c,c=n.colorThemePrefix??chunkCYGYUQUK_cjs.d;if(!i.length||!i.every(a=>["light","dark","system"].includes(a))||!i.includes(o))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(h===void 0||!t.includes(h))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([...i]),colorThemes:Object.freeze([...t]),defaultTheme:o,defaultColorTheme:h,globalClassName:m,colorThemePrefix:c,storageKey:n.storageKey??chunkCYGYUQUK_cjs.a,colorStorageKey:n.colorStorageKey??chunkCYGYUQUK_cjs.b}}var Y=(n,i)=>n.length===i.length&&n.every((t,o)=>t===i[o]),Pe=n=>n&&n!==true&&"currentTarget"in n?{element:n.currentTarget,animationOff:n.detail===0}:n,et=(n={},i={})=>{let t=n,o=Z(t);_(t);let h=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&U(e.colorTheme,s),e.initialColorTheme!==void 0&&U(e.initialColorTheme,s);};h(t,o.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c=()=>{if(t.storage===void 0)return Ae(t.storageKey,o.themes,o.defaultTheme);let e=m(t.storageKey??chunkCYGYUQUK_cjs.a);return o.themes.find(s=>s===e)??o.defaultTheme},a=()=>{if(t.storage===void 0)return De(t.colorStorageKey,o.colorThemes,o.defaultColorTheme);let e=m(t.colorStorageKey??chunkCYGYUQUK_cjs.b);return o.colorThemes.find(s=>s===e)??o.defaultColorTheme},T=t.initialTheme??c(),u=t.initialColorTheme??a(),ee=false,te=false,k=chunkI5GA5T23_cjs.c(),x=false,N=0,w=0,j,$,K,W,q=new Set,oe=t.theme??t.initialTheme??o.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??o.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:o.themes,colorThemes:o.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:chunkI5GA5T23_cjs.d(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b=l.colorTheme,Re=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=o.globalClassName,d=o.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(r=>e.classList.remove(`${d}${r}`)),K=`${d}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,d=o.themes,r=o.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,d)?l.themes:d,colorThemes:Y(l.colorThemes,r)?l.colorThemes:r,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),Re(),y&&q.forEach(C=>C());},ie=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&xe(e);},re=e=>{try{e();}catch(s){if(!i.onBrowserStorageError)throw s;i.onBrowserStorageError(s instanceof Error?s:new Error(String(s)));}},se=e=>{G(e),t.storage===void 0?re(()=>Ie(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=>{U(e,o.colorThemePrefix),t.storage===void 0?re(()=>ke(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);},_e=(e=false)=>{let s=e===true||e===false?{animationOff:e}:e,d=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,r={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};d&&Object.assign(r,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(r);let g=r.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===r.animationType)??"circle",C={duration:g,easing:r.easing??chunkCYGYUQUK_cjs.f,animationType:y,blurAmount:r.blurAmount??2,styleId:r.styleId??chunkCYGYUQUK_cjs.h};if(y==="slide"){let R=r.slideFromX!==void 0&&r.slideFromY!==void 0?{a:r.slideFromX,b:r.slideFromY}:chunkI5GA5T23_cjs.h(r.slideDirection??"left");return {...C,...R,x:r.slideToX??0,y:r.slideToY??0}}let A=s.element??i.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f=(y==="svg-logo"?chunkI5GA5T23_cjs.i("center"):null)??s.origin??(r.animationPosition&&r.animationPosition!=="trigger"?chunkI5GA5T23_cjs.i(r.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:chunkI5GA5T23_cjs.i("center"));return !f||!Number.isFinite(f.x)||!Number.isFinite(f.y)?null:{...C,...f,clipPathDirection:r.clipPathDirection??"top-left",animationPosition:r.animationPosition,logo:r.logoLight!==void 0?chunkI5GA5T23_cjs.d(O)==="light"?r.logoLight:r.logoDark:r.logo,logoWidth:r.logoWidth,logoHeight:r.logoHeight,gradientWidth:r.gradientWidth}},le=async(e,s)=>{let d=_e(s),r=w,g=()=>{r===w&&e();};N++;try{await Oe(()=>{if(r===w)return i.commit?i.commit(g):g()},d);}finally{r===w&&N--;}},F=async(e,s)=>{if(G(e),!o.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let d=w;try{await le(()=>se(e),s);}catch(r){throw d===w&&p===e&&(p=O),r}},X=async(e,s)=>{if(!o.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b)return;b=e;let d=w;try{await le(()=>ae(e),s);}catch(r){throw d===w&&b===e&&(b=P),r}},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=chunkI5GA5T23_cjs.c();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=chunkI5GA5T23_cjs.c(),E();},d=r=>{if(r.storageArea&&r.storageArea!==window.localStorage)return;let g=o.themes,y=o.colorThemes;if((r.key===null||r.key===(t.storageKey??chunkCYGYUQUK_cjs.a))&&t.theme===void 0){let C=r.newValue??o.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((r.key===null||r.key===(t.colorStorageKey??chunkCYGYUQUK_cjs.b))&&t.colorTheme===void 0){let C=r.newValue??o.defaultColorTheme;y.includes(C)&&(u=P=b=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",d),t.storage===void 0&&window.addEventListener("storage",d);},$(),j=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",d);},chunkI5GA5T23_cjs.a(),ie(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,d=l.colorTheme,r={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=r,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);h(v,f.colorThemePrefix),!Y(o.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(o.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,o=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),d!==l.colorTheme&&(P=b=l.colorTheme)),x&&(ie(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e=>{let s=chunkI5GA5T23_cjs.d(p)==="dark"?"light":"dark",d=o.themes.includes(s)?s:o.themes[(o.themes.indexOf(p)+1)%o.themes.length];return F(d,e)},toggleLightTheme:async e=>{chunkI5GA5T23_cjs.d(p)!=="light"&&await F("light",e);},toggleDarkTheme:async e=>{chunkI5GA5T23_cjs.d(p)!=="dark"&&await F("dark",e);},toggleColorTheme:async e=>{let s=o.colorThemes;s.length!==0&&await X(s[(s.indexOf(b)+1)%s.length],Pe(e));},createColorThemeToggle:e=>s=>X(e,Pe(s)),isColorThemeActive:e=>l.colorTheme===e}};
12
+ exports.a=J;exports.b=$e;exports.c=_;exports.d=xe;exports.e=Oe;exports.f=Ae;exports.g=Ie;exports.h=De;exports.i=ke;exports.j=et;
@@ -0,0 +1 @@
1
+ var t="theme",e="color-theme",o="dark",E="theme-",_=400,A="cubic-bezier(0.32, 0.72, 0, 1)",c=2,r="ui-theme-style";export{t as a,e as b,o as c,E as d,_ as e,A as f,c as g,r as h};
@@ -0,0 +1 @@
1
+ import {c,d,b,a}from'./chunk-CTNYTI5Q.js';function f(e={}){let r=e.themes??["light","dark","system"],o=e.colorThemes??["default"],l=e.defaultTheme??"system",s=e.defaultColorTheme??o[0],m=e.globalClassName??c,n=e.colorThemePrefix??d;if(!r.length||!r.every(t=>["light","dark","system"].includes(t))||!r.includes(l))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(s===void 0||!o.includes(s))throw new Error("colorThemes must include the defaultColorTheme.");if(![m,...o.map(t=>`${n}${t}`)].every(t=>t.length>0&&!/\s/.test(t)))throw new Error("Theme classes must be nonempty CSS class tokens.");return {themes:Object.freeze([...r]),colorThemes:Object.freeze([...o]),defaultTheme:l,defaultColorTheme:s,globalClassName:m,colorThemePrefix:n,storageKey:e.storageKey??a,colorStorageKey:e.colorStorageKey??b}}var g=f;export{g as a};
@@ -1,70 +1,4 @@
1
- declare enum ThemeAnimationType {
2
- CIRCLE = "circle",
3
- BLUR_CIRCLE = "blur-circle",
4
- SLIDE = "slide",
5
- CLIP_PATH = "clip-path",
6
- POLYGON_GRADIENT = "polygon-gradient",
7
- TRIANGLE = "triangle",
8
- SVG_LOGO = "svg-logo"
9
- }
10
- /** Clockwise from the top-left corner. */
11
- declare const TRANSITION_DIRECTIONS: readonly ["top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left"];
12
- type TransitionDirection = (typeof TRANSITION_DIRECTIONS)[number];
13
- type AnimationPosition = TransitionDirection | 'center' | 'trigger';
14
- interface ThemeAnimationSettings {
15
- /** Starting edge/corner for polygon wipes. Defaults to top-left. */
16
- clipPathDirection?: TransitionDirection;
17
- /** Fixed circle/triangle origin; SVG_LOGO always uses the viewport center. */
18
- animationPosition?: AnimationPosition;
19
- /** Stationary logo width in CSS pixels or auto; default is 96 when both are omitted. */
20
- logoWidth?: number | 'auto';
21
- /** Logo height in CSS pixels or auto; omitted dimensions preserve the SVG aspect ratio. */
22
- logoHeight?: number | 'auto';
23
- /** Gradient wipe feather in CSS pixels; defaults to 80. */
24
- gradientWidth?: number;
25
- }
26
- /** Choose one shared asset, or both destination-specific assets. */
27
- type ThemeLogoOptions = {
28
- logo?: string;
29
- logoLight?: never;
30
- logoDark?: never;
31
- } | {
32
- logo?: never;
33
- logoLight: string;
34
- logoDark: string;
35
- };
36
- type ThemeAnimationOptions = ThemeAnimationSettings & ThemeLogoOptions;
37
- type Theme = 'light' | 'dark' | 'system';
38
- type ColorTheme = string;
39
- type SlideDirection = 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
40
- interface AnimationConfig extends ThemeAnimationSettings {
41
- /** Asset already selected for the destination theme before capture. */
42
- logo?: string;
43
- a?: number;
44
- b?: number;
45
- x: number;
46
- y: number;
47
- duration: number;
48
- easing: string;
49
- animationType: ThemeAnimationType;
50
- blurAmount: number;
51
- styleId: string;
52
- }
53
- interface ThemeConfig {
54
- themes?: Theme[];
55
- colorThemes?: ColorTheme[];
56
- defaultTheme?: Theme;
57
- defaultColorTheme?: ColorTheme;
58
- globalClassName?: string;
59
- colorThemePrefix?: string;
60
- storageKey?: string;
61
- colorStorageKey?: string;
62
- }
63
- interface ThemeState {
64
- theme: Theme;
65
- colorTheme: ColorTheme;
66
- resolvedTheme: 'light' | 'dark';
67
- }
1
+ import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-CrR56NLm.cjs';
68
2
 
69
3
  /** Injects styles scoped to transitions owned by this library. */
70
4
  declare const injectBaseStyles: () => void;
@@ -142,4 +76,4 @@ declare const DEFAULT_EASING = "cubic-bezier(0.32, 0.72, 0, 1)";
142
76
  declare const DEFAULT_BLUR_AMOUNT = 2;
143
77
  declare const DEFAULT_STYLE_ID = "ui-theme-style";
144
78
 
145
- export { type AnimationConfig as A, prefersReducedMotion as B, type ColorTheme as C, DEFAULT_BLUR_AMOUNT as D, resolveTheme as E, supportsViewTransitions as F, GLOBAL_CLASS_NAME as G, resolveThemeForServer as H, STORAGE_KEY as S, type Theme as T, type AnimationPosition as a, COLOR_STORAGE_KEY as b, COLOR_THEME_PREFIX as c, DEFAULT_DURATION as d, DEFAULT_EASING as e, DEFAULT_STYLE_ID as f, type SlideDirection as g, TRANSITION_DIRECTIONS as h, type ThemeAnimationOptions as i, ThemeAnimationType as j, type ThemeConfig as k, type ThemeLogoOptions as l, type ThemeState as m, type TransitionDirection as n, createBlurCircleAnimation as o, createBlurCircleMask as p, createCircleAnimation as q, createClipPathAnimation as r, createPolygonGradientAnimation as s, createSlideAnimation as t, createSvgLogoAnimation as u, createTriangleAnimation as v, getAnimationPosition as w, getSlideFromCoords as x, getSystemTheme as y, injectBaseStyles as z };
79
+ export { COLOR_STORAGE_KEY as C, DEFAULT_BLUR_AMOUNT as D, GLOBAL_CLASS_NAME as G, STORAGE_KEY as S, COLOR_THEME_PREFIX as a, DEFAULT_DURATION as b, DEFAULT_EASING as c, DEFAULT_STYLE_ID as d, createBlurCircleAnimation as e, createBlurCircleMask as f, createCircleAnimation as g, createClipPathAnimation as h, createPolygonGradientAnimation as i, createSlideAnimation as j, createSvgLogoAnimation as k, createTriangleAnimation as l, getAnimationPosition as m, getSlideFromCoords as n, getSystemTheme as o, injectBaseStyles as p, prefersReducedMotion as q, resolveThemeForServer as r, resolveTheme as s, supportsViewTransitions as t };
@@ -1,70 +1,4 @@
1
- declare enum ThemeAnimationType {
2
- CIRCLE = "circle",
3
- BLUR_CIRCLE = "blur-circle",
4
- SLIDE = "slide",
5
- CLIP_PATH = "clip-path",
6
- POLYGON_GRADIENT = "polygon-gradient",
7
- TRIANGLE = "triangle",
8
- SVG_LOGO = "svg-logo"
9
- }
10
- /** Clockwise from the top-left corner. */
11
- declare const TRANSITION_DIRECTIONS: readonly ["top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left"];
12
- type TransitionDirection = (typeof TRANSITION_DIRECTIONS)[number];
13
- type AnimationPosition = TransitionDirection | 'center' | 'trigger';
14
- interface ThemeAnimationSettings {
15
- /** Starting edge/corner for polygon wipes. Defaults to top-left. */
16
- clipPathDirection?: TransitionDirection;
17
- /** Fixed circle/triangle origin; SVG_LOGO always uses the viewport center. */
18
- animationPosition?: AnimationPosition;
19
- /** Stationary logo width in CSS pixels or auto; default is 96 when both are omitted. */
20
- logoWidth?: number | 'auto';
21
- /** Logo height in CSS pixels or auto; omitted dimensions preserve the SVG aspect ratio. */
22
- logoHeight?: number | 'auto';
23
- /** Gradient wipe feather in CSS pixels; defaults to 80. */
24
- gradientWidth?: number;
25
- }
26
- /** Choose one shared asset, or both destination-specific assets. */
27
- type ThemeLogoOptions = {
28
- logo?: string;
29
- logoLight?: never;
30
- logoDark?: never;
31
- } | {
32
- logo?: never;
33
- logoLight: string;
34
- logoDark: string;
35
- };
36
- type ThemeAnimationOptions = ThemeAnimationSettings & ThemeLogoOptions;
37
- type Theme = 'light' | 'dark' | 'system';
38
- type ColorTheme = string;
39
- type SlideDirection = 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
40
- interface AnimationConfig extends ThemeAnimationSettings {
41
- /** Asset already selected for the destination theme before capture. */
42
- logo?: string;
43
- a?: number;
44
- b?: number;
45
- x: number;
46
- y: number;
47
- duration: number;
48
- easing: string;
49
- animationType: ThemeAnimationType;
50
- blurAmount: number;
51
- styleId: string;
52
- }
53
- interface ThemeConfig {
54
- themes?: Theme[];
55
- colorThemes?: ColorTheme[];
56
- defaultTheme?: Theme;
57
- defaultColorTheme?: ColorTheme;
58
- globalClassName?: string;
59
- colorThemePrefix?: string;
60
- storageKey?: string;
61
- colorStorageKey?: string;
62
- }
63
- interface ThemeState {
64
- theme: Theme;
65
- colorTheme: ColorTheme;
66
- resolvedTheme: 'light' | 'dark';
67
- }
1
+ import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-CrR56NLm.js';
68
2
 
69
3
  /** Injects styles scoped to transitions owned by this library. */
70
4
  declare const injectBaseStyles: () => void;
@@ -142,4 +76,4 @@ declare const DEFAULT_EASING = "cubic-bezier(0.32, 0.72, 0, 1)";
142
76
  declare const DEFAULT_BLUR_AMOUNT = 2;
143
77
  declare const DEFAULT_STYLE_ID = "ui-theme-style";
144
78
 
145
- export { type AnimationConfig as A, prefersReducedMotion as B, type ColorTheme as C, DEFAULT_BLUR_AMOUNT as D, resolveTheme as E, supportsViewTransitions as F, GLOBAL_CLASS_NAME as G, resolveThemeForServer as H, STORAGE_KEY as S, type Theme as T, type AnimationPosition as a, COLOR_STORAGE_KEY as b, COLOR_THEME_PREFIX as c, DEFAULT_DURATION as d, DEFAULT_EASING as e, DEFAULT_STYLE_ID as f, type SlideDirection as g, TRANSITION_DIRECTIONS as h, type ThemeAnimationOptions as i, ThemeAnimationType as j, type ThemeConfig as k, type ThemeLogoOptions as l, type ThemeState as m, type TransitionDirection as n, createBlurCircleAnimation as o, createBlurCircleMask as p, createCircleAnimation as q, createClipPathAnimation as r, createPolygonGradientAnimation as s, createSlideAnimation as t, createSvgLogoAnimation as u, createTriangleAnimation as v, getAnimationPosition as w, getSlideFromCoords as x, getSystemTheme as y, injectBaseStyles as z };
79
+ export { COLOR_STORAGE_KEY as C, DEFAULT_BLUR_AMOUNT as D, GLOBAL_CLASS_NAME as G, STORAGE_KEY as S, COLOR_THEME_PREFIX as a, DEFAULT_DURATION as b, DEFAULT_EASING as c, DEFAULT_STYLE_ID as d, createBlurCircleAnimation as e, createBlurCircleMask as f, createCircleAnimation as g, createClipPathAnimation as h, createPolygonGradientAnimation as i, createSlideAnimation as j, createSvgLogoAnimation as k, createTriangleAnimation as l, getAnimationPosition as m, getSlideFromCoords as n, getSystemTheme as o, injectBaseStyles as p, prefersReducedMotion as q, resolveThemeForServer as r, resolveTheme as s, supportsViewTransitions as t };
@@ -0,0 +1,76 @@
1
+ import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-CrR56NLm.cjs';
2
+
3
+ type SystemThemeMode = 'css' | 'js';
4
+ type ThemeTransitionSettings = ThemeAnimationOptions & {
5
+ duration?: number;
6
+ easing?: string;
7
+ animationType?: ThemeAnimationType | `${ThemeAnimationType}`;
8
+ blurAmount?: number;
9
+ styleId?: string;
10
+ slideDirection?: SlideDirection;
11
+ slideFromX?: number;
12
+ slideFromY?: number;
13
+ slideToX?: number;
14
+ slideToY?: number;
15
+ };
16
+ type ThemeTransitionOptions = ThemeTransitionSettings & {
17
+ animationOff?: boolean;
18
+ element?: Element | null;
19
+ origin?: {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ };
24
+ type ThemeTransitionInput = boolean | ThemeTransitionOptions;
25
+ type ColorThemeToggleInput = ThemeTransitionInput | {
26
+ currentTarget: Element;
27
+ detail: number;
28
+ };
29
+ type ColorThemeToggle = (input?: ColorThemeToggleInput) => Promise<void>;
30
+ interface ThemeStorage {
31
+ getItem: (key: string) => string | null;
32
+ setItem: (key: string, value: string) => void;
33
+ }
34
+ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
35
+ storage?: ThemeStorage | false;
36
+ theme?: Theme;
37
+ colorTheme?: string;
38
+ onThemeChange?: (theme: Theme) => void;
39
+ onColorThemeChange?: (colorTheme: string) => void;
40
+ initialTheme?: Theme;
41
+ initialColorTheme?: string;
42
+ systemThemeMode?: SystemThemeMode;
43
+ };
44
+ interface ThemeControllerSnapshot extends ThemeState {
45
+ readonly systemTheme: 'light' | 'dark';
46
+ readonly themes: readonly Theme[];
47
+ readonly colorThemes: readonly string[];
48
+ readonly mounted: boolean;
49
+ }
50
+ interface ThemeControllerAdapter {
51
+ commit?: (update: () => void) => void | Promise<void>;
52
+ getElement?: () => Element | null;
53
+ onBrowserStorageError?: (error: Error) => void;
54
+ }
55
+ interface ThemeController {
56
+ getSnapshot: () => ThemeControllerSnapshot;
57
+ getServerSnapshot: () => ThemeControllerSnapshot;
58
+ subscribe: (listener: () => void) => () => void;
59
+ mount: () => () => void;
60
+ dispose: () => void;
61
+ updateOptions: (options: Partial<ThemeControllerOptions>) => void;
62
+ setTheme: (theme: Theme) => void;
63
+ setColorTheme: (theme: string) => void;
64
+ switchTheme: (theme: Theme, input?: ThemeTransitionInput) => Promise<void>;
65
+ switchColorTheme: (theme: string, input?: ThemeTransitionInput) => Promise<void>;
66
+ toggleTheme: (input?: ThemeTransitionInput) => Promise<void>;
67
+ toggleLightTheme: (input?: ThemeTransitionInput) => Promise<void>;
68
+ toggleDarkTheme: (input?: ThemeTransitionInput) => Promise<void>;
69
+ toggleColorTheme: ColorThemeToggle;
70
+ createColorThemeToggle: (theme: string) => ColorThemeToggle;
71
+ isColorThemeActive: (theme: string) => boolean;
72
+ }
73
+ declare const createThemeController: (initialOptions?: ThemeControllerOptions, adapter?: ThemeControllerAdapter) => ThemeController;
74
+
75
+ export { createThemeController as i };
76
+ export type { ColorThemeToggle as C, SystemThemeMode as S, ThemeController as T, ColorThemeToggleInput as a, ThemeControllerAdapter as b, ThemeControllerOptions as c, ThemeControllerSnapshot as d, ThemeStorage as e, ThemeTransitionInput as f, ThemeTransitionOptions as g, ThemeTransitionSettings as h };
@@ -0,0 +1,76 @@
1
+ import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-CrR56NLm.js';
2
+
3
+ type SystemThemeMode = 'css' | 'js';
4
+ type ThemeTransitionSettings = ThemeAnimationOptions & {
5
+ duration?: number;
6
+ easing?: string;
7
+ animationType?: ThemeAnimationType | `${ThemeAnimationType}`;
8
+ blurAmount?: number;
9
+ styleId?: string;
10
+ slideDirection?: SlideDirection;
11
+ slideFromX?: number;
12
+ slideFromY?: number;
13
+ slideToX?: number;
14
+ slideToY?: number;
15
+ };
16
+ type ThemeTransitionOptions = ThemeTransitionSettings & {
17
+ animationOff?: boolean;
18
+ element?: Element | null;
19
+ origin?: {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ };
24
+ type ThemeTransitionInput = boolean | ThemeTransitionOptions;
25
+ type ColorThemeToggleInput = ThemeTransitionInput | {
26
+ currentTarget: Element;
27
+ detail: number;
28
+ };
29
+ type ColorThemeToggle = (input?: ColorThemeToggleInput) => Promise<void>;
30
+ interface ThemeStorage {
31
+ getItem: (key: string) => string | null;
32
+ setItem: (key: string, value: string) => void;
33
+ }
34
+ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
35
+ storage?: ThemeStorage | false;
36
+ theme?: Theme;
37
+ colorTheme?: string;
38
+ onThemeChange?: (theme: Theme) => void;
39
+ onColorThemeChange?: (colorTheme: string) => void;
40
+ initialTheme?: Theme;
41
+ initialColorTheme?: string;
42
+ systemThemeMode?: SystemThemeMode;
43
+ };
44
+ interface ThemeControllerSnapshot extends ThemeState {
45
+ readonly systemTheme: 'light' | 'dark';
46
+ readonly themes: readonly Theme[];
47
+ readonly colorThemes: readonly string[];
48
+ readonly mounted: boolean;
49
+ }
50
+ interface ThemeControllerAdapter {
51
+ commit?: (update: () => void) => void | Promise<void>;
52
+ getElement?: () => Element | null;
53
+ onBrowserStorageError?: (error: Error) => void;
54
+ }
55
+ interface ThemeController {
56
+ getSnapshot: () => ThemeControllerSnapshot;
57
+ getServerSnapshot: () => ThemeControllerSnapshot;
58
+ subscribe: (listener: () => void) => () => void;
59
+ mount: () => () => void;
60
+ dispose: () => void;
61
+ updateOptions: (options: Partial<ThemeControllerOptions>) => void;
62
+ setTheme: (theme: Theme) => void;
63
+ setColorTheme: (theme: string) => void;
64
+ switchTheme: (theme: Theme, input?: ThemeTransitionInput) => Promise<void>;
65
+ switchColorTheme: (theme: string, input?: ThemeTransitionInput) => Promise<void>;
66
+ toggleTheme: (input?: ThemeTransitionInput) => Promise<void>;
67
+ toggleLightTheme: (input?: ThemeTransitionInput) => Promise<void>;
68
+ toggleDarkTheme: (input?: ThemeTransitionInput) => Promise<void>;
69
+ toggleColorTheme: ColorThemeToggle;
70
+ createColorThemeToggle: (theme: string) => ColorThemeToggle;
71
+ isColorThemeActive: (theme: string) => boolean;
72
+ }
73
+ declare const createThemeController: (initialOptions?: ThemeControllerOptions, adapter?: ThemeControllerAdapter) => ThemeController;
74
+
75
+ export { createThemeController as i };
76
+ export type { ColorThemeToggle as C, SystemThemeMode as S, ThemeController as T, ColorThemeToggleInput as a, ThemeControllerAdapter as b, ThemeControllerOptions as c, ThemeControllerSnapshot as d, ThemeStorage as e, ThemeTransitionInput as f, ThemeTransitionOptions as g, ThemeTransitionSettings as h };
@@ -1 +1 @@
1
- 'use strict';var chunkV3LMT5IJ_cjs=require('../chunk-V3LMT5IJ.cjs'),chunkW4YFUPGE_cjs=require('../chunk-W4YFUPGE.cjs');Object.defineProperty(exports,"TRANSITION_DIRECTIONS",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.b}});Object.defineProperty(exports,"ThemeAnimationType",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.a}});Object.defineProperty(exports,"getStoredColorTheme",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.h}});Object.defineProperty(exports,"getStoredTheme",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.f}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.d}});Object.defineProperty(exports,"runThemeTransition",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.e}});Object.defineProperty(exports,"setStoredColorTheme",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.i}});Object.defineProperty(exports,"setStoredTheme",{enumerable:true,get:function(){return chunkV3LMT5IJ_cjs.g}});Object.defineProperty(exports,"COLOR_STORAGE_KEY",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.r}});Object.defineProperty(exports,"COLOR_THEME_PREFIX",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.t}});Object.defineProperty(exports,"DEFAULT_BLUR_AMOUNT",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.w}});Object.defineProperty(exports,"DEFAULT_DURATION",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.u}});Object.defineProperty(exports,"DEFAULT_EASING",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.v}});Object.defineProperty(exports,"DEFAULT_STYLE_ID",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.x}});Object.defineProperty(exports,"GLOBAL_CLASS_NAME",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.s}});Object.defineProperty(exports,"STORAGE_KEY",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.q}});Object.defineProperty(exports,"createBlurCircleAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.p}});Object.defineProperty(exports,"createBlurCircleMask",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.b}});Object.defineProperty(exports,"createCircleAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.n}});Object.defineProperty(exports,"createClipPathAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.j}});Object.defineProperty(exports,"createPolygonGradientAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.k}});Object.defineProperty(exports,"createSlideAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.o}});Object.defineProperty(exports,"createSvgLogoAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.m}});Object.defineProperty(exports,"createTriangleAnimation",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.l}});Object.defineProperty(exports,"getAnimationPosition",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.i}});Object.defineProperty(exports,"getSlideFromCoords",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.h}});Object.defineProperty(exports,"getSystemTheme",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.c}});Object.defineProperty(exports,"injectBaseStyles",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.a}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.g}});Object.defineProperty(exports,"resolveTheme",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.d}});Object.defineProperty(exports,"supportsViewTransitions",{enumerable:true,get:function(){return chunkW4YFUPGE_cjs.f}});
1
+ 'use strict';var chunkKQSBORXP_cjs=require('../chunk-KQSBORXP.cjs'),chunkI5GA5T23_cjs=require('../chunk-I5GA5T23.cjs'),chunkCYGYUQUK_cjs=require('../chunk-CYGYUQUK.cjs');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,"createThemeController",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.j}});Object.defineProperty(exports,"getStoredColorTheme",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.h}});Object.defineProperty(exports,"getStoredTheme",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.f}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.d}});Object.defineProperty(exports,"runThemeTransition",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.e}});Object.defineProperty(exports,"setStoredColorTheme",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.i}});Object.defineProperty(exports,"setStoredTheme",{enumerable:true,get:function(){return chunkKQSBORXP_cjs.g}});Object.defineProperty(exports,"createBlurCircleAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.p}});Object.defineProperty(exports,"createBlurCircleMask",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.b}});Object.defineProperty(exports,"createCircleAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.n}});Object.defineProperty(exports,"createClipPathAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.j}});Object.defineProperty(exports,"createPolygonGradientAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.k}});Object.defineProperty(exports,"createSlideAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.o}});Object.defineProperty(exports,"createSvgLogoAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.m}});Object.defineProperty(exports,"createTriangleAnimation",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.l}});Object.defineProperty(exports,"getAnimationPosition",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.i}});Object.defineProperty(exports,"getSlideFromCoords",{enumerable:true,get:function(){return chunkI5GA5T23_cjs.h}});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,"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}});
@@ -1,9 +1,11 @@
1
- import { A as AnimationConfig, C as ColorTheme, T as Theme } from '../constants-DmZ7yAIL.cjs';
2
- export { a as AnimationPosition, b as COLOR_STORAGE_KEY, c as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, d as DEFAULT_DURATION, e as DEFAULT_EASING, f as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, g as SlideDirection, h as TRANSITION_DIRECTIONS, i as ThemeAnimationOptions, j as ThemeAnimationType, k as ThemeConfig, l as ThemeLogoOptions, m as ThemeState, n as TransitionDirection, o as createBlurCircleAnimation, p as createBlurCircleMask, q as createCircleAnimation, r as createClipPathAnimation, s as createPolygonGradientAnimation, t as createSlideAnimation, u as createSvgLogoAnimation, v as createTriangleAnimation, w as getAnimationPosition, x as getSlideFromCoords, y as getSystemTheme, z as injectBaseStyles, B as prefersReducedMotion, E as resolveTheme, F as supportsViewTransitions } from '../constants-DmZ7yAIL.cjs';
1
+ import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-CrR56NLm.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-CrR56NLm.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-9M8X-rnX.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-83zmHd-p.cjs';
3
5
  export { p as preloadThemeLogo } from '../logo-DtwtRv4y.cjs';
4
6
 
5
7
  /** Latest request wins visually; every requested state update still runs once. */
6
- declare const runThemeTransition: (update: () => void, config: AnimationConfig | null) => Promise<void>;
8
+ declare const runThemeTransition: (update: () => void | Promise<void>, config: AnimationConfig | null) => Promise<void>;
7
9
 
8
10
  /**
9
11
  * Gets the stored theme from localStorage
@@ -12,7 +14,7 @@ declare const runThemeTransition: (update: () => void, config: AnimationConfig |
12
14
  * @param defaultTheme - Default theme if stored value is invalid
13
15
  * @returns The stored theme or default
14
16
  */
15
- declare const getStoredTheme: (key?: string, validThemes?: Theme[], defaultTheme?: Theme) => Theme;
17
+ declare const getStoredTheme: (key?: string, validThemes?: readonly Theme[], defaultTheme?: Theme) => Theme;
16
18
  /**
17
19
  * Stores theme in localStorage
18
20
  * @param theme - Theme to store
@@ -26,7 +28,7 @@ declare const setStoredTheme: (theme: Theme, key?: string) => void;
26
28
  * @param defaultColorTheme - Default color theme if stored value is invalid
27
29
  * @returns The stored color theme or default
28
30
  */
29
- declare const getStoredColorTheme: (key?: string, validColorThemes?: ColorTheme[], defaultColorTheme?: ColorTheme) => ColorTheme;
31
+ declare const getStoredColorTheme: (key?: string, validColorThemes?: readonly ColorTheme[], defaultColorTheme?: ColorTheme) => ColorTheme;
30
32
  /**
31
33
  * Stores color theme in localStorage
32
34
  * @param colorTheme - Color theme to store
@@ -1,9 +1,11 @@
1
- import { A as AnimationConfig, C as ColorTheme, T as Theme } from '../constants-DmZ7yAIL.js';
2
- export { a as AnimationPosition, b as COLOR_STORAGE_KEY, c as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, d as DEFAULT_DURATION, e as DEFAULT_EASING, f as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, g as SlideDirection, h as TRANSITION_DIRECTIONS, i as ThemeAnimationOptions, j as ThemeAnimationType, k as ThemeConfig, l as ThemeLogoOptions, m as ThemeState, n as TransitionDirection, o as createBlurCircleAnimation, p as createBlurCircleMask, q as createCircleAnimation, r as createClipPathAnimation, s as createPolygonGradientAnimation, t as createSlideAnimation, u as createSvgLogoAnimation, v as createTriangleAnimation, w as getAnimationPosition, x as getSlideFromCoords, y as getSystemTheme, z as injectBaseStyles, B as prefersReducedMotion, E as resolveTheme, F as supportsViewTransitions } from '../constants-DmZ7yAIL.js';
1
+ import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-CrR56NLm.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-CrR56NLm.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-PAa1nGZ0.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-DnMwV2nl.js';
3
5
  export { p as preloadThemeLogo } from '../logo-DtwtRv4y.js';
4
6
 
5
7
  /** Latest request wins visually; every requested state update still runs once. */
6
- declare const runThemeTransition: (update: () => void, config: AnimationConfig | null) => Promise<void>;
8
+ declare const runThemeTransition: (update: () => void | Promise<void>, config: AnimationConfig | null) => Promise<void>;
7
9
 
8
10
  /**
9
11
  * Gets the stored theme from localStorage
@@ -12,7 +14,7 @@ declare const runThemeTransition: (update: () => void, config: AnimationConfig |
12
14
  * @param defaultTheme - Default theme if stored value is invalid
13
15
  * @returns The stored theme or default
14
16
  */
15
- declare const getStoredTheme: (key?: string, validThemes?: Theme[], defaultTheme?: Theme) => Theme;
17
+ declare const getStoredTheme: (key?: string, validThemes?: readonly Theme[], defaultTheme?: Theme) => Theme;
16
18
  /**
17
19
  * Stores theme in localStorage
18
20
  * @param theme - Theme to store
@@ -26,7 +28,7 @@ declare const setStoredTheme: (theme: Theme, key?: string) => void;
26
28
  * @param defaultColorTheme - Default color theme if stored value is invalid
27
29
  * @returns The stored color theme or default
28
30
  */
29
- declare const getStoredColorTheme: (key?: string, validColorThemes?: ColorTheme[], defaultColorTheme?: ColorTheme) => ColorTheme;
31
+ declare const getStoredColorTheme: (key?: string, validColorThemes?: readonly ColorTheme[], defaultColorTheme?: ColorTheme) => ColorTheme;
30
32
  /**
31
33
  * Stores color theme in localStorage
32
34
  * @param colorTheme - Color theme to store
@@ -1 +1 @@
1
- export{b as TRANSITION_DIRECTIONS,a as ThemeAnimationType,h as getStoredColorTheme,f as getStoredTheme,d as preloadThemeLogo,e as runThemeTransition,i as setStoredColorTheme,g as setStoredTheme}from'../chunk-DFJEYTIW.js';export{r as COLOR_STORAGE_KEY,t as COLOR_THEME_PREFIX,w as DEFAULT_BLUR_AMOUNT,u as DEFAULT_DURATION,v as DEFAULT_EASING,x as DEFAULT_STYLE_ID,s as GLOBAL_CLASS_NAME,q as STORAGE_KEY,p as createBlurCircleAnimation,b as createBlurCircleMask,n as createCircleAnimation,j as createClipPathAnimation,k as createPolygonGradientAnimation,o as createSlideAnimation,m as createSvgLogoAnimation,l as createTriangleAnimation,i as getAnimationPosition,h as getSlideFromCoords,c as getSystemTheme,a as injectBaseStyles,g as prefersReducedMotion,d as resolveTheme,f as supportsViewTransitions}from'../chunk-WFG34KG5.js';
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-EKVKQZNN.js';export{p as createBlurCircleAnimation,b as createBlurCircleMask,n as createCircleAnimation,j as createClipPathAnimation,k as createPolygonGradientAnimation,o as createSlideAnimation,m as createSvgLogoAnimation,l as createTriangleAnimation,i as getAnimationPosition,h as getSlideFromCoords,c as getSystemTheme,a as injectBaseStyles,g as prefersReducedMotion,d as resolveTheme,f as supportsViewTransitions}from'../chunk-CY5E6WU4.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';
@@ -0,0 +1,106 @@
1
+ import React, { RefObject, ReactNode } from 'react';
2
+ import { c as Theme, C as ColorTheme, T as ThemeAnimationOptions, a as ThemeAnimationType } from './types-CrR56NLm.js';
3
+ import { d as ThemeControllerSnapshot, f as ThemeTransitionInput, C as ColorThemeToggle, c as ThemeControllerOptions } from './controller-DnMwV2nl.js';
4
+
5
+ type UseThemeProps = ThemeControllerOptions;
6
+ interface UseThemeReturn extends ThemeControllerSnapshot {
7
+ /** Ref to attach to the trigger button */
8
+ ref: RefObject<HTMLButtonElement | null>;
9
+ /** Current theme value */
10
+ theme: Theme;
11
+ /** Current color theme value */
12
+ colorTheme: ColorTheme;
13
+ /** Resolved theme (light or dark) */
14
+ resolvedTheme: 'light' | 'dark';
15
+ /** Set theme without animation */
16
+ setTheme: (theme: Theme) => void;
17
+ /** Set color theme without animation */
18
+ setColorTheme: (colorTheme: ColorTheme) => void;
19
+ /** Switch theme with animation */
20
+ switchTheme: (theme: Theme, options?: ThemeTransitionInput) => Promise<void>;
21
+ /** Switch color theme with animation */
22
+ switchColorTheme: (colorTheme: string, options?: ThemeTransitionInput) => Promise<void>;
23
+ /** Toggle between light and dark */
24
+ toggleTheme: (options?: ThemeTransitionInput) => Promise<void>;
25
+ /** Switch to light theme with animation */
26
+ toggleLightTheme: (options?: ThemeTransitionInput) => Promise<void>;
27
+ /** Switch to dark theme with animation */
28
+ toggleDarkTheme: (options?: ThemeTransitionInput) => Promise<void>;
29
+ /** Cycle through color themes */
30
+ toggleColorTheme: ColorThemeToggle;
31
+ /** Create a toggle function for a specific color theme */
32
+ createColorThemeToggle: (targetColorTheme: string) => ColorThemeToggle;
33
+ /** Check if a color theme is active */
34
+ isColorThemeActive: (targetColorTheme: string) => boolean;
35
+ }
36
+
37
+ /**
38
+ * Context type for the Next.js UI Theme Provider
39
+ */
40
+ interface NextUIThemeContextType extends UseThemeReturn {
41
+ /** System theme preference */
42
+ systemTheme: 'light' | 'dark';
43
+ /** Legacy convenience wrapper; does not mutate the shared ref. */
44
+ switchThemeFromElement: (theme: Theme, element: Element) => Promise<void>;
45
+ }
46
+ /**
47
+ * Props for the Next.js UI Theme Provider
48
+ */
49
+ type NextUIThemeProviderProps = ThemeAnimationOptions & {
50
+ /** React children to wrap with theme context */
51
+ children: ReactNode;
52
+ /** Available theme options */
53
+ themes?: readonly Theme[];
54
+ /** Available color theme options */
55
+ colorThemes?: readonly ColorTheme[];
56
+ /** Default theme to use */
57
+ defaultTheme?: Theme;
58
+ /** Default color theme to use */
59
+ defaultColorTheme?: ColorTheme;
60
+ /** Animation type for theme transitions */
61
+ animationType?: ThemeAnimationType | `${ThemeAnimationType}`;
62
+ /** Animation duration in milliseconds */
63
+ duration?: number;
64
+ /** Storage key for theme preference */
65
+ storageKey?: string;
66
+ /** Storage key for color theme preference */
67
+ colorStorageKey?: string;
68
+ /** HTML attribute to use for theme ('class' or 'data-theme') */
69
+ attribute?: 'class' | 'data-theme';
70
+ /** Class name for dark theme (when using 'class' attribute) */
71
+ globalClassName?: string;
72
+ /** Prefix for color theme classes */
73
+ colorThemePrefix?: string;
74
+ /** CSP nonce for inline script (SSR apps) */
75
+ nonce?: string;
76
+ /** Skip animation during initial hydration */
77
+ disableAnimationOnInit?: boolean;
78
+ /** Disable flash prevention script (for SPAs without SSR) */
79
+ disablePreHydrationScript?: boolean;
80
+ };
81
+ /**
82
+ * Next.js UI Theme Provider - Universal React theme management with animations
83
+ *
84
+ * This provider works with Next.js and provides flash prevention
85
+ * via pre-hydration script injection.
86
+ *
87
+ * Features:
88
+ * - Pre-hydration script for flash prevention (SSR apps)
89
+ * - Animated theme transitions via View Transitions API
90
+ * - Multi-dimensional theming (theme + colorTheme)
91
+ * - System theme detection
92
+ * - CSP support via nonce prop
93
+ *
94
+ * @param props - Provider configuration options
95
+ */
96
+ declare const NextUIThemeProvider: React.FC<NextUIThemeProviderProps>;
97
+ /**
98
+ * Hook to consume the Next.js UI Theme context
99
+ *
100
+ * @returns Theme context value with all theme state and methods
101
+ * @throws Error if used outside of NextUIThemeProvider
102
+ */
103
+ declare const useNextUITheme: () => NextUIThemeContextType;
104
+
105
+ export { NextUIThemeProvider as b, useNextUITheme as u };
106
+ export type { NextUIThemeContextType as N, UseThemeProps as U, UseThemeReturn as a, NextUIThemeProviderProps as c };