@tamagui/next-theme 1.88.1 → 1.88.2
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 +0 -11
- package/dist/cjs/NextThemeProvider.js +4 -8
- package/dist/cjs/NextThemeProvider.js.map +1 -1
- package/dist/cjs/ThemeSettingContext.js +0 -4
- package/dist/cjs/constants.js +0 -6
- package/dist/cjs/helpers.js +0 -6
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/useRootTheme.js +0 -4
- package/dist/cjs/useTheme.js +0 -5
- package/dist/esm/NextTheme.native.js +33 -8
- package/dist/esm/NextTheme.native.js.map +1 -1
- package/dist/esm/NextThemeProvider.native.js +60 -39
- package/dist/esm/NextThemeProvider.native.js.map +2 -2
- package/dist/esm/ThemeSettingContext.native.js +25 -4
- package/dist/esm/ThemeSettingContext.native.js.map +1 -1
- package/dist/esm/UseThemeProps.native.js +14 -0
- package/dist/esm/UseThemeProps.native.js.map +2 -2
- package/dist/esm/constants.native.js +25 -2
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/helpers.native.js +27 -4
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.native.js +21 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.native.js +14 -0
- package/dist/esm/types.native.js.map +2 -2
- package/dist/esm/useRootTheme.native.js +27 -7
- package/dist/esm/useRootTheme.native.js.map +1 -1
- package/dist/esm/useTheme.native.js +26 -5
- package/dist/esm/useTheme.native.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/NextTheme.js
CHANGED
|
@@ -19,15 +19,4 @@ __reExport(NextTheme_exports, require("./constants"), module.exports);
|
|
|
19
19
|
__reExport(NextTheme_exports, require("./useTheme"), module.exports);
|
|
20
20
|
__reExport(NextTheme_exports, require("./types"), module.exports);
|
|
21
21
|
__reExport(NextTheme_exports, require("./useRootTheme"), module.exports);
|
|
22
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
-
0 && (module.exports = {
|
|
24
|
-
...require("./NextThemeProvider"),
|
|
25
|
-
...require("./ThemeSettingContext"),
|
|
26
|
-
...require("./UseThemeProps"),
|
|
27
|
-
...require("./helpers"),
|
|
28
|
-
...require("./constants"),
|
|
29
|
-
...require("./useTheme"),
|
|
30
|
-
...require("./types"),
|
|
31
|
-
...require("./useRootTheme")
|
|
32
|
-
});
|
|
33
22
|
//# sourceMappingURL=NextTheme.js.map
|
|
@@ -49,7 +49,7 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
49
49
|
disableTransitionOnChange ? update() : React.startTransition(() => update()), theme === "system" && !forcedTheme && handleChangeTheme(_, !1);
|
|
50
50
|
}), handleChangeTheme = (0, import_use_event.useEvent)(
|
|
51
51
|
(theme2, updateStorage = !0, updateDOM = !0) => {
|
|
52
|
-
let name =
|
|
52
|
+
let name = value?.[theme2] || theme2;
|
|
53
53
|
if (updateStorage)
|
|
54
54
|
try {
|
|
55
55
|
localStorage.setItem(storageKey, theme2);
|
|
@@ -57,9 +57,9 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
57
57
|
}
|
|
58
58
|
if (theme2 === "system" && enableSystem) {
|
|
59
59
|
const resolved = (0, import_helpers.getSystemTheme)();
|
|
60
|
-
name =
|
|
60
|
+
name = value?.[resolved] || resolved;
|
|
61
61
|
}
|
|
62
|
-
if (onChangeTheme
|
|
62
|
+
if (onChangeTheme?.(name.replace("t_", "")), updateDOM) {
|
|
63
63
|
const d = document.documentElement;
|
|
64
64
|
attribute === "class" ? (d.classList.remove(...attrs), d.classList.add(name)) : d.setAttribute(attribute, name);
|
|
65
65
|
}
|
|
@@ -151,7 +151,7 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
151
151
|
skipNextHead
|
|
152
152
|
}) => {
|
|
153
153
|
const optimization = attribute === "class" ? `var d=document.documentElement.classList;${attrs.map((t) => `d.remove('${t}')`).join(";")};` : "var d=document.documentElement;", updateDOM = (name, literal) => {
|
|
154
|
-
name =
|
|
154
|
+
name = value?.[name] || name;
|
|
155
155
|
const val = literal ? name : `'${name}'`;
|
|
156
156
|
return attribute === "class" ? `d.add(${val})` : `d.setAttribute('${attribute}', ${val})`;
|
|
157
157
|
}, defaultSystem = defaultTheme === "system", contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: forcedTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -188,8 +188,4 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
188
188
|
},
|
|
189
189
|
(prevProps, nextProps) => prevProps.forcedTheme === nextProps.forcedTheme
|
|
190
190
|
);
|
|
191
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
192
|
-
0 && (module.exports = {
|
|
193
|
-
NextThemeProvider
|
|
194
|
-
});
|
|
195
191
|
//# sourceMappingURL=NextThemeProvider.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextThemeProvider.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C,+BAC1C,mBAAyB,+BACzB,cAAqB,+BACrB,QAAuB,2BACvB,eAAmD,kBAEnDA,oBAAoC,wBACpC,iBAAyC,sBACzC,6BAAoC,kCAiL9B;AA7KC,MAAM,wBAAoB;AAAA,EAC/B,CAAC;AAAA,IACC;AAAA,IACA,4BAA4B;AAAA,IAC5B,eAAe;AAAA,IACf,oBAAoB;AAAA,IACpB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,eAAe,eAAe,WAAW;AAAA,IACzC,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF,MAA0B;AACxB,UAAM,CAAC,OAAO,aAAa,QAAI,uBAAS,UAAM,yBAAS,YAA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AQ,SAAS,KAAK,EAAI,CAAC,SAAS;AAAA,YAC/C;AAAA,UACF,CAAC;AAAA,QACH;AAAA;AAAA,MAPI;AAAA,IAQN,GAEJ;AAGF,WAAI,eAAqB,WAElB,4CAAC,YAAAC,SAAA,EAAU,oBAAS;AAAA,EAC7B;AAAA,EACA,CAAC,WAAW,cAGN,UAAU,gBAAgB,UAAU;AAG5C;",
|
|
5
5
|
"names": ["import_constants", "theme", "NextHead"]
|
|
6
6
|
}
|
|
@@ -25,8 +25,4 @@ const ThemeSettingContext = (0, import_react.createContext)({
|
|
|
25
25
|
},
|
|
26
26
|
themes: []
|
|
27
27
|
});
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
ThemeSettingContext
|
|
31
|
-
});
|
|
32
28
|
//# sourceMappingURL=ThemeSettingContext.js.map
|
package/dist/cjs/constants.js
CHANGED
|
@@ -20,10 +20,4 @@ __export(constants_exports, {
|
|
|
20
20
|
});
|
|
21
21
|
module.exports = __toCommonJS(constants_exports);
|
|
22
22
|
const constants = {}, colorSchemes = ["light", "dark"], MEDIA = "(prefers-color-scheme: dark)";
|
|
23
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
-
0 && (module.exports = {
|
|
25
|
-
MEDIA,
|
|
26
|
-
colorSchemes,
|
|
27
|
-
constants
|
|
28
|
-
});
|
|
29
23
|
//# sourceMappingURL=constants.js.map
|
package/dist/cjs/helpers.js
CHANGED
|
@@ -30,10 +30,4 @@ const helpers = {}, getTheme = (key, fallback) => {
|
|
|
30
30
|
}
|
|
31
31
|
return theme || fallback;
|
|
32
32
|
}, getSystemTheme = (e) => (e || (e = window.matchMedia(import_constants.MEDIA)), e.matches ? "dark" : "light");
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
getSystemTheme,
|
|
36
|
-
getTheme,
|
|
37
|
-
helpers
|
|
38
|
-
});
|
|
39
33
|
//# sourceMappingURL=helpers.js.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -13,9 +13,4 @@ var src_exports = {};
|
|
|
13
13
|
module.exports = __toCommonJS(src_exports);
|
|
14
14
|
__reExport(src_exports, require("./NextTheme"), module.exports);
|
|
15
15
|
__reExport(src_exports, require("./types"), module.exports);
|
|
16
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
-
0 && (module.exports = {
|
|
18
|
-
...require("./NextTheme"),
|
|
19
|
-
...require("./types")
|
|
20
|
-
});
|
|
21
16
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/useRootTheme.js
CHANGED
package/dist/cjs/useTheme.js
CHANGED
|
@@ -20,9 +20,4 @@ __export(useTheme_exports, {
|
|
|
20
20
|
module.exports = __toCommonJS(useTheme_exports);
|
|
21
21
|
var import_react = require("react"), import_ThemeSettingContext = require("./ThemeSettingContext");
|
|
22
22
|
const useTheme = () => (0, import_react.useContext)(import_ThemeSettingContext.ThemeSettingContext), useThemeSetting = () => (0, import_react.useContext)(import_ThemeSettingContext.ThemeSettingContext);
|
|
23
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
-
0 && (module.exports = {
|
|
25
|
-
useTheme,
|
|
26
|
-
useThemeSetting
|
|
27
|
-
});
|
|
28
23
|
//# sourceMappingURL=useTheme.js.map
|
|
@@ -1,9 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var NextTheme_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(NextTheme_exports);
|
|
15
|
+
__reExport(NextTheme_exports, require("./NextThemeProvider"), module.exports);
|
|
16
|
+
__reExport(NextTheme_exports, require("./ThemeSettingContext"), module.exports);
|
|
17
|
+
__reExport(NextTheme_exports, require("./UseThemeProps"), module.exports);
|
|
18
|
+
__reExport(NextTheme_exports, require("./helpers"), module.exports);
|
|
19
|
+
__reExport(NextTheme_exports, require("./constants"), module.exports);
|
|
20
|
+
__reExport(NextTheme_exports, require("./useTheme"), module.exports);
|
|
21
|
+
__reExport(NextTheme_exports, require("./types"), module.exports);
|
|
22
|
+
__reExport(NextTheme_exports, require("./useRootTheme"), module.exports);
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
...require("./NextThemeProvider"),
|
|
26
|
+
...require("./ThemeSettingContext"),
|
|
27
|
+
...require("./UseThemeProps"),
|
|
28
|
+
...require("./helpers"),
|
|
29
|
+
...require("./constants"),
|
|
30
|
+
...require("./useTheme"),
|
|
31
|
+
...require("./types"),
|
|
32
|
+
...require("./useRootTheme")
|
|
33
|
+
});
|
|
9
34
|
//# sourceMappingURL=NextTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextTheme.tsx"],
|
|
4
|
-
"mappings": "AAGA,
|
|
4
|
+
"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;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var NextThemeProvider_exports = {};
|
|
25
|
+
__export(NextThemeProvider_exports, {
|
|
26
|
+
NextThemeProvider: () => NextThemeProvider
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(NextThemeProvider_exports);
|
|
29
|
+
var import_constants = require("@tamagui/constants"), import_use_event = require("@tamagui/use-event"), import_head = __toESM(require("next/head")), React = __toESM(require("react")), import_react = require("react"), import_constants2 = require("./constants"), import_helpers = require("./helpers"), import_ThemeSettingContext = require("./ThemeSettingContext"), import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
const NextThemeProvider = (0, import_react.memo)(
|
|
11
31
|
({
|
|
12
32
|
forcedTheme,
|
|
13
33
|
disableTransitionOnChange = !1,
|
|
14
34
|
enableSystem = !0,
|
|
15
35
|
enableColorScheme = !0,
|
|
16
36
|
storageKey = "theme",
|
|
17
|
-
themes = colorSchemes,
|
|
37
|
+
themes = import_constants2.colorSchemes,
|
|
18
38
|
defaultTheme = enableSystem ? "system" : "light",
|
|
19
39
|
attribute = "class",
|
|
20
40
|
skipNextHead,
|
|
@@ -25,37 +45,37 @@ const NextThemeProvider = memo(
|
|
|
25
45
|
},
|
|
26
46
|
children
|
|
27
47
|
}) => {
|
|
28
|
-
const [theme, setThemeState] = useState(() => getTheme(storageKey, defaultTheme)), [resolvedTheme, setResolvedTheme] = useState(() => getTheme(storageKey)), attrs = value ? Object.values(value) : themes, handleMediaQuery = useEvent((e) => {
|
|
29
|
-
const _ = getSystemTheme(e), update = () => setResolvedTheme(_);
|
|
48
|
+
const [theme, setThemeState] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey, defaultTheme)), [resolvedTheme, setResolvedTheme] = (0, import_react.useState)(() => (0, import_helpers.getTheme)(storageKey)), attrs = value ? Object.values(value) : themes, handleMediaQuery = (0, import_use_event.useEvent)((e) => {
|
|
49
|
+
const _ = (0, import_helpers.getSystemTheme)(e), update = () => setResolvedTheme(_);
|
|
30
50
|
disableTransitionOnChange ? update() : React.startTransition(() => update()), theme === "system" && !forcedTheme && handleChangeTheme(_, !1);
|
|
31
|
-
}), handleChangeTheme = useEvent(
|
|
51
|
+
}), handleChangeTheme = (0, import_use_event.useEvent)(
|
|
32
52
|
(theme2, updateStorage = !0, updateDOM = !0) => {
|
|
33
|
-
let name = value
|
|
53
|
+
let name = (value == null ? void 0 : value[theme2]) || theme2;
|
|
34
54
|
if (updateStorage)
|
|
35
55
|
try {
|
|
36
56
|
localStorage.setItem(storageKey, theme2);
|
|
37
57
|
} catch {
|
|
38
58
|
}
|
|
39
59
|
if (theme2 === "system" && enableSystem) {
|
|
40
|
-
const resolved = getSystemTheme();
|
|
41
|
-
name = value
|
|
60
|
+
const resolved = (0, import_helpers.getSystemTheme)();
|
|
61
|
+
name = (value == null ? void 0 : value[resolved]) || resolved;
|
|
42
62
|
}
|
|
43
|
-
if (onChangeTheme
|
|
63
|
+
if (onChangeTheme == null || onChangeTheme(name.replace("t_", "")), updateDOM) {
|
|
44
64
|
const d = document.documentElement;
|
|
45
65
|
attribute === "class" ? (d.classList.remove(...attrs), d.classList.add(name)) : d.setAttribute(attribute, name);
|
|
46
66
|
}
|
|
47
67
|
}
|
|
48
68
|
);
|
|
49
|
-
useIsomorphicLayoutEffect(() => {
|
|
50
|
-
const media = window.matchMedia(MEDIA);
|
|
69
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
70
|
+
const media = window.matchMedia(import_constants2.MEDIA);
|
|
51
71
|
return media.addListener(handleMediaQuery), handleMediaQuery(media), () => {
|
|
52
72
|
media.removeListener(handleMediaQuery);
|
|
53
73
|
};
|
|
54
74
|
}, []);
|
|
55
|
-
const set = useEvent((newTheme) => {
|
|
75
|
+
const set = (0, import_use_event.useEvent)((newTheme) => {
|
|
56
76
|
forcedTheme ? handleChangeTheme(newTheme, !0, !1) : handleChangeTheme(newTheme), setThemeState(newTheme);
|
|
57
77
|
});
|
|
58
|
-
useEffect(() => {
|
|
78
|
+
(0, import_react.useEffect)(() => {
|
|
59
79
|
const handleStorage = (e) => {
|
|
60
80
|
if (e.key !== storageKey)
|
|
61
81
|
return;
|
|
@@ -65,14 +85,14 @@ const NextThemeProvider = memo(
|
|
|
65
85
|
return window.addEventListener("storage", handleStorage), () => {
|
|
66
86
|
window.removeEventListener("storage", handleStorage);
|
|
67
87
|
};
|
|
68
|
-
}, [defaultTheme, set, storageKey]), useIsomorphicLayoutEffect(() => {
|
|
88
|
+
}, [defaultTheme, set, storageKey]), (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
69
89
|
if (!enableColorScheme)
|
|
70
90
|
return;
|
|
71
91
|
const colorScheme = (
|
|
72
92
|
// If theme is forced to light or dark, use that
|
|
73
|
-
forcedTheme && colorSchemes.includes(forcedTheme) ? forcedTheme : (
|
|
93
|
+
forcedTheme && import_constants2.colorSchemes.includes(forcedTheme) ? forcedTheme : (
|
|
74
94
|
// If regular theme is light or dark
|
|
75
|
-
theme && colorSchemes.includes(theme) ? theme : (
|
|
95
|
+
theme && import_constants2.colorSchemes.includes(theme) ? theme : (
|
|
76
96
|
// If theme is system, use the resolved version
|
|
77
97
|
theme === "system" && resolvedTheme || null
|
|
78
98
|
)
|
|
@@ -80,10 +100,10 @@ const NextThemeProvider = memo(
|
|
|
80
100
|
);
|
|
81
101
|
(typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") !== (colorScheme || "light") && document.documentElement.style.setProperty("color-scheme", colorScheme);
|
|
82
102
|
}, [enableColorScheme, theme, resolvedTheme, forcedTheme]);
|
|
83
|
-
const toggle = useEvent(() => {
|
|
103
|
+
const toggle = (0, import_use_event.useEvent)(() => {
|
|
84
104
|
const order = resolvedTheme === "dark" ? ["system", "light", "dark"] : ["system", "dark", "light"], next = order[(order.indexOf(theme) + 1) % order.length];
|
|
85
105
|
set(next);
|
|
86
|
-
}), systemTheme = enableSystem ? resolvedTheme : void 0, contextValue = useMemo(() => ({
|
|
106
|
+
}), systemTheme = enableSystem ? resolvedTheme : void 0, contextValue = (0, import_react.useMemo)(() => ({
|
|
87
107
|
theme,
|
|
88
108
|
current: theme,
|
|
89
109
|
set,
|
|
@@ -102,8 +122,8 @@ const NextThemeProvider = memo(
|
|
|
102
122
|
themes,
|
|
103
123
|
systemTheme
|
|
104
124
|
]);
|
|
105
|
-
return /* @__PURE__ */ jsxs(ThemeSettingContext.Provider, { value: contextValue, children: [
|
|
106
|
-
/* @__PURE__ */ jsx(
|
|
125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ThemeSettingContext.ThemeSettingContext.Provider, { value: contextValue, children: [
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
127
|
ThemeScript,
|
|
108
128
|
{
|
|
109
129
|
forcedTheme,
|
|
@@ -117,10 +137,10 @@ const NextThemeProvider = memo(
|
|
|
117
137
|
skipNextHead
|
|
118
138
|
}
|
|
119
139
|
),
|
|
120
|
-
useMemo(() => children, [children])
|
|
140
|
+
(0, import_react.useMemo)(() => children, [children])
|
|
121
141
|
] });
|
|
122
142
|
}
|
|
123
|
-
), ThemeScript = memo(
|
|
143
|
+
), ThemeScript = (0, import_react.memo)(
|
|
124
144
|
({
|
|
125
145
|
forcedTheme,
|
|
126
146
|
storageKey,
|
|
@@ -132,10 +152,10 @@ const NextThemeProvider = memo(
|
|
|
132
152
|
skipNextHead
|
|
133
153
|
}) => {
|
|
134
154
|
const optimization = attribute === "class" ? `var d=document.documentElement.classList;${attrs.map((t) => `d.remove('${t}')`).join(";")};` : "var d=document.documentElement;", updateDOM = (name, literal) => {
|
|
135
|
-
name = value
|
|
155
|
+
name = (value == null ? void 0 : value[name]) || name;
|
|
136
156
|
const val = literal ? name : `'${name}'`;
|
|
137
157
|
return attribute === "class" ? `d.add(${val})` : `d.setAttribute('${attribute}', ${val})`;
|
|
138
|
-
}, defaultSystem = defaultTheme === "system", contents = /* @__PURE__ */ jsx(Fragment, { children: forcedTheme ? /* @__PURE__ */ jsx(
|
|
158
|
+
}, defaultSystem = defaultTheme === "system", contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: forcedTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
159
|
"script",
|
|
140
160
|
{
|
|
141
161
|
dangerouslySetInnerHTML: {
|
|
@@ -144,17 +164,17 @@ const NextThemeProvider = memo(
|
|
|
144
164
|
}
|
|
145
165
|
},
|
|
146
166
|
"next-themes-script"
|
|
147
|
-
) : enableSystem ? /* @__PURE__ */ jsx(
|
|
167
|
+
) : enableSystem ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
168
|
"script",
|
|
149
169
|
{
|
|
150
170
|
dangerouslySetInnerHTML: {
|
|
151
|
-
__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(
|
|
171
|
+
__html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${defaultSystem ? "" : updateDOM(defaultTheme) + ";"}if("system"===e||(!e&&${defaultSystem})){var t="${import_constants2.MEDIA}",m=window.matchMedia(t);m.media!==t||m.matches?${updateDOM(
|
|
152
172
|
"dark"
|
|
153
173
|
)}:${updateDOM("light")}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? "x[e]" : "e", !0)}}catch(e){}}()`
|
|
154
174
|
}
|
|
155
175
|
},
|
|
156
176
|
"next-themes-script"
|
|
157
|
-
) : /* @__PURE__ */ jsx(
|
|
177
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
178
|
"script",
|
|
159
179
|
{
|
|
160
180
|
dangerouslySetInnerHTML: {
|
|
@@ -165,11 +185,12 @@ const NextThemeProvider = memo(
|
|
|
165
185
|
},
|
|
166
186
|
"next-themes-script"
|
|
167
187
|
) });
|
|
168
|
-
return skipNextHead ? contents : /* @__PURE__ */ jsx(
|
|
188
|
+
return skipNextHead ? contents : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_head.default, { children: contents });
|
|
169
189
|
},
|
|
170
190
|
(prevProps, nextProps) => prevProps.forcedTheme === nextProps.forcedTheme
|
|
171
191
|
);
|
|
172
|
-
export
|
|
192
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
193
|
+
0 && (module.exports = {
|
|
173
194
|
NextThemeProvider
|
|
174
|
-
};
|
|
195
|
+
});
|
|
175
196
|
//# sourceMappingURL=NextThemeProvider.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextThemeProvider.tsx"],
|
|
4
|
-
"mappings": "AAAA
|
|
5
|
-
"names": ["theme"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C,+BAC1C,mBAAyB,+BACzB,cAAqB,+BACrB,QAAuB,2BACvB,eAAmD,kBAEnDA,oBAAoC,wBACpC,iBAAyC,sBACzC,6BAAoC,kCAiL9B;AA7KC,MAAM,wBAAoB;AAAA,EAC/B,CAAC;AAAA,IACC;AAAA,IACA,4BAA4B;AAAA,IAC5B,eAAe;AAAA,IACf,oBAAoB;AAAA,IACpB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,eAAe,eAAe,WAAW;AAAA,IACzC,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF,MAA0B;AACxB,UAAM,CAAC,OAAO,aAAa,QAAI,uBAAS,UAAM,yBAAS,YAAY,YAAY,CAAC,GAC1E,CAAC,eAAe,gBAAgB,QAAI,uBA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AC;AAAA;AAAA,QAGC,yBAAyB;AAAA,UACvB,QAAQ,mBAAmB,YAAY,+BAA+B,UAAU,YAC9E,QAAQ,SAAS,KAAK,UAAU,KAAK,CAAC,MAAM,EAC9C,GAAG,UAAU,QAAQ,SAAS,KAAK,EAAI,CAAC,SAAS;AAAA,YAC/C;AAAA,UACF,CAAC;AAAA,QACH;AAAA;AAAA,MAPI;AAAA,IAQN,GAEJ;AAGF,WAAI,eAAqB,WAElB,4CAAC,YAAAC,SAAA,EAAU,oBAAS;AAAA,EAC7B;AAAA,EACA,CAAC,WAAW,cAGN,UAAU,gBAAgB,UAAU;AAG5C;",
|
|
5
|
+
"names": ["import_constants", "theme", "NextHead"]
|
|
6
6
|
}
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var ThemeSettingContext_exports = {};
|
|
17
|
+
__export(ThemeSettingContext_exports, {
|
|
18
|
+
ThemeSettingContext: () => ThemeSettingContext
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(ThemeSettingContext_exports);
|
|
21
|
+
var import_react = require("react");
|
|
22
|
+
const ThemeSettingContext = (0, import_react.createContext)({
|
|
3
23
|
toggle: () => {
|
|
4
24
|
},
|
|
5
25
|
set: (_) => {
|
|
6
26
|
},
|
|
7
27
|
themes: []
|
|
8
28
|
});
|
|
9
|
-
export
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
10
31
|
ThemeSettingContext
|
|
11
|
-
};
|
|
32
|
+
});
|
|
12
33
|
//# sourceMappingURL=ThemeSettingContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ThemeSettingContext.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"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;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1 +1,15 @@
|
|
|
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
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var UseThemeProps_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(UseThemeProps_exports);
|
|
1
15
|
//# sourceMappingURL=UseThemeProps.js.map
|
|
@@ -1,7 +1,30 @@
|
|
|
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: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var constants_exports = {};
|
|
17
|
+
__export(constants_exports, {
|
|
18
|
+
MEDIA: () => MEDIA,
|
|
19
|
+
colorSchemes: () => colorSchemes,
|
|
20
|
+
constants: () => constants
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(constants_exports);
|
|
1
23
|
const constants = {}, colorSchemes = ["light", "dark"], MEDIA = "(prefers-color-scheme: dark)";
|
|
2
|
-
export
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
3
26
|
MEDIA,
|
|
4
27
|
colorSchemes,
|
|
5
28
|
constants
|
|
6
|
-
};
|
|
29
|
+
});
|
|
7
30
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.tsx"],
|
|
4
|
-
"mappings": "AAAO,MAAM,YAAY,CAAC,GACb,eAAe,CAAC,SAAS,MAAM,GAC/B,QAAQ;",
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY,CAAC,GACb,eAAe,CAAC,SAAS,MAAM,GAC/B,QAAQ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
|
|
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: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var helpers_exports = {};
|
|
17
|
+
__export(helpers_exports, {
|
|
18
|
+
getSystemTheme: () => getSystemTheme,
|
|
19
|
+
getTheme: () => getTheme,
|
|
20
|
+
helpers: () => helpers
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
23
|
+
var import_constants = require("./constants");
|
|
2
24
|
const helpers = {}, getTheme = (key, fallback) => {
|
|
3
25
|
if (typeof window > "u")
|
|
4
26
|
return;
|
|
@@ -8,10 +30,11 @@ const helpers = {}, getTheme = (key, fallback) => {
|
|
|
8
30
|
} catch {
|
|
9
31
|
}
|
|
10
32
|
return theme || fallback;
|
|
11
|
-
}, getSystemTheme = (e) => (e || (e = window.matchMedia(MEDIA)), e.matches ? "dark" : "light");
|
|
12
|
-
export
|
|
33
|
+
}, getSystemTheme = (e) => (e || (e = window.matchMedia(import_constants.MEDIA)), e.matches ? "dark" : "light");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
13
36
|
getSystemTheme,
|
|
14
37
|
getTheme,
|
|
15
38
|
helpers
|
|
16
|
-
};
|
|
39
|
+
});
|
|
17
40
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEf,MAAM,UAAU,CAAC,GAGX,WAAW,CAAC,KAAa,aAAsB;AAC1D,MAAI,OAAO,SAAW;AAAa;AACnC,MAAI;AACJ,MAAI;AACF,YAAQ,aAAa,QAAQ,GAAG,KAAK;AAAA,EACvC,QAAY;AAAA,EAEZ;AACA,SAAO,SAAS;AAClB,GAEa,iBAAiB,CAAC,OACxB,MACH,IAAI,OAAO,WAAW,sBAAK,IAGd,EAAE,UACY,SAAS;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./NextTheme"), module.exports);
|
|
16
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
17
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
18
|
+
0 && (module.exports = {
|
|
19
|
+
...require("./NextTheme"),
|
|
20
|
+
...require("./types")
|
|
21
|
+
});
|
|
3
22
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/types.native.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
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
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var types_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(types_exports);
|
|
1
15
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var useRootTheme_exports = {};
|
|
17
|
+
__export(useRootTheme_exports, {
|
|
18
|
+
useRootTheme: () => useRootTheme
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(useRootTheme_exports);
|
|
21
|
+
var import_constants = require("@tamagui/constants"), import_react = require("react");
|
|
3
22
|
const useRootTheme = ({ fallback = "light" } = {}) => {
|
|
4
|
-
const [val, setVal] = useState(fallback);
|
|
5
|
-
return useIsomorphicLayoutEffect(() => {
|
|
23
|
+
const [val, setVal] = (0, import_react.useState)(fallback);
|
|
24
|
+
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
6
25
|
const classes = [...document.documentElement.classList], val2 = classes.includes("t_dark") ? "dark" : classes.includes("t_light") ? "light" : fallback;
|
|
7
|
-
startTransition(() => {
|
|
26
|
+
(0, import_react.startTransition)(() => {
|
|
8
27
|
setVal(val2);
|
|
9
28
|
});
|
|
10
29
|
}, []), [val, setVal];
|
|
11
30
|
};
|
|
12
|
-
export
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
13
33
|
useRootTheme
|
|
14
|
-
};
|
|
34
|
+
});
|
|
15
35
|
//# sourceMappingURL=useRootTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useRootTheme.tsx"],
|
|
4
|
-
"mappings": "AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C,+BAC1C,eAA0C;AAInC,MAAM,eAAe,CAAC,EAAE,WAAW,QAAQ,IAAgC,CAAC,MAAM;AACvF,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAsB,QAAQ;AAEpD,yDAA0B,MAAM;AAE9B,UAAM,UAAU,CAAC,GAAG,SAAS,gBAAgB,SAAS,GAEhDA,OAAmB,QAAQ,SAAS,QAAQ,IAC9C,SACA,QAAQ,SAAS,SAAS,IACxB,UACA;AAIN,sCAAgB,MAAM;AACpB,aAAOA,IAAG;AAAA,IACZ,CAAC;AAAA,EACH,GAAG,CAAC,CAAC,GAEE,CAAC,KAAK,MAAM;AACrB;",
|
|
5
5
|
"names": ["val"]
|
|
6
6
|
}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var useTheme_exports = {};
|
|
17
|
+
__export(useTheme_exports, {
|
|
18
|
+
useTheme: () => useTheme,
|
|
19
|
+
useThemeSetting: () => useThemeSetting
|
|
20
|
+
});
|
|
21
|
+
module.exports = __toCommonJS(useTheme_exports);
|
|
22
|
+
var import_react = require("react"), import_ThemeSettingContext = require("./ThemeSettingContext");
|
|
23
|
+
const useTheme = () => (0, import_react.useContext)(import_ThemeSettingContext.ThemeSettingContext), useThemeSetting = () => (0, import_react.useContext)(import_ThemeSettingContext.ThemeSettingContext);
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
5
26
|
useTheme,
|
|
6
27
|
useThemeSetting
|
|
7
|
-
};
|
|
28
|
+
});
|
|
8
29
|
//# sourceMappingURL=useTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useTheme.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B,kBAE3B,6BAAoC;AAM7B,MAAM,WAAW,UAAM,yBAAW,8CAAmB,GAE/C,kBAAkB,UAAM,yBAAW,8CAAmB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/next-theme",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"clean:build": "tamagui-build clean:build"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tamagui/constants": "1.88.
|
|
24
|
-
"@tamagui/use-event": "1.88.
|
|
23
|
+
"@tamagui/constants": "1.88.2",
|
|
24
|
+
"@tamagui/use-event": "1.88.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "*"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tamagui/build": "1.88.
|
|
30
|
+
"@tamagui/build": "1.88.2",
|
|
31
31
|
"react": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|