nextjs-themes
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -5,2 +5,3 @@ import { ColorSchemeType } from "../../types"; | ||
colorScheme: ColorSchemeType; | ||
targetSelector?: string; | ||
}) => null; |
"use client"; | ||
"use strict";var s=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)s(e,r,{get:o[r],enumerable:!0})},l=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of h(o))!f.call(e,c)&&c!==r&&s(e,c,{get:()=>o[c],enumerable:!(t=S(o,c))||t.enumerable});return e};var u=e=>l(s({},"__esModule",{value:!0}),e);var x={};y(x,{ForceColorScheme:()=>d});module.exports=u(x);var i=require("react");var p=require("r18gs");var n="nth";var T=e=>{let o=`${e!=null?e:`#${n}`}-`;return(0,p.useRGS)(o,{})};var d=e=>{let[o,r]=T();return(0,i.useEffect)(()=>(r(t=>({...t,fc:e.colorScheme})),()=>{r(t=>({...t,fc:void 0}))}),[e.colorScheme]),null};0&&(module.exports={ForceColorScheme}); | ||
"use strict";var n=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var l=(e,o)=>{for(var r in o)n(e,r,{get:o[r],enumerable:!0})},y=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of h(o))!f.call(e,c)&&c!==r&&n(e,c,{get:()=>o[c],enumerable:!(t=T(o,c))||t.enumerable});return e};var u=e=>y(n({},"__esModule",{value:!0}),e);var x={};l(x,{ForceColorScheme:()=>d});module.exports=u(x);var S=require("react");var p=require("r18gs");var s="nth";var i=e=>{let o=`${e!=null?e:`#${s}`}-`;return(0,p.useRGS)(o,{})};var d=e=>{let[o,r]=i(e.targetSelector);return(0,S.useEffect)(()=>(r(t=>({...t,fc:e.colorScheme})),()=>{r(t=>({...t,fc:void 0}))}),[e.colorScheme]),null};0&&(module.exports={ForceColorScheme}); |
"use client"; | ||
"use strict";var s=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)s(e,r,{get:o[r],enumerable:!0})},l=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of f(o))!h.call(e,c)&&c!==r&&s(e,c,{get:()=>o[c],enumerable:!(t=S(o,c))||t.enumerable});return e};var u=e=>l(s({},"__esModule",{value:!0}),e);var x={};y(x,{ForceColorScheme:()=>d});module.exports=u(x);var T=require("react");var p=require("r18gs");var n="nth";var i=e=>{let o=`${e!=null?e:`#${n}`}-`;return(0,p.useRGS)(o,{})};var d=e=>{let[o,r]=i();return(0,T.useEffect)(()=>(r(t=>({...t,fc:e.colorScheme})),()=>{r(t=>({...t,fc:void 0}))}),[e.colorScheme]),null};0&&(module.exports={ForceColorScheme}); | ||
"use strict";var n=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(e,o)=>{for(var r in o)n(e,r,{get:o[r],enumerable:!0})},y=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of f(o))!h.call(e,c)&&c!==r&&n(e,c,{get:()=>o[c],enumerable:!(t=T(o,c))||t.enumerable});return e};var u=e=>y(n({},"__esModule",{value:!0}),e);var x={};l(x,{ForceColorScheme:()=>d});module.exports=u(x);var S=require("react");var p=require("r18gs");var s="nth";var i=e=>{let o=`${e!=null?e:`#${s}`}-`;return(0,p.useRGS)(o,{})};var d=e=>{let[o,r]=i(e.targetSelector);return(0,S.useEffect)(()=>(r(t=>({...t,fc:e.colorScheme})),()=>{r(t=>({...t,fc:void 0}))}),[e.colorScheme]),null};0&&(module.exports={ForceColorScheme}); |
/** Force theme on a page */ | ||
export declare const ForceTheme: (props: { | ||
theme: string; | ||
targetSelector?: string; | ||
}) => null; |
"use client"; | ||
"use strict";var n=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},S=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of h(o))!u.call(e,s)&&s!==t&&n(e,s,{get:()=>o[s],enumerable:!(r=f(o,s))||r.enumerable});return e};var d=e=>S(n({},"__esModule",{value:!0}),e);var l={};y(l,{ForceTheme:()=>x});module.exports=d(l);var T=require("react");var c=require("r18gs");var p="nth";var i=e=>{let o=`${e!=null?e:`#${p}`}-`;return(0,c.useRGS)(o,{})};var x=e=>{let[o,t]=i();return(0,T.useEffect)(()=>(t(r=>({...r,f:e.theme})),()=>{t(r=>({...r,f:void 0}))}),[e.theme]),null};0&&(module.exports={ForceTheme}); | ||
"use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},y=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!S.call(e,n)&&n!==o&&s(e,n,{get:()=>t[n],enumerable:!(r=f(t,n))||r.enumerable});return e};var d=e=>y(s({},"__esModule",{value:!0}),e);var x={};u(x,{ForceTheme:()=>l});module.exports=d(x);var T=require("react");var p=require("r18gs");var c="nth";var i=e=>{let t=`${e!=null?e:`#${c}`}-`;return(0,p.useRGS)(t,{})};var l=e=>{let[t,o]=i(e.targetSelector);return(0,T.useEffect)(()=>(o(r=>({...r,f:e.theme})),()=>{o(r=>({...r,f:void 0}))}),[e.theme]),null};0&&(module.exports={ForceTheme}); |
"use client"; | ||
"use strict";var n=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},S=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of h(o))!u.call(e,s)&&s!==t&&n(e,s,{get:()=>o[s],enumerable:!(r=f(o,s))||r.enumerable});return e};var d=e=>S(n({},"__esModule",{value:!0}),e);var l={};y(l,{ForceTheme:()=>x});module.exports=d(l);var T=require("react");var c=require("r18gs");var p="nth";var i=e=>{let o=`${e!=null?e:`#${p}`}-`;return(0,c.useRGS)(o,{})};var x=e=>{let[o,t]=i();return(0,T.useEffect)(()=>(t(r=>({...r,f:e.theme})),()=>{t(r=>({...r,f:void 0}))}),[e.theme]),null};0&&(module.exports={ForceTheme}); | ||
"use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},y=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!S.call(e,n)&&n!==o&&s(e,n,{get:()=>t[n],enumerable:!(r=f(t,n))||r.enumerable});return e};var d=e=>y(s({},"__esModule",{value:!0}),e);var x={};u(x,{ForceTheme:()=>l});module.exports=d(x);var T=require("react");var p=require("r18gs");var c="nth";var i=e=>{let t=`${e!=null?e:`#${c}`}-`;return(0,p.useRGS)(t,{})};var l=e=>{let[t,o]=i(e.targetSelector);return(0,T.useEffect)(()=>(o(r=>({...r,f:e.theme})),()=>{o(r=>({...r,f:void 0}))}),[e.theme]),null};0&&(module.exports={ForceTheme}); |
"use client"; | ||
"use strict";var O=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var j=(t,e)=>{for(var s in e)O(t,s,{get:e[s],enumerable:!0})},B=(t,e,s,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z(e))!Q.call(t,n)&&n!==s&&O(t,n,{get:()=>e[n],enumerable:!(d=q(e,n))||d.enumerable});return t};var W=t=>B(O({},"__esModule",{value:!0}),t);var re={};j(re,{ColorSwitch:()=>oe,ThemeSwitcher:()=>te});module.exports=W(re);var k=require("react");var $=(t,e,s,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let c=["color-scheme","csp","theme","th"];window.u=h=>{var b;let a=(b=document.querySelector(t))!=null?b:document.documentElement,T=[];c.forEach((v,w)=>{T.push(`${v}-${h[w]}`),a.setAttribute(`data-${v}`,h[w])}),T[0]=h[0],s&&(T=T.map(v=>{var w;return(w=s[v])!=null?w:v})),a.className=T.join(" ")};let l=localStorage.getItem(t),i={...l?JSON.parse(l):e,s:m.matches?e.d:e.l},o,p,P,R;window.f=(h,a)=>{p=R=h,o=P=a},window.g=(h,a)=>{p=R!=null?R:h,o=P!=null?P:a},f(d,n),window.r=h=>{let a=o!=null?o:h.c,T=a===e.c?h.s:a,b=T===""?h.t:T===e.d?h.d:h.l,v=p!=null?p:b;return[T||h.s,a,v,p!=null?p:h.t]},u(r(i))};var I=require("r18gs");var F="nth",S="light",C="dark",x="system";var U={t:"",d:C,l:S,c:x,s:S},D=t=>{let e=t!=null?t:`#${F}`;return(0,I.useRGS)(e,()=>{let s=typeof m!="undefined"&&localStorage.getItem(e);return s?{...JSON.parse(s),s:m.matches?C:S}:U})},L=t=>{let e=`${t!=null?t:`#${F}`}-`;return(0,I.useRGS)(e,{})};var y=require("react/jsx-runtime"),A,M,E,N,V,X=({targetSelector:t,nonce:e,styles:s,forcedTheme:d,forcedColorScheme:n})=>{let c=t||`#${F}`;return typeof window!="undefined"&&!window.m&&$(c,U,s,d,n),typeof m!="undefined"&&([A,M,E,N,V]=[m,u,r,f,g]),(0,y.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${$})(${JSON.stringify([c,U,s,d,n]).slice(1,-1)})`},nonce:e})},Z=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},ee=({forcedTheme:t,forcedColorScheme:e,targetSelector:s,themeTransition:d})=>{let n=s||`#${F}`,[c,l]=D(s),[i]=L(s);return(0,k.useEffect)(()=>{A.addEventListener("change",()=>l(o=>({...o,s:A.matches?C:S}))),addEventListener("storage",o=>{o.key===n&&l(p=>({...p,...JSON.parse(o.newValue||"{}")}))})},[]),(0,k.useEffect)(()=>{let o=Z(d);M(E(c)),o(),localStorage.setItem(n,JSON.stringify(c))},[c]),(0,k.useEffect)(()=>{N(t,e),M(E(c))},[e,t]),(0,k.useEffect)(()=>{V(i.f,i.fc),M(E(c))},[i]),null},te=t=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(X,{...t}),(0,y.jsx)(ee,{...t})]});var Y={s:"nth-s",a:"nth-a"};var H=[x,C,S],J,K=t=>{let[e,s]=D(t),[d,n]=L(t);(0,k.useEffect)(()=>{J=window.r},[]);let c=i=>o=>s(p=>({...p,[i]:o})),l={theme:e.t,darkTheme:e.d,lightTheme:e.l,colorSchemePref:e.c,systemColorScheme:e.s,resolvedColorScheme:e.c===x||e.c===""?e.s:e.c,resolvedTheme:e.t,setTheme:c("t"),setDarkTheme:c("d"),setLightTheme:c("l"),setThemeSet:({darkTheme:i,lightTheme:o})=>s(p=>({...p,d:i,l:o})),setColorSchemePref:c("c"),toggleColorScheme(i){let o=H.indexOf(e.c),p=H.length;(o===-1||i&&o===p-1)&&(o=0),c("c")(H[(o+1)%p])},setForcedColorScheme:i=>n(o=>({...o,fc:i})),setForcedTheme:i=>n(o=>({...o,f:i}))};if(J){let i=J(e);l.resolvedColorScheme=i[0],l.resolvedTheme=i[1]}return l};var oe=({size:t=25,skipSystem:e,targetSelector:s,className:d,...n})=>{let{toggleColorScheme:c}=K(s),l=[Y.s,d].join(" ");return(0,y.jsx)("button",{className:l,onClick:()=>c(e),style:{"--s":`${t}px`},...n})};0&&(module.exports={ColorSwitch,ThemeSwitcher}); | ||
"use strict";var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var s in e)$(t,s,{get:e[s],enumerable:!0})},W=(t,e,s,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!j.call(t,n)&&n!==s&&$(t,n,{get:()=>e[n],enumerable:!(d=z(e,n))||d.enumerable});return t};var X=t=>W($({},"__esModule",{value:!0}),t);var se={};B(se,{ColorSwitch:()=>re,ThemeSwitcher:()=>oe});module.exports=X(se);var P=require("react");var I=(t,e,s,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let c=["color-scheme","csp","theme","th"];window.u=(h,a)=>{var U;let C=(U=document.querySelector(a))!=null?U:document.documentElement,y=[];c.forEach((w,x)=>{y.push(`${w}-${h[x]}`),C.setAttribute(`data-${w}`,h[x])}),y[0]=h[0],s&&(y=y.map(w=>{var x;return(x=s[w])!=null?x:w})),C.className=y.join(" ")};let l=localStorage.getItem(t),i={...l?JSON.parse(l):e,s:m.matches?e.d:e.l},o,p,R,b;window.f=(h,a)=>{p=b=h,o=R=a},window.g=(h,a)=>{p=b!=null?b:h,o=R!=null?R:a},f(d,n),window.r=h=>{let a=o!=null?o:h.c,C=a===e.c?h.s:a,y=C===""?h.t:C===e.d?h.d:h.l,U=p!=null?p:y;return[C||h.s,a,U,p!=null?p:h.t]},u(r(i),t)};var A=require("r18gs");var F="nth",T="light",v="dark",k="system";var D={t:"",d:v,l:T,c:k,s:T},L=t=>{let e=t!=null?t:`#${F}`;return(0,A.useRGS)(e,()=>{let s=typeof m!="undefined"&&localStorage.getItem(e);return s?{...JSON.parse(s),s:m.matches?v:T}:D})},M=t=>{let e=`${t!=null?t:`#${F}`}-`;return(0,A.useRGS)(e,{})};var S=require("react/jsx-runtime"),H,E,O,V,Y,Z=({targetSelector:t,nonce:e,styles:s,forcedTheme:d,forcedColorScheme:n})=>{let c=t||`#${F}`;return typeof window!="undefined"&&!window.m&&I(c,D,s,d,n),typeof m!="undefined"&&([H,E,O,V,Y]=[m,u,r,f,g]),(0,S.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${I})(${JSON.stringify([c,D,s,d,n]).slice(1,-1)})`},nonce:e})},ee=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},te=({forcedTheme:t,forcedColorScheme:e,targetSelector:s,themeTransition:d})=>{let n=s||`#${F}`,[c,l]=L(s),[i]=M(s);return(0,P.useEffect)(()=>{H.addEventListener("change",()=>l(o=>({...o,s:H.matches?v:T}))),addEventListener("storage",o=>{o.key===n&&l(p=>({...p,...JSON.parse(o.newValue||"{}")}))})},[]),(0,P.useEffect)(()=>{let o=ee(d);E(O(c),n),o(),localStorage.setItem(n,JSON.stringify(c))},[c]),(0,P.useEffect)(()=>{V(t,e),E(O(c),n)},[e,t]),(0,P.useEffect)(()=>{Y(i.f,i.fc),E(O(c),n)},[i]),null},oe=t=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z,{...t}),(0,S.jsx)(te,{...t})]});var G={s:"nth-s",a:"nth-a"};var J=[k,v,T],N,_=t=>{let[e,s]=L(t),[d,n]=M(t);(0,P.useEffect)(()=>{N=window.r},[]);let c=i=>o=>s(p=>({...p,[i]:o})),l={theme:e.t,darkTheme:e.d,lightTheme:e.l,colorSchemePref:e.c,systemColorScheme:e.s,resolvedColorScheme:e.c===k||e.c===""?e.s:e.c,resolvedTheme:e.t,setTheme:c("t"),setDarkTheme:c("d"),setLightTheme:c("l"),setThemeSet:({darkTheme:i,lightTheme:o})=>s(p=>({...p,d:i,l:o})),setColorSchemePref:c("c"),toggleColorScheme(i){let o=J.indexOf(e.c),p=J.length;(o===-1||i&&o===p-1)&&(o=0),c("c")(J[(o+1)%p])},setForcedColorScheme:i=>n(o=>({...o,fc:i})),setForcedTheme:i=>n(o=>({...o,f:i}))};if(N){let i=N(e);l.resolvedColorScheme=i[0],l.resolvedTheme=i[1]}return l};var re=({size:t=25,skipSystem:e,targetSelector:s,className:d,...n})=>{let{toggleColorScheme:c}=_(s),l=[G.s,d].join(" ");return(0,S.jsx)("button",{className:l,onClick:()=>c(e),style:{"--s":`${t}px`},...n})};0&&(module.exports={ColorSwitch,ThemeSwitcher}); |
"use client"; | ||
"use strict";var L=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var o in e)L(t,o,{get:e[o],enumerable:!0})},_=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of H(e))!b.call(t,s)&&s!==o&&L(t,s,{get:()=>e[s],enumerable:!(a=G(e,s))||a.enumerable});return t};var q=t=>_(L({},"__esModule",{value:!0}),t);var B={};K(B,{ThemeSwitcher:()=>z});module.exports=q(B);var x=require("react");var M=(t,e,o,a,s)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let p=["color-scheme","csp","theme","th"];window.u=n=>{var R;let d=(R=document.querySelector(t))!=null?R:document.documentElement,l=[];p.forEach((T,v)=>{l.push(`${T}-${n[v]}`),d.setAttribute(`data-${T}`,n[v])}),l[0]=n[0],o&&(l=l.map(T=>{var v;return(v=o[T])!=null?v:T})),d.className=l.join(" ")};let F=localStorage.getItem(t),w={...F?JSON.parse(F):e,s:m.matches?e.d:e.l},c,i,U,D;window.f=(n,d)=>{i=D=n,c=U=d},window.g=(n,d)=>{i=D!=null?D:n,c=U!=null?U:d},f(a,s),window.r=n=>{let d=c!=null?c:n.c,l=d===e.c?n.s:d,R=l===""?n.t:l===e.d?n.d:n.l,T=i!=null?i:R;return[l||n.s,d,T,i!=null?i:n.t]},u(r(w))};var $=require("r18gs");var y="nth",S="light",C="dark",k="system";var O={t:"",d:C,l:S,c:k,s:S},A=t=>{let e=t!=null?t:`#${y}`;return(0,$.useRGS)(e,()=>{let o=typeof m!="undefined"&&localStorage.getItem(e);return o?{...JSON.parse(o),s:m.matches?C:S}:O})},J=t=>{let e=`${t!=null?t:`#${y}`}-`;return(0,$.useRGS)(e,{})};var h=require("react/jsx-runtime"),I,P,E,N,V,Q=({targetSelector:t,nonce:e,styles:o,forcedTheme:a,forcedColorScheme:s})=>{let p=t||`#${y}`;return typeof window!="undefined"&&!window.m&&M(p,O,o,a,s),typeof m!="undefined"&&([I,P,E,N,V]=[m,u,r,f,g]),(0,h.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${M})(${JSON.stringify([p,O,o,a,s]).slice(1,-1)})`},nonce:e})},Y=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},j=({forcedTheme:t,forcedColorScheme:e,targetSelector:o,themeTransition:a})=>{let s=o||`#${y}`,[p,F]=A(o),[w]=J(o);return(0,x.useEffect)(()=>{I.addEventListener("change",()=>F(c=>({...c,s:I.matches?C:S}))),addEventListener("storage",c=>{c.key===s&&F(i=>({...i,...JSON.parse(c.newValue||"{}")}))})},[]),(0,x.useEffect)(()=>{let c=Y(a);P(E(p)),c(),localStorage.setItem(s,JSON.stringify(p))},[p]),(0,x.useEffect)(()=>{N(t,e),P(E(p))},[e,t]),(0,x.useEffect)(()=>{V(w.f,w.fc),P(E(p))},[w]),null},z=t=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Q,{...t}),(0,h.jsx)(j,{...t})]});0&&(module.exports={ThemeSwitcher}); | ||
"use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var _=(t,e)=>{for(var o in e)M(t,o,{get:e[o],enumerable:!0})},q=(t,e,o,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!K.call(t,n)&&n!==o&&M(t,n,{get:()=>e[n],enumerable:!(d=H(e,n))||d.enumerable});return t};var Q=t=>q(M({},"__esModule",{value:!0}),t);var W={};_(W,{ThemeSwitcher:()=>B});module.exports=Q(W);var U=require("react");var $=(t,e,o,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let p=["color-scheme","csp","theme","th"];window.u=(s,a)=>{var O;let T=(O=document.querySelector(a))!=null?O:document.documentElement,h=[];p.forEach((v,C)=>{h.push(`${v}-${s[C]}`),T.setAttribute(`data-${v}`,s[C])}),h[0]=s[0],o&&(h=h.map(v=>{var C;return(C=o[v])!=null?C:v})),T.className=h.join(" ")};let F=localStorage.getItem(t),w={...F?JSON.parse(F):e,s:m.matches?e.d:e.l},c,i,D,R;window.f=(s,a)=>{i=R=s,c=D=a},window.g=(s,a)=>{i=R!=null?R:s,c=D!=null?D:a},f(d,n),window.r=s=>{let a=c!=null?c:s.c,T=a===e.c?s.s:a,h=T===""?s.t:T===e.d?s.d:s.l,O=i!=null?i:h;return[T||s.s,a,O,i!=null?i:s.t]},u(r(w),t)};var I=require("r18gs");var y="nth",S="light",x="dark",A="system";var P={t:"",d:x,l:S,c:A,s:S},J=t=>{let e=t!=null?t:`#${y}`;return(0,I.useRGS)(e,()=>{let o=typeof m!="undefined"&&localStorage.getItem(e);return o?{...JSON.parse(o),s:m.matches?x:S}:P})},N=t=>{let e=`${t!=null?t:`#${y}`}-`;return(0,I.useRGS)(e,{})};var l=require("react/jsx-runtime"),k,E,L,V,G,Y=({targetSelector:t,nonce:e,styles:o,forcedTheme:d,forcedColorScheme:n})=>{let p=t||`#${y}`;return typeof window!="undefined"&&!window.m&&$(p,P,o,d,n),typeof m!="undefined"&&([k,E,L,V,G]=[m,u,r,f,g]),(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${$})(${JSON.stringify([p,P,o,d,n]).slice(1,-1)})`},nonce:e})},j=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},z=({forcedTheme:t,forcedColorScheme:e,targetSelector:o,themeTransition:d})=>{let n=o||`#${y}`,[p,F]=J(o),[w]=N(o);return(0,U.useEffect)(()=>{k.addEventListener("change",()=>F(c=>({...c,s:k.matches?x:S}))),addEventListener("storage",c=>{c.key===n&&F(i=>({...i,...JSON.parse(c.newValue||"{}")}))})},[]),(0,U.useEffect)(()=>{let c=j(d);E(L(p),n),c(),localStorage.setItem(n,JSON.stringify(p))},[p]),(0,U.useEffect)(()=>{V(t,e),E(L(p),n)},[e,t]),(0,U.useEffect)(()=>{G(w.f,w.fc),E(L(p),n)},[w]),null},B=t=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Y,{...t}),(0,l.jsx)(z,{...t})]});0&&(module.exports={ThemeSwitcher}); |
import type { ThemeStoreType } from "../../store"; | ||
import type { ColorSchemeType, ResolvedColorSchemeType } from "../../types"; | ||
type ValuesType = [ResolvedColorSchemeType, ColorSchemeType, string, string]; | ||
export type UpdateDOMFunc = (values: ValuesType) => void; | ||
export type UpdateDOMFunc = (values: ValuesType, targetSelector: string) => void; | ||
export type ResolveFunc = (store: ThemeStoreType) => ValuesType; | ||
@@ -6,0 +6,0 @@ export type UpdateForcedPropsFunc = (forcedThemeProp?: string, forcedColorSchemeProp?: ColorSchemeType) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";var S=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var n in e)S(t,n,{get:e[n],enumerable:!0})},O=(t,e,n,h)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of U(e))!R.call(t,d)&&d!==n&&S(t,d,{get:()=>e[d],enumerable:!(h=C(e,d))||h.enumerable});return t};var P=t=>O(S({},"__esModule",{value:!0}),t);var x={};M(x,{noFOUCScript:()=>V});module.exports=P(x);var V=(t,e,n,h,d)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let F=["color-scheme","csp","theme","th"];window.u=o=>{var g;let c=(g=document.querySelector(t))!=null?g:document.documentElement,p=[];F.forEach((l,a)=>{p.push(`${l}-${o[a]}`),c.setAttribute(`data-${l}`,o[a])}),p[0]=o[0],n&&(p=p.map(l=>{var a;return(a=n[l])!=null?a:l})),c.className=p.join(" ")};let v=localStorage.getItem(t),w={...v?JSON.parse(v):e,s:m.matches?e.d:e.l},y,s,T,i;window.f=(o,c)=>{s=i=o,y=T=c},window.g=(o,c)=>{s=i!=null?i:o,y=T!=null?T:c},f(h,d),window.r=o=>{let c=y!=null?y:o.c,p=c===e.c?o.s:c,g=p===""?o.t:p===e.d?o.d:o.l,l=s!=null?s:g;return[p||o.s,c,l,s!=null?s:o.t]},u(r(w))};0&&(module.exports={noFOUCScript}); | ||
"use strict";var v=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var O=(t,e)=>{for(var s in e)v(t,s,{get:e[s],enumerable:!0})},P=(t,e,s,T)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of R(e))!M.call(t,n)&&n!==s&&v(t,n,{get:()=>e[n],enumerable:!(T=U(e,n))||T.enumerable});return t};var V=t=>P(v({},"__esModule",{value:!0}),t);var $={};O($,{noFOUCScript:()=>x});module.exports=V($);var x=(t,e,s,T,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let w=["color-scheme","csp","theme","th"];window.u=(o,c)=>{var S;let l=(S=document.querySelector(c))!=null?S:document.documentElement,d=[];w.forEach((y,h)=>{d.push(`${y}-${o[h]}`),l.setAttribute(`data-${y}`,o[h])}),d[0]=o[0],s&&(d=d.map(y=>{var h;return(h=s[y])!=null?h:y})),l.className=d.join(" ")};let F=localStorage.getItem(t),C={...F?JSON.parse(F):e,s:m.matches?e.d:e.l},a,p,i,g;window.f=(o,c)=>{p=g=o,a=i=c},window.g=(o,c)=>{p=g!=null?g:o,a=i!=null?i:c},f(T,n),window.r=o=>{let c=a!=null?a:o.c,l=c===e.c?o.s:c,d=l===""?o.t:l===e.d?o.d:o.l,S=p!=null?p:d;return[l||o.s,c,S,p!=null?p:o.t]},u(r(C),t)};0&&(module.exports={noFOUCScript}); |
@@ -1,1 +0,1 @@ | ||
"use strict";var L=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var o in e)L(t,o,{get:e[o],enumerable:!0})},_=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of H(e))!b.call(t,s)&&s!==o&&L(t,s,{get:()=>e[s],enumerable:!(a=G(e,s))||a.enumerable});return t};var q=t=>_(L({},"__esModule",{value:!0}),t);var B={};K(B,{ThemeSwitcher:()=>z});module.exports=q(B);var U=require("react");var M=(t,e,o,a,s)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let p=["color-scheme","csp","theme","th"];window.u=n=>{var R;let d=(R=document.querySelector(t))!=null?R:document.documentElement,h=[];p.forEach((T,v)=>{h.push(`${T}-${n[v]}`),d.setAttribute(`data-${T}`,n[v])}),h[0]=n[0],o&&(h=h.map(T=>{var v;return(v=o[T])!=null?v:T})),d.className=h.join(" ")};let F=localStorage.getItem(t),w={...F?JSON.parse(F):e,s:m.matches?e.d:e.l},c,i,x,D;window.f=(n,d)=>{i=D=n,c=x=d},window.g=(n,d)=>{i=D!=null?D:n,c=x!=null?x:d},f(a,s),window.r=n=>{let d=c!=null?c:n.c,h=d===e.c?n.s:d,R=h===""?n.t:h===e.d?n.d:n.l,T=i!=null?i:R;return[h||n.s,d,T,i!=null?i:n.t]},u(r(w))};var $=require("r18gs");var y="nth",S="light",C="dark",k="system";var O={t:"",d:C,l:S,c:k,s:S},A=t=>{let e=t!=null?t:`#${y}`;return(0,$.useRGS)(e,()=>{let o=typeof m!="undefined"&&localStorage.getItem(e);return o?{...JSON.parse(o),s:m.matches?C:S}:O})},J=t=>{let e=`${t!=null?t:`#${y}`}-`;return(0,$.useRGS)(e,{})};var l=require("react/jsx-runtime"),I,P,E,N,V,Q=({targetSelector:t,nonce:e,styles:o,forcedTheme:a,forcedColorScheme:s})=>{let p=t||`#${y}`;return typeof window!="undefined"&&!window.m&&M(p,O,o,a,s),typeof m!="undefined"&&([I,P,E,N,V]=[m,u,r,f,g]),(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${M})(${JSON.stringify([p,O,o,a,s]).slice(1,-1)})`},nonce:e})},Y=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},j=({forcedTheme:t,forcedColorScheme:e,targetSelector:o,themeTransition:a})=>{let s=o||`#${y}`,[p,F]=A(o),[w]=J(o);return(0,U.useEffect)(()=>{I.addEventListener("change",()=>F(c=>({...c,s:I.matches?C:S}))),addEventListener("storage",c=>{c.key===s&&F(i=>({...i,...JSON.parse(c.newValue||"{}")}))})},[]),(0,U.useEffect)(()=>{let c=Y(a);P(E(p)),c(),localStorage.setItem(s,JSON.stringify(p))},[p]),(0,U.useEffect)(()=>{N(t,e),P(E(p))},[e,t]),(0,U.useEffect)(()=>{V(w.f,w.fc),P(E(p))},[w]),null},z=t=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Q,{...t}),(0,l.jsx)(j,{...t})]});0&&(module.exports={ThemeSwitcher}); | ||
"use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var _=(t,e)=>{for(var o in e)M(t,o,{get:e[o],enumerable:!0})},q=(t,e,o,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!K.call(t,n)&&n!==o&&M(t,n,{get:()=>e[n],enumerable:!(d=H(e,n))||d.enumerable});return t};var Q=t=>q(M({},"__esModule",{value:!0}),t);var W={};_(W,{ThemeSwitcher:()=>B});module.exports=Q(W);var x=require("react");var $=(t,e,o,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let p=["color-scheme","csp","theme","th"];window.u=(s,a)=>{var O;let T=(O=document.querySelector(a))!=null?O:document.documentElement,h=[];p.forEach((v,C)=>{h.push(`${v}-${s[C]}`),T.setAttribute(`data-${v}`,s[C])}),h[0]=s[0],o&&(h=h.map(v=>{var C;return(C=o[v])!=null?C:v})),T.className=h.join(" ")};let F=localStorage.getItem(t),w={...F?JSON.parse(F):e,s:m.matches?e.d:e.l},c,i,D,R;window.f=(s,a)=>{i=R=s,c=D=a},window.g=(s,a)=>{i=R!=null?R:s,c=D!=null?D:a},f(d,n),window.r=s=>{let a=c!=null?c:s.c,T=a===e.c?s.s:a,h=T===""?s.t:T===e.d?s.d:s.l,O=i!=null?i:h;return[T||s.s,a,O,i!=null?i:s.t]},u(r(w),t)};var I=require("r18gs");var y="nth",S="light",U="dark",A="system";var P={t:"",d:U,l:S,c:A,s:S},J=t=>{let e=t!=null?t:`#${y}`;return(0,I.useRGS)(e,()=>{let o=typeof m!="undefined"&&localStorage.getItem(e);return o?{...JSON.parse(o),s:m.matches?U:S}:P})},N=t=>{let e=`${t!=null?t:`#${y}`}-`;return(0,I.useRGS)(e,{})};var l=require("react/jsx-runtime"),k,E,L,V,G,Y=({targetSelector:t,nonce:e,styles:o,forcedTheme:d,forcedColorScheme:n})=>{let p=t||`#${y}`;return typeof window!="undefined"&&!window.m&&$(p,P,o,d,n),typeof m!="undefined"&&([k,E,L,V,G]=[m,u,r,f,g]),(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${$})(${JSON.stringify([p,P,o,d,n]).slice(1,-1)})`},nonce:e})},j=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},z=({forcedTheme:t,forcedColorScheme:e,targetSelector:o,themeTransition:d})=>{let n=o||`#${y}`,[p,F]=J(o),[w]=N(o);return(0,x.useEffect)(()=>{k.addEventListener("change",()=>F(c=>({...c,s:k.matches?U:S}))),addEventListener("storage",c=>{c.key===n&&F(i=>({...i,...JSON.parse(c.newValue||"{}")}))})},[]),(0,x.useEffect)(()=>{let c=j(d);E(L(p),n),c(),localStorage.setItem(n,JSON.stringify(p))},[p]),(0,x.useEffect)(()=>{V(t,e),E(L(p),n)},[e,t]),(0,x.useEffect)(()=>{G(w.f,w.fc),E(L(p),n)},[w]),null},B=t=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Y,{...t}),(0,l.jsx)(z,{...t})]});0&&(module.exports={ThemeSwitcher}); |
"use client"; | ||
"use strict";var O=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var j=(t,e)=>{for(var s in e)O(t,s,{get:e[s],enumerable:!0})},B=(t,e,s,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z(e))!Q.call(t,n)&&n!==s&&O(t,n,{get:()=>e[n],enumerable:!(d=q(e,n))||d.enumerable});return t};var W=t=>B(O({},"__esModule",{value:!0}),t);var re={};j(re,{ColorSwitch:()=>oe,ThemeSwitcher:()=>te,useTheme:()=>N});module.exports=W(re);var k=require("react");var $=(t,e,s,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let c=["color-scheme","csp","theme","th"];window.u=h=>{var b;let a=(b=document.querySelector(t))!=null?b:document.documentElement,T=[];c.forEach((v,x)=>{T.push(`${v}-${h[x]}`),a.setAttribute(`data-${v}`,h[x])}),T[0]=h[0],s&&(T=T.map(v=>{var x;return(x=s[v])!=null?x:v})),a.className=T.join(" ")};let l=localStorage.getItem(t),i={...l?JSON.parse(l):e,s:m.matches?e.d:e.l},o,p,P,R;window.f=(h,a)=>{p=R=h,o=P=a},window.g=(h,a)=>{p=R!=null?R:h,o=P!=null?P:a},f(d,n),window.r=h=>{let a=o!=null?o:h.c,T=a===e.c?h.s:a,b=T===""?h.t:T===e.d?h.d:h.l,v=p!=null?p:b;return[T||h.s,a,v,p!=null?p:h.t]},u(r(i))};var I=require("r18gs");var F="nth",S="light",C="dark",w="system";var U={t:"",d:C,l:S,c:w,s:S},D=t=>{let e=t!=null?t:`#${F}`;return(0,I.useRGS)(e,()=>{let s=typeof m!="undefined"&&localStorage.getItem(e);return s?{...JSON.parse(s),s:m.matches?C:S}:U})},L=t=>{let e=`${t!=null?t:`#${F}`}-`;return(0,I.useRGS)(e,{})};var y=require("react/jsx-runtime"),A,M,E,V,Y,X=({targetSelector:t,nonce:e,styles:s,forcedTheme:d,forcedColorScheme:n})=>{let c=t||`#${F}`;return typeof window!="undefined"&&!window.m&&$(c,U,s,d,n),typeof m!="undefined"&&([A,M,E,V,Y]=[m,u,r,f,g]),(0,y.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${$})(${JSON.stringify([c,U,s,d,n]).slice(1,-1)})`},nonce:e})},Z=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},ee=({forcedTheme:t,forcedColorScheme:e,targetSelector:s,themeTransition:d})=>{let n=s||`#${F}`,[c,l]=D(s),[i]=L(s);return(0,k.useEffect)(()=>{A.addEventListener("change",()=>l(o=>({...o,s:A.matches?C:S}))),addEventListener("storage",o=>{o.key===n&&l(p=>({...p,...JSON.parse(o.newValue||"{}")}))})},[]),(0,k.useEffect)(()=>{let o=Z(d);M(E(c)),o(),localStorage.setItem(n,JSON.stringify(c))},[c]),(0,k.useEffect)(()=>{V(t,e),M(E(c))},[e,t]),(0,k.useEffect)(()=>{Y(i.f,i.fc),M(E(c))},[i]),null},te=t=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(X,{...t}),(0,y.jsx)(ee,{...t})]});var G={s:"nth-s",a:"nth-a"};var H=[w,C,S],J,N=t=>{let[e,s]=D(t),[d,n]=L(t);(0,k.useEffect)(()=>{J=window.r},[]);let c=i=>o=>s(p=>({...p,[i]:o})),l={theme:e.t,darkTheme:e.d,lightTheme:e.l,colorSchemePref:e.c,systemColorScheme:e.s,resolvedColorScheme:e.c===w||e.c===""?e.s:e.c,resolvedTheme:e.t,setTheme:c("t"),setDarkTheme:c("d"),setLightTheme:c("l"),setThemeSet:({darkTheme:i,lightTheme:o})=>s(p=>({...p,d:i,l:o})),setColorSchemePref:c("c"),toggleColorScheme(i){let o=H.indexOf(e.c),p=H.length;(o===-1||i&&o===p-1)&&(o=0),c("c")(H[(o+1)%p])},setForcedColorScheme:i=>n(o=>({...o,fc:i})),setForcedTheme:i=>n(o=>({...o,f:i}))};if(J){let i=J(e);l.resolvedColorScheme=i[0],l.resolvedTheme=i[1]}return l};var oe=({size:t=25,skipSystem:e,targetSelector:s,className:d,...n})=>{let{toggleColorScheme:c}=N(s),l=[G.s,d].join(" ");return(0,y.jsx)("button",{className:l,onClick:()=>c(e),style:{"--s":`${t}px`},...n})};0&&(module.exports={ColorSwitch,ThemeSwitcher,useTheme}); | ||
"use strict";var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var s in e)$(t,s,{get:e[s],enumerable:!0})},W=(t,e,s,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!j.call(t,n)&&n!==s&&$(t,n,{get:()=>e[n],enumerable:!(d=z(e,n))||d.enumerable});return t};var X=t=>W($({},"__esModule",{value:!0}),t);var se={};B(se,{ColorSwitch:()=>re,ThemeSwitcher:()=>oe,useTheme:()=>V});module.exports=X(se);var P=require("react");var I=(t,e,s,d,n)=>{window.m=matchMedia("(prefers-color-scheme: dark)");let c=["color-scheme","csp","theme","th"];window.u=(h,a)=>{var U;let C=(U=document.querySelector(a))!=null?U:document.documentElement,y=[];c.forEach((x,w)=>{y.push(`${x}-${h[w]}`),C.setAttribute(`data-${x}`,h[w])}),y[0]=h[0],s&&(y=y.map(x=>{var w;return(w=s[x])!=null?w:x})),C.className=y.join(" ")};let l=localStorage.getItem(t),i={...l?JSON.parse(l):e,s:m.matches?e.d:e.l},o,p,R,b;window.f=(h,a)=>{p=b=h,o=R=a},window.g=(h,a)=>{p=b!=null?b:h,o=R!=null?R:a},f(d,n),window.r=h=>{let a=o!=null?o:h.c,C=a===e.c?h.s:a,y=C===""?h.t:C===e.d?h.d:h.l,U=p!=null?p:y;return[C||h.s,a,U,p!=null?p:h.t]},u(r(i),t)};var A=require("r18gs");var F="nth",T="light",v="dark",k="system";var D={t:"",d:v,l:T,c:k,s:T},L=t=>{let e=t!=null?t:`#${F}`;return(0,A.useRGS)(e,()=>{let s=typeof m!="undefined"&&localStorage.getItem(e);return s?{...JSON.parse(s),s:m.matches?v:T}:D})},M=t=>{let e=`${t!=null?t:`#${F}`}-`;return(0,A.useRGS)(e,{})};var S=require("react/jsx-runtime"),H,E,O,Y,G,Z=({targetSelector:t,nonce:e,styles:s,forcedTheme:d,forcedColorScheme:n})=>{let c=t||`#${F}`;return typeof window!="undefined"&&!window.m&&I(c,D,s,d,n),typeof m!="undefined"&&([H,E,O,Y,G]=[m,u,r,f,g]),(0,S.jsx)("script",{dangerouslySetInnerHTML:{__html:`(${I})(${JSON.stringify([c,D,s,d,n]).slice(1,-1)})`},nonce:e})},ee=(t="none")=>{let e=document.createElement("style");return e.textContent=`transition: ${t.split(";")[0]} !important;`,document.head.appendChild(e),()=>{getComputedStyle(document.body),setTimeout(()=>document.head.removeChild(e),1)}},te=({forcedTheme:t,forcedColorScheme:e,targetSelector:s,themeTransition:d})=>{let n=s||`#${F}`,[c,l]=L(s),[i]=M(s);return(0,P.useEffect)(()=>{H.addEventListener("change",()=>l(o=>({...o,s:H.matches?v:T}))),addEventListener("storage",o=>{o.key===n&&l(p=>({...p,...JSON.parse(o.newValue||"{}")}))})},[]),(0,P.useEffect)(()=>{let o=ee(d);E(O(c),n),o(),localStorage.setItem(n,JSON.stringify(c))},[c]),(0,P.useEffect)(()=>{Y(t,e),E(O(c),n)},[e,t]),(0,P.useEffect)(()=>{G(i.f,i.fc),E(O(c),n)},[i]),null},oe=t=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z,{...t}),(0,S.jsx)(te,{...t})]});var K={s:"nth-s",a:"nth-a"};var J=[k,v,T],N,V=t=>{let[e,s]=L(t),[d,n]=M(t);(0,P.useEffect)(()=>{N=window.r},[]);let c=i=>o=>s(p=>({...p,[i]:o})),l={theme:e.t,darkTheme:e.d,lightTheme:e.l,colorSchemePref:e.c,systemColorScheme:e.s,resolvedColorScheme:e.c===k||e.c===""?e.s:e.c,resolvedTheme:e.t,setTheme:c("t"),setDarkTheme:c("d"),setLightTheme:c("l"),setThemeSet:({darkTheme:i,lightTheme:o})=>s(p=>({...p,d:i,l:o})),setColorSchemePref:c("c"),toggleColorScheme(i){let o=J.indexOf(e.c),p=J.length;(o===-1||i&&o===p-1)&&(o=0),c("c")(J[(o+1)%p])},setForcedColorScheme:i=>n(o=>({...o,fc:i})),setForcedTheme:i=>n(o=>({...o,f:i}))};if(N){let i=N(e);l.resolvedColorScheme=i[0],l.resolvedTheme=i[1]}return l};var re=({size:t=25,skipSystem:e,targetSelector:s,className:d,...n})=>{let{toggleColorScheme:c}=V(s),l=[K.s,d].join(" ");return(0,S.jsx)("button",{className:l,onClick:()=>c(e),style:{"--s":`${t}px`},...n})};0&&(module.exports={ColorSwitch,ThemeSwitcher,useTheme}); |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.", | ||
@@ -8,0 +8,0 @@ "license": "MPL-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59764
419