@tamagui/web 1.15.30 → 1.15.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/addTheme.js +78 -0
- package/dist/cjs/addTheme.js.map +6 -0
- package/dist/cjs/updateTheme.js +47 -0
- package/dist/cjs/updateTheme.js.map +6 -0
- package/dist/esm/addTheme.js +54 -0
- package/dist/esm/addTheme.js.map +6 -0
- package/dist/esm/addTheme.mjs +54 -0
- package/dist/esm/addTheme.mjs.map +6 -0
- package/dist/esm/updateTheme.js +23 -0
- package/dist/esm/updateTheme.js.map +6 -0
- package/dist/esm/updateTheme.mjs +23 -0
- package/dist/esm/updateTheme.mjs.map +6 -0
- package/package.json +9 -9
|
@@ -0,0 +1,78 @@
|
|
|
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: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
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
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var addTheme_exports = {};
|
|
20
|
+
__export(addTheme_exports, {
|
|
21
|
+
addTheme: () => addTheme
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(addTheme_exports);
|
|
24
|
+
var import_constants = require("@tamagui/constants");
|
|
25
|
+
var import_config = require("./config.js");
|
|
26
|
+
var import_getThemeCSSRules = require("./helpers/getThemeCSSRules");
|
|
27
|
+
var import_themes = require("./helpers/themes.js");
|
|
28
|
+
function addTheme(props) {
|
|
29
|
+
var _a;
|
|
30
|
+
const config = (0, import_config.getConfig)();
|
|
31
|
+
if (process.env.NODE_ENV === "development") {
|
|
32
|
+
if (!config) {
|
|
33
|
+
throw new Error("No config");
|
|
34
|
+
}
|
|
35
|
+
const theme2 = config.themes[props.name];
|
|
36
|
+
if (!props.update && theme2) {
|
|
37
|
+
return { theme: theme2 };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const { name: themeName, theme: themeIn, insertCSS } = props;
|
|
41
|
+
const theme = { ...themeIn };
|
|
42
|
+
for (const key in theme) {
|
|
43
|
+
(0, import_themes.ensureThemeVariable)(theme, key);
|
|
44
|
+
}
|
|
45
|
+
const themeProxied = (0, import_themes.proxyThemeToParents)(themeName, theme, config.themes);
|
|
46
|
+
config.themes[themeName] = themeProxied;
|
|
47
|
+
let cssRules = [];
|
|
48
|
+
if (import_constants.isWeb) {
|
|
49
|
+
if (insertCSS) {
|
|
50
|
+
cssRules = (0, import_getThemeCSSRules.getThemeCSSRules)({
|
|
51
|
+
// @ts-ignore this works but should be fixed types
|
|
52
|
+
config,
|
|
53
|
+
themeName,
|
|
54
|
+
names: [themeName],
|
|
55
|
+
theme
|
|
56
|
+
});
|
|
57
|
+
const id = `t_theme_style_${themeName}`;
|
|
58
|
+
const existing = document.querySelector(`#${id}`);
|
|
59
|
+
const style = document.createElement("style");
|
|
60
|
+
style.id = id;
|
|
61
|
+
style.appendChild(document.createTextNode(cssRules.join("\n")));
|
|
62
|
+
document.head.appendChild(style);
|
|
63
|
+
if (existing) {
|
|
64
|
+
(_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
(0, import_config.updateConfig)("themes", { ...config.themes, [themeName]: themeProxied });
|
|
69
|
+
return {
|
|
70
|
+
theme: themeProxied,
|
|
71
|
+
cssRules
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
addTheme
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=addTheme.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/addTheme.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEtB,oBAAwC;AACxC,8BAAiC;AACjC,oBAAyD;AAIlD,SAAS,SAAS,OAKtB;AAbH;AAcE,QAAM,aAAS,yBAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,2CAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,mBAAe,mCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,wBAAO;AACT,QAAI,WAAW;AACb,qBAAW,0CAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,kCAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["theme"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
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
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var updateTheme_exports = {};
|
|
20
|
+
__export(updateTheme_exports, {
|
|
21
|
+
updateTheme: () => updateTheme
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(updateTheme_exports);
|
|
24
|
+
var import_addTheme = require("./addTheme.js");
|
|
25
|
+
var import_useTheme = require("./hooks/useTheme.js");
|
|
26
|
+
function updateTheme({
|
|
27
|
+
name,
|
|
28
|
+
theme
|
|
29
|
+
}) {
|
|
30
|
+
const next = (0, import_addTheme.addTheme)({ name, theme, insertCSS: true, update: true });
|
|
31
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
32
|
+
import_useTheme.activeThemeManagers.forEach((manager) => {
|
|
33
|
+
if (manager.state.name === name) {
|
|
34
|
+
manager.updateState({
|
|
35
|
+
name,
|
|
36
|
+
forceTheme: next.theme
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return next;
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
updateTheme
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=updateTheme.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/updateTheme.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,sBAAoC;AAI7B,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,WAAO,0BAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wCAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isWeb } from "@tamagui/constants";
|
|
2
|
+
import { getConfig, updateConfig } from "./config.js";
|
|
3
|
+
import { getThemeCSSRules } from "./helpers/getThemeCSSRules";
|
|
4
|
+
import { ensureThemeVariable, proxyThemeToParents } from "./helpers/themes.js";
|
|
5
|
+
function addTheme(props) {
|
|
6
|
+
var _a;
|
|
7
|
+
const config = getConfig();
|
|
8
|
+
if (process.env.NODE_ENV === "development") {
|
|
9
|
+
if (!config) {
|
|
10
|
+
throw new Error("No config");
|
|
11
|
+
}
|
|
12
|
+
const theme2 = config.themes[props.name];
|
|
13
|
+
if (!props.update && theme2) {
|
|
14
|
+
return { theme: theme2 };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const { name: themeName, theme: themeIn, insertCSS } = props;
|
|
18
|
+
const theme = { ...themeIn };
|
|
19
|
+
for (const key in theme) {
|
|
20
|
+
ensureThemeVariable(theme, key);
|
|
21
|
+
}
|
|
22
|
+
const themeProxied = proxyThemeToParents(themeName, theme, config.themes);
|
|
23
|
+
config.themes[themeName] = themeProxied;
|
|
24
|
+
let cssRules = [];
|
|
25
|
+
if (isWeb) {
|
|
26
|
+
if (insertCSS) {
|
|
27
|
+
cssRules = getThemeCSSRules({
|
|
28
|
+
// @ts-ignore this works but should be fixed types
|
|
29
|
+
config,
|
|
30
|
+
themeName,
|
|
31
|
+
names: [themeName],
|
|
32
|
+
theme
|
|
33
|
+
});
|
|
34
|
+
const id = `t_theme_style_${themeName}`;
|
|
35
|
+
const existing = document.querySelector(`#${id}`);
|
|
36
|
+
const style = document.createElement("style");
|
|
37
|
+
style.id = id;
|
|
38
|
+
style.appendChild(document.createTextNode(cssRules.join("\n")));
|
|
39
|
+
document.head.appendChild(style);
|
|
40
|
+
if (existing) {
|
|
41
|
+
(_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
updateConfig("themes", { ...config.themes, [themeName]: themeProxied });
|
|
46
|
+
return {
|
|
47
|
+
theme: themeProxied,
|
|
48
|
+
cssRules
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
addTheme
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=addTheme.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/addTheme.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;AAEtB,SAAS,WAAW,oBAAoB;AACxC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB,2BAA2B;AAIlD,SAAS,SAAS,OAKtB;AAbH;AAcE,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["theme"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isWeb } from "@tamagui/constants";
|
|
2
|
+
import { getConfig, updateConfig } from "./config.js";
|
|
3
|
+
import { getThemeCSSRules } from "./helpers/getThemeCSSRules";
|
|
4
|
+
import { ensureThemeVariable, proxyThemeToParents } from "./helpers/themes.js";
|
|
5
|
+
function addTheme(props) {
|
|
6
|
+
var _a;
|
|
7
|
+
const config = getConfig();
|
|
8
|
+
if (process.env.NODE_ENV === "development") {
|
|
9
|
+
if (!config) {
|
|
10
|
+
throw new Error("No config");
|
|
11
|
+
}
|
|
12
|
+
const theme2 = config.themes[props.name];
|
|
13
|
+
if (!props.update && theme2) {
|
|
14
|
+
return { theme: theme2 };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const { name: themeName, theme: themeIn, insertCSS } = props;
|
|
18
|
+
const theme = { ...themeIn };
|
|
19
|
+
for (const key in theme) {
|
|
20
|
+
ensureThemeVariable(theme, key);
|
|
21
|
+
}
|
|
22
|
+
const themeProxied = proxyThemeToParents(themeName, theme, config.themes);
|
|
23
|
+
config.themes[themeName] = themeProxied;
|
|
24
|
+
let cssRules = [];
|
|
25
|
+
if (isWeb) {
|
|
26
|
+
if (insertCSS) {
|
|
27
|
+
cssRules = getThemeCSSRules({
|
|
28
|
+
// @ts-ignore this works but should be fixed types
|
|
29
|
+
config,
|
|
30
|
+
themeName,
|
|
31
|
+
names: [themeName],
|
|
32
|
+
theme
|
|
33
|
+
});
|
|
34
|
+
const id = `t_theme_style_${themeName}`;
|
|
35
|
+
const existing = document.querySelector(`#${id}`);
|
|
36
|
+
const style = document.createElement("style");
|
|
37
|
+
style.id = id;
|
|
38
|
+
style.appendChild(document.createTextNode(cssRules.join("\n")));
|
|
39
|
+
document.head.appendChild(style);
|
|
40
|
+
if (existing) {
|
|
41
|
+
(_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
updateConfig("themes", { ...config.themes, [themeName]: themeProxied });
|
|
46
|
+
return {
|
|
47
|
+
theme: themeProxied,
|
|
48
|
+
cssRules
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
addTheme
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=addTheme.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/addTheme.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;AAEtB,SAAS,WAAW,oBAAoB;AACxC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB,2BAA2B;AAIlD,SAAS,SAAS,OAKtB;AAbH;AAcE,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["theme"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { addTheme } from "./addTheme.js";
|
|
2
|
+
import { activeThemeManagers } from "./hooks/useTheme.js";
|
|
3
|
+
function updateTheme({
|
|
4
|
+
name,
|
|
5
|
+
theme
|
|
6
|
+
}) {
|
|
7
|
+
const next = addTheme({ name, theme, insertCSS: true, update: true });
|
|
8
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
9
|
+
activeThemeManagers.forEach((manager) => {
|
|
10
|
+
if (manager.state.name === name) {
|
|
11
|
+
manager.updateState({
|
|
12
|
+
name,
|
|
13
|
+
forceTheme: next.theme
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return next;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
updateTheme
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=updateTheme.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/updateTheme.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAI7B,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { addTheme } from "./addTheme.js";
|
|
2
|
+
import { activeThemeManagers } from "./hooks/useTheme.js";
|
|
3
|
+
function updateTheme({
|
|
4
|
+
name,
|
|
5
|
+
theme
|
|
6
|
+
}) {
|
|
7
|
+
const next = addTheme({ name, theme, insertCSS: true, update: true });
|
|
8
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
9
|
+
activeThemeManagers.forEach((manager) => {
|
|
10
|
+
if (manager.state.name === name) {
|
|
11
|
+
manager.updateState({
|
|
12
|
+
name,
|
|
13
|
+
forceTheme: next.theme
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return next;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
updateTheme
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=updateTheme.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/updateTheme.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAI7B,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.32",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.15.
|
|
31
|
-
"@tamagui/constants": "1.15.
|
|
32
|
-
"@tamagui/helpers": "1.15.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.15.
|
|
34
|
-
"@tamagui/use-did-finish-ssr": "1.15.
|
|
35
|
-
"@tamagui/use-event": "1.15.
|
|
36
|
-
"@tamagui/use-force-update": "1.15.
|
|
30
|
+
"@tamagui/compose-refs": "1.15.32",
|
|
31
|
+
"@tamagui/constants": "1.15.32",
|
|
32
|
+
"@tamagui/helpers": "1.15.32",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.15.32",
|
|
34
|
+
"@tamagui/use-did-finish-ssr": "1.15.32",
|
|
35
|
+
"@tamagui/use-event": "1.15.32",
|
|
36
|
+
"@tamagui/use-force-update": "1.15.32"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "1.15.
|
|
42
|
+
"@tamagui/build": "1.15.32",
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
44
|
"csstype": "^3.0.10",
|
|
45
45
|
"react": "^18.2.0",
|