@hanzogui/theme 3.0.6 → 4.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.
@@ -3,50 +3,59 @@ import { startTransition } from "@hanzogui/start-transition";
3
3
  import { ensureThemeVariable, forceUpdateThemes, getConfig, getThemeCSSRules, mutatedAutoVariables, proxyThemeToParents, simpleHash, updateConfig } from "@hanzogui/web";
4
4
  function mutateThemes(param) {
5
5
  var {
6
- themes,
7
- batch,
8
- insertCSS = !0,
9
- ...props
10
- } = param,
11
- allThemesProxied = {},
12
- allThemesRaw = {},
13
- _iteratorNormalCompletion = !0,
14
- _didIteratorError = !1,
6
+ themes,
7
+ batch,
8
+ insertCSS = true,
9
+ ...props
10
+ } = param;
11
+ var allThemesProxied = {};
12
+ var allThemesRaw = {};
13
+ var _iteratorNormalCompletion = true,
14
+ _didIteratorError = false,
15
15
  _iteratorError = void 0;
16
16
  try {
17
- for (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
17
+ for (var _iterator = themes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
18
18
  var {
19
- name,
20
- theme
21
- } = _step.value,
22
- res = _mutateTheme({
23
- ...props,
24
- name,
25
- theme,
26
- // we'll do one update at the end
27
- avoidUpdate: !0,
28
- // always add which also replaces but doesnt fail first time
29
- mutationType: "add"
30
- });
31
- res && (allThemesProxied[name] = res.theme, allThemesRaw[name] = res.themeRaw);
19
+ name,
20
+ theme
21
+ } = _step.value;
22
+ var res = _mutateTheme({
23
+ ...props,
24
+ name,
25
+ theme,
26
+ // we'll do one update at the end
27
+ avoidUpdate: true,
28
+ // always add which also replaces but doesnt fail first time
29
+ mutationType: "add"
30
+ });
31
+ if (res) {
32
+ allThemesProxied[name] = res.theme;
33
+ allThemesRaw[name] = res.themeRaw;
34
+ }
32
35
  }
33
36
  } catch (err) {
34
- _didIteratorError = !0, _iteratorError = err;
37
+ _didIteratorError = true;
38
+ _iteratorError = err;
35
39
  } finally {
36
40
  try {
37
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
41
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
42
+ _iterator.return();
43
+ }
38
44
  } finally {
39
- if (_didIteratorError) throw _iteratorError;
45
+ if (_didIteratorError) {
46
+ throw _iteratorError;
47
+ }
40
48
  }
41
49
  }
42
50
  var cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
43
- return startTransition(function () {
51
+ startTransition(function () {
44
52
  for (var themeName in allThemesProxied) {
45
53
  var theme2 = allThemesProxied[themeName];
46
54
  updateThemeConfig(themeName, theme2);
47
55
  }
48
56
  updateThemeStates();
49
- }), {
57
+ });
58
+ return {
50
59
  themes: allThemesProxied,
51
60
  themesRaw: allThemesRaw,
52
61
  cssRules
@@ -54,77 +63,105 @@ function mutateThemes(param) {
54
63
  }
55
64
  function _mutateTheme(props) {
56
65
  if (isServer) {
57
- process.env.NODE_ENV === "development" && console.warn("Theme mutation is not supported on server side");
66
+ if (process.env.NODE_ENV === "development") {
67
+ console.warn("Theme mutation is not supported on server side");
68
+ }
58
69
  return;
59
70
  }
60
- var config = getConfig(),
61
- {
62
- name: themeName,
63
- theme: themeIn,
64
- insertCSS,
65
- mutationType
66
- } = props;
71
+ var config = getConfig();
72
+ var {
73
+ name: themeName,
74
+ theme: themeIn,
75
+ insertCSS,
76
+ mutationType
77
+ } = props;
67
78
  if (process.env.NODE_ENV === "development") {
68
- if (!config) throw new Error("No config");
79
+ if (!config) {
80
+ throw new Error("No config");
81
+ }
69
82
  var theme = config.themes[props.name];
70
- if (mutationType !== "add" && !theme) throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
83
+ if (mutationType !== "add" && !theme) {
84
+ throw new Error(`${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`);
85
+ }
86
+ }
87
+ var _config_themes_themeName;
88
+ var theme1 = {
89
+ ...(mutationType === "update" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {}),
90
+ ...themeIn
91
+ };
92
+ for (var key in theme1) {
93
+ ensureThemeVariable(theme1, key);
71
94
  }
72
- var _config_themes_themeName,
73
- theme1 = {
74
- ...(mutationType === "update" ? (_config_themes_themeName = config.themes[themeName]) !== null && _config_themes_themeName !== void 0 ? _config_themes_themeName : {} : {}),
75
- ...themeIn
76
- };
77
- for (var key in theme1) ensureThemeVariable(theme1, key);
78
- var themeProxied = proxyThemeToParents(themeName, theme1),
79
- response = {
80
- themeRaw: theme1,
81
- theme: themeProxied,
82
- cssRules: []
83
- };
84
- return props.avoidUpdate || (insertCSS && (response.cssRules = insertThemeCSS({
85
- [themeName]: theme1
86
- })), updateThemeConfig(themeName, themeProxied), updateThemeStates()), response;
95
+ var themeProxied = proxyThemeToParents(themeName, theme1);
96
+ var response = {
97
+ themeRaw: theme1,
98
+ theme: themeProxied,
99
+ cssRules: []
100
+ };
101
+ if (props.avoidUpdate) {
102
+ return response;
103
+ }
104
+ if (insertCSS) {
105
+ response.cssRules = insertThemeCSS({
106
+ [themeName]: theme1
107
+ });
108
+ }
109
+ updateThemeConfig(themeName, themeProxied);
110
+ updateThemeStates();
111
+ return response;
87
112
  }
88
113
  function updateThemeConfig(themeName, theme) {
89
114
  var config = getConfig();
90
- config.themes[themeName] = theme, updateConfig("themes", config.themes);
115
+ config.themes[themeName] = theme;
116
+ updateConfig("themes", config.themes);
91
117
  }
92
118
  function updateThemeStates() {
93
119
  forceUpdateThemes();
94
120
  }
95
121
  function insertThemeCSS(themes) {
96
- var batch = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
97
- return [];
98
- var config, cssRules;
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 = [];
99
128
  for (var themeName in themes) {
100
- var theme = themes[themeName],
101
- rules = getThemeCSSRules({
102
- config,
103
- themeName,
104
- names: [themeName],
105
- hasDarkLight: !0,
106
- theme,
107
- // Use mutated variable creator which starts from high index to avoid conflicts
108
- useMutatedVariables: !0
109
- });
110
- cssRules = [...cssRules, ...rules], batch || updateStyle(`t_theme_style_${themeName}`, rules);
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
+ }
111
143
  }
112
144
  if (mutatedAutoVariables.length > 0) {
113
- var autoVarCSS;
114
- updateStyle("t_mutate_vars", [autoVarCSS]);
145
+ var autoVarCSS = `:root{${mutatedAutoVariables.map(function (v) {
146
+ return `--${v.name}:${v.val}`;
147
+ }).join(";")}}`;
148
+ updateStyle(`t_mutate_vars`, [autoVarCSS]);
115
149
  }
116
150
  if (batch) {
117
- var id;
151
+ var id = typeof batch == "string" ? batch : simpleHash(Object.keys(themes).join(""));
118
152
  updateStyle(`t_theme_style_${id}`, cssRules);
119
153
  }
154
+ return cssRules;
120
155
  }
121
156
  function updateStyle(id, rules) {
122
- var existing = document.querySelector(`#${id}`),
123
- style = document.createElement("style");
124
- if (style.id = id, style.appendChild(document.createTextNode(rules.join(`
125
- `))), document.head.appendChild(style), existing) {
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) {
126
163
  var _existing_parentElement;
127
- (_existing_parentElement = existing.parentElement) === null || _existing_parentElement === void 0 || _existing_parentElement.removeChild(existing);
164
+ (_existing_parentElement = existing.parentElement) === null || _existing_parentElement === void 0 ? void 0 : _existing_parentElement.removeChild(existing);
128
165
  }
129
166
  }
130
167
  export { _mutateTheme, mutateThemes };
@@ -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","id","existing","document","querySelector","style","createElement","appendChild","createTextNode","join"],"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;MAAAC,MAAA;MAAAC,KAAA;MAAAC,SAAA;MAAA,GAAAC;IAAA,IAAAJ,KAAA;IAAAK,gBAAA;IAAAC,YAAA;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;UAAAS,IAAA;UAAAC;QAAA,IAAAJ,KAAA,CAAAK,KAAA;QAAAC,GAAA,GAAAC,YAAA;UACA,GAAAhB,KAAA;UACAY,IAAA;U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QACAjC,KAAA;QACA;QACAkC,mBAAA;MAAA;IAAAzB,QAEA,IACD,GAAAA,QAAA,EAED,GAAAsB,KAAA,CAKF,EAAA9C,KAAA,IAAAkD,WAAA,kBAAAxB,SAAA,IAAAoB,KAAA;EAGA;EACE,IAAArD,oBAAmB,CAAAoD,MAAS;IAC5B,IAAAM,UAAY;IACdD,WAAA,mBAEIC,UAAO,CACT;EACA;EACF,IAAAnD,KAAA;IAEA,IAAAoD,EAAO;IACTF,WAAA,kBAAAE,EAAA,IAAA5B,QAAA;EAEA;AACE;AAEA,SAAM0B,WACNA,CAAAE,EAAM,EAAAN,KAAA;EAAoD,IAC1DO,QAAA,GAASC,QAAK,CAAAC,aAAiB,CAC3B,IAAAH,EAAA;IAAAI,KACF,GAAAF,QAAS,CAAAG,aAAe,QAAY;EAExC,IAAAD,KAAA,CAAAJ,EAAA,GAAAA,EAAA,EAAAI,KAAA,CAAAE,WAAA,CAAAJ,QAAA,CAAAK,cAAA,CAAAb,KAAA,CAAAc,IAAA","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","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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CAAA3D,MAAA,EAAAwD,IAAA;IACFL,WAAA,kBAAAM,EAAA,IAAAhC,QAAA","ignoreList":[]}
@@ -2,7 +2,7 @@ import { _mutateTheme } from "./_mutateTheme.mjs";
2
2
  function addTheme(props) {
3
3
  return _mutateTheme({
4
4
  ...props,
5
- insertCSS: !0,
5
+ insertCSS: true,
6
6
  mutationType: "add"
7
7
  });
8
8
  }
@@ -2,7 +2,7 @@ import { _mutateTheme } from "./_mutateTheme.native.js";
2
2
  function addTheme(props) {
3
3
  return _mutateTheme({
4
4
  ...props,
5
- insertCSS: !0,
5
+ insertCSS: true,
6
6
  mutationType: "add"
7
7
  });
8
8
  }
@@ -3,12 +3,13 @@ function replaceTheme({
3
3
  name,
4
4
  theme
5
5
  }) {
6
- return _mutateTheme({
6
+ const next = _mutateTheme({
7
7
  name,
8
8
  theme,
9
- insertCSS: !0,
9
+ insertCSS: true,
10
10
  mutationType: "replace"
11
11
  });
12
+ return next;
12
13
  }
13
14
  export { replaceTheme };
14
15
  //# sourceMappingURL=replaceTheme.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["_mutateTheme","replaceTheme","name","theme","insertCSS","mutationType"],"sources":["../../src/replaceTheme.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,YAAA,QAAoB;AAEtB,SAASC,aAAa;EAC3BC,IAAA;EACAC;AACF,GAGG;EAED,OADaH,YAAA,CAAa;IAAEE,IAAA;IAAMC,KAAA;IAAOC,SAAA,EAAW;IAAMC,YAAA,EAAc;EAAU,CAAC;AAErF","ignoreList":[]}
1
+ {"version":3,"names":["_mutateTheme","replaceTheme","name","theme","next","insertCSS","mutationType"],"sources":["../../src/replaceTheme.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,YAAA,QAAoB;AAEtB,SAASC,aAAa;EAC3BC,IAAA;EACAC;AACF,GAGG;EACD,MAAMC,IAAA,GAAOJ,YAAA,CAAa;IAAEE,IAAA;IAAMC,KAAA;IAAOE,SAAA,EAAW;IAAMC,YAAA,EAAc;EAAU,CAAC;EACnF,OAAOF,IAAA;AACT","ignoreList":[]}
@@ -1,15 +1,15 @@
1
1
  import { _mutateTheme } from "./_mutateTheme.native.js";
2
2
  function replaceTheme(param) {
3
3
  var {
4
- name,
5
- theme
6
- } = param,
7
- next = _mutateTheme({
8
- name,
9
- theme,
10
- insertCSS: !0,
11
- mutationType: "replace"
12
- });
4
+ name,
5
+ theme
6
+ } = param;
7
+ var next = _mutateTheme({
8
+ name,
9
+ theme,
10
+ insertCSS: true,
11
+ mutationType: "replace"
12
+ });
13
13
  return next;
14
14
  }
15
15
  export { replaceTheme };
@@ -1 +1 @@
1
- {"version":3,"names":["_mutateTheme","replaceTheme","param","name","theme","next","insertCSS","mutationType"],"sources":["../../src/replaceTheme.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,YAAA,QAAoB;AAEtB,SAASC,aAAaC,KAAA;EAC3B;MAAAC,IAAA;MAAAC;IAAA,IAAAF,KAAA;IAAAG,IAAA,GAAAL,YAAA;MACAG,IAAA;MAICC,KAAA;MAEDE,SADa;MAEfC,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_mutateTheme","replaceTheme","param","name","theme","next","insertCSS","mutationType"],"sources":["../../src/replaceTheme.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,YAAA,QAAoB;AAEtB,SAASC,aAAaC,KAAA;EAC3B;IAAAC,IAAA;IAAAC;EAAA,IAAAF,KAAA;EACA,IAAAG,IAAA,GAAAL,YAAA;IAICG,IAAA;IACDC,KAAM;IACNE,SAAO;IACTC,YAAA","ignoreList":[]}
@@ -6,7 +6,7 @@ function updateTheme({
6
6
  return _mutateTheme({
7
7
  name,
8
8
  theme,
9
- insertCSS: !0,
9
+ insertCSS: true,
10
10
  mutationType: "update"
11
11
  });
12
12
  }
@@ -7,7 +7,7 @@ function updateTheme(param) {
7
7
  return _mutateTheme({
8
8
  name,
9
9
  theme,
10
- insertCSS: !0,
10
+ insertCSS: true,
11
11
  mutationType: "update"
12
12
  });
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/theme",
3
- "version": "3.0.6",
3
+ "version": "4.3.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -144,7 +144,7 @@ function updateThemeStates() {
144
144
  }
145
145
 
146
146
  function insertThemeCSS(themes: Record<string, PartialTheme>, batch: Batch = false) {
147
- if (process.env.HANZO_GUI_TARGET !== 'web') {
147
+ if (process.env.GUI_TARGET !== 'web') {
148
148
  return []
149
149
  }
150
150