@tamagui/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/_mutateTheme.native.js +21 -33
- package/dist/esm/_mutateTheme.native.js.map +1 -1
- package/dist/esm/addTheme.native.js +4 -25
- package/dist/esm/addTheme.native.js.map +1 -1
- package/dist/esm/index.native.js +7 -31
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/replaceTheme.native.js +4 -25
- package/dist/esm/replaceTheme.native.js.map +1 -1
- package/dist/esm/updateTheme.native.js +4 -25
- package/dist/esm/updateTheme.native.js.map +1 -1
- package/dist/jsx/_mutateTheme.native.js +21 -33
- package/dist/jsx/_mutateTheme.native.js.map +1 -1
- package/dist/jsx/addTheme.native.js +4 -25
- package/dist/jsx/addTheme.native.js.map +1 -1
- package/dist/jsx/index.native.js +7 -31
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/replaceTheme.native.js +4 -25
- package/dist/jsx/replaceTheme.native.js.map +1 -1
- package/dist/jsx/updateTheme.native.js +4 -25
- package/dist/jsx/updateTheme.native.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 mutateTheme_exports = {};
|
|
17
|
-
__export(mutateTheme_exports, {
|
|
18
|
-
_mutateTheme: () => _mutateTheme,
|
|
19
|
-
mutateThemes: () => mutateThemes
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(mutateTheme_exports);
|
|
22
|
-
var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web"), import_react = require("react");
|
|
1
|
+
import { isServer } from "@tamagui/constants";
|
|
2
|
+
import {
|
|
3
|
+
activeThemeManagers,
|
|
4
|
+
ensureThemeVariable,
|
|
5
|
+
getConfig,
|
|
6
|
+
getThemeCSSRules,
|
|
7
|
+
proxyThemeToParents,
|
|
8
|
+
simpleHash,
|
|
9
|
+
updateConfig
|
|
10
|
+
} from "@tamagui/web";
|
|
11
|
+
import { startTransition } from "react";
|
|
23
12
|
function mutateThemes({
|
|
24
13
|
themes,
|
|
25
14
|
batch,
|
|
@@ -40,7 +29,7 @@ function mutateThemes({
|
|
|
40
29
|
res && (allThemesProxied[name] = res.theme, allThemesRaw[name] = res.themeRaw);
|
|
41
30
|
}
|
|
42
31
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
43
|
-
return
|
|
32
|
+
return startTransition(() => {
|
|
44
33
|
for (const themeName in allThemesProxied) {
|
|
45
34
|
const theme = allThemesProxied[themeName];
|
|
46
35
|
updateThemeConfig(themeName, theme), notifyThemeManagersOfUpdate(themeName, theme);
|
|
@@ -52,11 +41,11 @@ function mutateThemes({
|
|
|
52
41
|
};
|
|
53
42
|
}
|
|
54
43
|
function _mutateTheme(props) {
|
|
55
|
-
if (
|
|
44
|
+
if (isServer) {
|
|
56
45
|
process.env.NODE_ENV === "development" && console.warn("Theme mutation is not supported on server side");
|
|
57
46
|
return;
|
|
58
47
|
}
|
|
59
|
-
const config =
|
|
48
|
+
const config = getConfig(), { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
|
|
60
49
|
if (process.env.NODE_ENV === "development") {
|
|
61
50
|
if (!config)
|
|
62
51
|
throw new Error("No config");
|
|
@@ -71,8 +60,8 @@ function _mutateTheme(props) {
|
|
|
71
60
|
...themeIn
|
|
72
61
|
};
|
|
73
62
|
for (const key in theme)
|
|
74
|
-
|
|
75
|
-
const themeProxied =
|
|
63
|
+
ensureThemeVariable(theme, key);
|
|
64
|
+
const themeProxied = proxyThemeToParents(themeName, theme), response = {
|
|
76
65
|
themeRaw: theme,
|
|
77
66
|
theme: themeProxied,
|
|
78
67
|
cssRules: []
|
|
@@ -82,11 +71,11 @@ function _mutateTheme(props) {
|
|
|
82
71
|
})), updateThemeConfig(themeName, themeProxied), notifyThemeManagersOfUpdate(themeName, themeProxied)), response;
|
|
83
72
|
}
|
|
84
73
|
function updateThemeConfig(themeName, theme) {
|
|
85
|
-
const config =
|
|
86
|
-
config.themes[themeName] = theme,
|
|
74
|
+
const config = getConfig();
|
|
75
|
+
config.themes[themeName] = theme, updateConfig("themes", config.themes);
|
|
87
76
|
}
|
|
88
77
|
function notifyThemeManagersOfUpdate(themeName, theme) {
|
|
89
|
-
|
|
78
|
+
activeThemeManagers.forEach((manager) => {
|
|
90
79
|
manager.state.name === themeName && manager.updateStateFromProps(
|
|
91
80
|
{
|
|
92
81
|
name: themeName,
|
|
@@ -105,9 +94,8 @@ function updateStyle(id, rules) {
|
|
|
105
94
|
style.id = id, style.appendChild(document.createTextNode(rules.join(`
|
|
106
95
|
`))), document.head.appendChild(style), existing && ((_a = existing.parentElement) == null || _a.removeChild(existing));
|
|
107
96
|
}
|
|
108
|
-
|
|
109
|
-
0 && (module.exports = {
|
|
97
|
+
export {
|
|
110
98
|
_mutateTheme,
|
|
111
99
|
mutateThemes
|
|
112
|
-
}
|
|
100
|
+
};
|
|
113
101
|
//# sourceMappingURL=_mutateTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/_mutateTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;A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wnPropNames = 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 addTheme_exports = {};
|
|
17
|
-
__export(addTheme_exports, {
|
|
18
|
-
addTheme: () => addTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(addTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function addTheme(props) {
|
|
23
|
-
return
|
|
3
|
+
return _mutateTheme({ ...props, insertCSS: !0, mutationType: "add" });
|
|
24
4
|
}
|
|
25
|
-
|
|
26
|
-
0 && (module.exports = {
|
|
5
|
+
export {
|
|
27
6
|
addTheme
|
|
28
|
-
}
|
|
7
|
+
};
|
|
29
8
|
//# sourceMappingURL=addTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/addTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,SAAS,OAItB;AACD,SAAO,aAAa,EAAE,GAAG,OAAO,WAAW,IAAM,cAAc,MAAM,CAAC;AACxE;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
__export(src_exports, {
|
|
18
|
-
mutateThemes: () => import_mutateTheme.mutateThemes
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
__reExport(src_exports, require("./addTheme"), module.exports);
|
|
22
|
-
__reExport(src_exports, require("./updateTheme"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./replaceTheme"), module.exports);
|
|
24
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
mutateThemes,
|
|
28
|
-
...require("./addTheme"),
|
|
29
|
-
...require("./updateTheme"),
|
|
30
|
-
...require("./replaceTheme")
|
|
31
|
-
});
|
|
1
|
+
export * from "./addTheme";
|
|
2
|
+
export * from "./updateTheme";
|
|
3
|
+
export * from "./replaceTheme";
|
|
4
|
+
import { mutateThemes } from "./_mutateTheme";
|
|
5
|
+
export {
|
|
6
|
+
mutateThemes
|
|
7
|
+
};
|
|
32
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,32 +1,11 @@
|
|
|
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 replaceTheme_exports = {};
|
|
17
|
-
__export(replaceTheme_exports, {
|
|
18
|
-
replaceTheme: () => replaceTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(replaceTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function replaceTheme({
|
|
23
3
|
name,
|
|
24
4
|
theme
|
|
25
5
|
}) {
|
|
26
|
-
return
|
|
6
|
+
return _mutateTheme({ name, theme, insertCSS: !0, mutationType: "replace" });
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
0 && (module.exports = {
|
|
8
|
+
export {
|
|
30
9
|
replaceTheme
|
|
31
|
-
}
|
|
10
|
+
};
|
|
32
11
|
//# sourceMappingURL=replaceTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/replaceTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAED,SADa,aAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,UAAU,CAAC;AAErF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,32 +1,11 @@
|
|
|
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 updateTheme_exports = {};
|
|
17
|
-
__export(updateTheme_exports, {
|
|
18
|
-
updateTheme: () => updateTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(updateTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function updateTheme({
|
|
23
3
|
name,
|
|
24
4
|
theme
|
|
25
5
|
}) {
|
|
26
|
-
return
|
|
6
|
+
return _mutateTheme({ name, theme, insertCSS: !0, mutationType: "update" });
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
0 && (module.exports = {
|
|
8
|
+
export {
|
|
30
9
|
updateTheme
|
|
31
|
-
}
|
|
10
|
+
};
|
|
32
11
|
//# sourceMappingURL=updateTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/updateTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,SAAO,aAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,SAAS,CAAC;AAC9E;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 mutateTheme_exports = {};
|
|
17
|
-
__export(mutateTheme_exports, {
|
|
18
|
-
_mutateTheme: () => _mutateTheme,
|
|
19
|
-
mutateThemes: () => mutateThemes
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(mutateTheme_exports);
|
|
22
|
-
var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web"), import_react = require("react");
|
|
1
|
+
import { isServer } from "@tamagui/constants";
|
|
2
|
+
import {
|
|
3
|
+
activeThemeManagers,
|
|
4
|
+
ensureThemeVariable,
|
|
5
|
+
getConfig,
|
|
6
|
+
getThemeCSSRules,
|
|
7
|
+
proxyThemeToParents,
|
|
8
|
+
simpleHash,
|
|
9
|
+
updateConfig
|
|
10
|
+
} from "@tamagui/web";
|
|
11
|
+
import { startTransition } from "react";
|
|
23
12
|
function mutateThemes({
|
|
24
13
|
themes,
|
|
25
14
|
batch,
|
|
@@ -40,7 +29,7 @@ function mutateThemes({
|
|
|
40
29
|
res && (allThemesProxied[name] = res.theme, allThemesRaw[name] = res.themeRaw);
|
|
41
30
|
}
|
|
42
31
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
43
|
-
return
|
|
32
|
+
return startTransition(() => {
|
|
44
33
|
for (const themeName in allThemesProxied) {
|
|
45
34
|
const theme = allThemesProxied[themeName];
|
|
46
35
|
updateThemeConfig(themeName, theme), notifyThemeManagersOfUpdate(themeName, theme);
|
|
@@ -52,11 +41,11 @@ function mutateThemes({
|
|
|
52
41
|
};
|
|
53
42
|
}
|
|
54
43
|
function _mutateTheme(props) {
|
|
55
|
-
if (
|
|
44
|
+
if (isServer) {
|
|
56
45
|
process.env.NODE_ENV === "development" && console.warn("Theme mutation is not supported on server side");
|
|
57
46
|
return;
|
|
58
47
|
}
|
|
59
|
-
const config =
|
|
48
|
+
const config = getConfig(), { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
|
|
60
49
|
if (process.env.NODE_ENV === "development") {
|
|
61
50
|
if (!config)
|
|
62
51
|
throw new Error("No config");
|
|
@@ -71,8 +60,8 @@ function _mutateTheme(props) {
|
|
|
71
60
|
...themeIn
|
|
72
61
|
};
|
|
73
62
|
for (const key in theme)
|
|
74
|
-
|
|
75
|
-
const themeProxied =
|
|
63
|
+
ensureThemeVariable(theme, key);
|
|
64
|
+
const themeProxied = proxyThemeToParents(themeName, theme), response = {
|
|
76
65
|
themeRaw: theme,
|
|
77
66
|
theme: themeProxied,
|
|
78
67
|
cssRules: []
|
|
@@ -82,11 +71,11 @@ function _mutateTheme(props) {
|
|
|
82
71
|
})), updateThemeConfig(themeName, themeProxied), notifyThemeManagersOfUpdate(themeName, themeProxied)), response;
|
|
83
72
|
}
|
|
84
73
|
function updateThemeConfig(themeName, theme) {
|
|
85
|
-
const config =
|
|
86
|
-
config.themes[themeName] = theme,
|
|
74
|
+
const config = getConfig();
|
|
75
|
+
config.themes[themeName] = theme, updateConfig("themes", config.themes);
|
|
87
76
|
}
|
|
88
77
|
function notifyThemeManagersOfUpdate(themeName, theme) {
|
|
89
|
-
|
|
78
|
+
activeThemeManagers.forEach((manager) => {
|
|
90
79
|
manager.state.name === themeName && manager.updateStateFromProps(
|
|
91
80
|
{
|
|
92
81
|
name: themeName,
|
|
@@ -105,9 +94,8 @@ function updateStyle(id, rules) {
|
|
|
105
94
|
style.id = id, style.appendChild(document.createTextNode(rules.join(`
|
|
106
95
|
`))), document.head.appendChild(style), existing && ((_a = existing.parentElement) == null || _a.removeChild(existing));
|
|
107
96
|
}
|
|
108
|
-
|
|
109
|
-
0 && (module.exports = {
|
|
97
|
+
export {
|
|
110
98
|
_mutateTheme,
|
|
111
99
|
mutateThemes
|
|
112
|
-
}
|
|
100
|
+
};
|
|
113
101
|
//# sourceMappingURL=_mutateTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/_mutateTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAmBzB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,GAMG;AACD,QAAM,mBAAgD,CAAC,GACjD,eAA4C,CAAC;AAEnD,aAAW,EAAE,MAAM,MAAM,KAAK,QAAQ;AACpC,UAAM,MAAM,aAAa;AAAA,MACvB,GAAG;AAAA,MACH;AAAA,MACA;AAAA;AAAA,MAEA,aAAa;AAAA;AAAA,MAEb,cAAc;AAAA,IAChB,CAAC;AACD,IAAI,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AAW,YAAY,GACzC,4BAA4B,WAAW,YAAY,IAE5C;AACT;AAEA,SAAS,kBAAkB,WAAmB,OAAoB;AAChE,QAAM,SAAS,UAAU;AACzB,SAAO,OAAO,SAAS,IAAI,OAC3B,aAAa,UAAU,OAAO,MAAM;AACtC;AAEA,SAAS,4BAA4B,WAAmB,OAAoB;AAC1E,sBAAoB,QAAQ,CAAC,YAAY;AACvC,IAAI,QAAQ,MAAM,SAAS,aACzB,QAAQ;AAAA,MACN;AAAA,QACE,MAAM;AAAA,QACN,YAAY;AAAA,MACd;AAAA,MACA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AAEA,SAAS,eAAe,QAAsC,QAAe,IAAO;AAEhF,SAAO,CAAC;AA8BZ;AAEA,SAAS,YAAY,IAAY,OAAiB;AA9LlD;AA+LE,QAAM,WAAW,SAAS,cAAc,IAAI,EAAE,EAAE,GAC1C,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,KAAK,IACX,MAAM,YAAY,SAAS,eAAe,MAAM,KAAK;AAAA,CAAI,CAAC,CAAC,GAC3D,SAAS,KAAK,YAAY,KAAK,GAC3B,cACF,cAAS,kBAAT,WAAwB,YAAY;AAExC;",
|
|
5
5
|
"names": ["theme"]
|
|
6
6
|
}
|
|
@@ -1,29 +1,8 @@
|
|
|
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 addTheme_exports = {};
|
|
17
|
-
__export(addTheme_exports, {
|
|
18
|
-
addTheme: () => addTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(addTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function addTheme(props) {
|
|
23
|
-
return
|
|
3
|
+
return _mutateTheme({ ...props, insertCSS: !0, mutationType: "add" });
|
|
24
4
|
}
|
|
25
|
-
|
|
26
|
-
0 && (module.exports = {
|
|
5
|
+
export {
|
|
27
6
|
addTheme
|
|
28
|
-
}
|
|
7
|
+
};
|
|
29
8
|
//# sourceMappingURL=addTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/addTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,SAAS,OAItB;AACD,SAAO,aAAa,EAAE,GAAG,OAAO,WAAW,IAAM,cAAc,MAAM,CAAC;AACxE;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
__export(src_exports, {
|
|
18
|
-
mutateThemes: () => import_mutateTheme.mutateThemes
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
__reExport(src_exports, require("./addTheme"), module.exports);
|
|
22
|
-
__reExport(src_exports, require("./updateTheme"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./replaceTheme"), module.exports);
|
|
24
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
mutateThemes,
|
|
28
|
-
...require("./addTheme"),
|
|
29
|
-
...require("./updateTheme"),
|
|
30
|
-
...require("./replaceTheme")
|
|
31
|
-
});
|
|
1
|
+
export * from "./addTheme";
|
|
2
|
+
export * from "./updateTheme";
|
|
3
|
+
export * from "./replaceTheme";
|
|
4
|
+
import { mutateThemes } from "./_mutateTheme";
|
|
5
|
+
export {
|
|
6
|
+
mutateThemes
|
|
7
|
+
};
|
|
32
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,32 +1,11 @@
|
|
|
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 replaceTheme_exports = {};
|
|
17
|
-
__export(replaceTheme_exports, {
|
|
18
|
-
replaceTheme: () => replaceTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(replaceTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function replaceTheme({
|
|
23
3
|
name,
|
|
24
4
|
theme
|
|
25
5
|
}) {
|
|
26
|
-
return
|
|
6
|
+
return _mutateTheme({ name, theme, insertCSS: !0, mutationType: "replace" });
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
0 && (module.exports = {
|
|
8
|
+
export {
|
|
30
9
|
replaceTheme
|
|
31
|
-
}
|
|
10
|
+
};
|
|
32
11
|
//# sourceMappingURL=replaceTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/replaceTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAED,SADa,aAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,UAAU,CAAC;AAErF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,32 +1,11 @@
|
|
|
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 updateTheme_exports = {};
|
|
17
|
-
__export(updateTheme_exports, {
|
|
18
|
-
updateTheme: () => updateTheme
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(updateTheme_exports);
|
|
21
|
-
var import_mutateTheme = require("./_mutateTheme");
|
|
1
|
+
import { _mutateTheme } from "./_mutateTheme";
|
|
22
2
|
function updateTheme({
|
|
23
3
|
name,
|
|
24
4
|
theme
|
|
25
5
|
}) {
|
|
26
|
-
return
|
|
6
|
+
return _mutateTheme({ name, theme, insertCSS: !0, mutationType: "update" });
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
0 && (module.exports = {
|
|
8
|
+
export {
|
|
30
9
|
updateTheme
|
|
31
|
-
}
|
|
10
|
+
};
|
|
32
11
|
//# sourceMappingURL=updateTheme.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/updateTheme.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,oBAAoB;AAEtB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,SAAO,aAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,SAAS,CAAC;AAC9E;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/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",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"clean:build": "tamagui-build clean:build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tamagui/constants": "1.88.
|
|
25
|
-
"@tamagui/web": "1.88.
|
|
24
|
+
"@tamagui/constants": "1.88.23",
|
|
25
|
+
"@tamagui/web": "1.88.23"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "*"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tamagui/build": "1.88.
|
|
31
|
+
"@tamagui/build": "1.88.23",
|
|
32
32
|
"react": "^18.2.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|