@koine/next 2.0.0-alpha.4 → 2.0.0-beta.10
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/12/AnalyticsGoogle.js +65 -25
- package/12/AnalyticsGoogle.mjs +41 -15
- package/12/DisableErrorOverlay.js +29 -16
- package/12/DisableErrorOverlay.mjs +8 -5
- package/12/DynamicNamespaces.d.ts +1 -1
- package/12/DynamicNamespaces.js +22 -12
- package/12/DynamicNamespaces.mjs +1 -2
- package/12/Favicon.js +28 -9
- package/12/Favicon.mjs +6 -2
- package/12/Link.d.ts +1 -1
- package/12/Link.js +36 -13
- package/12/Link.mjs +14 -6
- package/12/NextProgress.js +47 -24
- package/12/NextProgress.mjs +26 -17
- package/12/Seo.d.ts +1 -1
- package/12/Seo.js +27 -32
- package/12/Seo.mjs +5 -4
- package/12/SeoDefaults.d.ts +1 -1
- package/12/SeoDefaults.js +27 -13
- package/12/SeoDefaults.mjs +5 -3
- package/12/T.d.ts +1 -1
- package/12/T.js +42 -16
- package/12/T.mjs +20 -6
- package/12/ThemeContext.js +22 -7
- package/12/ThemeContext.mjs +3 -3
- package/12/ThemeProvider.js +164 -147
- package/12/ThemeProvider.mjs +139 -129
- package/12/TransText.js +22 -7
- package/12/TransText.mjs +1 -1
- package/12/app/AppHead.js +29 -9
- package/12/app/AppHead.mjs +8 -2
- package/12/app/AppMain.d.ts +4 -4
- package/12/app/AppMain.js +5 -1
- package/12/app/AppMain.mjs +1 -1
- package/12/app/css/AppMain.js +37 -16
- package/12/app/css/AppMain.mjs +15 -5
- package/12/app/css/AppTheme.d.ts +1 -1
- package/12/app/css/AppTheme.js +28 -13
- package/12/app/css/AppTheme.mjs +7 -4
- package/12/app/css/auth/index.d.ts +1 -1
- package/12/app/css/auth/index.js +38 -15
- package/12/app/css/auth/index.mjs +17 -6
- package/12/app/css/index.d.ts +1 -1
- package/12/app/css/index.js +34 -59
- package/12/app/css/index.mjs +14 -6
- package/12/app/index.js +6 -4
- package/12/app/sc/AppMain.js +68 -27
- package/12/app/sc/AppMain.mjs +46 -13
- package/12/app/sc/AppTheme.d.ts +1 -1
- package/12/app/sc/AppTheme.js +31 -13
- package/12/app/sc/AppTheme.mjs +9 -4
- package/12/app/sc/auth/index.d.ts +1 -1
- package/12/app/sc/auth/index.js +38 -15
- package/12/app/sc/auth/index.mjs +17 -6
- package/12/app/sc/index.d.ts +1 -1
- package/12/app/sc/index.js +34 -61
- package/12/app/sc/index.mjs +14 -6
- package/12/document/Document.js +47 -29
- package/12/document/Document.mjs +24 -14
- package/12/document/css/index.js +47 -32
- package/12/document/css/index.mjs +26 -18
- package/12/document/index.js +18 -6
- package/12/document/sc/index.js +71 -65
- package/12/document/sc/index.mjs +46 -45
- package/12/getT.js +22 -13
- package/12/getT.mjs +2 -4
- package/12/index.js +99 -51
- package/12/index.mjs +2 -2
- package/12/seoBuildTags.js +81 -76
- package/12/seoBuildTags.mjs +59 -55
- package/12/to.js +21 -19
- package/12/to.mjs +4 -10
- package/12/translationAsOptions.js +15 -9
- package/12/translationAsOptions.mjs +6 -6
- package/12/types-i18n.js +4 -3
- package/12/types-i18n.mjs +1 -2
- package/12/types-seo.js +3 -1
- package/12/types-seo.mjs +1 -1
- package/12/useBackUrl.js +30 -16
- package/12/useBackUrl.mjs +8 -8
- package/12/useDateFormat.js +37 -38
- package/12/useDateFormat.mjs +15 -28
- package/12/useForm.d.ts +1 -1
- package/12/useForm.js +46 -20
- package/12/useForm.mjs +25 -13
- package/12/useLocale.js +22 -8
- package/12/useT.d.ts +1 -1
- package/12/useT.js +53 -39
- package/12/useT.mjs +32 -14
- package/12/useTheme.js +22 -11
- package/12/useTheme.mjs +1 -2
- package/12/useTo.js +23 -16
- package/12/useTo.mjs +3 -10
- package/README.md +1 -1
- package/config/index.js +225 -251
- package/config/index.mjs +187 -204
- package/getSiteUrl.js +22 -15
- package/getSiteUrl.mjs +2 -4
- package/index.js +19 -6
- package/load.js +21 -8
- package/load.mjs +3 -4
- package/package.json +23 -16
- package/typings.d.ts +60 -0
- package/12/app/css/auth/package.json +0 -6
- package/12/app/css/package.json +0 -6
- package/12/app/package.json +0 -6
- package/12/app/sc/auth/package.json +0 -6
- package/12/app/sc/package.json +0 -6
- package/12/document/css/package.json +0 -6
- package/12/document/package.json +0 -6
- package/12/document/sc/package.json +0 -6
- package/12/package.json +0 -6
- package/config/package.json +0 -6
package/12/ThemeProvider.js
CHANGED
|
@@ -1,69 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
exports
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
ThemeProvider: function() {
|
|
14
|
+
return ThemeProvider;
|
|
15
|
+
},
|
|
16
|
+
default: function() {
|
|
17
|
+
return _default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
21
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
|
+
const _script = /*#__PURE__*/ _interop_require_default._(require("next/script"));
|
|
23
|
+
const _react = require("react");
|
|
24
|
+
const _isServer = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/isServer"));
|
|
25
|
+
const _ThemeContext = require("./ThemeContext");
|
|
26
|
+
const colorSchemes = [
|
|
27
|
+
"light",
|
|
28
|
+
"dark"
|
|
29
|
+
];
|
|
30
|
+
const MEDIA = "(prefers-color-scheme: dark)";
|
|
31
|
+
const THEME_STORAGE_KEY = "theme";
|
|
32
|
+
const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme, themes = [
|
|
33
|
+
"light",
|
|
34
|
+
"dark"
|
|
35
|
+
], defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce })=>{
|
|
36
|
+
const [theme, setThemeState] = (0, _react.useState)(()=>getTheme(THEME_STORAGE_KEY, defaultTheme));
|
|
37
|
+
const [resolvedTheme, setResolvedTheme] = (0, _react.useState)(()=>getTheme(THEME_STORAGE_KEY));
|
|
38
|
+
const attrs = !value ? themes : Object.values(value);
|
|
39
|
+
const applyTheme = (0, _react.useCallback)((theme)=>{
|
|
40
|
+
let resolved = theme;
|
|
41
|
+
if (_isServer.default || !resolved) return;
|
|
37
42
|
// If theme is system, resolve it before setting theme
|
|
38
43
|
if (theme === "system" && enableSystem) {
|
|
39
44
|
resolved = getSystemTheme();
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const name = value ? value[resolved] : resolved;
|
|
47
|
+
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
48
|
+
const d = document.documentElement;
|
|
44
49
|
if (attribute === "class") {
|
|
45
|
-
|
|
46
|
-
if (name)
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
+
d.classList.remove(...attrs);
|
|
51
|
+
if (name) d.classList.add(name);
|
|
52
|
+
} else {
|
|
50
53
|
if (name) {
|
|
51
54
|
d.setAttribute(attribute, name);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
55
|
+
} else {
|
|
54
56
|
d.removeAttribute(attribute);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
if (enableColorScheme) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: "";
|
|
61
|
-
var colorScheme = colorSchemes.includes(resolved)
|
|
62
|
-
? resolved
|
|
63
|
-
: fallback;
|
|
60
|
+
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : "";
|
|
61
|
+
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
64
62
|
d.style.colorScheme = colorScheme;
|
|
65
63
|
}
|
|
66
|
-
enable
|
|
64
|
+
enable?.();
|
|
67
65
|
}, [
|
|
68
66
|
attribute,
|
|
69
67
|
attrs,
|
|
@@ -71,169 +69,188 @@ var ThemeProvider = function (_a) {
|
|
|
71
69
|
disableTransitionOnChange,
|
|
72
70
|
enableColorScheme,
|
|
73
71
|
enableSystem,
|
|
74
|
-
value
|
|
72
|
+
value
|
|
75
73
|
]);
|
|
76
|
-
|
|
74
|
+
const setTheme = (0, _react.useCallback)((theme)=>{
|
|
77
75
|
setThemeState(theme);
|
|
78
76
|
// Save to storage
|
|
79
77
|
try {
|
|
80
78
|
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Unsupported
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// Unsupported
|
|
84
81
|
}
|
|
85
82
|
}, []);
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
const handleMediaQuery = (0, _react.useCallback)((e)=>{
|
|
84
|
+
const resolved = getSystemTheme(e);
|
|
88
85
|
setResolvedTheme(resolved);
|
|
89
86
|
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
90
87
|
applyTheme("system");
|
|
91
88
|
}
|
|
92
|
-
}, [
|
|
89
|
+
}, [
|
|
90
|
+
theme,
|
|
91
|
+
enableSystem,
|
|
92
|
+
forcedTheme,
|
|
93
|
+
applyTheme
|
|
94
|
+
]);
|
|
93
95
|
// Always listen to System preference
|
|
94
|
-
(0,
|
|
95
|
-
|
|
96
|
+
(0, _react.useEffect)(()=>{
|
|
97
|
+
const media = window.matchMedia(MEDIA);
|
|
96
98
|
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
97
99
|
media.addListener(handleMediaQuery);
|
|
98
100
|
handleMediaQuery(media);
|
|
99
|
-
return
|
|
100
|
-
}, [
|
|
101
|
+
return ()=>media.removeListener(handleMediaQuery);
|
|
102
|
+
}, [
|
|
103
|
+
handleMediaQuery
|
|
104
|
+
]);
|
|
101
105
|
// localStorage event handling
|
|
102
|
-
(0,
|
|
103
|
-
|
|
106
|
+
(0, _react.useEffect)(()=>{
|
|
107
|
+
const handleStorage = (e)=>{
|
|
104
108
|
if (e.key !== THEME_STORAGE_KEY) {
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
107
111
|
// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
108
|
-
|
|
112
|
+
const theme = e.newValue || defaultTheme;
|
|
109
113
|
setTheme(theme);
|
|
110
114
|
};
|
|
111
115
|
window.addEventListener("storage", handleStorage);
|
|
112
|
-
return
|
|
113
|
-
}, [
|
|
116
|
+
return ()=>window.removeEventListener("storage", handleStorage);
|
|
117
|
+
}, [
|
|
118
|
+
defaultTheme,
|
|
119
|
+
setTheme
|
|
120
|
+
]);
|
|
114
121
|
// Whenever theme or forcedTheme changes, apply it
|
|
115
|
-
(0,
|
|
116
|
-
applyTheme(forcedTheme
|
|
117
|
-
}, [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
(0, _react.useEffect)(()=>{
|
|
123
|
+
applyTheme(forcedTheme ?? theme);
|
|
124
|
+
}, [
|
|
125
|
+
applyTheme,
|
|
126
|
+
forcedTheme,
|
|
127
|
+
theme
|
|
128
|
+
]);
|
|
129
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ThemeContext.ThemeContext.Provider, {
|
|
130
|
+
value: {
|
|
131
|
+
theme,
|
|
132
|
+
setTheme,
|
|
133
|
+
forcedTheme,
|
|
122
134
|
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
123
|
-
themes: enableSystem ?
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
themes: enableSystem ? [
|
|
136
|
+
...themes,
|
|
137
|
+
"system"
|
|
138
|
+
] : themes,
|
|
139
|
+
systemTheme: enableSystem ? resolvedTheme : undefined
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(ThemeScript, {
|
|
143
|
+
forcedTheme,
|
|
144
|
+
disableTransitionOnChange,
|
|
145
|
+
enableSystem,
|
|
146
|
+
enableColorScheme,
|
|
147
|
+
themes,
|
|
148
|
+
defaultTheme,
|
|
149
|
+
attribute,
|
|
150
|
+
value,
|
|
151
|
+
children,
|
|
152
|
+
attrs,
|
|
153
|
+
nonce
|
|
154
|
+
}),
|
|
155
|
+
children
|
|
156
|
+
]
|
|
157
|
+
});
|
|
126
158
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var forcedTheme = _a.forcedTheme, attribute = _a.attribute, enableSystem = _a.enableSystem, enableColorScheme = _a.enableColorScheme, defaultTheme = _a.defaultTheme, value = _a.value, attrs = _a.attrs, nonce = _a.nonce;
|
|
130
|
-
var defaultSystem = defaultTheme === "system";
|
|
159
|
+
const ThemeScript = /*#__PURE__*/ (0, _react.memo)(({ forcedTheme, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce })=>{
|
|
160
|
+
const defaultSystem = defaultTheme === "system";
|
|
131
161
|
// Code-golfing the amount of characters in the script
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.join(","), ")");
|
|
136
|
-
return "var d=document.documentElement.classList;".concat(removeClasses, ";");
|
|
162
|
+
const optimization = (()=>{
|
|
163
|
+
const removeClasses = `d.remove(${attrs.map((t)=>`'${t}'`).join(",")})`;
|
|
164
|
+
return `var d=document.documentElement.classList;${removeClasses};`;
|
|
137
165
|
})();
|
|
138
|
-
|
|
166
|
+
const fallbackColorScheme = (()=>{
|
|
139
167
|
if (!enableColorScheme) {
|
|
140
168
|
return "";
|
|
141
169
|
}
|
|
142
|
-
|
|
143
|
-
? defaultTheme
|
|
144
|
-
: null;
|
|
170
|
+
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null;
|
|
145
171
|
if (fallback) {
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return "if(e==='light'||e==='dark')d.style.colorScheme=e";
|
|
172
|
+
return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
|
|
173
|
+
} else {
|
|
174
|
+
return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
|
|
150
175
|
}
|
|
151
176
|
})();
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var val = literal ? name + "|| ''" : "'".concat(resolvedName, "'");
|
|
157
|
-
var text = "";
|
|
177
|
+
const updateDOM = (name, literal = false, setColorScheme = true)=>{
|
|
178
|
+
const resolvedName = value ? value[name] : name;
|
|
179
|
+
const val = literal ? name + `|| ''` : `'${resolvedName}'`;
|
|
180
|
+
let text = "";
|
|
158
181
|
// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
159
182
|
// as it only incurs 1 style recalculation rather than 2
|
|
160
183
|
// This can save over 250ms of work for pages with big DOM
|
|
161
|
-
if (enableColorScheme &&
|
|
162
|
-
|
|
163
|
-
!literal &&
|
|
164
|
-
colorSchemes.includes(name)) {
|
|
165
|
-
text += "d.style.colorScheme = '".concat(name, "';");
|
|
184
|
+
if (enableColorScheme && setColorScheme && !literal && colorSchemes.includes(name)) {
|
|
185
|
+
text += `d.style.colorScheme = '${name}';`;
|
|
166
186
|
}
|
|
167
187
|
if (attribute === "class") {
|
|
168
188
|
if (literal || resolvedName) {
|
|
169
|
-
text +=
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
text += "null";
|
|
189
|
+
text += `d.add(${val})`;
|
|
190
|
+
} else {
|
|
191
|
+
text += `null`;
|
|
173
192
|
}
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
193
|
+
} else {
|
|
176
194
|
if (resolvedName) {
|
|
177
|
-
text +=
|
|
195
|
+
text += `d[s](n, ${val})`;
|
|
178
196
|
}
|
|
179
197
|
}
|
|
180
198
|
return text;
|
|
181
199
|
};
|
|
182
|
-
|
|
200
|
+
const scriptSrc = (()=>{
|
|
183
201
|
if (forcedTheme) {
|
|
184
|
-
return
|
|
202
|
+
return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
|
|
185
203
|
}
|
|
186
204
|
if (enableSystem) {
|
|
187
|
-
return
|
|
188
|
-
? "else{" + updateDOM(defaultTheme, false, false) + "}"
|
|
189
|
-
: "").concat(fallbackColorScheme, "}catch(e){}}()");
|
|
205
|
+
return `!function(){try {${optimization}var e=localStorage.getItem('${THEME_STORAGE_KEY}');if("system"===e||(!e&&${defaultSystem})){var t="${MEDIA}",m=window.matchMedia(t);if(m.media!==t||m.matches){${updateDOM("dark")}}else{${updateDOM("light")}}}else if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}${!defaultSystem ? `else{` + updateDOM(defaultTheme, false, false) + "}" : ""}${fallbackColorScheme}}catch(e){}}()`;
|
|
190
206
|
}
|
|
191
|
-
return
|
|
207
|
+
return `!function(){try{${optimization}var e=localStorage.getItem("${THEME_STORAGE_KEY}");if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}else{${updateDOM(defaultTheme, false, false)};}${fallbackColorScheme}}catch(t){}}();`;
|
|
192
208
|
})();
|
|
193
209
|
// We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
|
|
194
210
|
// However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
|
|
195
211
|
// But our script cannot be external because it changes at runtime based on React props
|
|
196
212
|
// so we trick next/script by passing `src` as a base64 JS script
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
213
|
+
const encodedScript = `data:text/javascript;base64,${encodeBase64(scriptSrc)}`;
|
|
214
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_script.default, {
|
|
215
|
+
id: "next-theme-script",
|
|
216
|
+
strategy: "beforeInteractive",
|
|
217
|
+
src: encodedScript,
|
|
218
|
+
nonce: nonce
|
|
219
|
+
});
|
|
220
|
+
}, // Never re-render this component
|
|
221
|
+
()=>true);
|
|
202
222
|
// Helpers
|
|
203
|
-
|
|
204
|
-
if (
|
|
205
|
-
|
|
206
|
-
var theme;
|
|
223
|
+
const getTheme = (key, fallback)=>{
|
|
224
|
+
if (_isServer.default) return undefined;
|
|
225
|
+
let theme;
|
|
207
226
|
try {
|
|
208
227
|
theme = localStorage.getItem(key) || undefined;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Unsupported
|
|
228
|
+
} catch (e) {
|
|
229
|
+
// Unsupported
|
|
212
230
|
}
|
|
213
231
|
return theme || fallback;
|
|
214
232
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
css.appendChild(d.createTextNode(
|
|
233
|
+
const disableAnimation = ()=>{
|
|
234
|
+
const d = document;
|
|
235
|
+
const css = d.createElement("style");
|
|
236
|
+
css.appendChild(d.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
|
|
219
237
|
d.head.appendChild(css);
|
|
220
|
-
return
|
|
238
|
+
return ()=>{
|
|
221
239
|
// Force restyle
|
|
222
|
-
(
|
|
240
|
+
(()=>window.getComputedStyle(d.body))();
|
|
223
241
|
// Wait for next tick before removing
|
|
224
|
-
setTimeout(
|
|
242
|
+
setTimeout(()=>{
|
|
225
243
|
d.head.removeChild(css);
|
|
226
244
|
}, 1);
|
|
227
245
|
};
|
|
228
246
|
};
|
|
229
|
-
|
|
230
|
-
if (!e)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
var systemTheme = isDark ? "dark" : "light";
|
|
247
|
+
const getSystemTheme = (e)=>{
|
|
248
|
+
if (!e) e = window.matchMedia(MEDIA);
|
|
249
|
+
const isDark = e.matches;
|
|
250
|
+
const systemTheme = isDark ? "dark" : "light";
|
|
234
251
|
return systemTheme;
|
|
235
252
|
};
|
|
236
|
-
|
|
237
|
-
return
|
|
253
|
+
const encodeBase64 = (str)=>{
|
|
254
|
+
return _isServer.default ? Buffer.from(str).toString("base64") : btoa(str);
|
|
238
255
|
};
|
|
239
|
-
|
|
256
|
+
const _default = ThemeProvider;
|