@tamagui/next-theme 1.14.1 → 1.14.3

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 (59) hide show
  1. package/dist/cjs/NextTheme.js +25 -1
  2. package/dist/cjs/NextTheme.js.map +2 -2
  3. package/dist/cjs/NextThemeProvider.js +266 -1
  4. package/dist/cjs/NextThemeProvider.js.map +2 -2
  5. package/dist/cjs/ThemeSettingContext.js +35 -1
  6. package/dist/cjs/ThemeSettingContext.js.map +2 -2
  7. package/dist/cjs/UseThemeProps.js +16 -1
  8. package/dist/cjs/UseThemeProps.js.map +2 -2
  9. package/dist/cjs/constants.js +34 -1
  10. package/dist/cjs/constants.js.map +2 -2
  11. package/dist/cjs/helpers.js +51 -1
  12. package/dist/cjs/helpers.js.map +2 -2
  13. package/dist/cjs/index.js +18 -1
  14. package/dist/cjs/index.js.map +2 -2
  15. package/dist/cjs/types.js +16 -1
  16. package/dist/cjs/types.js.map +2 -2
  17. package/dist/cjs/useIsomorphicLayoutEffect.js +29 -1
  18. package/dist/cjs/useIsomorphicLayoutEffect.js.map +2 -2
  19. package/dist/cjs/useRootTheme.js +52 -1
  20. package/dist/cjs/useRootTheme.js.map +2 -2
  21. package/dist/cjs/useTheme.js +33 -1
  22. package/dist/cjs/useTheme.js.map +2 -2
  23. package/dist/esm/NextTheme.js +8 -1
  24. package/dist/esm/NextTheme.js.map +1 -1
  25. package/dist/esm/NextTheme.mjs +8 -1
  26. package/dist/esm/NextTheme.mjs.map +1 -1
  27. package/dist/esm/NextThemeProvider.js +232 -1
  28. package/dist/esm/NextThemeProvider.js.map +2 -2
  29. package/dist/esm/NextThemeProvider.mjs +232 -1
  30. package/dist/esm/NextThemeProvider.mjs.map +2 -2
  31. package/dist/esm/ThemeSettingContext.js +11 -1
  32. package/dist/esm/ThemeSettingContext.js.map +2 -2
  33. package/dist/esm/ThemeSettingContext.mjs +11 -1
  34. package/dist/esm/ThemeSettingContext.mjs.map +2 -2
  35. package/dist/esm/constants.js +8 -1
  36. package/dist/esm/constants.js.map +2 -2
  37. package/dist/esm/constants.mjs +8 -1
  38. package/dist/esm/constants.mjs.map +2 -2
  39. package/dist/esm/helpers.js +25 -1
  40. package/dist/esm/helpers.js.map +2 -2
  41. package/dist/esm/helpers.mjs +25 -1
  42. package/dist/esm/helpers.mjs.map +2 -2
  43. package/dist/esm/index.js +1 -1
  44. package/dist/esm/index.js.map +1 -1
  45. package/dist/esm/index.mjs +1 -1
  46. package/dist/esm/index.mjs.map +1 -1
  47. package/dist/esm/useIsomorphicLayoutEffect.js +5 -1
  48. package/dist/esm/useIsomorphicLayoutEffect.js.map +2 -2
  49. package/dist/esm/useIsomorphicLayoutEffect.mjs +5 -1
  50. package/dist/esm/useIsomorphicLayoutEffect.mjs.map +2 -2
  51. package/dist/esm/useRootTheme.js +18 -1
  52. package/dist/esm/useRootTheme.js.map +2 -2
  53. package/dist/esm/useRootTheme.mjs +18 -1
  54. package/dist/esm/useRootTheme.mjs.map +2 -2
  55. package/dist/esm/useTheme.js +8 -1
  56. package/dist/esm/useTheme.js.map +2 -2
  57. package/dist/esm/useTheme.mjs +8 -1
  58. package/dist/esm/useTheme.mjs.map +2 -2
  59. package/package.json +3 -3
@@ -1,2 +1,26 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./NextThemeProvider"),module.exports);r(o,require("./ThemeSettingContext"),module.exports);r(o,require("./UseThemeProps"),module.exports);r(o,require("./helpers"),module.exports);r(o,require("./constants"),module.exports);r(o,require("./useTheme"),module.exports);r(o,require("./types"),module.exports);r(o,require("./useRootTheme"),module.exports);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var NextTheme_exports = {};
17
+ module.exports = __toCommonJS(NextTheme_exports);
18
+ __reExport(NextTheme_exports, require("./NextThemeProvider"), module.exports);
19
+ __reExport(NextTheme_exports, require("./ThemeSettingContext"), module.exports);
20
+ __reExport(NextTheme_exports, require("./UseThemeProps"), module.exports);
21
+ __reExport(NextTheme_exports, require("./helpers"), module.exports);
22
+ __reExport(NextTheme_exports, require("./constants"), module.exports);
23
+ __reExport(NextTheme_exports, require("./useTheme"), module.exports);
24
+ __reExport(NextTheme_exports, require("./types"), module.exports);
25
+ __reExport(NextTheme_exports, require("./useRootTheme"), module.exports);
2
26
  //# sourceMappingURL=NextTheme.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/NextTheme.tsx"],
4
4
  "sourcesContent": ["// https://raw.githubusercontent.com/pacocoursey/next-themes/master/index.tsx\n// forked temporarily\n\nexport * from './NextThemeProvider'\nexport * from './ThemeSettingContext'\nexport * from './UseThemeProps'\nexport * from './helpers'\nexport * from './constants'\nexport * from './useTheme'\nexport * from './types'\nexport * from './useRootTheme'\n"],
5
- "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAGAE,EAAAF,EAAc,+BAHd,gBAIAE,EAAAF,EAAc,iCAJd,gBAKAE,EAAAF,EAAc,2BALd,gBAMAE,EAAAF,EAAc,qBANd,gBAOAE,EAAAF,EAAc,uBAPd,gBAQAE,EAAAF,EAAc,sBARd,gBASAE,EAAAF,EAAc,mBATd,gBAUAE,EAAAF,EAAc,0BAVd",
6
- "names": ["NextTheme_exports", "__toCommonJS", "__reExport"]
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAGA,8BAAc,gCAHd;AAIA,8BAAc,kCAJd;AAKA,8BAAc,4BALd;AAMA,8BAAc,sBANd;AAOA,8BAAc,wBAPd;AAQA,8BAAc,uBARd;AASA,8BAAc,oBATd;AAUA,8BAAc,2BAVd;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,267 @@
1
- "use strict";var U=Object.create;var E=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var q=(t,n)=>{for(var s in n)E(t,s,{get:n[s],enumerable:!0})},V=(t,n,s,h)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of z(n))!Q.call(t,o)&&o!==s&&E(t,o,{get:()=>n[o],enumerable:!(h=b(n,o))||h.enumerable});return t};var j=(t,n,s)=>(s=t!=null?U(F(t)):{},V(n||!t||!t.__esModule?E(s,"default",{value:t,enumerable:!0}):s,t)),B=t=>V(E({},"__esModule",{value:!0}),t);var Y={};q(Y,{NextThemeProvider:()=>W});module.exports=B(Y);var l=require("react/jsx-runtime"),P=require("@tamagui/use-event"),A=j(require("next/head")),G=j(require("react")),d=require("react"),g=require("./constants"),$=require("./helpers"),C=require("./ThemeSettingContext"),_=require("./useIsomorphicLayoutEffect");const W=({forcedTheme:t,disableTransitionOnChange:n=!0,enableSystem:s=!0,enableColorScheme:h=!0,storageKey:o="theme",themes:c=g.colorSchemes,defaultTheme:y=s?"system":"light",attribute:x="class",skipNextHead:k,onChangeTheme:a,value:m={dark:"t_dark",light:"t_light"},children:w})=>{const[r,S]=(0,d.useState)(()=>(0,$.getTheme)(o,y)),[u,D]=(0,d.useState)(()=>(0,$.getTheme)(o)),I=m?Object.values(m):c,O=(0,P.useEvent)(e=>{const i=(0,$.getSystemTheme)(e);G.startTransition(()=>{D(i)}),r==="system"&&!t&&M(i,!1)}),T=(0,d.useRef)(O);T.current=O;const M=(0,P.useEvent)((e,i=!0,f=!0)=>{let v=(m==null?void 0:m[e])||e;if(i)try{localStorage.setItem(o,e)}catch{}if(e==="system"&&s){const p=(0,$.getSystemTheme)();v=(m==null?void 0:m[p])||p}if(a==null||a(v.replace("t_","")),f){const p=document.documentElement;x==="class"?(p.classList.remove(...I),p.classList.add(v)):p.setAttribute(x,v)}});(0,_.useIsomorphicLayoutEffect)(()=>{const e=(...f)=>T.current(...f),i=window.matchMedia(g.MEDIA);return i.addListener(e),e(i),()=>{i.removeListener(e)}},[]);const L=(0,P.useEvent)(e=>{t?M(e,!0,!1):M(e),S(e)});(0,d.useEffect)(()=>{const e=i=>{if(i.key!==o)return;const f=i.newValue||y;L(f)};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[y,L,o]),(0,_.useIsomorphicLayoutEffect)(()=>{if(!h)return;const e=t&&g.colorSchemes.includes(t)?t:r&&g.colorSchemes.includes(r)?r:r==="system"&&u||null,i=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",f=e||"light";(i!==f||f==="dark")&&document.documentElement.style.setProperty("color-scheme",e)},[h,r,u,t]);const H=(0,P.useEvent)(()=>{const e=u==="dark"?["system","light","dark"]:["system","dark","light"],i=e[(e.indexOf(r)+1)%e.length];L(i)}),N=r==="system"?u:r,R=s?u:void 0,J=(0,d.useMemo)(()=>({theme:r,current:r,set:L,toggle:H,forcedTheme:t,resolvedTheme:N,themes:s?[...c,"system"]:c,systemTheme:R}),[r,L,H,t,N,s,c,R]);return(0,l.jsxs)(C.ThemeSettingContext.Provider,{value:J,children:[(0,l.jsx)(X,{forcedTheme:t,storageKey:o,systemTheme:u,attribute:x,value:m,enableSystem:s,defaultTheme:y,attrs:I,skipNextHead:k}),(0,d.useMemo)(()=>w,[w])]})},X=(0,d.memo)(({forcedTheme:t,storageKey:n,attribute:s,enableSystem:h,defaultTheme:o,value:c,attrs:y,skipNextHead:x})=>{const k=(()=>s==="class"?`var d=document.documentElement.classList;${y.map(S=>`d.remove('${S}')`).join(";")};`:"var d=document.documentElement;")(),a=(r,S)=>{r=(c==null?void 0:c[r])||r;const u=S?r:`'${r}'`;return s==="class"?`d.add(${u})`:`d.setAttribute('${s}', ${u})`},m=o==="system",w=(0,l.jsx)(l.Fragment,{children:t?(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`!function(){${k}${a(t)}}()`}},"next-themes-script"):h?(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`!function(){try {${k}var e=localStorage.getItem('${n}');${m?"":a(o)+";"}if("system"===e||(!e&&${m})){var t="${g.MEDIA}",m=window.matchMedia(t);m.media!==t||m.matches?${a("dark")}:${a("light")}}else if(e) ${c?`var x=${JSON.stringify(c)};`:""}${a(c?"x[e]":"e",!0)}}catch(e){}}()`}},"next-themes-script"):(0,l.jsx)("script",{dangerouslySetInnerHTML:{__html:`!function(){try{${k}var e=localStorage.getItem("${n}");if(e){${c?`var x=${JSON.stringify(c)};`:""}${a(c?"x[e]":"e",!0)}}else{${a(o)};}}catch(t){}}();`}},"next-themes-script")});return x?w:(0,l.jsx)(A.default,{children:w})},(t,n)=>t.forcedTheme===n.forcedTheme);0&&(module.exports={NextThemeProvider});
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var NextThemeProvider_exports = {};
30
+ __export(NextThemeProvider_exports, {
31
+ NextThemeProvider: () => NextThemeProvider
32
+ });
33
+ module.exports = __toCommonJS(NextThemeProvider_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_use_event = require("@tamagui/use-event");
36
+ var import_head = __toESM(require("next/head"));
37
+ var React = __toESM(require("react"));
38
+ var import_react = require("react");
39
+ var import_constants = require("./constants");
40
+ var import_helpers = require("./helpers");
41
+ var import_ThemeSettingContext = require("./ThemeSettingContext");
42
+ var import_useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
43
+ const NextThemeProvider = ({
44
+ forcedTheme,
45
+ disableTransitionOnChange = true,
46
+ enableSystem = true,
47
+ enableColorScheme = true,
48
+ storageKey = "theme",
49
+ themes = import_constants.colorSchemes,
50
+ defaultTheme = enableSystem ? "system" : "light",
51
+ attribute = "class",
52
+ skipNextHead,
53
+ onChangeTheme,
54
+ value = {
55
+ dark: "t_dark",
56
+ light: "t_light"
57
+ },
58
+ children
59
+ }) => {
60
+ const [theme, setThemeState] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey, defaultTheme));
61
+ const [resolvedTheme, setResolvedTheme] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey));
62
+ const attrs = !value ? themes : Object.values(value);
63
+ const handleMediaQuery = (0, import_use_event.useEvent)((e) => {
64
+ const systemTheme2 = (0, import_helpers.getSystemTheme)(e);
65
+ React.startTransition(() => {
66
+ setResolvedTheme(systemTheme2);
67
+ });
68
+ if (theme === "system" && !forcedTheme) {
69
+ handleChangeTheme(systemTheme2, false);
70
+ }
71
+ });
72
+ const mediaListener = (0, import_react.useRef)(handleMediaQuery);
73
+ mediaListener.current = handleMediaQuery;
74
+ const handleChangeTheme = (0, import_use_event.useEvent)((theme2, updateStorage = true, updateDOM = true) => {
75
+ let name = (value == null ? void 0 : value[theme2]) || theme2;
76
+ if (updateStorage) {
77
+ try {
78
+ localStorage.setItem(storageKey, theme2);
79
+ } catch (e) {
80
+ }
81
+ }
82
+ if (theme2 === "system" && enableSystem) {
83
+ const resolved = (0, import_helpers.getSystemTheme)();
84
+ name = (value == null ? void 0 : value[resolved]) || resolved;
85
+ }
86
+ onChangeTheme == null ? void 0 : onChangeTheme(name.replace("t_", ""));
87
+ if (updateDOM) {
88
+ const d = document.documentElement;
89
+ if (attribute === "class") {
90
+ d.classList.remove(...attrs);
91
+ d.classList.add(name);
92
+ } else {
93
+ d.setAttribute(attribute, name);
94
+ }
95
+ }
96
+ });
97
+ (0, import_useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(() => {
98
+ const handler = (...args) => mediaListener.current(...args);
99
+ const media = window.matchMedia(import_constants.MEDIA);
100
+ media.addListener(handler);
101
+ handler(media);
102
+ return () => {
103
+ media.removeListener(handler);
104
+ };
105
+ }, []);
106
+ const set = (0, import_use_event.useEvent)((newTheme) => {
107
+ if (forcedTheme) {
108
+ handleChangeTheme(newTheme, true, false);
109
+ } else {
110
+ handleChangeTheme(newTheme);
111
+ }
112
+ setThemeState(newTheme);
113
+ });
114
+ (0, import_react.useEffect)(() => {
115
+ const handleStorage = (e) => {
116
+ if (e.key !== storageKey) {
117
+ return;
118
+ }
119
+ const theme2 = e.newValue || defaultTheme;
120
+ set(theme2);
121
+ };
122
+ window.addEventListener("storage", handleStorage);
123
+ return () => {
124
+ window.removeEventListener("storage", handleStorage);
125
+ };
126
+ }, [defaultTheme, set, storageKey]);
127
+ (0, import_useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(() => {
128
+ if (!enableColorScheme)
129
+ return;
130
+ const colorScheme = (
131
+ // If theme is forced to light or dark, use that
132
+ forcedTheme && import_constants.colorSchemes.includes(forcedTheme) ? forcedTheme : (
133
+ // If regular theme is light or dark
134
+ theme && import_constants.colorSchemes.includes(theme) ? theme : (
135
+ // If theme is system, use the resolved version
136
+ theme === "system" ? resolvedTheme || null : null
137
+ )
138
+ )
139
+ );
140
+ const userPrefers = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
141
+ const wePrefer = colorScheme || "light";
142
+ if (userPrefers !== wePrefer || wePrefer === "dark") {
143
+ document.documentElement.style.setProperty("color-scheme", colorScheme);
144
+ }
145
+ }, [enableColorScheme, theme, resolvedTheme, forcedTheme]);
146
+ const toggle = (0, import_use_event.useEvent)(() => {
147
+ const order = resolvedTheme === "dark" ? ["system", "light", "dark"] : ["system", "dark", "light"];
148
+ const next = order[(order.indexOf(theme) + 1) % order.length];
149
+ set(next);
150
+ });
151
+ const contextResolvedTheme = theme === "system" ? resolvedTheme : theme;
152
+ const systemTheme = enableSystem ? resolvedTheme : void 0;
153
+ const contextValue = (0, import_react.useMemo)(() => {
154
+ const value2 = {
155
+ theme,
156
+ current: theme,
157
+ set,
158
+ toggle,
159
+ forcedTheme,
160
+ resolvedTheme: contextResolvedTheme,
161
+ themes: enableSystem ? [...themes, "system"] : themes,
162
+ systemTheme
163
+ };
164
+ return value2;
165
+ }, [
166
+ theme,
167
+ set,
168
+ toggle,
169
+ forcedTheme,
170
+ contextResolvedTheme,
171
+ enableSystem,
172
+ themes,
173
+ systemTheme
174
+ ]);
175
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ThemeSettingContext.ThemeSettingContext.Provider, { value: contextValue, children: [
176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
177
+ ThemeScript,
178
+ {
179
+ ...{
180
+ forcedTheme,
181
+ storageKey,
182
+ systemTheme: resolvedTheme,
183
+ attribute,
184
+ value,
185
+ enableSystem,
186
+ defaultTheme,
187
+ attrs,
188
+ skipNextHead
189
+ }
190
+ }
191
+ ),
192
+ (0, import_react.useMemo)(() => children, [children])
193
+ ] });
194
+ };
195
+ const ThemeScript = (0, import_react.memo)(
196
+ ({
197
+ forcedTheme,
198
+ storageKey,
199
+ attribute,
200
+ enableSystem,
201
+ defaultTheme,
202
+ value,
203
+ attrs,
204
+ skipNextHead
205
+ }) => {
206
+ const optimization = (() => {
207
+ if (attribute === "class") {
208
+ const removeClasses = attrs.map((t) => `d.remove('${t}')`).join(";");
209
+ return `var d=document.documentElement.classList;${removeClasses};`;
210
+ } else {
211
+ return `var d=document.documentElement;`;
212
+ }
213
+ })();
214
+ const updateDOM = (name, literal) => {
215
+ name = (value == null ? void 0 : value[name]) || name;
216
+ const val = literal ? name : `'${name}'`;
217
+ if (attribute === "class") {
218
+ return `d.add(${val})`;
219
+ }
220
+ return `d.setAttribute('${attribute}', ${val})`;
221
+ };
222
+ const defaultSystem = defaultTheme === "system";
223
+ const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: forcedTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
224
+ "script",
225
+ {
226
+ dangerouslySetInnerHTML: {
227
+ // These are minified via Terser and then updated by hand, don't recommend
228
+ __html: `!function(){${optimization}${updateDOM(forcedTheme)}}()`
229
+ }
230
+ },
231
+ "next-themes-script"
232
+ ) : enableSystem ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
+ "script",
234
+ {
235
+ dangerouslySetInnerHTML: {
236
+ __html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${!defaultSystem ? updateDOM(defaultTheme) + ";" : ""}if("system"===e||(!e&&${defaultSystem})){var t="${import_constants.MEDIA}",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM(
237
+ "dark"
238
+ )}:${updateDOM("light")}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? "x[e]" : "e", true)}}catch(e){}}()`
239
+ }
240
+ },
241
+ "next-themes-script"
242
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
+ "script",
244
+ {
245
+ dangerouslySetInnerHTML: {
246
+ __html: `!function(){try{${optimization}var e=localStorage.getItem("${storageKey}");if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? "x[e]" : "e", true)}}else{${updateDOM(
247
+ defaultTheme
248
+ )};}}catch(t){}}();`
249
+ }
250
+ },
251
+ "next-themes-script"
252
+ ) });
253
+ if (skipNextHead)
254
+ return contents;
255
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_head.default, { children: contents });
256
+ },
257
+ (prevProps, nextProps) => {
258
+ if (prevProps.forcedTheme !== nextProps.forcedTheme)
259
+ return false;
260
+ return true;
261
+ }
262
+ );
263
+ // Annotate the CommonJS export names for ESM import in node:
264
+ 0 && (module.exports = {
265
+ NextThemeProvider
266
+ });
2
267
  //# sourceMappingURL=NextThemeProvider.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/NextThemeProvider.tsx"],
4
4
  "sourcesContent": ["import { useEvent } from '@tamagui/use-event'\nimport NextHead from 'next/head'\nimport * as React from 'react'\nimport { memo, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { MEDIA, colorSchemes } from './constants'\nimport { getSystemTheme, getTheme } from './helpers'\nimport { ThemeSettingContext } from './ThemeSettingContext'\nimport { ValueObject } from './types'\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\nimport { ThemeProviderProps, UseThemeProps } from './UseThemeProps'\n\nexport const NextThemeProvider: React.FC<ThemeProviderProps> = ({\n forcedTheme,\n disableTransitionOnChange = true,\n enableSystem = true,\n enableColorScheme = true,\n storageKey = 'theme',\n themes = colorSchemes,\n defaultTheme = enableSystem ? 'system' : 'light',\n attribute = 'class',\n skipNextHead,\n onChangeTheme,\n value = {\n dark: 't_dark',\n light: 't_light',\n },\n children,\n}) => {\n const [theme, setThemeState] = useState(() => getTheme(storageKey, defaultTheme))\n const [resolvedTheme, setResolvedTheme] = useState(() => getTheme(storageKey))\n // const resolvedTheme = React.useDeferredValue(resolvedThemeFast)\n const attrs = !value ? themes : Object.values(value)\n\n const handleMediaQuery = useEvent((e?) => {\n const systemTheme = getSystemTheme(e)\n React.startTransition(() => {\n setResolvedTheme(systemTheme)\n })\n if (theme === 'system' && !forcedTheme) {\n handleChangeTheme(systemTheme, false)\n }\n })\n\n // Ref hack to avoid adding handleMediaQuery as a dep\n const mediaListener = useRef(handleMediaQuery)\n mediaListener.current = handleMediaQuery\n\n const handleChangeTheme = useEvent((theme, updateStorage = true, updateDOM = true) => {\n let name = value?.[theme] || theme\n\n if (updateStorage) {\n try {\n localStorage.setItem(storageKey, theme)\n } catch (e) {\n // Unsupported\n }\n }\n\n if (theme === 'system' && enableSystem) {\n const resolved = getSystemTheme()\n name = value?.[resolved] || resolved\n }\n\n onChangeTheme?.(name.replace('t_', ''))\n\n if (updateDOM) {\n const d = document.documentElement\n if (attribute === 'class') {\n d.classList.remove(...attrs)\n d.classList.add(name)\n } else {\n d.setAttribute(attribute, name)\n }\n }\n })\n\n useIsomorphicLayoutEffect(() => {\n const handler = (...args: any) => mediaListener.current(...args)\n // Always listen to System preference\n const media = window.matchMedia(MEDIA)\n // Intentionally use deprecated listener methods to support iOS & old browsers\n media.addListener(handler)\n handler(media)\n return () => {\n media.removeListener(handler)\n }\n }, [])\n\n const set = useEvent((newTheme) => {\n if (forcedTheme) {\n handleChangeTheme(newTheme, true, false)\n } else {\n handleChangeTheme(newTheme)\n }\n setThemeState(newTheme)\n })\n\n // localStorage event handling\n useEffect(() => {\n const handleStorage = (e: StorageEvent) => {\n if (e.key !== storageKey) {\n return\n }\n // If default theme set, use it if localstorage === null (happens on local storage manual deletion)\n const theme = e.newValue || defaultTheme\n set(theme)\n }\n window.addEventListener('storage', handleStorage)\n return () => {\n window.removeEventListener('storage', handleStorage)\n }\n }, [defaultTheme, set, storageKey])\n\n // color-scheme handling\n useIsomorphicLayoutEffect(() => {\n if (!enableColorScheme) return\n\n const colorScheme =\n // If theme is forced to light or dark, use that\n forcedTheme && colorSchemes.includes(forcedTheme)\n ? forcedTheme\n : // If regular theme is light or dark\n theme && colorSchemes.includes(theme)\n ? theme\n : // If theme is system, use the resolved version\n theme === 'system'\n ? resolvedTheme || null\n : null\n\n // color-scheme tells browser how to render built-in elements like forms, scrollbars, etc.\n // if color-scheme is null, this will remove the property\n const userPrefers =\n typeof window !== 'undefined' &&\n window.matchMedia &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light'\n\n const wePrefer = colorScheme || 'light'\n\n // avoid running this because it causes full page reflow\n if (userPrefers !== wePrefer || wePrefer === 'dark') {\n document.documentElement.style.setProperty('color-scheme', colorScheme)\n }\n }, [enableColorScheme, theme, resolvedTheme, forcedTheme])\n\n const toggle = useEvent(() => {\n const order =\n resolvedTheme === 'dark' ? ['system', 'light', 'dark'] : ['system', 'dark', 'light']\n const next = order[(order.indexOf(theme) + 1) % order.length]\n set(next)\n })\n\n const contextResolvedTheme = theme === 'system' ? resolvedTheme : theme\n const systemTheme = (enableSystem ? resolvedTheme : undefined) as\n | 'light'\n | 'dark'\n | undefined\n const contextValue = useMemo(() => {\n const value: UseThemeProps = {\n theme,\n current: theme,\n set,\n toggle,\n forcedTheme,\n resolvedTheme: contextResolvedTheme,\n themes: enableSystem ? [...themes, 'system'] : themes,\n systemTheme,\n } as const\n return value\n }, [\n theme,\n set,\n toggle,\n forcedTheme,\n contextResolvedTheme,\n enableSystem,\n themes,\n systemTheme,\n ])\n\n return (\n <ThemeSettingContext.Provider value={contextValue}>\n <ThemeScript\n {...{\n forcedTheme,\n storageKey,\n systemTheme: resolvedTheme,\n attribute,\n value,\n enableSystem,\n defaultTheme,\n attrs,\n skipNextHead,\n }}\n />\n {/* because on SSR we re-run and can avoid whole tree re-render */}\n {useMemo(() => children, [children])}\n </ThemeSettingContext.Provider>\n )\n}\nconst ThemeScript = memo(\n ({\n forcedTheme,\n storageKey,\n attribute,\n enableSystem,\n defaultTheme,\n value,\n attrs,\n skipNextHead,\n }: {\n forcedTheme?: string\n storageKey: string\n attribute?: string\n enableSystem?: boolean\n defaultTheme: string\n value?: ValueObject\n attrs: any\n skipNextHead?: boolean\n }) => {\n // Code-golfing the amount of characters in the script\n const optimization = (() => {\n if (attribute === 'class') {\n const removeClasses = attrs.map((t: string) => `d.remove('${t}')`).join(';')\n return `var d=document.documentElement.classList;${removeClasses};`\n } else {\n return `var d=document.documentElement;`\n }\n })()\n\n const updateDOM = (name: string, literal?: boolean) => {\n name = value?.[name] || name\n const val = literal ? name : `'${name}'`\n\n if (attribute === 'class') {\n return `d.add(${val})`\n }\n\n return `d.setAttribute('${attribute}', ${val})`\n }\n\n const defaultSystem = defaultTheme === 'system'\n\n const contents = (\n <>\n {forcedTheme ? (\n <script\n // nonce={nonce}\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // These are minified via Terser and then updated by hand, don't recommend\n __html: `!function(){${optimization}${updateDOM(forcedTheme)}}()`,\n }}\n />\n ) : enableSystem ? (\n <script\n // nonce={nonce}\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n __html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${\n !defaultSystem ? updateDOM(defaultTheme) + ';' : ''\n }if(\"system\"===e||(!e&&${defaultSystem})){var t=\"${MEDIA}\",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM(\n 'dark'\n )}:${updateDOM('light')}}else if(e) ${\n value ? `var x=${JSON.stringify(value)};` : ''\n }${updateDOM(value ? 'x[e]' : 'e', true)}}catch(e){}}()`,\n }}\n />\n ) : (\n <script\n // nonce={nonce}\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n __html: `!function(){try{${optimization}var e=localStorage.getItem(\"${storageKey}\");if(e){${\n value ? `var x=${JSON.stringify(value)};` : ''\n }${updateDOM(value ? 'x[e]' : 'e', true)}}else{${updateDOM(\n defaultTheme\n )};}}catch(t){}}();`,\n }}\n />\n )}\n </>\n )\n\n if (skipNextHead) return contents\n\n return <NextHead>{contents}</NextHead>\n },\n (prevProps, nextProps) => {\n // Only re-render when forcedTheme changes\n // the rest of the props should be completely stable\n if (prevProps.forcedTheme !== nextProps.forcedTheme) return false\n return true\n }\n)\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAuLI,IAAAI,EAAA,6BAvLJC,EAAyB,8BACzBC,EAAqB,wBACrBC,EAAuB,oBACvBC,EAA2D,iBAE3DC,EAAoC,uBACpCC,EAAyC,qBACzCC,EAAoC,iCAEpCC,EAA0C,uCAGnC,MAAMV,EAAkD,CAAC,CAC9D,YAAAW,EACA,0BAAAC,EAA4B,GAC5B,aAAAC,EAAe,GACf,kBAAAC,EAAoB,GACpB,WAAAC,EAAa,QACb,OAAAC,EAAS,eACT,aAAAC,EAAeJ,EAAe,SAAW,QACzC,UAAAK,EAAY,QACZ,aAAAC,EACA,cAAAC,EACA,MAAAC,EAAQ,CACN,KAAM,SACN,MAAO,SACT,EACA,SAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAOC,CAAa,KAAI,YAAS,OAAM,YAAST,EAAYE,CAAY,CAAC,EAC1E,CAACQ,EAAeC,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,OAAS,IAAK,EAAI,UAAUY,EAC/ChB,CACF,oBACF,GAPI,oBAQN,EAEJ,EAGF,OAAIE,EAAqBuC,KAElB,OAAC,EAAAC,QAAA,CAAU,SAAAD,EAAS,CAC7B,EACA,CAACE,EAAWC,IAGND,EAAU,cAAgBC,EAAU,WAG5C",
6
- "names": ["NextThemeProvider_exports", "__export", "NextThemeProvider", "__toCommonJS", "import_jsx_runtime", "import_use_event", "import_head", "React", "import_react", "import_constants", "import_helpers", "import_ThemeSettingContext", "import_useIsomorphicLayoutEffect", "forcedTheme", "disableTransitionOnChange", "enableSystem", "enableColorScheme", "storageKey", "themes", "defaultTheme", "attribute", "skipNextHead", "onChangeTheme", "value", "children", "theme", "setThemeState", "resolvedTheme", "setResolvedTheme", "attrs", "handleMediaQuery", "systemTheme", "handleChangeTheme", "mediaListener", "updateStorage", "updateDOM", "name", "resolved", "d", "handler", "args", "media", "set", "newTheme", "handleStorage", "e", "colorScheme", "userPrefers", "wePrefer", "toggle", "order", "next", "contextResolvedTheme", "contextValue", "ThemeScript", "optimization", "t", "literal", "val", "defaultSystem", "contents", "NextHead", "prevProps", "nextProps"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuLI;AAvLJ,uBAAyB;AACzB,kBAAqB;AACrB,YAAuB;AACvB,mBAA2D;AAE3D,uBAAoC;AACpC,qBAAyC;AACzC,iCAAoC;AAEpC,uCAA0C;AAGnC,MAAM,oBAAkD,CAAC;AAAA,EAC9D;AAAA,EACA,4BAA4B;AAAA,EAC5B,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,eAAe,eAAe,WAAW;AAAA,EACzC,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,aAAa,QAA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;AAAA,IAC3C;AAEA,UAAM,gBAAgB,iBAAiB;AAEvC,UAAM,WACJ,2EACG,wBACC;AAAA,MAAC;AAAA;AAAA,QAGC,yBAAyB;AAAA;AAAA,UAEvB,QAAQ,eAAe,eAAe,UAAU,WAAW;AAAA,QAC7D;AAAA;AAAA,MAJI;AAAA,IAKN,IACE,eACF;AAAA,MAAC;AAAA;AAAA,QAGC,yBAAyB;AAAA,UACvB,QAAQ,oBAAoB,2CAA2C,gBACrE,CAAC,gBAAgB,UAAU,YAAY,IAAI,MAAM,2BAC1B,0BAA0B,yEAAwD;AAAA,YACzG;AAAA,UACF,KAAK,UAAU,OAAO,gBACpB,QAAQ,SAAS,KAAK,UAAU,KAAK,OAAO,KAC3C,UAAU,QAAQ,SAAS,KAAK,IAAI;AAAA,QACzC;AAAA;AAAA,MATI;AAAA,IAUN,IAEA;AAAA,MAAC;AAAA;AAAA,QAGC,yBAAyB;AAAA,UACvB,QAAQ,mBAAmB,2CAA2C,sBACpE,QAAQ,SAAS,KAAK,UAAU,KAAK,OAAO,KAC3C,UAAU,QAAQ,SAAS,KAAK,IAAI,UAAU;AAAA,YAC/C;AAAA,UACF;AAAA,QACF;AAAA;AAAA,MAPI;AAAA,IAQN,GAEJ;AAGF,QAAI;AAAc,aAAO;AAEzB,WAAO,4CAAC,YAAAC,SAAA,EAAU,oBAAS;AAAA,EAC7B;AAAA,EACA,CAAC,WAAW,cAAc;AAGxB,QAAI,UAAU,gBAAgB,UAAU;AAAa,aAAO;AAC5D,WAAO;AAAA,EACT;AACF;",
6
+ "names": ["systemTheme", "theme", "value", "NextHead"]
7
7
  }
@@ -1,2 +1,36 @@
1
- "use strict";var r=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var i=(t,e)=>{for(var m in e)r(t,m,{get:e[m],enumerable:!0})},x=(t,e,m,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of n(e))!g.call(t,o)&&o!==m&&r(t,o,{get:()=>e[o],enumerable:!(s=h(e,o))||s.enumerable});return t};var T=t=>x(r({},"__esModule",{value:!0}),t);var f={};i(f,{ThemeSettingContext:()=>c});module.exports=T(f);var p=require("react");const c=(0,p.createContext)({toggle:()=>{},set:t=>{},themes:[]});0&&(module.exports={ThemeSettingContext});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ThemeSettingContext_exports = {};
20
+ __export(ThemeSettingContext_exports, {
21
+ ThemeSettingContext: () => ThemeSettingContext
22
+ });
23
+ module.exports = __toCommonJS(ThemeSettingContext_exports);
24
+ var import_react = require("react");
25
+ const ThemeSettingContext = (0, import_react.createContext)({
26
+ toggle: () => {
27
+ },
28
+ set: (_) => {
29
+ },
30
+ themes: []
31
+ });
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ ThemeSettingContext
35
+ });
2
36
  //# sourceMappingURL=ThemeSettingContext.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/ThemeSettingContext.tsx"],
4
4
  "sourcesContent": ["import { createContext } from 'react'\n\nimport { UseThemeProps } from './UseThemeProps'\n\nexport const ThemeSettingContext = createContext<UseThemeProps>({\n toggle: () => {},\n set: (_) => {},\n themes: [],\n})\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8B,iBAIvB,MAAMF,KAAsB,iBAA6B,CAC9D,OAAQ,IAAM,CAAC,EACf,IAAMG,GAAM,CAAC,EACb,OAAQ,CAAC,CACX,CAAC",
6
- "names": ["ThemeSettingContext_exports", "__export", "ThemeSettingContext", "__toCommonJS", "import_react", "_"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAIvB,MAAM,0BAAsB,4BAA6B;AAAA,EAC9D,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,KAAK,CAAC,MAAM;AAAA,EAAC;AAAA,EACb,QAAQ,CAAC;AACX,CAAC;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,17 @@
1
- "use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var g=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!m.call(t,r)&&r!==i&&s(t,r,{get:()=>e[r],enumerable:!(n=o(e,r))||n.enumerable});return t};var h=t=>g(s({},"__esModule",{value:!0}),t);var l={};module.exports=h(l);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var UseThemeProps_exports = {};
16
+ module.exports = __toCommonJS(UseThemeProps_exports);
2
17
  //# sourceMappingURL=UseThemeProps.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/UseThemeProps.tsx"],
4
4
  "sourcesContent": ["import { ValueObject } from './types'\n\nexport interface UseThemeProps {\n /** List of all available theme names */\n themes: string[]\n /** Forced theme name for the current page */\n forcedTheme?: string\n /** Update the theme */\n set: (theme: string) => void\n toggle: () => void\n /** Active theme name - will return \"system\" if not overriden, see \"resolvedTheme\" for getting resolved system value */\n current?: string\n /** @deprecated Use `current` instead (deprecating avoid confusion with useTheme) */\n theme?: string\n /** If `enableSystem` is true and the active theme is \"system\", this returns whether the system preference resolved to \"dark\" or \"light\". Otherwise, identical to `theme` */\n resolvedTheme?: string\n /** If enableSystem is true, returns the System theme preference (\"dark\" or \"light\"), regardless what the active theme is */\n systemTheme?: 'dark' | 'light'\n}\n\nexport interface ThemeProviderProps {\n children?: any\n /** List of all available theme names */\n themes?: string[]\n /** Forced theme name for the current page */\n forcedTheme?: string\n /** Whether to switch between dark and light themes based on prefers-color-scheme */\n enableSystem?: boolean\n systemTheme?: string\n /** Disable all CSS transitions when switching themes */\n disableTransitionOnChange?: boolean\n /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */\n enableColorScheme?: boolean\n /** Key used to store theme setting in localStorage */\n storageKey?: string\n /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */\n defaultTheme?: string\n /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */\n attribute?: string | 'class'\n /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */\n value?: ValueObject\n onChangeTheme?: (name: string) => void\n\n // avoids warning\n skipNextHead?: boolean\n}\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["UseThemeProps_exports", "__toCommonJS"]
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,35 @@
1
- "use strict";var c=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var h=(e,o)=>{for(var t in o)c(e,t,{get:o[t],enumerable:!0})},l=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of p(o))!a.call(e,r)&&r!==t&&c(e,r,{get:()=>o[r],enumerable:!(s=n(o,r))||s.enumerable});return e};var x=e=>l(c({},"__esModule",{value:!0}),e);var f={};h(f,{MEDIA:()=>m,colorSchemes:()=>k,constants:()=>d});module.exports=x(f);const d={},k=["light","dark"],m="(prefers-color-scheme: dark)";0&&(module.exports={MEDIA,colorSchemes,constants});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ MEDIA: () => MEDIA,
22
+ colorSchemes: () => colorSchemes,
23
+ constants: () => constants
24
+ });
25
+ module.exports = __toCommonJS(constants_exports);
26
+ const constants = {};
27
+ const colorSchemes = ["light", "dark"];
28
+ const MEDIA = "(prefers-color-scheme: dark)";
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ MEDIA,
32
+ colorSchemes,
33
+ constants
34
+ });
2
35
  //# sourceMappingURL=constants.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants.tsx"],
4
4
  "sourcesContent": ["export const constants = {}\nexport const colorSchemes = ['light', 'dark']\nexport const MEDIA = '(prefers-color-scheme: dark)'\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,iBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAL,GAAO,MAAMI,EAAY,CAAC,EACbD,EAAe,CAAC,QAAS,MAAM,EAC/BD,EAAQ",
6
- "names": ["constants_exports", "__export", "MEDIA", "colorSchemes", "constants", "__toCommonJS"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY,CAAC;AACnB,MAAM,eAAe,CAAC,SAAS,MAAM;AACrC,MAAM,QAAQ;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,52 @@
1
- "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},h=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!a.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(s=m(t,n))||s.enumerable});return e};var f=e=>h(i({},"__esModule",{value:!0}),e);var y={};c(y,{getSystemTheme:()=>p,getTheme:()=>u,helpers:()=>g});module.exports=f(y);var o=require("./constants");const g={},u=(e,t)=>{if(typeof window>"u")return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},p=e=>(e||(e=window.matchMedia(o.MEDIA)),e.matches?"dark":"light");0&&(module.exports={getSystemTheme,getTheme,helpers});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var helpers_exports = {};
20
+ __export(helpers_exports, {
21
+ getSystemTheme: () => getSystemTheme,
22
+ getTheme: () => getTheme,
23
+ helpers: () => helpers
24
+ });
25
+ module.exports = __toCommonJS(helpers_exports);
26
+ var import_constants = require("./constants");
27
+ const helpers = {};
28
+ const getTheme = (key, fallback) => {
29
+ if (typeof window === "undefined")
30
+ return void 0;
31
+ let theme;
32
+ try {
33
+ theme = localStorage.getItem(key) || void 0;
34
+ } catch (e) {
35
+ }
36
+ return theme || fallback;
37
+ };
38
+ const getSystemTheme = (e) => {
39
+ if (!e) {
40
+ e = window.matchMedia(import_constants.MEDIA);
41
+ }
42
+ const isDark = e.matches;
43
+ const systemTheme = isDark ? "dark" : "light";
44
+ return systemTheme;
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ getSystemTheme,
49
+ getTheme,
50
+ helpers
51
+ });
2
52
  //# sourceMappingURL=helpers.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers.tsx"],
4
4
  "sourcesContent": ["import { MEDIA } from './constants'\n\nexport const helpers = {}\n// Helpers\n\nexport const getTheme = (key: string, fallback?: string) => {\n if (typeof window === 'undefined') return undefined\n let theme\n try {\n theme = localStorage.getItem(key) || undefined\n } catch (e) {\n // Unsupported\n }\n return theme || fallback\n}\n\nexport const getSystemTheme = (e?: MediaQueryList) => {\n if (!e) {\n e = window.matchMedia(MEDIA)\n }\n\n const isDark = e.matches\n const systemTheme = isDark ? 'dark' : 'light'\n return systemTheme\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,aAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAAsB,uBAEf,MAAMF,EAAU,CAAC,EAGXD,EAAW,CAACI,EAAaC,IAAsB,CAC1D,GAAI,OAAO,OAAW,IAAa,OACnC,IAAIC,EACJ,GAAI,CACFA,EAAQ,aAAa,QAAQF,CAAG,GAAK,MACvC,MAAE,CAEF,CACA,OAAOE,GAASD,CAClB,EAEaN,EAAkB,IACxB,IACH,EAAI,OAAO,WAAW,OAAK,GAGd,EAAE,QACY,OAAS",
6
- "names": ["helpers_exports", "__export", "getSystemTheme", "getTheme", "helpers", "__toCommonJS", "import_constants", "key", "fallback", "theme"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEf,MAAM,UAAU,CAAC;AAGjB,MAAM,WAAW,CAAC,KAAa,aAAsB;AAC1D,MAAI,OAAO,WAAW;AAAa,WAAO;AAC1C,MAAI;AACJ,MAAI;AACF,YAAQ,aAAa,QAAQ,GAAG,KAAK;AAAA,EACvC,SAAS,GAAP;AAAA,EAEF;AACA,SAAO,SAAS;AAClB;AAEO,MAAM,iBAAiB,CAAC,MAAuB;AACpD,MAAI,CAAC,GAAG;AACN,QAAI,OAAO,WAAW,sBAAK;AAAA,EAC7B;AAEA,QAAM,SAAS,EAAE;AACjB,QAAM,cAAc,SAAS,SAAS;AACtC,SAAO;AACT;",
6
+ "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,19 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./NextTheme"),module.exports);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./NextTheme"), module.exports);
2
19
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["export * from './NextTheme'\n"],
5
- "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,uBAAd",
6
- "names": ["src_exports", "__toCommonJS", "__reExport"]
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,wBAAd;",
6
+ "names": []
7
7
  }