@tamagui/theme 1.61.2 → 1.62.0

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.
Files changed (47) hide show
  1. package/dist/cjs/_mutateTheme.js +36 -79
  2. package/dist/cjs/_mutateTheme.js.map +1 -1
  3. package/dist/cjs/_mutateTheme.native.js +112 -0
  4. package/dist/cjs/_mutateTheme.native.js.map +6 -0
  5. package/dist/cjs/addTheme.js +6 -10
  6. package/dist/cjs/addTheme.js.map +1 -1
  7. package/dist/cjs/addTheme.native.js +29 -0
  8. package/dist/cjs/addTheme.native.js.map +6 -0
  9. package/dist/cjs/index.js +6 -11
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/index.native.js +32 -0
  12. package/dist/cjs/index.native.js.map +6 -0
  13. package/dist/cjs/replaceTheme.js +6 -11
  14. package/dist/cjs/replaceTheme.js.map +1 -1
  15. package/dist/cjs/replaceTheme.native.js +32 -0
  16. package/dist/cjs/replaceTheme.native.js.map +6 -0
  17. package/dist/cjs/updateTheme.js +6 -10
  18. package/dist/cjs/updateTheme.js.map +1 -1
  19. package/dist/cjs/updateTheme.native.js +32 -0
  20. package/dist/cjs/updateTheme.native.js.map +6 -0
  21. package/dist/esm/_mutateTheme.js +30 -67
  22. package/dist/esm/_mutateTheme.js.map +1 -1
  23. package/dist/esm/addTheme.js +1 -1
  24. package/dist/esm/addTheme.js.map +1 -1
  25. package/dist/esm/replaceTheme.js +1 -2
  26. package/dist/esm/replaceTheme.js.map +1 -1
  27. package/dist/esm/updateTheme.js +1 -1
  28. package/dist/esm/updateTheme.js.map +1 -1
  29. package/dist/jsx/_mutateTheme.js +30 -66
  30. package/dist/jsx/_mutateTheme.js.map +1 -1
  31. package/dist/jsx/_mutateTheme.native.js +100 -0
  32. package/dist/jsx/_mutateTheme.native.js.map +6 -0
  33. package/dist/jsx/addTheme.js +1 -1
  34. package/dist/jsx/addTheme.js.map +1 -1
  35. package/dist/jsx/addTheme.native.js +8 -0
  36. package/dist/jsx/addTheme.native.js.map +6 -0
  37. package/dist/jsx/index.native.js +8 -0
  38. package/dist/jsx/index.native.js.map +6 -0
  39. package/dist/jsx/replaceTheme.js +1 -2
  40. package/dist/jsx/replaceTheme.js.map +1 -1
  41. package/dist/jsx/replaceTheme.native.js +11 -0
  42. package/dist/jsx/replaceTheme.native.js.map +6 -0
  43. package/dist/jsx/updateTheme.js +1 -1
  44. package/dist/jsx/updateTheme.js.map +1 -1
  45. package/dist/jsx/updateTheme.native.js +11 -0
  46. package/dist/jsx/updateTheme.native.js.map +6 -0
  47. package/package.json +4 -4
@@ -1,62 +1,50 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
13
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
15
  var mutateTheme_exports = {};
20
16
  __export(mutateTheme_exports, {
21
17
  _mutateTheme: () => _mutateTheme,
22
18
  mutateThemes: () => mutateThemes
23
19
  });
24
20
  module.exports = __toCommonJS(mutateTheme_exports);
25
- var import_constants = require("@tamagui/constants");
26
- var import_web = require("@tamagui/web");
27
- var import_react = require("react");
21
+ var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web"), import_react = require("react");
28
22
  function mutateThemes({
29
23
  themes,
30
24
  batch,
31
- insertCSS = true,
25
+ insertCSS = !0,
32
26
  ...props
33
27
  }) {
34
- const allThemesProxied = {};
35
- const allThemesRaw = {};
28
+ const allThemesProxied = {}, allThemesRaw = {};
36
29
  for (const { name, theme } of themes) {
37
30
  const res = _mutateTheme({
38
31
  ...props,
39
32
  name,
40
33
  theme,
41
34
  // we'll do one update at the end
42
- avoidUpdate: true,
35
+ avoidUpdate: !0,
43
36
  // always add which also replaces but doesnt fail first time
44
37
  mutationType: "add"
45
38
  });
46
- if (res) {
47
- allThemesProxied[name] = res.theme;
48
- allThemesRaw[name] = res.themeRaw;
49
- }
39
+ res && (allThemesProxied[name] = res.theme, allThemesRaw[name] = res.themeRaw);
50
40
  }
51
41
  const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
52
- (0, import_react.startTransition)(() => {
42
+ return (0, import_react.startTransition)(() => {
53
43
  for (const themeName in allThemesProxied) {
54
44
  const theme = allThemesProxied[themeName];
55
- updateThemeConfig(themeName, theme);
56
- notifyThemeManagersOfUpdate(themeName, theme);
45
+ updateThemeConfig(themeName, theme), notifyThemeManagersOfUpdate(themeName, theme);
57
46
  }
58
- });
59
- return {
47
+ }), {
60
48
  themes: allThemesProxied,
61
49
  themesRaw: allThemesRaw,
62
50
  cssRules
@@ -64,86 +52,61 @@ function mutateThemes({
64
52
  }
65
53
  function _mutateTheme(props) {
66
54
  if (import_constants.isServer) {
67
- if (process.env.NODE_ENV === "development") {
68
- console.warn("Theme mutation is not supported on server side");
69
- }
55
+ process.env.NODE_ENV === "development" && console.warn("Theme mutation is not supported on server side");
70
56
  return;
71
57
  }
72
- const config = (0, import_web.getConfig)();
73
- const { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
58
+ const config = (0, import_web.getConfig)(), { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
74
59
  if (process.env.NODE_ENV === "development") {
75
- if (!config) {
60
+ if (!config)
76
61
  throw new Error("No config");
77
- }
78
62
  const theme2 = config.themes[props.name];
79
- if (mutationType !== "add" && !theme2) {
63
+ if (mutationType !== "add" && !theme2)
80
64
  throw new Error(
81
65
  `${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`
82
66
  );
83
- }
84
67
  }
85
68
  const theme = {
86
69
  ...mutationType === "update" ? config.themes[themeName] ?? {} : {},
87
70
  ...themeIn
88
71
  };
89
- for (const key in theme) {
72
+ for (const key in theme)
90
73
  (0, import_web.ensureThemeVariable)(theme, key);
91
- }
92
- const themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme);
93
- const response = {
74
+ const themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme), response = {
94
75
  themeRaw: theme,
95
76
  theme: themeProxied,
96
77
  cssRules: []
97
78
  };
98
- if (props.avoidUpdate) {
99
- return response;
100
- }
101
- if (insertCSS) {
102
- response.cssRules = insertThemeCSS({
103
- [themeName]: theme
104
- });
105
- }
106
- updateThemeConfig(themeName, themeProxied);
107
- notifyThemeManagersOfUpdate(themeName, themeProxied);
108
- return response;
79
+ return props.avoidUpdate || (insertCSS && (response.cssRules = insertThemeCSS({
80
+ [themeName]: theme
81
+ })), updateThemeConfig(themeName, themeProxied), notifyThemeManagersOfUpdate(themeName, themeProxied)), response;
109
82
  }
110
83
  function updateThemeConfig(themeName, theme) {
111
84
  const config = (0, import_web.getConfig)();
112
- config.themes[themeName] = theme;
113
- (0, import_web.updateConfig)("themes", config.themes);
85
+ config.themes[themeName] = theme, (0, import_web.updateConfig)("themes", config.themes);
114
86
  }
115
87
  function notifyThemeManagersOfUpdate(themeName, theme) {
116
88
  import_web.activeThemeManagers.forEach((manager) => {
117
- if (manager.state.name === themeName) {
118
- manager.updateStateFromProps(
119
- {
120
- name: themeName,
121
- forceTheme: theme
122
- },
123
- true
124
- );
125
- }
89
+ manager.state.name === themeName && manager.updateStateFromProps(
90
+ {
91
+ name: themeName,
92
+ forceTheme: theme
93
+ },
94
+ !0
95
+ );
126
96
  });
127
97
  }
128
- function insertThemeCSS(themes, batch = false) {
129
- if (process.env.TAMAGUI_TARGET !== "web") {
130
- return [];
131
- }
98
+ function insertThemeCSS(themes, batch = !1) {
132
99
  const config = (0, import_web.getConfig)();
133
100
  let cssRules = [];
134
101
  for (const themeName in themes) {
135
- const theme = themes[themeName];
136
- const rules = (0, import_web.getThemeCSSRules)({
102
+ const theme = themes[themeName], rules = (0, import_web.getThemeCSSRules)({
137
103
  // @ts-ignore this works but should be fixed types
138
104
  config,
139
105
  themeName,
140
106
  names: [themeName],
141
107
  theme
142
108
  });
143
- cssRules = [...cssRules, ...rules];
144
- if (!batch) {
145
- updateStyle(`t_theme_style_${themeName}`, rules);
146
- }
109
+ cssRules = [...cssRules, ...rules], batch || updateStyle(`t_theme_style_${themeName}`, rules);
147
110
  }
148
111
  if (batch) {
149
112
  const id = (0, import_web.simpleHash)(Object.keys(themes).join(","));
@@ -152,15 +115,9 @@ function insertThemeCSS(themes, batch = false) {
152
115
  return cssRules;
153
116
  }
154
117
  function updateStyle(id, rules) {
155
- var _a;
156
- const existing = document.querySelector(`#${id}`);
157
- const style = document.createElement("style");
158
- style.id = id;
159
- style.appendChild(document.createTextNode(rules.join("\n")));
160
- document.head.appendChild(style);
161
- if (existing) {
162
- (_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
163
- }
118
+ const existing = document.querySelector(`#${id}`), style = document.createElement("style");
119
+ style.id = id, style.appendChild(document.createTextNode(rules.join(`
120
+ `))), document.head.appendChild(style), existing && existing.parentElement?.removeChild(existing);
164
121
  }
165
122
  // Annotate the CommonJS export names for ESM import in node:
166
123
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "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Descriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var mutateTheme_exports = {};
17
+ __export(mutateTheme_exports, {
18
+ _mutateTheme: () => _mutateTheme,
19
+ mutateThemes: () => mutateThemes
20
+ });
21
+ module.exports = __toCommonJS(mutateTheme_exports);
22
+ var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web"), import_react = require("react");
23
+ function mutateThemes({
24
+ themes,
25
+ batch,
26
+ insertCSS = !0,
27
+ ...props
28
+ }) {
29
+ const allThemesProxied = {}, allThemesRaw = {};
30
+ for (const { name, theme } of themes) {
31
+ const res = _mutateTheme({
32
+ ...props,
33
+ name,
34
+ theme,
35
+ // we'll do one update at the end
36
+ avoidUpdate: !0,
37
+ // always add which also replaces but doesnt fail first time
38
+ mutationType: "add"
39
+ });
40
+ res && (allThemesProxied[name] = res.theme, allThemesRaw[name] = res.themeRaw);
41
+ }
42
+ const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : [];
43
+ return (0, import_react.startTransition)(() => {
44
+ for (const themeName in allThemesProxied) {
45
+ const theme = allThemesProxied[themeName];
46
+ updateThemeConfig(themeName, theme), notifyThemeManagersOfUpdate(themeName, theme);
47
+ }
48
+ }), {
49
+ themes: allThemesProxied,
50
+ themesRaw: allThemesRaw,
51
+ cssRules
52
+ };
53
+ }
54
+ function _mutateTheme(props) {
55
+ if (import_constants.isServer) {
56
+ process.env.NODE_ENV === "development" && console.warn("Theme mutation is not supported on server side");
57
+ return;
58
+ }
59
+ const config = (0, import_web.getConfig)(), { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
60
+ if (process.env.NODE_ENV === "development") {
61
+ if (!config)
62
+ throw new Error("No config");
63
+ const theme2 = config.themes[props.name];
64
+ if (mutationType !== "add" && !theme2)
65
+ throw new Error(
66
+ `${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`
67
+ );
68
+ }
69
+ const theme = {
70
+ ...mutationType === "update" ? config.themes[themeName] ?? {} : {},
71
+ ...themeIn
72
+ };
73
+ for (const key in theme)
74
+ (0, import_web.ensureThemeVariable)(theme, key);
75
+ const themeProxied = (0, import_web.proxyThemeToParents)(themeName, theme), response = {
76
+ themeRaw: theme,
77
+ theme: themeProxied,
78
+ cssRules: []
79
+ };
80
+ return props.avoidUpdate || (insertCSS && (response.cssRules = insertThemeCSS({
81
+ [themeName]: theme
82
+ })), updateThemeConfig(themeName, themeProxied), notifyThemeManagersOfUpdate(themeName, themeProxied)), response;
83
+ }
84
+ function updateThemeConfig(themeName, theme) {
85
+ const config = (0, import_web.getConfig)();
86
+ config.themes[themeName] = theme, (0, import_web.updateConfig)("themes", config.themes);
87
+ }
88
+ function notifyThemeManagersOfUpdate(themeName, theme) {
89
+ import_web.activeThemeManagers.forEach((manager) => {
90
+ manager.state.name === themeName && manager.updateStateFromProps(
91
+ {
92
+ name: themeName,
93
+ forceTheme: theme
94
+ },
95
+ !0
96
+ );
97
+ });
98
+ }
99
+ function insertThemeCSS(themes, batch = !1) {
100
+ return [];
101
+ }
102
+ function updateStyle(id, rules) {
103
+ const existing = document.querySelector(`#${id}`), style = document.createElement("style");
104
+ style.id = id, style.appendChild(document.createTextNode(rules.join(`
105
+ `))), document.head.appendChild(style), existing && existing.parentElement?.removeChild(existing);
106
+ }
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ _mutateTheme,
110
+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,KAAK,GAC3B,YACF,SAAS,eAAe,YAAY,QAAQ;AAEhD;",
5
+ "names": ["theme"]
6
+ }
@@ -1,21 +1,17 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
13
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
15
  var addTheme_exports = {};
20
16
  __export(addTheme_exports, {
21
17
  addTheme: () => addTheme
@@ -23,7 +19,7 @@ __export(addTheme_exports, {
23
19
  module.exports = __toCommonJS(addTheme_exports);
24
20
  var import_mutateTheme = require("./_mutateTheme");
25
21
  function addTheme(props) {
26
- return (0, import_mutateTheme._mutateTheme)({ ...props, insertCSS: true, mutationType: "add" });
22
+ return (0, import_mutateTheme._mutateTheme)({ ...props, insertCSS: !0, mutationType: "add" });
27
23
  }
28
24
  // Annotate the CommonJS export names for ESM import in node:
29
25
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,SAAS,OAItB;AACD,aAAO,iCAAa,EAAE,GAAG,OAAO,WAAW,MAAM,cAAc,MAAM,CAAC;AACxE;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,SAAS,OAItB;AACD,aAAO,iCAAa,EAAE,GAAG,OAAO,WAAW,IAAM,cAAc,MAAM,CAAC;AACxE;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var addTheme_exports = {};
17
+ __export(addTheme_exports, {
18
+ addTheme: () => addTheme
19
+ });
20
+ module.exports = __toCommonJS(addTheme_exports);
21
+ var import_mutateTheme = require("./_mutateTheme");
22
+ function addTheme(props) {
23
+ return (0, import_mutateTheme._mutateTheme)({ ...props, insertCSS: !0, mutationType: "add" });
24
+ }
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ addTheme
28
+ });
29
+ //# sourceMappingURL=addTheme.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/addTheme.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,SAAS,OAItB;AACD,aAAO,iCAAa,EAAE,GAAG,OAAO,WAAW,IAAM,cAAc,MAAM,CAAC;AACxE;",
5
+ "names": []
6
+ }
package/dist/cjs/index.js CHANGED
@@ -1,22 +1,17 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
13
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
20
15
  var src_exports = {};
21
16
  __export(src_exports, {
22
17
  mutateThemes: () => import_mutateTheme.mutateThemes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,uBAAd;AACA,wBAAc,0BADd;AAEA,wBAAc,2BAFd;AAGA,yBAA6B;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,uBAAd;AACA,wBAAc,0BADd;AAEA,wBAAc,2BAFd;AAGA,yBAA6B;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var src_exports = {};
17
+ __export(src_exports, {
18
+ mutateThemes: () => import_mutateTheme.mutateThemes
19
+ });
20
+ module.exports = __toCommonJS(src_exports);
21
+ __reExport(src_exports, require("./addTheme"), module.exports);
22
+ __reExport(src_exports, require("./updateTheme"), module.exports);
23
+ __reExport(src_exports, require("./replaceTheme"), module.exports);
24
+ var import_mutateTheme = require("./_mutateTheme");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ mutateThemes,
28
+ ...require("./addTheme"),
29
+ ...require("./updateTheme"),
30
+ ...require("./replaceTheme")
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,uBAAd;AACA,wBAAc,0BADd;AAEA,wBAAc,2BAFd;AAGA,yBAA6B;",
5
+ "names": []
6
+ }
@@ -1,21 +1,17 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
13
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
15
  var replaceTheme_exports = {};
20
16
  __export(replaceTheme_exports, {
21
17
  replaceTheme: () => replaceTheme
@@ -26,8 +22,7 @@ function replaceTheme({
26
22
  name,
27
23
  theme
28
24
  }) {
29
- const next = (0, import_mutateTheme._mutateTheme)({ name, theme, insertCSS: true, mutationType: "replace" });
30
- return next;
25
+ return (0, import_mutateTheme._mutateTheme)({ name, theme, insertCSS: !0, mutationType: "replace" });
31
26
  }
32
27
  // Annotate the CommonJS export names for ESM import in node:
33
28
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/replaceTheme.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AACD,QAAM,WAAO,iCAAa,EAAE,MAAM,OAAO,WAAW,MAAM,cAAc,UAAU,CAAC;AACnF,SAAO;AACT;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAED,aADa,iCAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,UAAU,CAAC;AAErF;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var replaceTheme_exports = {};
17
+ __export(replaceTheme_exports, {
18
+ replaceTheme: () => replaceTheme
19
+ });
20
+ module.exports = __toCommonJS(replaceTheme_exports);
21
+ var import_mutateTheme = require("./_mutateTheme");
22
+ function replaceTheme({
23
+ name,
24
+ theme
25
+ }) {
26
+ return (0, import_mutateTheme._mutateTheme)({ name, theme, insertCSS: !0, mutationType: "replace" });
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ replaceTheme
31
+ });
32
+ //# sourceMappingURL=replaceTheme.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/replaceTheme.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAED,aADa,iCAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,UAAU,CAAC;AAErF;",
5
+ "names": []
6
+ }
@@ -1,21 +1,17 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
13
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
15
  var updateTheme_exports = {};
20
16
  __export(updateTheme_exports, {
21
17
  updateTheme: () => updateTheme
@@ -26,7 +22,7 @@ function updateTheme({
26
22
  name,
27
23
  theme
28
24
  }) {
29
- return (0, import_mutateTheme._mutateTheme)({ name, theme, insertCSS: true, mutationType: "update" });
25
+ return (0, import_mutateTheme._mutateTheme)({ name, theme, insertCSS: !0, mutationType: "update" });
30
26
  }
31
27
  // Annotate the CommonJS export names for ESM import in node:
32
28
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,aAAO,iCAAa,EAAE,MAAM,OAAO,WAAW,MAAM,cAAc,SAAS,CAAC;AAC9E;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA6B;AAEtB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,aAAO,iCAAa,EAAE,MAAM,OAAO,WAAW,IAAM,cAAc,SAAS,CAAC;AAC9E;",
5
5
  "names": []
6
6
  }