@tamagui/next-theme 1.88.21 → 1.88.23
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/esm/NextTheme.native.js +8 -33
- package/dist/esm/NextTheme.native.js.map +1 -1
- package/dist/esm/NextThemeProvider.native.js +35 -56
- package/dist/esm/NextThemeProvider.native.js.map +2 -2
- package/dist/esm/ThemeSettingContext.native.js +4 -25
- package/dist/esm/ThemeSettingContext.native.js.map +1 -1
- package/dist/esm/UseThemeProps.native.js +0 -14
- package/dist/esm/UseThemeProps.native.js.map +2 -2
- package/dist/esm/constants.native.js +2 -25
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/helpers.native.js +4 -27
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.native.js +2 -21
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.native.js +0 -14
- package/dist/esm/types.native.js.map +2 -2
- package/dist/esm/useRootTheme.native.js +6 -26
- package/dist/esm/useRootTheme.native.js.map +1 -1
- package/dist/esm/useTheme.native.js +5 -26
- package/dist/esm/useTheme.native.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
});
|
|
1
|
+
export * from "./NextThemeProvider";
|
|
2
|
+
export * from "./ThemeSettingContext";
|
|
3
|
+
export * from "./UseThemeProps";
|
|
4
|
+
export * from "./helpers";
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./useTheme";
|
|
7
|
+
export * from "./types";
|
|
8
|
+
export * from "./useRootTheme";
|
|
34
9
|
//# sourceMappingURL=NextTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextTheme.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAGA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,40 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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)(
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { useEvent } from "@tamagui/use-event";
|
|
3
|
+
import NextHead from "next/head";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
6
|
+
import { MEDIA, colorSchemes } from "./constants";
|
|
7
|
+
import { getSystemTheme, getTheme } from "./helpers";
|
|
8
|
+
import { ThemeSettingContext } from "./ThemeSettingContext";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
const NextThemeProvider = memo(
|
|
31
11
|
({
|
|
32
12
|
forcedTheme,
|
|
33
13
|
disableTransitionOnChange = !1,
|
|
34
14
|
enableSystem = !0,
|
|
35
15
|
enableColorScheme = !0,
|
|
36
16
|
storageKey = "theme",
|
|
37
|
-
themes =
|
|
17
|
+
themes = colorSchemes,
|
|
38
18
|
defaultTheme = enableSystem ? "system" : "light",
|
|
39
19
|
attribute = "class",
|
|
40
20
|
skipNextHead,
|
|
@@ -45,10 +25,10 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
45
25
|
},
|
|
46
26
|
children
|
|
47
27
|
}) => {
|
|
48
|
-
const [theme, setThemeState] =
|
|
49
|
-
const _ =
|
|
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(_);
|
|
50
30
|
disableTransitionOnChange ? update() : React.startTransition(() => update()), theme === "system" && !forcedTheme && handleChangeTheme(_, !1);
|
|
51
|
-
}), handleChangeTheme =
|
|
31
|
+
}), handleChangeTheme = useEvent(
|
|
52
32
|
(theme2, updateStorage = !0, updateDOM = !0) => {
|
|
53
33
|
let name = (value == null ? void 0 : value[theme2]) || theme2;
|
|
54
34
|
if (updateStorage)
|
|
@@ -57,7 +37,7 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
57
37
|
} catch {
|
|
58
38
|
}
|
|
59
39
|
if (theme2 === "system" && enableSystem) {
|
|
60
|
-
const resolved =
|
|
40
|
+
const resolved = getSystemTheme();
|
|
61
41
|
name = (value == null ? void 0 : value[resolved]) || resolved;
|
|
62
42
|
}
|
|
63
43
|
if (onChangeTheme == null || onChangeTheme(name.replace("t_", "")), updateDOM) {
|
|
@@ -66,16 +46,16 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
66
46
|
}
|
|
67
47
|
}
|
|
68
48
|
);
|
|
69
|
-
|
|
70
|
-
const media = window.matchMedia(
|
|
49
|
+
useIsomorphicLayoutEffect(() => {
|
|
50
|
+
const media = window.matchMedia(MEDIA);
|
|
71
51
|
return media.addListener(handleMediaQuery), handleMediaQuery(media), () => {
|
|
72
52
|
media.removeListener(handleMediaQuery);
|
|
73
53
|
};
|
|
74
54
|
}, []);
|
|
75
|
-
const set =
|
|
55
|
+
const set = useEvent((newTheme) => {
|
|
76
56
|
forcedTheme ? handleChangeTheme(newTheme, !0, !1) : handleChangeTheme(newTheme), setThemeState(newTheme);
|
|
77
57
|
});
|
|
78
|
-
|
|
58
|
+
useEffect(() => {
|
|
79
59
|
const handleStorage = (e) => {
|
|
80
60
|
if (e.key !== storageKey)
|
|
81
61
|
return;
|
|
@@ -85,14 +65,14 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
85
65
|
return window.addEventListener("storage", handleStorage), () => {
|
|
86
66
|
window.removeEventListener("storage", handleStorage);
|
|
87
67
|
};
|
|
88
|
-
}, [defaultTheme, set, storageKey]),
|
|
68
|
+
}, [defaultTheme, set, storageKey]), useIsomorphicLayoutEffect(() => {
|
|
89
69
|
if (!enableColorScheme)
|
|
90
70
|
return;
|
|
91
71
|
const colorScheme = (
|
|
92
72
|
// If theme is forced to light or dark, use that
|
|
93
|
-
forcedTheme &&
|
|
73
|
+
forcedTheme && colorSchemes.includes(forcedTheme) ? forcedTheme : (
|
|
94
74
|
// If regular theme is light or dark
|
|
95
|
-
theme &&
|
|
75
|
+
theme && colorSchemes.includes(theme) ? theme : (
|
|
96
76
|
// If theme is system, use the resolved version
|
|
97
77
|
theme === "system" && resolvedTheme || null
|
|
98
78
|
)
|
|
@@ -100,10 +80,10 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
100
80
|
);
|
|
101
81
|
(typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") !== (colorScheme || "light") && document.documentElement.style.setProperty("color-scheme", colorScheme);
|
|
102
82
|
}, [enableColorScheme, theme, resolvedTheme, forcedTheme]);
|
|
103
|
-
const toggle =
|
|
83
|
+
const toggle = useEvent(() => {
|
|
104
84
|
const order = resolvedTheme === "dark" ? ["system", "light", "dark"] : ["system", "dark", "light"], next = order[(order.indexOf(theme) + 1) % order.length];
|
|
105
85
|
set(next);
|
|
106
|
-
}), systemTheme = enableSystem ? resolvedTheme : void 0, contextValue =
|
|
86
|
+
}), systemTheme = enableSystem ? resolvedTheme : void 0, contextValue = useMemo(() => ({
|
|
107
87
|
theme,
|
|
108
88
|
current: theme,
|
|
109
89
|
set,
|
|
@@ -122,8 +102,8 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
122
102
|
themes,
|
|
123
103
|
systemTheme
|
|
124
104
|
]);
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ jsxs(ThemeSettingContext.Provider, { value: contextValue, children: [
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
127
107
|
ThemeScript,
|
|
128
108
|
{
|
|
129
109
|
forcedTheme,
|
|
@@ -137,10 +117,10 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
137
117
|
skipNextHead
|
|
138
118
|
}
|
|
139
119
|
),
|
|
140
|
-
|
|
120
|
+
useMemo(() => children, [children])
|
|
141
121
|
] });
|
|
142
122
|
}
|
|
143
|
-
), ThemeScript =
|
|
123
|
+
), ThemeScript = memo(
|
|
144
124
|
({
|
|
145
125
|
forcedTheme,
|
|
146
126
|
storageKey,
|
|
@@ -155,7 +135,7 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
155
135
|
name = (value == null ? void 0 : value[name]) || name;
|
|
156
136
|
const val = literal ? name : `'${name}'`;
|
|
157
137
|
return attribute === "class" ? `d.add(${val})` : `d.setAttribute('${attribute}', ${val})`;
|
|
158
|
-
}, defaultSystem = defaultTheme === "system", contents = /* @__PURE__ */
|
|
138
|
+
}, defaultSystem = defaultTheme === "system", contents = /* @__PURE__ */ jsx(Fragment, { children: forcedTheme ? /* @__PURE__ */ jsx(
|
|
159
139
|
"script",
|
|
160
140
|
{
|
|
161
141
|
dangerouslySetInnerHTML: {
|
|
@@ -164,17 +144,17 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
164
144
|
}
|
|
165
145
|
},
|
|
166
146
|
"next-themes-script"
|
|
167
|
-
) : enableSystem ? /* @__PURE__ */
|
|
147
|
+
) : enableSystem ? /* @__PURE__ */ jsx(
|
|
168
148
|
"script",
|
|
169
149
|
{
|
|
170
150
|
dangerouslySetInnerHTML: {
|
|
171
|
-
__html: `!function(){try {${optimization}var e=localStorage.getItem('${storageKey}');${defaultSystem ? "" : updateDOM(defaultTheme) + ";"}if("system"===e||(!e&&${defaultSystem})){var t="${
|
|
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(
|
|
172
152
|
"dark"
|
|
173
153
|
)}:${updateDOM("light")}}else if(e) ${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? "x[e]" : "e", !0)}}catch(e){}}()`
|
|
174
154
|
}
|
|
175
155
|
},
|
|
176
156
|
"next-themes-script"
|
|
177
|
-
) : /* @__PURE__ */
|
|
157
|
+
) : /* @__PURE__ */ jsx(
|
|
178
158
|
"script",
|
|
179
159
|
{
|
|
180
160
|
dangerouslySetInnerHTML: {
|
|
@@ -185,12 +165,11 @@ const NextThemeProvider = (0, import_react.memo)(
|
|
|
185
165
|
},
|
|
186
166
|
"next-themes-script"
|
|
187
167
|
) });
|
|
188
|
-
return skipNextHead ? contents : /* @__PURE__ */
|
|
168
|
+
return skipNextHead ? contents : /* @__PURE__ */ jsx(NextHead, { children: contents });
|
|
189
169
|
},
|
|
190
170
|
(prevProps, nextProps) => prevProps.forcedTheme === nextProps.forcedTheme
|
|
191
171
|
);
|
|
192
|
-
|
|
193
|
-
0 && (module.exports = {
|
|
172
|
+
export {
|
|
194
173
|
NextThemeProvider
|
|
195
|
-
}
|
|
174
|
+
};
|
|
196
175
|
//# sourceMappingURL=NextThemeProvider.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NextThemeProvider.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": "AAAA,SAAS,iCAAiC;AAC1C,SAAS,gBAAgB;AACzB,OAAO,cAAc;AACrB,YAAY,WAAW;AACvB,SAAS,MAAM,WAAW,SAAS,gBAAgB;AAEnD,SAAS,OAAO,oBAAoB;AACpC,SAAS,gBAAgB,gBAAgB;AACzC,SAAS,2BAA2B;AAiL9B,SAgEA,UA/DE,KADF;AA7KC,MAAM,oBAAoB;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,IAAI,SAAS,MAAM,SAAS,YAAY,YAAY,CAAC,GAC1E,CAAC,eAAe,gBAAgB,IAAI,SAAS,MAAM,SAAS,UAAU,CAAC,GACvE,QAAS,QAAiB,OAAO,OAAO,KAAK,IAA5B,QAEjB,mBAAmB,SAAS,CAAC,MA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C,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,oBAAC,YAAU,oBAAS;AAAA,EAC7B;AAAA,EACA,CAAC,WAAW,cAGN,UAAU,gBAAgB,UAAU;AAG5C;",
|
|
5
|
+
"names": ["theme"]
|
|
6
6
|
}
|
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)({
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const ThemeSettingContext = createContext({
|
|
23
3
|
toggle: () => {
|
|
24
4
|
},
|
|
25
5
|
set: (_) => {
|
|
26
6
|
},
|
|
27
7
|
themes: []
|
|
28
8
|
});
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
9
|
+
export {
|
|
31
10
|
ThemeSettingContext
|
|
32
|
-
}
|
|
11
|
+
};
|
|
33
12
|
//# sourceMappingURL=ThemeSettingContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ThemeSettingContext.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAIvB,MAAM,sBAAsB,cAA6B;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,15 +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 __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);
|
|
15
1
|
//# sourceMappingURL=UseThemeProps.js.map
|
|
@@ -1,30 +1,7 @@
|
|
|
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);
|
|
23
1
|
const constants = {}, colorSchemes = ["light", "dark"], MEDIA = "(prefers-color-scheme: dark)";
|
|
24
|
-
|
|
25
|
-
0 && (module.exports = {
|
|
2
|
+
export {
|
|
26
3
|
MEDIA,
|
|
27
4
|
colorSchemes,
|
|
28
5
|
constants
|
|
29
|
-
}
|
|
6
|
+
};
|
|
30
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAO,MAAM,YAAY,CAAC,GACb,eAAe,CAAC,SAAS,MAAM,GAC/B,QAAQ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
|
|
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");
|
|
1
|
+
import { MEDIA } from "./constants";
|
|
24
2
|
const helpers = {}, getTheme = (key, fallback) => {
|
|
25
3
|
if (typeof window > "u")
|
|
26
4
|
return;
|
|
@@ -30,11 +8,10 @@ const helpers = {}, getTheme = (key, fallback) => {
|
|
|
30
8
|
} catch {
|
|
31
9
|
}
|
|
32
10
|
return theme || fallback;
|
|
33
|
-
}, getSystemTheme = (e) => (e || (e = window.matchMedia(
|
|
34
|
-
|
|
35
|
-
0 && (module.exports = {
|
|
11
|
+
}, getSystemTheme = (e) => (e || (e = window.matchMedia(MEDIA)), e.matches ? "dark" : "light");
|
|
12
|
+
export {
|
|
36
13
|
getSystemTheme,
|
|
37
14
|
getTheme,
|
|
38
15
|
helpers
|
|
39
|
-
}
|
|
16
|
+
};
|
|
40
17
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;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,KAAK,IAGd,EAAE,UACY,SAAS;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
});
|
|
1
|
+
export * from "./NextTheme";
|
|
2
|
+
export * from "./types";
|
|
22
3
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/types.native.js
CHANGED
|
@@ -1,15 +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 __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);
|
|
15
1
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
1
|
+
import { isClient } from "@tamagui/constants";
|
|
2
|
+
import { useState } from "react";
|
|
22
3
|
const useRootTheme = ({ fallback = "light" } = {}) => {
|
|
23
4
|
let initialVal = fallback;
|
|
24
|
-
if (
|
|
5
|
+
if (isClient) {
|
|
25
6
|
const classes = [...document.documentElement.classList];
|
|
26
7
|
initialVal = classes.includes("t_dark") ? "dark" : classes.includes("t_light") ? "light" : fallback;
|
|
27
8
|
}
|
|
28
|
-
return
|
|
9
|
+
return useState(initialVal);
|
|
29
10
|
};
|
|
30
|
-
|
|
31
|
-
0 && (module.exports = {
|
|
11
|
+
export {
|
|
32
12
|
useRootTheme
|
|
33
|
-
}
|
|
13
|
+
};
|
|
34
14
|
//# sourceMappingURL=useRootTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useRootTheme.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAIlB,MAAM,eAAe,CAAC,EAAE,WAAW,QAAQ,IAAgC,CAAC,MAAM;AACvF,MAAI,aAAa;AAEjB,MAAI,UAAU;AAEZ,UAAM,UAAU,CAAC,GAAG,SAAS,gBAAgB,SAAS;AACtD,iBAAa,QAAQ,SAAS,QAAQ,IAClC,SACA,QAAQ,SAAS,SAAS,IACxB,UACA;AAAA,EACR;AAEA,SAAO,SAAsB,UAAU;AACzC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 = {
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeSettingContext } from "./ThemeSettingContext";
|
|
3
|
+
const useTheme = () => useContext(ThemeSettingContext), useThemeSetting = () => useContext(ThemeSettingContext);
|
|
4
|
+
export {
|
|
26
5
|
useTheme,
|
|
27
6
|
useThemeSetting
|
|
28
|
-
}
|
|
7
|
+
};
|
|
29
8
|
//# sourceMappingURL=useTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useTheme.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAE3B,SAAS,2BAA2B;AAM7B,MAAM,WAAW,MAAM,WAAW,mBAAmB,GAE/C,kBAAkB,MAAM,WAAW,mBAAmB;",
|
|
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.23",
|
|
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.23",
|
|
24
|
+
"@tamagui/use-event": "1.88.23"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "*"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tamagui/build": "1.88.
|
|
30
|
+
"@tamagui/build": "1.88.23",
|
|
31
31
|
"react": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|