@tamagui/theme 3.0.0-beta.669.1 → 3.0.0-beta.728.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_mutateTheme.cjs +2 -8
- package/dist/cjs/_mutateTheme.native.cjs +2 -8
- package/dist/cjs/_mutateTheme.native.js +2 -8
- package/dist/cjs/_mutateTheme.native.js.map +1 -1
- package/dist/cjs/addTheme.cjs +0 -1
- package/dist/cjs/addTheme.native.cjs +0 -1
- package/dist/cjs/addTheme.native.js +0 -1
- package/dist/cjs/addTheme.native.js.map +1 -1
- package/dist/cjs/index.cjs +0 -1
- package/dist/cjs/index.native.cjs +0 -1
- package/dist/cjs/index.native.js +0 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/replaceTheme.cjs +0 -1
- package/dist/cjs/replaceTheme.native.cjs +0 -1
- package/dist/cjs/replaceTheme.native.js +0 -1
- package/dist/cjs/replaceTheme.native.js.map +1 -1
- package/dist/cjs/updateTheme.cjs +0 -1
- package/dist/cjs/updateTheme.native.cjs +0 -1
- package/dist/cjs/updateTheme.native.js +0 -1
- package/dist/cjs/updateTheme.native.js.map +1 -1
- package/dist/esm/_mutateTheme.mjs +2 -7
- package/dist/esm/_mutateTheme.mjs.map +1 -1
- package/dist/esm/_mutateTheme.native.js +2 -7
- package/dist/esm/_mutateTheme.native.js.map +1 -1
- package/package.json +6 -6
- package/src/_mutateTheme.ts +2 -7
- package/types/_mutateTheme.d.ts.map +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -46,10 +45,7 @@ function mutateThemes({ themes, batch, insertCSS = true, ...props }) {
|
|
|
46
45
|
}
|
|
47
46
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
48
47
|
(0, import_start_transition.startTransition)(() => {
|
|
49
|
-
|
|
50
|
-
const theme = allThemesProxied[themeName];
|
|
51
|
-
updateThemeConfig(themeName, theme);
|
|
52
|
-
}
|
|
48
|
+
(0, import_web.updateConfig)("themes", allThemesProxied);
|
|
53
49
|
updateThemeStates();
|
|
54
50
|
});
|
|
55
51
|
return {
|
|
@@ -88,9 +84,7 @@ function _mutateTheme(props) {
|
|
|
88
84
|
return response;
|
|
89
85
|
}
|
|
90
86
|
function updateThemeConfig(themeName, theme) {
|
|
91
|
-
|
|
92
|
-
config.themes[themeName] = theme;
|
|
93
|
-
(0, import_web.updateConfig)("themes", config.themes);
|
|
87
|
+
(0, import_web.updateConfig)("themes", { [themeName]: theme });
|
|
94
88
|
}
|
|
95
89
|
function updateThemeStates() {
|
|
96
90
|
(0, import_web.forceUpdateThemes)();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -62,10 +61,7 @@ function mutateThemes(param) {
|
|
|
62
61
|
}
|
|
63
62
|
var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
64
63
|
(0, import_start_transition.startTransition)(function() {
|
|
65
|
-
|
|
66
|
-
var theme2 = allThemesProxied[themeName];
|
|
67
|
-
updateThemeConfig(themeName, theme2);
|
|
68
|
-
}
|
|
64
|
+
(0, import_web.updateConfig)("themes", allThemesProxied);
|
|
69
65
|
updateThemeStates();
|
|
70
66
|
});
|
|
71
67
|
return {
|
|
@@ -105,9 +101,7 @@ function _mutateTheme(props) {
|
|
|
105
101
|
return response;
|
|
106
102
|
}
|
|
107
103
|
function updateThemeConfig(themeName, theme) {
|
|
108
|
-
|
|
109
|
-
config.themes[themeName] = theme;
|
|
110
|
-
(0, import_web.updateConfig)("themes", config.themes);
|
|
104
|
+
(0, import_web.updateConfig)("themes", { [themeName]: theme });
|
|
111
105
|
}
|
|
112
106
|
function updateThemeStates() {
|
|
113
107
|
(0, import_web.forceUpdateThemes)();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -62,10 +61,7 @@ function mutateThemes(param) {
|
|
|
62
61
|
}
|
|
63
62
|
var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
64
63
|
(0, import_start_transition.startTransition)(function() {
|
|
65
|
-
|
|
66
|
-
var theme2 = allThemesProxied[themeName];
|
|
67
|
-
updateThemeConfig(themeName, theme2);
|
|
68
|
-
}
|
|
64
|
+
(0, import_web.updateConfig)("themes", allThemesProxied);
|
|
69
65
|
updateThemeStates();
|
|
70
66
|
});
|
|
71
67
|
return {
|
|
@@ -105,9 +101,7 @@ function _mutateTheme(props) {
|
|
|
105
101
|
return response;
|
|
106
102
|
}
|
|
107
103
|
function updateThemeConfig(themeName, theme) {
|
|
108
|
-
|
|
109
|
-
config.themes[themeName] = theme;
|
|
110
|
-
(0, import_web.updateConfig)("themes", config.themes);
|
|
104
|
+
(0, import_web.updateConfig)("themes", { [themeName]: theme });
|
|
111
105
|
}
|
|
112
106
|
function updateThemeStates() {
|
|
113
107
|
(0, import_web.forceUpdateThemes)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_mutateTheme.native.js","names":[],"sources":["cjs/_mutateTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar mutateTheme_exports = {};\n__export(mutateTheme_exports, {\n\t_mutateTheme: () => _mutateTheme,\n\tmutateThemes: () => mutateThemes\n});\nmodule.exports = __toCommonJS(mutateTheme_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_start_transition = require(\"@tamagui/start-transition\");\nvar import_web = require(\"@tamagui/web\");\nfunction mutateThemes(param) {\n\tvar { themes, batch, insertCSS = true, ...props } = param;\n\tvar allThemesProxied = {};\n\tvar allThemesRaw = {};\n\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\ttry {\n\t\tfor (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar { name, theme } = _step.value;\n\t\t\tvar res = _mutateTheme({\n\t\t\t\t...props,\n\t\t\t\tname,\n\t\t\t\ttheme,\n\t\t\t\tavoidUpdate: true,\n\t\t\t\tmutationType: \"add\"\n\t\t\t});\n\t\t\tif (res) {\n\t\t\t\tallThemesProxied[name] = res.theme;\n\t\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t} finally {\n\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t}\n\t}\n\tvar cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\t(0, import_start_transition.startTransition)(function() {\n\t\
|
|
1
|
+
{"version":3,"file":"_mutateTheme.native.js","names":[],"sources":["cjs/_mutateTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar mutateTheme_exports = {};\n__export(mutateTheme_exports, {\n\t_mutateTheme: () => _mutateTheme,\n\tmutateThemes: () => mutateThemes\n});\nmodule.exports = __toCommonJS(mutateTheme_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_start_transition = require(\"@tamagui/start-transition\");\nvar import_web = require(\"@tamagui/web\");\nfunction mutateThemes(param) {\n\tvar { themes, batch, insertCSS = true, ...props } = param;\n\tvar allThemesProxied = {};\n\tvar allThemesRaw = {};\n\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\ttry {\n\t\tfor (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar { name, theme } = _step.value;\n\t\t\tvar res = _mutateTheme({\n\t\t\t\t...props,\n\t\t\t\tname,\n\t\t\t\ttheme,\n\t\t\t\tavoidUpdate: true,\n\t\t\t\tmutationType: \"add\"\n\t\t\t});\n\t\t\tif (res) {\n\t\t\t\tallThemesProxied[name] = res.theme;\n\t\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t} finally {\n\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t}\n\t}\n\tvar cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\t(0, import_start_transition.startTransition)(function() {\n\t\t(0, import_web.updateConfig)(\"themes\", allThemesProxied);\n\t\tupdateThemeStates();\n\t});\n\treturn {\n\t\tthemes: allThemesProxied,\n\t\tthemesRaw: allThemesRaw,\n\t\tcssRules\n\t};\n}\nfunction _mutateTheme(props) {\n\tif (import_constants.isServer) {\n\t\tif (process.env.NODE_ENV === \"development\") console.warn(\"Theme mutation is not supported on server side\");\n\t\treturn;\n\t}\n\tvar config = (0, import_web.getConfig)();\n\tvar { name: themeName, theme: themeIn, insertCSS, mutationType } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!config) throw new Error(\"No config\");\n\t\tvar theme = config.themes[props.name];\n\t\tif (mutationType !== \"add\" && !theme) throw new Error(`${mutationType === \"replace\" ? \"Replace\" : \"Update\"} theme failed! Theme ${props.name} does not exist`);\n\t}\n\tvar _config_themes_themeName;\n\tvar theme1 = {\n\t\t...mutationType === \"update\" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {},\n\t\t...themeIn\n\t};\n\tfor (var key in theme1) (0, import_web.ensureThemeVariable)(theme1, key);\n\tvar themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme1);\n\tvar response = {\n\t\tthemeRaw: theme1,\n\t\ttheme: themeProxied,\n\t\tcssRules: []\n\t};\n\tif (props.avoidUpdate) return response;\n\tif (insertCSS) response.cssRules = insertThemeCSS({ [themeName]: theme1 });\n\tupdateThemeConfig(themeName, themeProxied);\n\tupdateThemeStates();\n\treturn response;\n}\nfunction updateThemeConfig(themeName, theme) {\n\t(0, import_web.updateConfig)(\"themes\", { [themeName]: theme });\n}\nfunction updateThemeStates() {\n\t(0, import_web.forceUpdateThemes)();\n}\nfunction insertThemeCSS(themes) {\n\targuments.length > 1 && arguments[1] !== void 0 && arguments[1];\n\treturn [];\n}\n//# sourceMappingURL=_mutateTheme.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB;CAC7B,oBAAoB;CACpB,oBAAoB;AACrB,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,0BAA0B,QAAQ,2BAA2B;AACjE,IAAI,aAAa,Q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WAAW;EACxC,IAAI,QAAQ,OAAO,OAAO,MAAM;EAChC,IAAI,iBAAiB,SAAS,CAAC,OAAO,MAAM,IAAI,MAAM,GAAG,iBAAiB,YAAY,YAAY,SAAS,uBAAuB,MAAM,KAAK,gBAAgB;CAC9J;CACA,IAAI;CACJ,IAAI,SAAS;EACZ,GAAG,iBAAiB,YAAY,2BAA2B,OAAO,OAAO,gBAAgB,QAAQ,6BAA6B,KAAK,IAAI,2BAA2B,CAAC,IAAI,CAAC;EACxK,GAAG;CACJ;CACA,KAAK,IAAI,OAAO,QAAQ,CAAC,GAAG,WAAW,oBAAmB,CAAE,QAAQ,GAAG;CACvE,IAAI,gBAAgB,GAAG,WAAW,oBAAmB,CAAE,WAAW,MAAM;CACxE,IAAI,WAAW;EACd,UAAU;EACV,OAAO;EACP,UAAU,CAAC;CACZ;CACA,IAAI,MAAM,aAAa,OAAO;CAC9B,IAAI,WAAW,SAAS,WAAW,eAAe,GAAG,YAAY,OAAO,CAAC;CACzE,kBAAkB,WAAW,YAAY;CACzC,kBAAkB;CAClB,OAAO;AACR;AACA,SAAS,kBAAkB,WAAW,OAAO;CAC5C,CAAC,GAAG,WAAW,aAAY,CAAE,UAAU,GAAG,YAAY,MAAM,CAAC;AAC9D;AACA,SAAS,oBAAoB;CAC5B,CAAC,GAAG,WAAW,kBAAiB,CAAE;AACnC;AACA,SAAS,eAAe,QAAQ;CAC/B,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,KAAK,UAAU;CAC7D,OAAO,CAAC;AACT"}
|
package/dist/cjs/addTheme.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addTheme.native.js","names":[],"sources":["cjs/addTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar addTheme_exports = {};\n__export(addTheme_exports, {\n addTheme: () => addTheme\n});\nmodule.exports = __toCommonJS(addTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction addTheme(props) {\n return (0, import_mutateTheme._mutateTheme)({\n ...props,\n insertCSS: true,\n mutationType: \"add\"\n });\n}\n//# sourceMappingURL=addTheme.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"addTheme.native.js","names":[],"sources":["cjs/addTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar addTheme_exports = {};\n__export(addTheme_exports, {\n addTheme: () => addTheme\n});\nmodule.exports = __toCommonJS(addTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction addTheme(props) {\n return (0, import_mutateTheme._mutateTheme)({\n ...props,\n insertCSS: true,\n mutationType: \"add\"\n });\n}\n//# sourceMappingURL=addTheme.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB,EACzB,gBAAgB,SAClB,CAAC;AACD,OAAO,UAAU,aAAa,gBAAgB;AAC9C,IAAI,qBAAqB,QAAQ,0BAAgB;AACjD,SAAS,SAAS,OAAO;CACvB,QAAQ,GAAG,mBAAmB,aAAY,CAAE;EAC1C,GAAG;EACH,WAAW;EACX,cAAc;CAChB,CAAC;AACH"}
|
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n mutateThemes: () => import_mutateTheme.mutateThemes\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./addTheme\"), module.exports);\n__reExport(index_exports, require(\"./updateTheme\"), module.exports);\n__reExport(index_exports, require(\"./replaceTheme\"), module.exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\n//# sourceMappingURL=index.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n mutateThemes: () => import_mutateTheme.mutateThemes\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./addTheme\"), module.exports);\n__reExport(index_exports, require(\"./updateTheme\"), module.exports);\n__reExport(index_exports, require(\"./replaceTheme\"), module.exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,oBAAoB,mBAAmB,aACzC,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,sBAAY,GAAG,OAAO,OAAO;AAC/D,WAAW,eAAe,QAAQ,yBAAe,GAAG,OAAO,OAAO;AAClE,WAAW,eAAe,QAAQ,0BAAgB,GAAG,OAAO,OAAO;AACnE,IAAI,qBAAqB,QAAQ,0BAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceTheme.native.js","names":[],"sources":["cjs/replaceTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar replaceTheme_exports = {};\n__export(replaceTheme_exports, {\n replaceTheme: () => replaceTheme\n});\nmodule.exports = __toCommonJS(replaceTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction replaceTheme(param) {\n var { name, theme } = param;\n var next = (0, import_mutateTheme._mutateTheme)({\n name,\n theme,\n insertCSS: true,\n mutationType: \"replace\"\n });\n return next;\n}\n//# sourceMappingURL=replaceTheme.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"replaceTheme.native.js","names":[],"sources":["cjs/replaceTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar replaceTheme_exports = {};\n__export(replaceTheme_exports, {\n replaceTheme: () => replaceTheme\n});\nmodule.exports = __toCommonJS(replaceTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction replaceTheme(param) {\n var { name, theme } = param;\n var next = (0, import_mutateTheme._mutateTheme)({\n name,\n theme,\n insertCSS: true,\n mutationType: \"replace\"\n });\n return next;\n}\n//# sourceMappingURL=replaceTheme.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB,EAC7B,oBAAoB,aACtB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,qBAAqB,QAAQ,0BAAgB;AACjD,SAAS,aAAa,OAAO;CAC3B,IAAI,EAAE,MAAM,UAAU;CACtB,IAAI,QAAQ,GAAG,mBAAmB,aAAY,CAAE;EAC9C;EACA;EACA,WAAW;EACX,cAAc;CAChB,CAAC;CACD,OAAO;AACT"}
|
package/dist/cjs/updateTheme.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateTheme.native.js","names":[],"sources":["cjs/updateTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar updateTheme_exports = {};\n__export(updateTheme_exports, {\n updateTheme: () => updateTheme\n});\nmodule.exports = __toCommonJS(updateTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction updateTheme(param) {\n var { name, theme } = param;\n return (0, import_mutateTheme._mutateTheme)({\n name,\n theme,\n insertCSS: true,\n mutationType: \"update\"\n });\n}\n//# sourceMappingURL=updateTheme.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateTheme.native.js","names":[],"sources":["cjs/updateTheme.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar updateTheme_exports = {};\n__export(updateTheme_exports, {\n updateTheme: () => updateTheme\n});\nmodule.exports = __toCommonJS(updateTheme_exports);\nvar import_mutateTheme = require(\"./_mutateTheme\");\nfunction updateTheme(param) {\n var { name, theme } = param;\n return (0, import_mutateTheme._mutateTheme)({\n name,\n theme,\n insertCSS: true,\n mutationType: \"update\"\n });\n}\n//# sourceMappingURL=updateTheme.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB,EAC5B,mBAAmB,YACrB,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,qBAAqB,QAAQ,0BAAgB;AACjD,SAAS,YAAY,OAAO;CAC1B,IAAI,EAAE,MAAM,UAAU;CACtB,QAAQ,GAAG,mBAAmB,aAAY,CAAE;EAC1C;EACA;EACA,WAAW;EACX,cAAc;CAChB,CAAC;AACH"}
|
|
@@ -20,10 +20,7 @@ function mutateThemes({ themes, batch, insertCSS = true, ...props }) {
|
|
|
20
20
|
}
|
|
21
21
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
22
22
|
startTransition(() => {
|
|
23
|
-
|
|
24
|
-
const theme = allThemesProxied[themeName];
|
|
25
|
-
updateThemeConfig(themeName, theme);
|
|
26
|
-
}
|
|
23
|
+
updateConfig("themes", allThemesProxied);
|
|
27
24
|
updateThemeStates();
|
|
28
25
|
});
|
|
29
26
|
return {
|
|
@@ -62,9 +59,7 @@ function _mutateTheme(props) {
|
|
|
62
59
|
return response;
|
|
63
60
|
}
|
|
64
61
|
function updateThemeConfig(themeName, theme) {
|
|
65
|
-
|
|
66
|
-
config.themes[themeName] = theme;
|
|
67
|
-
updateConfig("themes", config.themes);
|
|
62
|
+
updateConfig("themes", { [themeName]: theme });
|
|
68
63
|
}
|
|
69
64
|
function updateThemeStates() {
|
|
70
65
|
forceUpdateThemes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_mutateTheme.js","names":[],"sources":["esm/_mutateTheme.js"],"sourcesContent":["import { isServer } from \"@tamagui/constants\";\nimport { startTransition } from \"@tamagui/start-transition\";\nimport { ensureThemeVariable, forceUpdateThemes, getConfig, getMutatedAutoVariableCSS, getThemeCSSRules, proxyThemeToParents, simpleHash, updateConfig } from \"@tamagui/web\";\n\nfunction mutateThemes({ themes, batch, insertCSS = true, ...props }) {\n\tconst allThemesProxied = {};\n\tconst allThemesRaw = {};\n\tfor (const { name, theme } of themes) {\n\t\tconst res = _mutateTheme({\n\t\t\t...props,\n\t\t\tname,\n\t\t\ttheme,\n\t\t\tavoidUpdate: true,\n\t\t\tmutationType: \"add\"\n\t\t});\n\t\tif (res) {\n\t\t\tallThemesProxied[name] = res.theme;\n\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t}\n\t}\n\tconst cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\tstartTransition(() => {\n\t\
|
|
1
|
+
{"version":3,"file":"_mutateTheme.js","names":[],"sources":["esm/_mutateTheme.js"],"sourcesContent":["import { isServer } from \"@tamagui/constants\";\nimport { startTransition } from \"@tamagui/start-transition\";\nimport { ensureThemeVariable, forceUpdateThemes, getConfig, getMutatedAutoVariableCSS, getThemeCSSRules, proxyThemeToParents, simpleHash, updateConfig } from \"@tamagui/web\";\n\nfunction mutateThemes({ themes, batch, insertCSS = true, ...props }) {\n\tconst allThemesProxied = {};\n\tconst allThemesRaw = {};\n\tfor (const { name, theme } of themes) {\n\t\tconst res = _mutateTheme({\n\t\t\t...props,\n\t\t\tname,\n\t\t\ttheme,\n\t\t\tavoidUpdate: true,\n\t\t\tmutationType: \"add\"\n\t\t});\n\t\tif (res) {\n\t\t\tallThemesProxied[name] = res.theme;\n\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t}\n\t}\n\tconst cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\tstartTransition(() => {\n\t\tupdateConfig(\"themes\", allThemesProxied);\n\t\tupdateThemeStates();\n\t});\n\treturn {\n\t\tthemes: allThemesProxied,\n\t\tthemesRaw: allThemesRaw,\n\t\tcssRules\n\t};\n}\nfunction _mutateTheme(props) {\n\tif (isServer) {\n\t\tif (process.env.NODE_ENV === \"development\") console.warn(\"Theme mutation is not supported on server side\");\n\t\treturn;\n\t}\n\tconst config = getConfig();\n\tconst { name: themeName, theme: themeIn, insertCSS, mutationType } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!config) throw new Error(\"No config\");\n\t\tconst theme2 = config.themes[props.name];\n\t\tif (mutationType !== \"add\" && !theme2) throw new Error(`${mutationType === \"replace\" ? \"Replace\" : \"Update\"} theme failed! Theme ${props.name} does not exist`);\n\t}\n\tconst theme = {\n\t\t...mutationType === \"update\" ? config.themes[themeName] ?? {} : {},\n\t\t...themeIn\n\t};\n\tfor (const key in theme) ensureThemeVariable(theme, key);\n\tconst themeProxied = proxyThemeToParents(themeName, theme);\n\tconst response = {\n\t\tthemeRaw: theme,\n\t\ttheme: themeProxied,\n\t\tcssRules: []\n\t};\n\tif (props.avoidUpdate) return response;\n\tif (insertCSS) response.cssRules = insertThemeCSS({ [themeName]: theme });\n\tupdateThemeConfig(themeName, themeProxied);\n\tupdateThemeStates();\n\treturn response;\n}\nfunction updateThemeConfig(themeName, theme) {\n\tupdateConfig(\"themes\", { [themeName]: theme });\n}\nfunction updateThemeStates() {\n\tforceUpdateThemes();\n}\nfunction insertThemeCSS(themes, batch = false) {\n\tconst config = getConfig();\n\tlet cssRules = [];\n\tfor (const themeName in themes) {\n\t\tconst theme = themes[themeName];\n\t\tconst rules = getThemeCSSRules({\n\t\t\tconfig,\n\t\t\tthemeName,\n\t\t\tnames: [themeName],\n\t\t\thasDarkLight: true,\n\t\t\ttheme,\n\t\t\tuseMutatedVariables: true\n\t\t});\n\t\tcssRules = [...cssRules, ...rules];\n\t\tif (!batch) updateStyle(`t_theme_style_${themeName}`, rules);\n\t}\n\tconst mutatedAutoVariableCSS = getMutatedAutoVariableCSS();\n\tif (mutatedAutoVariableCSS) updateStyle(`t_mutate_vars`, [`:root{${mutatedAutoVariableCSS}}`]);\n\tif (batch) updateStyle(`t_theme_style_${typeof batch == \"string\" ? batch : simpleHash(Object.keys(themes).join(\"\"))}`, cssRules);\n\treturn cssRules;\n}\nfunction updateStyle(id, rules) {\n\tconst existing = document.querySelector(`#${id}`);\n\tconst style = document.createElement(\"style\");\n\tstyle.id = id;\n\tstyle.appendChild(document.createTextNode(rules.join(\"\\n\")));\n\tdocument.head.appendChild(style);\n\tif (existing) existing.parentElement?.removeChild(existing);\n}\n\nexport { _mutateTheme, mutateThemes };"],"mappings":";;;;;AAIA,SAAS,aAAa,EAAE,QAAQ,OAAO,YAAY,MAAM,GAAG,SAAS;CACpE,MAAM,mBAAmB,CAAC;CAC1B,MAAM,eAAe,CAAC;CACtB,KAAK,MAAM,EAAE,MAAM,WAAW,QAAQ;EACrC,MAAM,MAAM,aAAa;GACxB,GAAG;GACH;GACA;GACA,aAAa;GACb,cAAc;EACf,CAAC;EACD,IAAI,KAAK;GACR,iBAAiB,QAAQ,IAAI;GAC7B,aAAa,QAAQ,IAAI;EAC1B;CACD;CACA,MAAM,WAAW,YAAY,eAAe,cAAc,KAAK,IAAI,CAAC;CACpE,sBAAsB;EACrB,aAAa,UAAU,gBAAgB;EACvC,kBAAkB;CACnB,CAAC;CACD,OAAO;EACN,QAAQ;EACR,WAAW;EACX;CACD;AACD;AACA,SAAS,aAAa,OAAO;CAC5B,IAAI,UAAU;EACb,IAAI,QAAQ,IAAI,aAAa,eAAe,QAAQ,KAAK,gDAAgD;EACzG;CACD;CACA,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,MAAM,WAAW,OAAO,SAAS,WAAW,iBAAiB;CACrE,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC3C,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,WAAW;EACxC,MAAM,SAAS,OAAO,OAAO,MAAM;EACnC,IAAI,iBAAiB,SAAS,CAAC,QAAQ,MAAM,IAAI,MAAM,GAAG,iBAAiB,YAAY,YAAY,SAAS,uBAAuB,MAAM,KAAK,gBAAgB;CAC/J;CACA,MAAM,QAAQ;EACb,GAAG,iBAAiB,WAAW,OAAO,OAAO,cAAc,CAAC,IAAI,CAAC;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K,YAAY,KAAK;CAC/B,IAAI,UAAU,SAAS,eAAe,YAAY,QAAQ;AAC3D"}
|
|
@@ -34,10 +34,7 @@ function mutateThemes(param) {
|
|
|
34
34
|
}
|
|
35
35
|
var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
|
|
36
36
|
startTransition(function() {
|
|
37
|
-
|
|
38
|
-
var theme2 = allThemesProxied[themeName];
|
|
39
|
-
updateThemeConfig(themeName, theme2);
|
|
40
|
-
}
|
|
37
|
+
updateConfig("themes", allThemesProxied);
|
|
41
38
|
updateThemeStates();
|
|
42
39
|
});
|
|
43
40
|
return {
|
|
@@ -77,9 +74,7 @@ function _mutateTheme(props) {
|
|
|
77
74
|
return response;
|
|
78
75
|
}
|
|
79
76
|
function updateThemeConfig(themeName, theme) {
|
|
80
|
-
|
|
81
|
-
config.themes[themeName] = theme;
|
|
82
|
-
updateConfig("themes", config.themes);
|
|
77
|
+
updateConfig("themes", { [themeName]: theme });
|
|
83
78
|
}
|
|
84
79
|
function updateThemeStates() {
|
|
85
80
|
forceUpdateThemes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_mutateTheme.native.js","names":[],"sources":["esm/_mutateTheme.native.js"],"sourcesContent":["import { isServer } from \"@tamagui/constants\";\nimport { startTransition } from \"@tamagui/start-transition\";\nimport { ensureThemeVariable, forceUpdateThemes, getConfig, proxyThemeToParents, updateConfig } from \"@tamagui/web\";\n\nfunction mutateThemes(param) {\n\tvar { themes, batch, insertCSS = true, ...props } = param;\n\tvar allThemesProxied = {};\n\tvar allThemesRaw = {};\n\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\ttry {\n\t\tfor (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar { name, theme } = _step.value;\n\t\t\tvar res = _mutateTheme({\n\t\t\t\t...props,\n\t\t\t\tname,\n\t\t\t\ttheme,\n\t\t\t\tavoidUpdate: true,\n\t\t\t\tmutationType: \"add\"\n\t\t\t});\n\t\t\tif (res) {\n\t\t\t\tallThemesProxied[name] = res.theme;\n\t\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t} finally {\n\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t}\n\t}\n\tvar cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\tstartTransition(function() {\n\t\
|
|
1
|
+
{"version":3,"file":"_mutateTheme.native.js","names":[],"sources":["esm/_mutateTheme.native.js"],"sourcesContent":["import { isServer } from \"@tamagui/constants\";\nimport { startTransition } from \"@tamagui/start-transition\";\nimport { ensureThemeVariable, forceUpdateThemes, getConfig, proxyThemeToParents, updateConfig } from \"@tamagui/web\";\n\nfunction mutateThemes(param) {\n\tvar { themes, batch, insertCSS = true, ...props } = param;\n\tvar allThemesProxied = {};\n\tvar allThemesRaw = {};\n\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\ttry {\n\t\tfor (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar { name, theme } = _step.value;\n\t\t\tvar res = _mutateTheme({\n\t\t\t\t...props,\n\t\t\t\tname,\n\t\t\t\ttheme,\n\t\t\t\tavoidUpdate: true,\n\t\t\t\tmutationType: \"add\"\n\t\t\t});\n\t\t\tif (res) {\n\t\t\t\tallThemesProxied[name] = res.theme;\n\t\t\t\tallThemesRaw[name] = res.themeRaw;\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t} finally {\n\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t}\n\t}\n\tvar cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];\n\tstartTransition(function() {\n\t\tupdateConfig(\"themes\", allThemesProxied);\n\t\tupdateThemeStates();\n\t});\n\treturn {\n\t\tthemes: allThemesProxied,\n\t\tthemesRaw: allThemesRaw,\n\t\tcssRules\n\t};\n}\nfunction _mutateTheme(props) {\n\tif (isServer) {\n\t\tif (process.env.NODE_ENV === \"development\") console.warn(\"Theme mutation is not supported on server side\");\n\t\treturn;\n\t}\n\tvar config = getConfig();\n\tvar { name: themeName, theme: themeIn, insertCSS, mutationType } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!config) throw new Error(\"No config\");\n\t\tvar theme = config.themes[props.name];\n\t\tif (mutationType !== \"add\" && !theme) throw new Error(`${mutationType === \"replace\" ? \"Replace\" : \"Update\"} theme failed! Theme ${props.name} does not exist`);\n\t}\n\tvar _config_themes_themeName;\n\tvar theme1 = {\n\t\t...mutationType === \"update\" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {},\n\t\t...themeIn\n\t};\n\tfor (var key in theme1) ensureThemeVariable(theme1, key);\n\tvar themeProxied = proxyThemeToParents(themeName, theme1);\n\tvar response = {\n\t\tthemeRaw: theme1,\n\t\ttheme: themeProxied,\n\t\tcssRules: []\n\t};\n\tif (props.avoidUpdate) return response;\n\tif (insertCSS) response.cssRules = insertThemeCSS({ [themeName]: theme1 });\n\tupdateThemeConfig(themeName, themeProxied);\n\tupdateThemeStates();\n\treturn response;\n}\nfunction updateThemeConfig(themeName, theme) {\n\tupdateConfig(\"themes\", { [themeName]: theme });\n}\nfunction updateThemeStates() {\n\tforceUpdateThemes();\n}\nfunction insertThemeCSS(themes) {\n\targuments.length > 1 && arguments[1] !== void 0 && arguments[1];\n\treturn [];\n}\n\nexport { _mutateTheme, mutateThemes };"],"mappings":";;;;;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AAI,MAAM,GAAG,iBAAiB,YAAY,YAAY,SAAS,uBAAuB,MAAM,KAAK,gBAAgB;CAC9J;CACA,IAAI;CACJ,IAAI,SAAS;EACZ,GAAG,iBAAiB,YAAY,2BAA2B,OAAO,OAAO,gBAAgB,QAAQ,6BAA6B,KAAK,IAAI,2BAA2B,CAAC,IAAI,CAAC;EACxK,GAAG;CACJ;CACA,KAAK,IAAI,OAAO,QAAQ,oBAAoB,QAAQ,GAAG;CACvD,IAAI,eAAe,oBAAoB,WAAW,MAAM;CACxD,IAAI,WAAW;EACd,UAAU;EACV,OAAO;EACP,UAAU,CAAC;CACZ;CACA,IAAI,MAAM,aAAa,OAAO;CAC9B,IAAI,WAAW,SAAS,WAAW,eAAe,GAAG,YAAY,OAAO,CAAC;CACzE,kBAAkB,WAAW,YAAY;CACzC,kBAAkB;CAClB,OAAO;AACR;AACA,SAAS,kBAAkB,WAAW,OAAO;CAC5C,aAAa,UAAU,GAAG,YAAY,MAAM,CAAC;AAC9C;AACA,SAAS,oBAAoB;CAC5B,kBAAkB;AACnB;AACA,SAAS,eAAe,QAAQ;CAC/B,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,KAAK,UAAU;CAC7D,OAAO,CAAC;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/theme",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.728.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"clean:build": "tamagui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
38
|
-
"@tamagui/start-transition": "3.0.0-beta.
|
|
39
|
-
"@tamagui/web": "3.0.0-beta.
|
|
37
|
+
"@tamagui/constants": "3.0.0-beta.728.1",
|
|
38
|
+
"@tamagui/start-transition": "3.0.0-beta.728.1",
|
|
39
|
+
"@tamagui/web": "3.0.0-beta.728.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "3.0.0-beta.
|
|
43
|
-
"react": "
|
|
42
|
+
"@tamagui/build": "3.0.0-beta.728.1",
|
|
43
|
+
"react": "19.2.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=19"
|
package/src/_mutateTheme.ts
CHANGED
|
@@ -61,10 +61,7 @@ export function mutateThemes({
|
|
|
61
61
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : []
|
|
62
62
|
|
|
63
63
|
startTransition(() => {
|
|
64
|
-
|
|
65
|
-
const theme = allThemesProxied[themeName]
|
|
66
|
-
updateThemeConfig(themeName, theme)
|
|
67
|
-
}
|
|
64
|
+
updateConfig('themes', allThemesProxied)
|
|
68
65
|
updateThemeStates()
|
|
69
66
|
})
|
|
70
67
|
|
|
@@ -134,9 +131,7 @@ export function _mutateTheme(props: MutateThemeOptions & MutateOneThemeProps) {
|
|
|
134
131
|
}
|
|
135
132
|
|
|
136
133
|
function updateThemeConfig(themeName: string, theme: ThemeParsed) {
|
|
137
|
-
|
|
138
|
-
config.themes[themeName] = theme
|
|
139
|
-
updateConfig('themes', config.themes)
|
|
134
|
+
updateConfig('themes', { [themeName]: theme })
|
|
140
135
|
}
|
|
141
136
|
|
|
142
137
|
function updateThemeStates() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_mutateTheme.d.ts","sourceRoot":"","sources":["../src/_mutateTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAYhE,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAA;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW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