@tamagui/next-theme 2.7.7 → 3.0.0-beta.643.1
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.cjs +10 -11
- package/dist/cjs/NextThemeProvider.cjs +182 -201
- package/dist/cjs/ThemeSettingContext.cjs +18 -21
- package/dist/cjs/UseThemeProps.cjs +10 -11
- package/dist/cjs/constants.cjs +17 -18
- package/dist/cjs/helpers.cjs +30 -31
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/useRootTheme.cjs +22 -27
- package/dist/cjs/useTheme.cjs +15 -20
- package/dist/esm/NextTheme.mjs +15 -9
- package/dist/esm/NextThemeProvider.mjs +166 -175
- package/dist/esm/NextThemeProvider.mjs.map +1 -1
- package/dist/esm/ThemeSettingContext.mjs +5 -3
- package/dist/esm/ThemeSettingContext.mjs.map +1 -1
- package/dist/esm/UseThemeProps.mjs +0 -2
- package/dist/esm/constants.mjs +1 -0
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/helpers.mjs +15 -13
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/useRootTheme.mjs +9 -9
- package/dist/esm/useRootTheme.mjs.map +1 -1
- package/dist/esm/useTheme.mjs +3 -2
- package/dist/esm/useTheme.mjs.map +1 -1
- package/package.json +5 -5
- package/src/NextThemeProvider.tsx +0 -1
- package/src/UseThemeProps.tsx +0 -2
- package/src/useTheme.tsx +0 -6
- package/types/NextThemeProvider.d.ts.map +1 -1
- package/types/UseThemeProps.d.ts +0 -2
- package/types/UseThemeProps.d.ts.map +2 -2
- package/types/useTheme.d.ts +0 -4
- package/types/useTheme.d.ts.map +2 -2
- package/dist/esm/NextTheme.mjs.map +0 -1
- package/dist/esm/UseThemeProps.mjs.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
package/dist/cjs/NextTheme.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
17
|
var NextTheme_exports = {};
|
|
19
18
|
module.exports = __toCommonJS(NextTheme_exports);
|
|
20
19
|
__reExport(NextTheme_exports, require("./NextThemeProvider.cjs"), module.exports);
|
|
@@ -24,4 +23,4 @@ __reExport(NextTheme_exports, require("./helpers.cjs"), module.exports);
|
|
|
24
23
|
__reExport(NextTheme_exports, require("./constants.cjs"), module.exports);
|
|
25
24
|
__reExport(NextTheme_exports, require("./useTheme.cjs"), module.exports);
|
|
26
25
|
__reExport(NextTheme_exports, require("./types.cjs"), module.exports);
|
|
27
|
-
__reExport(NextTheme_exports, require("./useRootTheme.cjs"), module.exports);
|
|
26
|
+
__reExport(NextTheme_exports, require("./useRootTheme.cjs"), module.exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,36 +6,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
30
26
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
28
|
var NextThemeProvider_exports = {};
|
|
35
|
-
__export(NextThemeProvider_exports, {
|
|
36
|
-
NextThemeProvider: () => NextThemeProvider
|
|
37
|
-
});
|
|
29
|
+
__export(NextThemeProvider_exports, { NextThemeProvider: () => NextThemeProvider });
|
|
38
30
|
module.exports = __toCommonJS(NextThemeProvider_exports);
|
|
39
31
|
var import_constants = require("@tamagui/constants");
|
|
40
32
|
var import_use_event = require("@tamagui/use-event");
|
|
@@ -45,181 +37,170 @@ var import_constants2 = require("./constants.cjs");
|
|
|
45
37
|
var import_helpers = require("./helpers.cjs");
|
|
46
38
|
var import_ThemeSettingContext = require("./ThemeSettingContext.cjs");
|
|
47
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
|
-
const NextThemeProvider = (0, import_react.memo)(({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
40
|
+
const NextThemeProvider = (0, import_react.memo)(({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, storageKey = "theme", themes = import_constants2.colorSchemes, defaultTheme = enableSystem ? "system" : "light", attribute = "class", skipNextHead, onChangeTheme, value = {
|
|
41
|
+
dark: "t_dark",
|
|
42
|
+
light: "t_light"
|
|
43
|
+
}, children }) => {
|
|
44
|
+
const [theme, setThemeState] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey, defaultTheme));
|
|
45
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey));
|
|
46
|
+
const attrs = !value ? themes : Object.values(value);
|
|
47
|
+
const handleMediaQuery = (0, import_use_event.useEvent)((e) => {
|
|
48
|
+
const _ = (0, import_helpers.getSystemTheme)(e);
|
|
49
|
+
const update = () => setResolvedTheme(_);
|
|
50
|
+
if (disableTransitionOnChange) {
|
|
51
|
+
update();
|
|
52
|
+
} else {
|
|
53
|
+
React.startTransition(() => update());
|
|
54
|
+
}
|
|
55
|
+
if (theme === "system" && !forcedTheme) {
|
|
56
|
+
handleChangeTheme(_, false);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const handleChangeTheme = (0, import_use_event.useEvent)((theme2, updateStorage = true, updateDOM = true) => {
|
|
60
|
+
let name = value?.[theme2] || theme2;
|
|
61
|
+
if (updateStorage) {
|
|
62
|
+
try {
|
|
63
|
+
localStorage.setItem(storageKey, theme2);
|
|
64
|
+
} catch (e) {}
|
|
65
|
+
}
|
|
66
|
+
if (theme2 === "system" && enableSystem) {
|
|
67
|
+
const resolved = (0, import_helpers.getSystemTheme)();
|
|
68
|
+
name = value?.[resolved] || resolved;
|
|
69
|
+
}
|
|
70
|
+
onChangeTheme?.(name.replace("t_", ""));
|
|
71
|
+
if (updateDOM) {
|
|
72
|
+
const d = document.documentElement;
|
|
73
|
+
if (attribute === "class") {
|
|
74
|
+
d.classList.remove(...attrs);
|
|
75
|
+
d.classList.add(name);
|
|
76
|
+
} else {
|
|
77
|
+
d.setAttribute(attribute, name);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
82
|
+
const media = window.matchMedia(import_constants2.MEDIA);
|
|
83
|
+
media.addListener(handleMediaQuery);
|
|
84
|
+
handleMediaQuery(media);
|
|
85
|
+
return () => {
|
|
86
|
+
media.removeListener(handleMediaQuery);
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
const set = (0, import_use_event.useEvent)((newTheme) => {
|
|
90
|
+
if (forcedTheme) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
handleChangeTheme(newTheme);
|
|
94
|
+
setThemeState(newTheme);
|
|
95
|
+
});
|
|
96
|
+
(0, import_react.useEffect)(() => {
|
|
97
|
+
const handleStorage = (e) => {
|
|
98
|
+
if (e.key !== storageKey) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const theme2 = e.newValue || defaultTheme;
|
|
102
|
+
set(theme2);
|
|
103
|
+
};
|
|
104
|
+
window.addEventListener("storage", handleStorage);
|
|
105
|
+
return () => {
|
|
106
|
+
window.removeEventListener("storage", handleStorage);
|
|
107
|
+
};
|
|
108
|
+
}, [
|
|
109
|
+
defaultTheme,
|
|
110
|
+
set,
|
|
111
|
+
storageKey
|
|
112
|
+
]);
|
|
113
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
114
|
+
if (!enableColorScheme) return;
|
|
115
|
+
const colorScheme = forcedTheme && import_constants2.colorSchemes.includes(forcedTheme) ? forcedTheme : theme && import_constants2.colorSchemes.includes(theme) ? theme : theme === "system" ? resolvedTheme || null : null;
|
|
116
|
+
const userPrefers = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
117
|
+
const wePrefer = colorScheme || "light";
|
|
118
|
+
if (userPrefers !== wePrefer) {
|
|
119
|
+
document.documentElement.style.setProperty("color-scheme", colorScheme);
|
|
120
|
+
}
|
|
121
|
+
}, [
|
|
122
|
+
enableColorScheme,
|
|
123
|
+
theme,
|
|
124
|
+
resolvedTheme,
|
|
125
|
+
forcedTheme
|
|
126
|
+
]);
|
|
127
|
+
const toggle = (0, import_use_event.useEvent)(() => {
|
|
128
|
+
const order = resolvedTheme === "dark" ? [
|
|
129
|
+
"system",
|
|
130
|
+
"light",
|
|
131
|
+
"dark"
|
|
132
|
+
] : [
|
|
133
|
+
"system",
|
|
134
|
+
"dark",
|
|
135
|
+
"light"
|
|
136
|
+
];
|
|
137
|
+
const next = order[(order.indexOf(theme) + 1) % order.length];
|
|
138
|
+
set(next);
|
|
139
|
+
});
|
|
140
|
+
const systemTheme = enableSystem ? resolvedTheme : void 0;
|
|
141
|
+
const contextValue = (0, import_react.useMemo)(() => {
|
|
142
|
+
const value2 = {
|
|
143
|
+
current: theme,
|
|
144
|
+
set,
|
|
145
|
+
toggle,
|
|
146
|
+
forcedTheme,
|
|
147
|
+
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
148
|
+
themes: enableSystem ? [...themes, "system"] : themes,
|
|
149
|
+
systemTheme
|
|
150
|
+
};
|
|
151
|
+
return value2;
|
|
152
|
+
}, [
|
|
153
|
+
theme,
|
|
154
|
+
set,
|
|
155
|
+
toggle,
|
|
156
|
+
forcedTheme,
|
|
157
|
+
resolvedTheme,
|
|
158
|
+
enableSystem,
|
|
159
|
+
themes,
|
|
160
|
+
systemTheme
|
|
161
|
+
]);
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ThemeSettingContext.ThemeSettingContext.Provider, {
|
|
163
|
+
value: contextValue,
|
|
164
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeScript, { ...{
|
|
165
|
+
forcedTheme,
|
|
166
|
+
storageKey,
|
|
167
|
+
systemTheme: resolvedTheme,
|
|
168
|
+
attribute,
|
|
169
|
+
value,
|
|
170
|
+
enableSystem,
|
|
171
|
+
defaultTheme,
|
|
172
|
+
attrs,
|
|
173
|
+
skipNextHead
|
|
174
|
+
} }), children]
|
|
175
|
+
});
|
|
180
176
|
});
|
|
181
|
-
const ThemeScript = (0, import_react.memo)(({
|
|
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
|
-
const scriptContent = forcedTheme ? `!function(){${optimization}${updateDOM(forcedTheme)}}()` : enableSystem ? `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');if("system"===e||(!e&&${defaultSystem})){var t="${import_constants2.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)}}${!defaultSystem ? `else{${updateDOM(defaultTheme)}}` : ""}}catch(e){}}()` : `!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){}}();`;
|
|
208
|
-
if (skipNextHead) {
|
|
209
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("script", {
|
|
210
|
-
dangerouslySetInnerHTML: {
|
|
211
|
-
__html: scriptContent
|
|
212
|
-
}
|
|
213
|
-
}, "next-themes-script");
|
|
214
|
-
}
|
|
215
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_script.default, {
|
|
216
|
-
id: "next-themes-script",
|
|
217
|
-
strategy: "beforeInteractive",
|
|
218
|
-
dangerouslySetInnerHTML: {
|
|
219
|
-
__html: scriptContent
|
|
220
|
-
}
|
|
221
|
-
});
|
|
177
|
+
const ThemeScript = (0, import_react.memo)(({ forcedTheme, storageKey, attribute, enableSystem, defaultTheme, value, attrs, skipNextHead }) => {
|
|
178
|
+
const optimization = (() => {
|
|
179
|
+
if (attribute === "class") {
|
|
180
|
+
const removeClasses = attrs.map((t) => `d.remove('${t}')`).join(";");
|
|
181
|
+
return `var d=document.documentElement.classList;${removeClasses};`;
|
|
182
|
+
}
|
|
183
|
+
return `var d=document.documentElement;`;
|
|
184
|
+
})();
|
|
185
|
+
const updateDOM = (name, literal) => {
|
|
186
|
+
name = value?.[name] || name;
|
|
187
|
+
const val = literal ? name : `'${name}'`;
|
|
188
|
+
if (attribute === "class") {
|
|
189
|
+
return `d.add(${val})`;
|
|
190
|
+
}
|
|
191
|
+
return `d.setAttribute('${attribute}', ${val})`;
|
|
192
|
+
};
|
|
193
|
+
const defaultSystem = defaultTheme === "system";
|
|
194
|
+
const scriptContent = forcedTheme ? `!function(){${optimization}${updateDOM(forcedTheme)}}()` : enableSystem ? `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');if("system"===e||(!e&&${defaultSystem})){var t="${import_constants2.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)}}${!defaultSystem ? `else{${updateDOM(defaultTheme)}}` : ""}}catch(e){}}()` : `!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){}}();`;
|
|
195
|
+
if (skipNextHead) {
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", { dangerouslySetInnerHTML: { __html: scriptContent } }, "next-themes-script");
|
|
197
|
+
}
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_script.default, {
|
|
199
|
+
id: "next-themes-script",
|
|
200
|
+
strategy: "beforeInteractive",
|
|
201
|
+
dangerouslySetInnerHTML: { __html: scriptContent }
|
|
202
|
+
});
|
|
222
203
|
}, (prevProps, nextProps) => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
204
|
+
if (prevProps.forcedTheme !== nextProps.forcedTheme) return false;
|
|
205
|
+
return true;
|
|
206
|
+
});
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var ThemeSettingContext_exports = {};
|
|
24
|
-
__export(ThemeSettingContext_exports, {
|
|
25
|
-
ThemeSettingContext: () => ThemeSettingContext
|
|
26
|
-
});
|
|
23
|
+
__export(ThemeSettingContext_exports, { ThemeSettingContext: () => ThemeSettingContext });
|
|
27
24
|
module.exports = __toCommonJS(ThemeSettingContext_exports);
|
|
28
25
|
var import_react = require("react");
|
|
29
26
|
const ThemeSettingContext = (0, import_react.createContext)({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
27
|
+
toggle: () => {},
|
|
28
|
+
set: (_) => {},
|
|
29
|
+
themes: []
|
|
30
|
+
});
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
}), mod);
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
16
|
var UseThemeProps_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(UseThemeProps_exports);
|
|
17
|
+
module.exports = __toCommonJS(UseThemeProps_exports);
|
package/dist/cjs/constants.cjs
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var constants_exports = {};
|
|
24
23
|
__export(constants_exports, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
MEDIA: () => MEDIA,
|
|
25
|
+
colorSchemes: () => colorSchemes,
|
|
26
|
+
constants: () => constants
|
|
28
27
|
});
|
|
29
28
|
module.exports = __toCommonJS(constants_exports);
|
|
30
29
|
const constants = {};
|
|
31
30
|
const colorSchemes = ["light", "dark"];
|
|
32
|
-
const MEDIA = "(prefers-color-scheme: dark)";
|
|
31
|
+
const MEDIA = "(prefers-color-scheme: dark)";
|