@hanzogui/theme 7.0.0 → 7.3.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/LICENSE CHANGED
@@ -1,21 +1,42 @@
1
- MIT License
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026-present, Hanzo AI, Inc.
4
+
5
+ Portions of this software are derived from upstream code originally licensed under
6
+ the MIT License, with the following copyright notices retained per its terms:
2
7
 
3
8
  Copyright (c) 2020 Nate Wienert
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
9
+ Copyright (c) 2015-present, Nicolas Gallagher.
10
+ Copyright (c) 2015-present, Facebook, Inc.
11
+ Copyright (c) 2021 Radix
12
+ Copyright (c) 2017 Carmelo Pullara
13
+ Copyright (c) 2018 Framer B.V.
14
+ Copyright (c) 2022 WorkOS
15
+
16
+ All rights reserved.
17
+
18
+ Redistribution and use in source and binary forms, with or without
19
+ modification, are permitted provided that the following conditions are met:
20
+
21
+ 1. Redistributions of source code must retain the above copyright notice, this
22
+ list of conditions and the following disclaimer.
23
+
24
+ 2. Redistributions in binary form must reproduce the above copyright notice,
25
+ this list of conditions and the following disclaimer in the documentation
26
+ and/or other materials provided with the distribution.
27
+
28
+ 3. Neither the name of the copyright holder nor the names of its contributors
29
+ may be used to endorse or promote products derived from this software
30
+ without specific prior written permission.
31
+
32
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42
+ POSSIBILITY OF SUCH DAMAGE.
@@ -45,9 +45,7 @@ function mutateThemes({
45
45
  ...props,
46
46
  name,
47
47
  theme,
48
- // we'll do one update at the end
49
48
  avoidUpdate: true,
50
- // always add which also replaces but doesnt fail first time
51
49
  mutationType: "add"
52
50
  });
53
51
  if (res) {
@@ -71,9 +69,7 @@ function mutateThemes({
71
69
  }
72
70
  function _mutateTheme(props) {
73
71
  if (import_constants.isServer) {
74
- if (process.env.NODE_ENV === "development") {
75
- console.warn("Theme mutation is not supported on server side");
76
- }
72
+ if (process.env.NODE_ENV === "development") console.warn("Theme mutation is not supported on server side");
77
73
  return;
78
74
  }
79
75
  const config = (0, import_web.getConfig)();
@@ -84,35 +80,25 @@ function _mutateTheme(props) {
84
80
  mutationType
85
81
  } = props;
86
82
  if (process.env.NODE_ENV === "development") {
87
- if (!config) {
88
- throw new Error("No config");
89
- }
83
+ if (!config) throw new Error("No config");
90
84
  const theme2 = config.themes[props.name];
91
- if (mutationType !== "add" && !theme2) {
92
- throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
93
- }
85
+ if (mutationType !== "add" && !theme2) throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
94
86
  }
95
87
  const theme = {
96
88
  ...(mutationType === "update" ? config.themes[themeName] ?? {} : {}),
97
89
  ...themeIn
98
90
  };
99
- for (const key in theme) {
100
- (0, import_web.ensureThemeVariable)(theme, key);
101
- }
91
+ for (const key in theme) (0, import_web.ensureThemeVariable)(theme, key);
102
92
  const themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme);
103
93
  const response = {
104
94
  themeRaw: theme,
105
95
  theme: themeProxied,
106
96
  cssRules: []
107
97
  };
108
- if (props.avoidUpdate) {
109
- return response;
110
- }
111
- if (insertCSS) {
112
- response.cssRules = insertThemeCSS({
113
- [themeName]: theme
114
- });
115
- }
98
+ if (props.avoidUpdate) return response;
99
+ if (insertCSS) response.cssRules = insertThemeCSS({
100
+ [themeName]: theme
101
+ });
116
102
  updateThemeConfig(themeName, themeProxied);
117
103
  updateThemeStates();
118
104
  return response;
@@ -126,9 +112,6 @@ function updateThemeStates() {
126
112
  (0, import_web.forceUpdateThemes)();
127
113
  }
128
114
  function insertThemeCSS(themes, batch = false) {
129
- if (false) {
130
- return [];
131
- }
132
115
  const config = (0, import_web.getConfig)();
133
116
  let cssRules = [];
134
117
  for (const themeName in themes) {
@@ -139,22 +122,13 @@ function insertThemeCSS(themes, batch = false) {
139
122
  names: [themeName],
140
123
  hasDarkLight: true,
141
124
  theme,
142
- // Use mutated variable creator which starts from high index to avoid conflicts
143
125
  useMutatedVariables: true
144
126
  });
145
127
  cssRules = [...cssRules, ...rules];
146
- if (!batch) {
147
- updateStyle(`t_theme_style_${themeName}`, rules);
148
- }
149
- }
150
- if (import_web.mutatedAutoVariables.length > 0) {
151
- const autoVarCSS = `:root{${import_web.mutatedAutoVariables.map(v => `--${v.name}:${v.val}`).join(";")}}`;
152
- updateStyle(`t_mutate_vars`, [autoVarCSS]);
153
- }
154
- if (batch) {
155
- const id = typeof batch == "string" ? batch : (0, import_web.simpleHash)(Object.keys(themes).join(""));
156
- updateStyle(`t_theme_style_${id}`, cssRules);
128
+ if (!batch) updateStyle(`t_theme_style_${themeName}`, rules);
157
129
  }
130
+ if (import_web.mutatedAutoVariables.length > 0) updateStyle(`t_mutate_vars`, [`:root{${import_web.mutatedAutoVariables.map(v => `--${v.name}:${v.val}`).join(";")}}`]);
131
+ if (batch) updateStyle(`t_theme_style_${typeof batch == "string" ? batch : (0, import_web.simpleHash)(Object.keys(themes).join(""))}`, cssRules);
158
132
  return cssRules;
159
133
  }
160
134
  function updateStyle(id, rules) {
@@ -163,7 +137,5 @@ function updateStyle(id, rules) {
163
137
  style.id = id;
164
138
  style.appendChild(document.createTextNode(rules.join("\n")));
165
139
  document.head.appendChild(style);
166
- if (existing) {
167
- existing.parentElement?.removeChild(existing);
168
- }
140
+ if (existing) existing.parentElement?.removeChild(existing);
169
141
  }
@@ -53,9 +53,7 @@ function mutateThemes(param) {
53
53
  ...props,
54
54
  name,
55
55
  theme,
56
- // we'll do one update at the end
57
56
  avoidUpdate: true,
58
- // always add which also replaces but doesnt fail first time
59
57
  mutationType: "add"
60
58
  });
61
59
  if (res) {
@@ -68,13 +66,9 @@ function mutateThemes(param) {
68
66
  _iteratorError = err;
69
67
  } finally {
70
68
  try {
71
- if (!_iteratorNormalCompletion && _iterator.return != null) {
72
- _iterator.return();
73
- }
69
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
74
70
  } finally {
75
- if (_didIteratorError) {
76
- throw _iteratorError;
77
- }
71
+ if (_didIteratorError) throw _iteratorError;
78
72
  }
79
73
  }
80
74
  var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
@@ -93,9 +87,7 @@ function mutateThemes(param) {
93
87
  }
94
88
  function _mutateTheme(props) {
95
89
  if (import_constants.isServer) {
96
- if (process.env.NODE_ENV === "development") {
97
- console.warn("Theme mutation is not supported on server side");
98
- }
90
+ if (process.env.NODE_ENV === "development") console.warn("Theme mutation is not supported on server side");
99
91
  return;
100
92
  }
101
93
  var config = (0, import_web.getConfig)();
@@ -106,36 +98,26 @@ function _mutateTheme(props) {
106
98
  mutationType
107
99
  } = props;
108
100
  if (process.env.NODE_ENV === "development") {
109
- if (!config) {
110
- throw new Error("No config");
111
- }
101
+ if (!config) throw new Error("No config");
112
102
  var theme = config.themes[props.name];
113
- if (mutationType !== "add" && !theme) {
114
- throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
115
- }
103
+ if (mutationType !== "add" && !theme) throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
116
104
  }
117
105
  var _config_themes_themeName;
118
106
  var theme1 = {
119
107
  ...(mutationType === "update" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {}),
120
108
  ...themeIn
121
109
  };
122
- for (var key in theme1) {
123
- (0, import_web.ensureThemeVariable)(theme1, key);
124
- }
110
+ for (var key in theme1) (0, import_web.ensureThemeVariable)(theme1, key);
125
111
  var themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme1);
126
112
  var response = {
127
113
  themeRaw: theme1,
128
114
  theme: themeProxied,
129
115
  cssRules: []
130
116
  };
131
- if (props.avoidUpdate) {
132
- return response;
133
- }
134
- if (insertCSS) {
135
- response.cssRules = insertThemeCSS({
136
- [themeName]: theme1
137
- });
138
- }
117
+ if (props.avoidUpdate) return response;
118
+ if (insertCSS) response.cssRules = insertThemeCSS({
119
+ [themeName]: theme1
120
+ });
139
121
  updateThemeConfig(themeName, themeProxied);
140
122
  updateThemeStates();
141
123
  return response;
@@ -149,49 +131,7 @@ function updateThemeStates() {
149
131
  (0, import_web.forceUpdateThemes)();
150
132
  }
151
133
  function insertThemeCSS(themes) {
152
- var batch = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
153
- if (true) {
154
- return [];
155
- }
156
- var config = (0, import_web.getConfig)();
157
- var cssRules = [];
158
- for (var themeName in themes) {
159
- var theme = themes[themeName];
160
- var rules = (0, import_web.getThemeCSSRules)({
161
- config,
162
- themeName,
163
- names: [themeName],
164
- hasDarkLight: true,
165
- theme,
166
- // Use mutated variable creator which starts from high index to avoid conflicts
167
- useMutatedVariables: true
168
- });
169
- cssRules = [...cssRules, ...rules];
170
- if (!batch) {
171
- updateStyle(`t_theme_style_${themeName}`, rules);
172
- }
173
- }
174
- if (import_web.mutatedAutoVariables.length > 0) {
175
- var autoVarCSS = `:root{${import_web.mutatedAutoVariables.map(function (v) {
176
- return `--${v.name}:${v.val}`;
177
- }).join(";")}}`;
178
- updateStyle(`t_mutate_vars`, [autoVarCSS]);
179
- }
180
- if (batch) {
181
- var id = typeof batch == "string" ? batch : (0, import_web.simpleHash)(Object.keys(themes).join(""));
182
- updateStyle(`t_theme_style_${id}`, cssRules);
183
- }
184
- return cssRules;
185
- }
186
- function updateStyle(id, rules) {
187
- var existing = document.querySelector(`#${id}`);
188
- var style = document.createElement("style");
189
- style.id = id;
190
- style.appendChild(document.createTextNode(rules.join("\n")));
191
- document.head.appendChild(style);
192
- if (existing) {
193
- var _existing_parentElement;
194
- (_existing_parentElement = existing.parentElement) === null || _existing_parentElement === void 0 ? void 0 : _existing_parentElement.removeChild(existing);
195
- }
134
+ arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
135
+ return [];
196
136
  }
197
137
  //# sourceMappingURL=_mutateTheme.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","mutateTheme_exports","__export","_mutateTheme","mutateThemes","module","exports","import_constants","require","import_start_transition","import_web","param","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","name","theme","res","avoidUpdate","mutationType","themeRaw","err","return","cssRules","insertThemeCSS","startTransition","themeName","theme2","updateThemeConfig","updateThemeStates","themesRaw","isServer","process","env","NODE_ENV","console","warn","config","getConfig","themeIn","Error","_config_themes_themeName","theme1","key","ensureThemeVariable","themeProxied","proxyThemeToParents","response","updateConfig","forceUpdateThemes","arguments","length","rules","getThemeCSSRules","names","hasDarkLight","useMutatedVariables","updateStyle","mutatedAutoVariables"],"sources":["../../src/_mutateTheme.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAAyB,CAAAK,mBAAA;AACzB,IAAAM,gBAAA,GAAAC,OAAgC;AAEhC,IAAAC,uBASO,GAAAD,OAAA;AAmBA,IAAAE,UAAS,GAAAF,OAAa;AAAA,SAC3BJ,aAAAO,KAAA;EACA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,SAAA;IAAA,GAAAC;EAAA,IAAAJ,KAAA;EACA,IAAAK,gBAAY;EACZ,IAAGC,YAAA;EACL,IAKGC,yBAAA;IAAAC,iBAAA;IAAAC,cAAA;EACD;IACA,KAAM,IAAAC,SAAA,GAA6CT,MAAA,CAAAU,MAAA,CAAAC,QAAA,KAAA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YAAQ,YAAAX,MAAA,CAAArC,MAAiB;AAAA;AAC7B,SACA6B,kBAAA;EAAA,IACA/B,UAAQ,CAAAmD,iBAAS;AAAA;AACH,SACdzB,eAAAxB,MAAA;EAAA,IAAAC,KAAA,GAAAiD,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAAA,IAEA;IACF,OAAC;EAED;EAEA,IAAAb,MAAK,IAAO,GAAAvC,UAAA,CAAAwC,SAAA;EACV,IAAAf,QAAA,KAAY;EAAmC,KACjD,IAAAG,SAAA,IAAA1B,MAAA;IACF,IAAAgB,KAAA,GAAAhB,MAAA,CAAA0B,SAAA;IAGA,IAAI0B,KAAA,OAAAtD,UAAA,CAAAuD,gBAA8B;MAChChB,MAAM;MACNX,SAAA;MACF4B,KAAA,GAEI5B,SAAO,CACT;MACA6B,YAAY;MACdvC,KAAA;MAEA;MACFwC,mBAAA;IAEA;IACEjC,QAAM,IACN,GAAMA,QAAQ,EACd,GAAM6B,KAAK,CACX;IACA,KAAAnD,KAAS,EAAK;MACVwD,WAAU,kBAAA/B,SAAA,IAAA0B,KAAA;IACZ;EACF;EACF,IAAAtD,UAAA,CAAA4D,oBAAA,CAAAP,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","mutateTheme_exports","_mutateTheme","mutateThemes","module","exports","import_constants","require","import_start_transition","import_web","param","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","theme","res","avoidUpdate","mutationType","themeRaw","err","return","cssRules","insertThemeCSS","startTransition","themeName","theme2","updateThemeConfig","updateThemeStates","themesRaw","isServer","process","env","NODE_ENV","console","warn","config","getConfig","themeIn","Error","_config_themes_themeName","theme1","ensureThemeVariable","themeProxied","proxyThemeToParents","response","updateConfig","forceUpdateThemes","arguments","length"],"sources":["_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(\"@hanzogui/constants\");\nvar import_start_transition = require(\"@hanzogui/start-transition\");\nvar import_web = require(\"@hanzogui/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\tfor (var themeName in allThemesProxied) {\n\t\t\tvar theme2 = allThemesProxied[themeName];\n\t\t\tupdateThemeConfig(themeName, theme2);\n\t\t}\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\tvar config = (0, import_web.getConfig)();\n\tconfig.themes[themeName] = theme;\n\t(0, import_web.updateConfig)(\"themes\", config.themes);\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":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC/B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAAEZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAC7CC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IACdE,UAAU,EAAE;EACb,CAAC,CAAC;AACH,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC7C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IACnE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,CAAC,EAAE,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAAEnB,SAAS,CAACiB,EAAE,EAAEI,GAAG,EAAE;MAC9GP,GAAG,EAAEA,CA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,QAAQ,GAAG;IACd1B,QAAQ,EAAEsB,MAAM;IAChB1B,KAAK,EAAE4B,YAAY;IACnBrB,QAAQ,EAAE;EACX,CAAC;EACD,IAAInB,KAAK,CAACc,WAAW,EAAE,OAAO4B,QAAQ;EACtC,IAAI3C,SAAS,EAAE2C,QAAQ,CAACvB,QAAQ,GAAGC,cAAc,CAAC;IAAE,CAACE,SAAS,GAAGgB;EAAO,CAAC,CAAC;EAC1Ed,iBAAiB,CAACF,SAAS,EAAEkB,YAAY,CAAC;EAC1Cf,iBAAiB,CAAC,CAAC;EACnB,OAAOiB,QAAQ;AAChB;AACA,SAASlB,iBAAiBA,CAACF,SAAS,EAAEV,KAAK,EAAE;EAC5C,IAAIqB,MAAM,GAAG,CAAC,CAAC,EAAEtC,UAAU,CAACuC,SAAS,EAAE,CAAC;EACxCD,MAAM,CAACpC,MAAM,CAACyB,SAAS,CAAC,GAAGV,KAAK;EAChC,CAAC,CAAC,EAAEjB,UAAU,CAACgD,YAAY,EAAE,QAAQ,EAAEV,MAAM,CAACpC,MAAM,CAAC;AACtD;AACA,SAAS4B,iBAAiBA,CAAA,EAAG;EAC5B,CAAC,CAAC,EAAE9B,UAAU,CAACiD,iBAAiB,EAAE,CAAC;AACpC;AACA,SAASxB,cAAcA,CAACvB,MAAM,EAAE;EAC/BgD,SAAS,CAACC,MAAM,GAAG,CAAC,IAAID,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAIA,SAAS,CAAC,CAAC,CAAC;EAC/D,OAAO,EAAE;AACV","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","addTheme_exports","__export","addTheme","module","exports","import_mutateTheme","require","props","_mutateTheme"],"sources":["../../src/addTheme.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,CAAAD,gBAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAA6B,CAAAK,gBAAA;AAEtB,IAAAK,kBAAkB,GAItBC,OAAA;AACD,SAAAJ,QAAOA,CAAAK,KAAA;EACT,WAAAF,kBAAA,CAAAG,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","addTheme_exports","addTheme","module","exports","import_mutateTheme","require","props","_mutateTheme","insertCSS","mutationType"],"sources":["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":"AAAA,YAAY;;AACZ,IAAIA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BAAgB,EAAE;EACzBC,QAAQ,EAAEA,CAAA,KAAMA;AAClB,CAAC,CAAC;AACFC,MAAM,CAACC,OAAO,GAAGN,YAAY,CAACG,gBAAgB,CAAC;AAC/C,IAAII,kBAAkB,GAAGC,OAAO,CAAC,0BAAgB,CAAC;AAClD,SAASJ,QAAQA,CAACK,KAAK,EAAE;EACvB,OAAO,CAAC,CAAC,EAAEF,kBAAkB,CAACG,YAAY,EAAE;IAC1C,GAAGD,KAAK;IACRE,SAAS,EAAE,IAAI;IACfC,YAAY,EAAE;EAChB,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","mutateThemes","import_mutateTheme","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD;AAAA;AAAAE,MAAA,CAAAC,OAAA,GAAAV,YAAc,CAAAK,aAAA;AACdM,UAAA,CAAAN,aAAA,EAAcO,OAAA,0BAAAH,MADd,CAAAC,OAAA;AAEAC,UAAA,CAAAN,aAAA,EAAcO,OAAA,6BAAAH,MAFd,CAAAC,OAAA;AAGAC,UAAA,CAAAN,aAAA,EAA6BO,OAAA,8BAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__reExport","mod","secondTarget","__toCommonJS","value","index_exports","mutateThemes","import_mutateTheme","module","exports","require"],"sources":["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":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,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AACC,OAAO,CAAC;AAChET,UAAU,CAACK,aAAa,EAAEK,OAAO,CAAC,yBAAe,CAAC,EAAEF,MAAM,CAACC,OAAO,CAAC;AACnET,UAAU,CAACK,aAAa,EAAEK,OAAO,CAAC,0BAAgB,CAAC,EAAEF,MAAM,CAACC,OAAO,CAAC;AACpE,IAAIF,kBAAkB,GAAGG,OAAO,CAAC,0BAAgB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","replaceTheme_exports","__export","replaceTheme","module","exports","import_mutateTheme","require","param","name","theme","next","_mutateTheme","insertCSS"],"sources":["../../src/replaceTheme.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAA6B,CAAAK,oBAAA;AAEtB,IAAAK,kBAAsB,GAAAC,OAAA;AAAA,SAC3BJ,aAAAK,KAAA;EACA;IAAAC,IAAA;IAAAC;EAAA,IAAAF,KAAA;EACF,IAGGG,IAAA,OAAAL,kBAAA,CAAAM,YAAA;IACDH,IAAM;IACNC,KAAO;IACTG,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","replaceTheme_exports","replaceTheme","module","exports","import_mutateTheme","require","param","theme","next","_mutateTheme","insertCSS","mutationType"],"sources":["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":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAA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value","updateTheme_exports","__export","updateTheme","module","exports","import_mutateTheme","require","param","name","theme","_mutateTheme"],"sources":["../../src/updateTheme.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAA6B,CAAAK,mBAAA;AAEtB,IAAAK,kBAAqB,GAAAC,OAAA;AAAA,SAC1BJ,YAAAK,KAAA;EACA;IAAAC,IAAA;IAAAC;EAAA,IAAAF,KAAA;EACF,OAGG,IAAAF,kBAAA,CAAAK,YAAA;IACDF,IAAA;IACFC,KAAA","ignoreList":[]}
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","updateTheme_exports","updateTheme","module","exports","import_mutateTheme","require","param","theme","_mutateTheme","insertCSS","mutationType"],"sources":["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":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,CAAC,EACrC,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/CnB,SAAS,CAACiB,EAAE,EAAEI,GAAG,EAAE;MAAEP,GAAG,EAAEA,CAAA,KAAMI,IAAI,CAACG,GAAG,CAAC;MAAEN,UAAU,EAAE,EAAEK,IAAI,GAAGjB,gBAAgB,CAACe,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACL;IAAW,CAAC,CAAC;EACxH;EACA,OAAOE,EAAE;AACX,CAAC;AACD,IAAIM,YAAY,GAAIC,GAAG,IAAKR,WAAW,CAAChB,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAEyB,KAAK,EAAE;AAAK,CAAC,CAAC,EAAED,GAAG,CAAC;AAC1F,IAAIE,mBAAmB,GAAG,CAAC,CAAC;AAC5BhB,QAAQ,CAACgB,mBAAmB,EAAE;EAC5BC,WAAW,EAAEA,CAAA,KAAMA;AACrB,CAAC,CAAC;AACFC,MAAM,CAACC,OAAO,GAAGN,YAAY,CAACG,mBAAmB,CAAC;AAClD,IAAII,kBAAkB,GAAGC,OAAO,CAAC,0BAAgB,CAAC;AAClD,SAASJ,WAAWA,CAACK,KAAK,EAAE;EAC1B,IAAI;IAAEnB,IAAI;IAAEoB;EAAM,CAAC,GAAGD,KAAK;EAC3B,OAAO,CAAC,CAAC,EAAEF,kBAAkB,CAACI,YAAY,EAAE;IAC1CrB,IAAI;IACJoB,KAAK;IACLE,SAAS,EAAE,IAAI;IACfC,YAAY,EAAE;EAChB,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -17,9 +17,7 @@ function mutateThemes({
17
17
  ...props,
18
18
  name,
19
19
  theme,
20
- // we'll do one update at the end
21
20
  avoidUpdate: true,
22
- // always add which also replaces but doesnt fail first time
23
21
  mutationType: "add"
24
22
  });
25
23
  if (res) {
@@ -43,9 +41,7 @@ function mutateThemes({
43
41
  }
44
42
  function _mutateTheme(props) {
45
43
  if (isServer) {
46
- if (process.env.NODE_ENV === "development") {
47
- console.warn("Theme mutation is not supported on server side");
48
- }
44
+ if (process.env.NODE_ENV === "development") console.warn("Theme mutation is not supported on server side");
49
45
  return;
50
46
  }
51
47
  const config = getConfig();
@@ -56,35 +52,25 @@ function _mutateTheme(props) {
56
52
  mutationType
57
53
  } = props;
58
54
  if (process.env.NODE_ENV === "development") {
59
- if (!config) {
60
- throw new Error("No config");
61
- }
55
+ if (!config) throw new Error("No config");
62
56
  const theme2 = config.themes[props.name];
63
- if (mutationType !== "add" && !theme2) {
64
- throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
65
- }
57
+ if (mutationType !== "add" && !theme2) throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
66
58
  }
67
59
  const theme = {
68
60
  ...(mutationType === "update" ? config.themes[themeName] ?? {} : {}),
69
61
  ...themeIn
70
62
  };
71
- for (const key in theme) {
72
- ensureThemeVariable(theme, key);
73
- }
63
+ for (const key in theme) ensureThemeVariable(theme, key);
74
64
  const themeProxied = proxyThemeToParents(themeName, theme);
75
65
  const response = {
76
66
  themeRaw: theme,
77
67
  theme: themeProxied,
78
68
  cssRules: []
79
69
  };
80
- if (props.avoidUpdate) {
81
- return response;
82
- }
83
- if (insertCSS) {
84
- response.cssRules = insertThemeCSS({
85
- [themeName]: theme
86
- });
87
- }
70
+ if (props.avoidUpdate) return response;
71
+ if (insertCSS) response.cssRules = insertThemeCSS({
72
+ [themeName]: theme
73
+ });
88
74
  updateThemeConfig(themeName, themeProxied);
89
75
  updateThemeStates();
90
76
  return response;
@@ -98,9 +84,6 @@ function updateThemeStates() {
98
84
  forceUpdateThemes();
99
85
  }
100
86
  function insertThemeCSS(themes, batch = false) {
101
- if (false) {
102
- return [];
103
- }
104
87
  const config = getConfig();
105
88
  let cssRules = [];
106
89
  for (const themeName in themes) {
@@ -111,22 +94,13 @@ function insertThemeCSS(themes, batch = false) {
111
94
  names: [themeName],
112
95
  hasDarkLight: true,
113
96
  theme,
114
- // Use mutated variable creator which starts from high index to avoid conflicts
115
97
  useMutatedVariables: true
116
98
  });
117
99
  cssRules = [...cssRules, ...rules];
118
- if (!batch) {
119
- updateStyle(`t_theme_style_${themeName}`, rules);
120
- }
121
- }
122
- if (mutatedAutoVariables.length > 0) {
123
- const autoVarCSS = `:root{${mutatedAutoVariables.map(v => `--${v.name}:${v.val}`).join(";")}}`;
124
- updateStyle(`t_mutate_vars`, [autoVarCSS]);
125
- }
126
- if (batch) {
127
- const id = typeof batch == "string" ? batch : simpleHash(Object.keys(themes).join(""));
128
- updateStyle(`t_theme_style_${id}`, cssRules);
100
+ if (!batch) updateStyle(`t_theme_style_${themeName}`, rules);
129
101
  }
102
+ if (mutatedAutoVariables.length > 0) updateStyle(`t_mutate_vars`, [`:root{${mutatedAutoVariables.map(v => `--${v.name}:${v.val}`).join(";")}}`]);
103
+ if (batch) updateStyle(`t_theme_style_${typeof batch == "string" ? batch : simpleHash(Object.keys(themes).join(""))}`, cssRules);
130
104
  return cssRules;
131
105
  }
132
106
  function updateStyle(id, rules) {
@@ -135,9 +109,7 @@ function updateStyle(id, rules) {
135
109
  style.id = id;
136
110
  style.appendChild(document.createTextNode(rules.join("\n")));
137
111
  document.head.appendChild(style);
138
- if (existing) {
139
- existing.parentElement?.removeChild(existing);
140
- }
112
+ if (existing) existing.parentElement?.removeChild(existing);
141
113
  }
142
114
  export { _mutateTheme, mutateThemes };
143
115
  //# sourceMappingURL=_mutateTheme.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["isServer","startTransition","ensureThemeVariable","forceUpdateThemes","getConfig","getThemeCSSRules","mutatedAutoVariables","proxyThemeToParents","simpleHash","updateConfig","mutateThemes","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","name","theme","res","_mutateTheme","avoidUpdate","mutationType","themeRaw","cssRules","insertThemeCSS","themeName","updateThemeConfig","updateThemeStates","themesRaw","process","env","NODE_ENV","console","warn","config","themeIn","Error","theme2","key","themeProxied","response","rules","names","hasDarkLight","useMutatedVariables","updateStyle","length","autoVarCSS","map","v","val","join","id","Object","keys","existing","document","querySelector","style","createElement","appendChild","createTextNode","head","parentElement","removeChild"],"sources":["../../src/_mutateTheme.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,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EAEA,OAAOA,QAAA;AACT;AAEA,SAASsB,YAAYO,EAAA,EAAYX,KAAA,EAAiB;EAChD,MAAMc,QAAA,GAAWC,QAAA,CAASC,aAAA,CAAc,IAAIL,EAAE,EAAE;EAChD,MAAMM,KAAA,GAAQF,QAAA,CAASG,aAAA,CAAc,OAAO;EAC5CD,KAAA,CAAMN,EAAA,GAAKA,EAAA;EACXM,KAAA,CAAME,WAAA,CAAYJ,QAAA,CAASK,cAAA,CAAepB,KAAA,CAAMU,IAAA,CAAK,IAAI,CAAC,CAAC;EAC3DK,QAAA,CAASM,IAAA,CAAKF,WAAA,CAAYF,KAAK;EAC/B,IAAIH,QAAA,EAAU;IACZA,QAAA,CAASQ,aAAA,EAAeC,WAAA,CAAYT,QAAQ;EAC9C;AACF","ignoreList":[]}
1
+ {"version":3,"names":["isServer","startTransition","ensureThemeVariable","forceUpdateThemes","getConfig","getThemeCSSRules","mutatedAutoVariables","proxyThemeToParents","simpleHash","updateConfig","mutateThemes","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","name","theme","res","_mutateTheme","avoidUpdate","mutationType","themeRaw","cssRules","insertThemeCSS","themeName","updateThemeConfig","updateThemeStates","themesRaw","process","env","NODE_ENV","console","warn","config","themeIn","Error","theme2","key","themeProxied","response","rules","names","hasDarkLight","useMutatedVariables","updateStyle","length","map","v","val","join","Object","keys","id","existing","document","querySelector","style","createElement","appendChild","createTextNode","head","parentElement","removeChild"],"sources":["../../src/_mutateTheme.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,eAAA,QAAuB;AAEhC,SAAAC,mBAAA,EAAAC,iBAAA,EAAAC,SAAA,EAAAC,gBAAA,EAAAC,oBAAA,EAAAC,mBAAA,EAAAC,UAAA,EAAAC,YAAA;AAAA,SACEC,aAAA;EAAAC,MAAA;EAAAC,KAAA;EAAAC,SAAA;EAAA,GAAAC;AAAA;EAAA,MACAC,gBAAA;EAAA,MACAC,YAAA;EAAA,KACA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AA,CAAA,CAAAhC,IAAA,IAAAgC,CAAA,CAAAC,GAAA,IAAAC,IAAA;EAAA,IAAAvC,KAChC,EAAAkC,WAAY,yBAAAlC,KAAA,eAAAA,KAAA,GAAAJ,UAAA,CAAA4C,MAAA,CAAAC,IAAA,CAAA1C,MAAA,EAAAwC,IAAA,SAAA3B,QAAA;EAAA,OACdA,QAAA;AAAA;AAGH,SAAAsB,WAAkBA,CAAAQ,EAAA,EAAAZ,KAAA,EAAW;EAC7B,MAAAa,QAAA,GAAAC,QAAkB,CAAAC,aAAA,KAAAH,EAAA;EAElB,MAAAI,KAAO,GAAAF,QAAA,CAAAG,aAAA;EACTD,KAAA,CAAAJ,EAAA,GAAAA,EAAA;EAEAI,KAAA,CAAAE,WAAS,CAAAJ,QAAkB,CAAAK,cAAmB,CAAAnB,KAAoB,CAAAS,IAAA;EAChEK,QAAM,CAAAM,IAAA,CAAAF,WAAS,CAAUF,KAAA;EACzB,IAAAH,QAAO,EAAAA,QAAO,CAAAQ,aAAa,EAAAC,WAAA,CAAAT,QAAA;AAC3B;AACF,SAAAnC,YAAA,EAAAV,YAAA","ignoreList":[]}
@@ -23,9 +23,7 @@ function mutateThemes(param) {
23
23
  ...props,
24
24
  name,
25
25
  theme,
26
- // we'll do one update at the end
27
26
  avoidUpdate: true,
28
- // always add which also replaces but doesnt fail first time
29
27
  mutationType: "add"
30
28
  });
31
29
  if (res) {
@@ -38,13 +36,9 @@ function mutateThemes(param) {
38
36
  _iteratorError = err;
39
37
  } finally {
40
38
  try {
41
- if (!_iteratorNormalCompletion && _iterator.return != null) {
42
- _iterator.return();
43
- }
39
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
44
40
  } finally {
45
- if (_didIteratorError) {
46
- throw _iteratorError;
47
- }
41
+ if (_didIteratorError) throw _iteratorError;
48
42
  }
49
43
  }
50
44
  var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
@@ -63,9 +57,7 @@ function mutateThemes(param) {
63
57
  }
64
58
  function _mutateTheme(props) {
65
59
  if (isServer) {
66
- if (process.env.NODE_ENV === "development") {
67
- console.warn("Theme mutation is not supported on server side");
68
- }
60
+ if (process.env.NODE_ENV === "development") console.warn("Theme mutation is not supported on server side");
69
61
  return;
70
62
  }
71
63
  var config = getConfig();
@@ -76,36 +68,26 @@ function _mutateTheme(props) {
76
68
  mutationType
77
69
  } = props;
78
70
  if (process.env.NODE_ENV === "development") {
79
- if (!config) {
80
- throw new Error("No config");
81
- }
71
+ if (!config) throw new Error("No config");
82
72
  var theme = config.themes[props.name];
83
- if (mutationType !== "add" && !theme) {
84
- throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
85
- }
73
+ if (mutationType !== "add" && !theme) throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
86
74
  }
87
75
  var _config_themes_themeName;
88
76
  var theme1 = {
89
77
  ...(mutationType === "update" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {}),
90
78
  ...themeIn
91
79
  };
92
- for (var key in theme1) {
93
- ensureThemeVariable(theme1, key);
94
- }
80
+ for (var key in theme1) ensureThemeVariable(theme1, key);
95
81
  var themeProxied = proxyThemeToParents(themeName, theme1);
96
82
  var response = {
97
83
  themeRaw: theme1,
98
84
  theme: themeProxied,
99
85
  cssRules: []
100
86
  };
101
- if (props.avoidUpdate) {
102
- return response;
103
- }
104
- if (insertCSS) {
105
- response.cssRules = insertThemeCSS({
106
- [themeName]: theme1
107
- });
108
- }
87
+ if (props.avoidUpdate) return response;
88
+ if (insertCSS) response.cssRules = insertThemeCSS({
89
+ [themeName]: theme1
90
+ });
109
91
  updateThemeConfig(themeName, themeProxied);
110
92
  updateThemeStates();
111
93
  return response;
@@ -119,50 +101,8 @@ function updateThemeStates() {
119
101
  forceUpdateThemes();
120
102
  }
121
103
  function insertThemeCSS(themes) {
122
- var batch = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
123
- if (true) {
124
- return [];
125
- }
126
- var config = getConfig();
127
- var cssRules = [];
128
- for (var themeName in themes) {
129
- var theme = themes[themeName];
130
- var rules = getThemeCSSRules({
131
- config,
132
- themeName,
133
- names: [themeName],
134
- hasDarkLight: true,
135
- theme,
136
- // Use mutated variable creator which starts from high index to avoid conflicts
137
- useMutatedVariables: true
138
- });
139
- cssRules = [...cssRules, ...rules];
140
- if (!batch) {
141
- updateStyle(`t_theme_style_${themeName}`, rules);
142
- }
143
- }
144
- if (mutatedAutoVariables.length > 0) {
145
- var autoVarCSS = `:root{${mutatedAutoVariables.map(function (v) {
146
- return `--${v.name}:${v.val}`;
147
- }).join(";")}}`;
148
- updateStyle(`t_mutate_vars`, [autoVarCSS]);
149
- }
150
- if (batch) {
151
- var id = typeof batch == "string" ? batch : simpleHash(Object.keys(themes).join(""));
152
- updateStyle(`t_theme_style_${id}`, cssRules);
153
- }
154
- return cssRules;
155
- }
156
- function updateStyle(id, rules) {
157
- var existing = document.querySelector(`#${id}`);
158
- var style = document.createElement("style");
159
- style.id = id;
160
- style.appendChild(document.createTextNode(rules.join("\n")));
161
- document.head.appendChild(style);
162
- if (existing) {
163
- var _existing_parentElement;
164
- (_existing_parentElement = existing.parentElement) === null || _existing_parentElement === void 0 ? void 0 : _existing_parentElement.removeChild(existing);
165
- }
104
+ arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
105
+ return [];
166
106
  }
167
107
  export { _mutateTheme, mutateThemes };
168
108
  //# sourceMappingURL=_mutateTheme.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isServer","startTransition","ensureThemeVariable","forceUpdateThemes","getConfig","getThemeCSSRules","mutatedAutoVariables","proxyThemeToParents","simpleHash","updateConfig","mutateThemes","param","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","name","theme","value","res","_mutateTheme","avoidUpdate","mutationType","themeRaw","err","return","cssRules","insertThemeCSS","themeName","theme2","updateThemeConfig","updateThemeStates","themesRaw","process","env","NODE_ENV","console","warn","config","themeIn","Error","_config_themes_themeName","theme1","key","themeProxied","response","arguments","length","rules","names","hasDarkLight","useMutatedVariables","updateStyle","autoVarCSS","map","v","val","join","id","Object","keys"],"sources":["../../src/_mutateTheme.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,eAAA,QAAuB;AAEhC,SAAAC,mBAAA,EAAAC,iBAAA,EAAAC,SAAA,EAAAC,gBAAA,EAAAC,oBAAA,EAAAC,mBAAA,EAAAC,UAAA,EAAAC,YAAA;AAAA,SACEC,aAAAC,KAAA;EACA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,SAAA;IAAA,GAAAC;EAAA,IAAAJ,KAAA;EACA,IAAAK,gBAAA;EACA,IAAAC,YAAA;EACA,IAAAC,yBAAA;IAAAC,iBAAA;IAAAC,cAAA;EACA;IACA,SAAAC,SAAA,GAAAT,MAAA,CAAAU,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAN,yBAAA,IAAAM,KAAA,GAAAH,SAAA,CAAAI,IAAA,IAAAC,IAAA,GAAAR,yBAAA;MACA;QAAAS,IAAA;QAAAC;MAAA,IAAAJ,KAAA,CAAAK,KAAA;MAAA,IACKC,GAAA,GAAAC,YAAA;QAmBA,GAAShB,KAAA;QACdY,IAAA;QACAC,KAAA;QACA;QACGI,WAAA;QAMF;QACKC,YAAA;MACN,EAAM;MACN,IAAAH,GAAW,EAAE;QACXd,gBAAY,CAAAW,IAAa,IAAAG,GAAA,CAAAF,KAAA;QACvBX,YAAG,CAAAU,IAAA,IAAAG,GAAA,CAAAI,QAAA;MACH;IAAA;EACA,SAAAC,GAAA;IAAAhB,iBAEa;IAAAC,cAAA,GAAAe,GAAA;EAAA,UAEb;IACF,IAAC;MACD,IAAI,CAAAjB,yBAAK,IAAAG,SAAA,CAAAe,MAAA;QACPf,SAA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F,IAAArD,oBAAA,CAAAoD,MAAA;IAEA,IAAAM,UAAS,GAAY,SAAY1D,oBAAiB,CAAA2D,GAAA,WAAAC,CAAA;MAChD,OAAM,KAAAA,CAAW,CAAAvC,IAAA,IAASuC,CAAA,CAAAC,GAAA;IAC1B,GAAAC,IAAM,KAAQ;IACdL,WAAW,mBACXC,UAAM,CACN;EACA;EACE,IAAAnD,KAAA,EAAS;IACX,IAAAwD,EAAA,UAAAxD,KAAA,eAAAA,KAAA,GAAAL,UAAA,CAAA8D,MAAA,CAAAC,IAAA,CAAA3D,MAAA,EAAAwD,IAAA;IACFL,WAAA,kBAAAM,EAAA,IAAAhC,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["isServer","startTransition","ensureThemeVariable","forceUpdateThemes","getConfig","getThemeCSSRules","mutatedAutoVariables","proxyThemeToParents","simpleHash","updateConfig","mutateThemes","param","themes","batch","insertCSS","props","allThemesProxied","allThemesRaw","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","name","theme","value","res","_mutateTheme","avoidUpdate","mutationType","themeRaw","err","return","cssRules","insertThemeCSS","themeName","theme2","updateThemeConfig","updateThemeStates","themesRaw","process","env","NODE_ENV","console","warn","config","themeIn","Error","_config_themes_themeName","theme1","key","themeProxied","response","arguments","length"],"sources":["../../src/_mutateTheme.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,eAAA,QAAuB;AAEhC,SAAAC,mBAAA,EAAAC,iBAAA,EAAAC,SAAA,EAAAC,gBAAA,EAAAC,oBAAA,EAAAC,mBAAA,EAAAC,UAAA,EAAAC,YAAA;AAAA,SACEC,aAAAC,KAAA;EAAA,IACA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,SAAA;IAAA,GAAAC;EAAA,IAAAJ,KAAA;EAAA,IACAK,gBAAA;EAAA,IACAC,YAAA;EAAA,IACAC,yBAAA;IAAAC,iBAAA;IAAAC,cAAA;EAAA,IACA;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AA,CAAAC,MAAS,QAAWD,SAAA,QAAe,UAAAA,SAAA;EAAA,OAChC;AAAY;AACd,SACH1B,YAAA,EAAArB,YAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/theme",
3
- "version": "7.0.0",
3
+ "version": "7.3.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -28,21 +28,23 @@
28
28
  "access": "public"
29
29
  },
30
30
  "scripts": {
31
- "build": "hanzo-gui-build",
32
- "watch": "hanzo-gui-build --watch",
33
- "clean": "hanzo-gui-build clean",
34
- "clean:build": "hanzo-gui-build clean:build"
31
+ "build": "gui-build",
32
+ "watch": "gui-build --watch",
33
+ "clean": "gui-build clean",
34
+ "clean:build": "gui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@hanzogui/constants": "^7.0.0",
38
- "@hanzogui/start-transition": "^7.0.0",
39
- "@hanzogui/web": "^7.0.0"
37
+ "@hanzogui/constants": "7.3.1",
38
+ "@hanzogui/start-transition": "7.3.1",
39
+ "@hanzogui/web": "7.3.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@hanzogui/build": "^7.0.0",
42
+ "@hanzogui/build": "7.3.1",
43
43
  "react": ">=19"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=19"
47
- }
48
- }
47
+ },
48
+ "license": "BSD-3-Clause",
49
+ "author": "Hanzo AI <dev@hanzo.ai>"
50
+ }