@tamagui/next-theme 1.0.1-beta.98 → 1.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/NextTheme.js +111 -113
- package/dist/cjs/NextTheme.js.map +3 -3
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/NextTheme.js +104 -114
- package/dist/esm/NextTheme.js.map +3 -3
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/src/NextTheme.tsx +71 -74
- package/types/NextTheme.d.ts +23 -2
- package/types/index.d.ts +0 -0
- package/dist/jsx/NextTheme.js +0 -219
- package/dist/jsx/index.js +0 -1
- package/types/NextTheme.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
package/dist/cjs/NextTheme.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
8
|
var __export = (target, all) => {
|
|
22
9
|
for (var name in all)
|
|
23
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,27 +17,34 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
17
|
}
|
|
31
18
|
return to;
|
|
32
19
|
};
|
|
33
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
34
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
25
|
var NextTheme_exports = {};
|
|
36
26
|
__export(NextTheme_exports, {
|
|
37
27
|
NextThemeProvider: () => NextThemeProvider,
|
|
38
28
|
useRootTheme: () => useRootTheme,
|
|
39
|
-
useTheme: () => useTheme
|
|
29
|
+
useTheme: () => useTheme,
|
|
30
|
+
useThemeSetting: () => useThemeSetting
|
|
40
31
|
});
|
|
41
32
|
module.exports = __toCommonJS(NextTheme_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_use_event = require("@tamagui/use-event");
|
|
42
35
|
var import_head = __toESM(require("next/head"));
|
|
43
36
|
var React = __toESM(require("react"));
|
|
44
37
|
var import_react = require("react");
|
|
45
38
|
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
|
|
46
|
-
const
|
|
47
|
-
|
|
39
|
+
const ThemeSettingContext = (0, import_react.createContext)({
|
|
40
|
+
toggle: () => {
|
|
48
41
|
},
|
|
49
|
-
|
|
42
|
+
set: (_) => {
|
|
50
43
|
},
|
|
51
44
|
themes: []
|
|
52
45
|
});
|
|
53
|
-
const useTheme = () => (0, import_react.useContext)(
|
|
46
|
+
const useTheme = () => (0, import_react.useContext)(ThemeSettingContext);
|
|
47
|
+
const useThemeSetting = () => (0, import_react.useContext)(ThemeSettingContext);
|
|
54
48
|
const colorSchemes = ["light", "dark"];
|
|
55
49
|
const MEDIA = "(prefers-color-scheme: dark)";
|
|
56
50
|
const useRootTheme = () => {
|
|
@@ -65,7 +59,7 @@ const NextThemeProvider = ({
|
|
|
65
59
|
enableSystem = true,
|
|
66
60
|
enableColorScheme = true,
|
|
67
61
|
storageKey = "theme",
|
|
68
|
-
themes =
|
|
62
|
+
themes = colorSchemes,
|
|
69
63
|
defaultTheme = enableSystem ? "system" : "light",
|
|
70
64
|
attribute = "class",
|
|
71
65
|
onChangeTheme,
|
|
@@ -78,19 +72,18 @@ const NextThemeProvider = ({
|
|
|
78
72
|
const [theme, setThemeState] = (0, import_react.useState)(() => getTheme(storageKey, defaultTheme));
|
|
79
73
|
const [resolvedTheme, setResolvedTheme] = (0, import_react.useState)(() => getTheme(storageKey));
|
|
80
74
|
const attrs = !value ? themes : Object.values(value);
|
|
81
|
-
const handleMediaQuery = (0,
|
|
82
|
-
const
|
|
75
|
+
const handleMediaQuery = (0, import_use_event.useEvent)((e) => {
|
|
76
|
+
const systemTheme2 = getSystemTheme(e);
|
|
83
77
|
React.startTransition(() => {
|
|
84
|
-
setResolvedTheme(
|
|
78
|
+
setResolvedTheme(systemTheme2);
|
|
85
79
|
});
|
|
86
80
|
if (theme === "system" && !forcedTheme)
|
|
87
|
-
handleChangeTheme(
|
|
88
|
-
}
|
|
81
|
+
handleChangeTheme(systemTheme2, false);
|
|
82
|
+
});
|
|
89
83
|
const mediaListener = (0, import_react.useRef)(handleMediaQuery);
|
|
90
84
|
mediaListener.current = handleMediaQuery;
|
|
91
|
-
const handleChangeTheme = (0,
|
|
85
|
+
const handleChangeTheme = (0, import_use_event.useEvent)((theme2, updateStorage = true, updateDOM = true) => {
|
|
92
86
|
let name = (value == null ? void 0 : value[theme2]) || theme2;
|
|
93
|
-
const enable = disableTransitionOnChange && updateDOM ? disableAnimation() : null;
|
|
94
87
|
if (updateStorage) {
|
|
95
88
|
try {
|
|
96
89
|
localStorage.setItem(storageKey, theme2);
|
|
@@ -110,9 +103,8 @@ const NextThemeProvider = ({
|
|
|
110
103
|
} else {
|
|
111
104
|
d.setAttribute(attribute, name);
|
|
112
105
|
}
|
|
113
|
-
enable == null ? void 0 : enable();
|
|
114
106
|
}
|
|
115
|
-
}
|
|
107
|
+
});
|
|
116
108
|
useIsomorphicLayoutEffect(() => {
|
|
117
109
|
const handler = (...args) => mediaListener.current(...args);
|
|
118
110
|
const media = window.matchMedia(MEDIA);
|
|
@@ -122,108 +114,125 @@ const NextThemeProvider = ({
|
|
|
122
114
|
media.removeListener(handler);
|
|
123
115
|
};
|
|
124
116
|
}, []);
|
|
125
|
-
const
|
|
117
|
+
const set = (0, import_use_event.useEvent)((newTheme) => {
|
|
126
118
|
if (forcedTheme) {
|
|
127
119
|
handleChangeTheme(newTheme, true, false);
|
|
128
120
|
} else {
|
|
129
121
|
handleChangeTheme(newTheme);
|
|
130
122
|
}
|
|
131
123
|
setThemeState(newTheme);
|
|
132
|
-
}
|
|
124
|
+
});
|
|
133
125
|
(0, import_react.useEffect)(() => {
|
|
134
126
|
const handleStorage = (e) => {
|
|
135
127
|
if (e.key !== storageKey) {
|
|
136
128
|
return;
|
|
137
129
|
}
|
|
138
130
|
const theme2 = e.newValue || defaultTheme;
|
|
139
|
-
|
|
131
|
+
set(theme2);
|
|
140
132
|
};
|
|
141
133
|
window.addEventListener("storage", handleStorage);
|
|
142
134
|
return () => {
|
|
143
135
|
window.removeEventListener("storage", handleStorage);
|
|
144
136
|
};
|
|
145
|
-
}, []);
|
|
137
|
+
}, [defaultTheme, set, storageKey]);
|
|
146
138
|
useIsomorphicLayoutEffect(() => {
|
|
147
139
|
if (!enableColorScheme)
|
|
148
140
|
return;
|
|
149
|
-
|
|
150
|
-
|
|
141
|
+
const colorScheme = forcedTheme && colorSchemes.includes(forcedTheme) ? forcedTheme : theme && colorSchemes.includes(theme) ? theme : theme === "system" ? resolvedTheme || null : null;
|
|
142
|
+
const userPrefers = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
143
|
+
const wePrefer = colorScheme || "light";
|
|
144
|
+
if (userPrefers !== wePrefer) {
|
|
145
|
+
document.documentElement.style.setProperty("color-scheme", colorScheme);
|
|
146
|
+
}
|
|
151
147
|
}, [enableColorScheme, theme, resolvedTheme, forcedTheme]);
|
|
148
|
+
const toggle = (0, import_use_event.useEvent)(() => {
|
|
149
|
+
const order = resolvedTheme === "dark" ? ["system", "light", "dark"] : ["system", "dark", "light"];
|
|
150
|
+
const next = order[(order.indexOf(theme) + 1) % order.length];
|
|
151
|
+
set(next);
|
|
152
|
+
});
|
|
153
|
+
const contextResolvedTheme = theme === "system" ? resolvedTheme : theme;
|
|
154
|
+
const systemTheme = enableSystem ? resolvedTheme : void 0;
|
|
152
155
|
const contextValue = (0, import_react.useMemo)(() => {
|
|
153
|
-
|
|
156
|
+
const value2 = {
|
|
154
157
|
theme,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const next = order[(order.indexOf(theme) + 1) % order.length];
|
|
159
|
-
setTheme(next);
|
|
160
|
-
},
|
|
158
|
+
current: theme,
|
|
159
|
+
set,
|
|
160
|
+
toggle,
|
|
161
161
|
forcedTheme,
|
|
162
|
-
resolvedTheme:
|
|
162
|
+
resolvedTheme: contextResolvedTheme,
|
|
163
163
|
themes: enableSystem ? [...themes, "system"] : themes,
|
|
164
|
-
systemTheme
|
|
164
|
+
systemTheme
|
|
165
165
|
};
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
return value2;
|
|
167
|
+
}, [theme, set, toggle, forcedTheme, contextResolvedTheme, enableSystem, themes, systemTheme]);
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ThemeSettingContext.Provider, {
|
|
169
|
+
value: contextValue,
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeScript, {
|
|
172
|
+
...{
|
|
173
|
+
forcedTheme,
|
|
174
|
+
storageKey,
|
|
175
|
+
systemTheme: resolvedTheme,
|
|
176
|
+
attribute,
|
|
177
|
+
value,
|
|
178
|
+
enableSystem,
|
|
179
|
+
defaultTheme,
|
|
180
|
+
attrs
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
(0, import_react.useMemo)(() => children, [children])
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const ThemeScript = (0, import_react.memo)(
|
|
188
|
+
({
|
|
170
189
|
forcedTheme,
|
|
171
190
|
storageKey,
|
|
172
|
-
systemTheme: resolvedTheme,
|
|
173
191
|
attribute,
|
|
174
|
-
value,
|
|
175
192
|
enableSystem,
|
|
176
193
|
defaultTheme,
|
|
194
|
+
value,
|
|
177
195
|
attrs
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
dangerouslySetInnerHTML: {
|
|
219
|
-
__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(defaultTheme)};}}catch(t){}}();`
|
|
220
|
-
}
|
|
221
|
-
}));
|
|
222
|
-
}, (prevProps, nextProps) => {
|
|
223
|
-
if (prevProps.forcedTheme !== nextProps.forcedTheme)
|
|
224
|
-
return false;
|
|
225
|
-
return true;
|
|
226
|
-
});
|
|
196
|
+
}) => {
|
|
197
|
+
const optimization = (() => {
|
|
198
|
+
if (attribute === "class") {
|
|
199
|
+
const removeClasses = attrs.map((t) => `d.remove('${t}')`).join(";");
|
|
200
|
+
return `var d=document.documentElement.classList;${removeClasses};`;
|
|
201
|
+
} else {
|
|
202
|
+
return `var d=document.documentElement;`;
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
const updateDOM = (name, literal) => {
|
|
206
|
+
name = (value == null ? void 0 : value[name]) || name;
|
|
207
|
+
const val = literal ? name : `'${name}'`;
|
|
208
|
+
if (attribute === "class") {
|
|
209
|
+
return `d.add(${val})`;
|
|
210
|
+
}
|
|
211
|
+
return `d.setAttribute('${attribute}', ${val})`;
|
|
212
|
+
};
|
|
213
|
+
const defaultSystem = defaultTheme === "system";
|
|
214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_head.default, {
|
|
215
|
+
children: forcedTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
|
|
216
|
+
dangerouslySetInnerHTML: {
|
|
217
|
+
__html: `!function(){${optimization}${updateDOM(forcedTheme)}}()`
|
|
218
|
+
}
|
|
219
|
+
}, "next-themes-script") : enableSystem ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
|
|
220
|
+
dangerouslySetInnerHTML: {
|
|
221
|
+
__html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${!defaultSystem ? updateDOM(defaultTheme) + ";" : ""}if("system"===e||(!e&&${defaultSystem})){var t="${MEDIA}",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM("dark")}:${updateDOM("light")}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? "x[e]" : "e", true)}}catch(e){}}()`
|
|
222
|
+
}
|
|
223
|
+
}, "next-themes-script") : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
|
|
224
|
+
dangerouslySetInnerHTML: {
|
|
225
|
+
__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(defaultTheme)};}}catch(t){}}();`
|
|
226
|
+
}
|
|
227
|
+
}, "next-themes-script")
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
(prevProps, nextProps) => {
|
|
231
|
+
if (prevProps.forcedTheme !== nextProps.forcedTheme)
|
|
232
|
+
return false;
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
);
|
|
227
236
|
const getTheme = (key, fallback) => {
|
|
228
237
|
if (typeof window === "undefined")
|
|
229
238
|
return void 0;
|
|
@@ -234,18 +243,6 @@ const getTheme = (key, fallback) => {
|
|
|
234
243
|
}
|
|
235
244
|
return theme || fallback;
|
|
236
245
|
};
|
|
237
|
-
const disableAnimation = () => {
|
|
238
|
-
const css = document.createElement("style");
|
|
239
|
-
css.appendChild(document.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
|
|
240
|
-
document.head.appendChild(css);
|
|
241
|
-
return () => {
|
|
242
|
-
;
|
|
243
|
-
(() => window.getComputedStyle(document.body))();
|
|
244
|
-
setTimeout(() => {
|
|
245
|
-
document.head.removeChild(css);
|
|
246
|
-
}, 1);
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
246
|
const getSystemTheme = (e) => {
|
|
250
247
|
if (!e) {
|
|
251
248
|
e = window.matchMedia(MEDIA);
|
|
@@ -258,6 +255,7 @@ const getSystemTheme = (e) => {
|
|
|
258
255
|
0 && (module.exports = {
|
|
259
256
|
NextThemeProvider,
|
|
260
257
|
useRootTheme,
|
|
261
|
-
useTheme
|
|
258
|
+
useTheme,
|
|
259
|
+
useThemeSetting
|
|
262
260
|
});
|
|
263
261
|
//# sourceMappingURL=NextTheme.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextTheme.tsx"],
|
|
4
|
-
"sourcesContent": ["// https://raw.githubusercontent.com/pacocoursey/next-themes/master/index.tsx\n// forked temporarily due to buggy theme change\n\nimport NextHead from 'next/head'\nimport * as React from 'react'\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\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 setTheme: (theme: string) => void\n toggleTheme: () => void\n /** Active theme name */\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\nconst ThemeContext = createContext<UseThemeProps>({\n toggleTheme: () => {},\n setTheme: (_) => {},\n themes: [],\n})\nexport const useTheme = () => useContext(ThemeContext)\n\nconst colorSchemes = ['light', 'dark']\nconst MEDIA = '(prefers-color-scheme: dark)'\n\ninterface ValueObject {\n [themeName: string]: string\n}\n\nexport const useRootTheme = () => {\n const isClient = typeof document !== 'undefined'\n // @ts-ignore\n const classes = isClient ? [...document.documentElement.classList] : []\n const isDark = classes.includes('t_dark')\n return useState(isDark ? 'dark' : 'light')\n}\n\nexport const NextThemeProvider: React.FC<ThemeProviderProps> = ({\n forcedTheme,\n disableTransitionOnChange = true,\n enableSystem = true,\n enableColorScheme = true,\n storageKey = 'theme',\n themes = ['light', 'dark'],\n defaultTheme = enableSystem ? 'system' : 'light',\n attribute = 'class',\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 = useCallback(\n (e?) => {\n const systemTheme = getSystemTheme(e)\n React.startTransition(() => {\n setResolvedTheme(systemTheme)\n })\n if (theme === 'system' && !forcedTheme) handleChangeTheme(systemTheme, false)\n },\n [theme, forcedTheme]\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 = useCallback((theme, updateStorage = true, updateDOM = true) => {\n let name = value?.[theme] || theme\n\n const enable = disableTransitionOnChange && updateDOM ? disableAnimation() : null\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\n if (attribute === 'class') {\n d.classList.remove(...attrs)\n d.classList.add(name)\n } else {\n d.setAttribute(attribute, name)\n }\n enable?.()\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 setTheme = useCallback(\n (newTheme) => {\n if (forcedTheme) {\n handleChangeTheme(newTheme, true, false)\n } else {\n handleChangeTheme(newTheme)\n }\n setThemeState(newTheme)\n },\n [forcedTheme]\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 setTheme(theme)\n }\n window.addEventListener('storage', handleStorage)\n return () => {\n window.removeEventListener('storage', handleStorage)\n }\n }, [])\n\n // color-scheme handling\n useIsomorphicLayoutEffect(() => {\n if (!enableColorScheme) return\n\n let 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 document.documentElement.style.setProperty('color-scheme', colorScheme)\n }, [enableColorScheme, theme, resolvedTheme, forcedTheme])\n\n const contextValue = useMemo(() => {\n return {\n theme,\n setTheme,\n toggleTheme() {\n const order =\n resolvedTheme === 'dark' ? ['system', 'light', 'dark'] : ['system', 'dark', 'light']\n const next = order[(order.indexOf(theme) + 1) % order.length]\n setTheme(next)\n },\n forcedTheme,\n resolvedTheme: theme === 'system' ? resolvedTheme : theme,\n themes: enableSystem ? [...themes, 'system'] : themes,\n systemTheme: (enableSystem ? resolvedTheme : undefined) as 'light' | 'dark' | undefined,\n } as const\n }, [theme, forcedTheme, resolvedTheme, enableSystem])\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemeScript\n {...{\n forcedTheme,\n storageKey,\n systemTheme: resolvedTheme,\n attribute,\n value,\n enableSystem,\n defaultTheme,\n attrs,\n }}\n />\n {children}\n </ThemeContext.Provider>\n )\n}\n\nconst ThemeScript = memo(\n ({\n forcedTheme,\n storageKey,\n attribute,\n enableSystem,\n defaultTheme,\n value,\n attrs,\n }: {\n forcedTheme?: string\n storageKey: string\n attribute?: string\n enableSystem?: boolean\n defaultTheme: string\n value?: ValueObject\n attrs: any\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 return (\n <NextHead>\n {forcedTheme ? (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // These are minified via Terser and then updated by hand, don't recommend\n // prettier-ignore\n __html: `!function(){${optimization}${updateDOM(forcedTheme)}}()`,\n }}\n />\n ) : enableSystem ? (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // prettier-ignore\n __html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${!defaultSystem ? updateDOM(defaultTheme) + ';' : ''}if(\"system\"===e||(!e&&${defaultSystem})){var t=\"${MEDIA}\",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM('dark')}:${updateDOM('light')}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ''}${updateDOM(value ? 'x[e]' : 'e', true)}}catch(e){}}()`,\n }}\n />\n ) : (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // prettier-ignore\n __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(defaultTheme)};}}catch(t){}}();`,\n }}\n />\n )}\n </NextHead>\n )\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\n// Helpers\nconst 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\nconst disableAnimation = () => {\n const css = document.createElement('style')\n css.appendChild(\n document.createTextNode(\n `*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`\n )\n )\n document.head.appendChild(css)\n\n return () => {\n // Force restyle\n ;(() => window.getComputedStyle(document.body))()\n\n // Wait for next tick before removing\n setTimeout(() => {\n document.head.removeChild(css)\n }, 1)\n }\n}\n\nconst 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": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["// https://raw.githubusercontent.com/pacocoursey/next-themes/master/index.tsx\n// forked temporarily due to buggy theme change\n\nimport { useEvent } from '@tamagui/use-event'\nimport NextHead from 'next/head'\nimport * as React from 'react'\nimport {\n createContext,\n memo,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\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\nconst ThemeSettingContext = createContext<UseThemeProps>({\n toggle: () => {},\n set: (_) => {},\n themes: [],\n})\n\n/**\n * @deprecated renamed to `useThemeSetting` to avoid confusion with core `useTheme` hook\n */\nexport const useTheme = () => useContext(ThemeSettingContext)\n\nexport const useThemeSetting = () => useContext(ThemeSettingContext)\n\nconst colorSchemes = ['light', 'dark']\nconst MEDIA = '(prefers-color-scheme: dark)'\n\ninterface ValueObject {\n [themeName: string]: string\n}\n\nexport const useRootTheme = () => {\n const isClient = typeof document !== 'undefined'\n // @ts-ignore\n const classes = isClient ? [...document.documentElement.classList] : []\n const isDark = classes.includes('t_dark')\n return useState(isDark ? 'dark' : 'light')\n}\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 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) handleChangeTheme(systemTheme, false)\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) {\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 'light' | 'dark' | 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 }, [theme, set, toggle, forcedTheme, contextResolvedTheme, enableSystem, themes, systemTheme])\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 }}\n />\n {/* because on SSR we re-run and can avoid whole tree re-render */}\n {useMemo(() => children, [children])}\n </ThemeSettingContext.Provider>\n )\n}\n\nconst ThemeScript = memo(\n ({\n forcedTheme,\n storageKey,\n attribute,\n enableSystem,\n defaultTheme,\n value,\n attrs,\n }: {\n forcedTheme?: string\n storageKey: string\n attribute?: string\n enableSystem?: boolean\n defaultTheme: string\n value?: ValueObject\n attrs: any\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 return (\n <NextHead>\n {forcedTheme ? (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // These are minified via Terser and then updated by hand, don't recommend\n // prettier-ignore\n __html: `!function(){${optimization}${updateDOM(forcedTheme)}}()`,\n }}\n />\n ) : enableSystem ? (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // prettier-ignore\n __html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${!defaultSystem ? updateDOM(defaultTheme) + ';' : ''}if(\"system\"===e||(!e&&${defaultSystem})){var t=\"${MEDIA}\",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM('dark')}:${updateDOM('light')}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ''}${updateDOM(value ? 'x[e]' : 'e', true)}}catch(e){}}()`,\n }}\n />\n ) : (\n <script\n key=\"next-themes-script\"\n dangerouslySetInnerHTML={{\n // prettier-ignore\n __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(defaultTheme)};}}catch(t){}}();`,\n }}\n />\n )}\n </NextHead>\n )\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\n// Helpers\nconst 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\nconst 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": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqPI;AAlPJ,uBAAyB;AACzB,kBAAqB;AACrB,YAAuB;AACvB,mBASO;AAEP,MAAM,4BAA4B,OAAO,WAAW,cAAc,+BAAkB;AA4CpF,MAAM,0BAAsB,4BAA6B;AAAA,EACvD,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,KAAK,CAAC,MAAM;AAAA,EAAC;AAAA,EACb,QAAQ,CAAC;AACX,CAAC;AAKM,M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