@tamagui/theme 1.26.0 → 1.27.0-1684163004699

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/theme",
3
- "version": "1.26.0",
3
+ "version": "1.27.0-1684163004699",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -17,14 +17,14 @@
17
17
  "watch": "tamagui-build --watch"
18
18
  },
19
19
  "dependencies": {
20
- "@tamagui/constants": "1.26.0",
21
- "@tamagui/web": "1.26.0"
20
+ "@tamagui/constants": "1.27.0-1684163004699",
21
+ "@tamagui/web": "1.27.0-1684163004699"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "*"
25
25
  },
26
26
  "devDependencies": {
27
- "@tamagui/build": "1.26.0",
27
+ "@tamagui/build": "1.27.0-1684163004699",
28
28
  "react": "^18.2.0"
29
29
  },
30
30
  "publishConfig": {
@@ -1,84 +0,0 @@
1
- import { isServer } from "@tamagui/constants";
2
- import {
3
- activeThemeManagers,
4
- ensureThemeVariable,
5
- getConfig,
6
- getThemeCSSRules,
7
- proxyThemeToParents,
8
- updateConfig
9
- } from "@tamagui/web";
10
- function _mutateTheme(props) {
11
- var _a;
12
- if (isServer) {
13
- if (process.env.NODE_ENV === "development") {
14
- console.warn("Theme mutation is not supported on server side");
15
- }
16
- return;
17
- }
18
- const config = getConfig();
19
- const { name: themeName, theme: themeIn, insertCSS, mutationType } = props;
20
- if (process.env.NODE_ENV === "development") {
21
- if (!config) {
22
- throw new Error("No config");
23
- }
24
- const theme2 = config.themes[props.name];
25
- if (mutationType && !theme2) {
26
- throw new Error(
27
- `${mutationType === "replace" ? "Replace" : "Update"} theme failed! Theme ${props.name} does not exist`
28
- );
29
- }
30
- if (!props.mutationType && theme2) {
31
- return { theme: theme2 };
32
- }
33
- }
34
- const theme = {
35
- ...mutationType === "update" ? config.themes[themeName] ?? {} : {},
36
- ...themeIn
37
- };
38
- for (const key in theme) {
39
- ensureThemeVariable(theme, key);
40
- }
41
- const themeProxied = proxyThemeToParents(themeName, theme, config.themes);
42
- config.themes[themeName] = themeProxied;
43
- let cssRules = [];
44
- updateConfig("themes", { ...config.themes, [themeName]: themeProxied });
45
- if (process.env.TAMAGUI_TARGET === "web") {
46
- if (insertCSS) {
47
- cssRules = getThemeCSSRules({
48
- // @ts-ignore this works but should be fixed types
49
- config,
50
- themeName,
51
- names: [themeName],
52
- theme
53
- });
54
- const id = `t_theme_style_${themeName}`;
55
- const existing = document.querySelector(`#${id}`);
56
- const style = document.createElement("style");
57
- style.id = id;
58
- style.appendChild(document.createTextNode(cssRules.join("\n")));
59
- document.head.appendChild(style);
60
- if (existing) {
61
- (_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
62
- }
63
- }
64
- }
65
- activeThemeManagers.forEach((manager) => {
66
- if (manager.state.name === props.name) {
67
- manager.updateState(
68
- {
69
- name: props.name,
70
- forceTheme: themeProxied
71
- },
72
- true
73
- );
74
- }
75
- });
76
- return {
77
- theme: themeProxied,
78
- cssRules
79
- };
80
- }
81
- export {
82
- _mutateTheme
83
- };
84
- //# sourceMappingURL=_mutateTheme.mjs.map
@@ -1,8 +0,0 @@
1
- import { _mutateTheme } from "./_mutateTheme";
2
- function addTheme(props) {
3
- return _mutateTheme({ ...props });
4
- }
5
- export {
6
- addTheme
7
- };
8
- //# sourceMappingURL=addTheme.mjs.map
@@ -1,4 +0,0 @@
1
- export * from "./addTheme";
2
- export * from "./updateTheme";
3
- export * from "./replaceTheme";
4
- //# sourceMappingURL=index.mjs.map
@@ -1,12 +0,0 @@
1
- import { _mutateTheme } from "./_mutateTheme";
2
- function replaceTheme({
3
- name,
4
- theme
5
- }) {
6
- const next = _mutateTheme({ name, theme, insertCSS: true, mutationType: "replace" });
7
- return next;
8
- }
9
- export {
10
- replaceTheme
11
- };
12
- //# sourceMappingURL=replaceTheme.mjs.map
@@ -1,12 +0,0 @@
1
- import { _mutateTheme } from "./_mutateTheme";
2
- function updateTheme({
3
- name,
4
- theme
5
- }) {
6
- return _mutateTheme({ name, theme, insertCSS: true, mutationType: "update" });
7
- }
8
- globalThis["updateTheme"] = updateTheme;
9
- export {
10
- updateTheme
11
- };
12
- //# sourceMappingURL=updateTheme.mjs.map