@tamagui/theme 2.7.7 → 3.0.0-beta.1097.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/dist/cjs/_mutateTheme.cjs +96 -116
- package/dist/cjs/_mutateTheme.native.cjs +113 -0
- package/dist/cjs/_mutateTheme.native.js +87 -109
- package/dist/cjs/_mutateTheme.native.js.map +1 -1
- package/dist/cjs/addTheme.cjs +19 -23
- package/dist/cjs/addTheme.native.cjs +33 -0
- package/dist/cjs/addTheme.native.js +19 -22
- package/dist/cjs/addTheme.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -18
- package/dist/cjs/index.native.cjs +30 -0
- package/dist/cjs/index.native.js +14 -17
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/replaceTheme.cjs +22 -29
- package/dist/cjs/replaceTheme.native.cjs +36 -0
- package/dist/cjs/replaceTheme.native.js +22 -28
- package/dist/cjs/replaceTheme.native.js.map +1 -1
- package/dist/cjs/updateTheme.cjs +21 -28
- package/dist/cjs/updateTheme.native.cjs +35 -0
- package/dist/cjs/updateTheme.native.js +21 -27
- package/dist/cjs/updateTheme.native.js.map +1 -1
- package/dist/esm/_mutateTheme.mjs +84 -100
- package/dist/esm/_mutateTheme.mjs.map +1 -1
- package/dist/esm/_mutateTheme.native.js +75 -94
- package/dist/esm/_mutateTheme.native.js.map +1 -1
- package/dist/esm/addTheme.mjs +7 -5
- package/dist/esm/addTheme.mjs.map +1 -1
- package/dist/esm/addTheme.native.js +7 -5
- package/dist/esm/addTheme.native.js.map +1 -1
- package/dist/esm/index.js +8 -5
- package/dist/esm/index.mjs +8 -5
- package/dist/esm/index.native.js +8 -5
- package/dist/esm/replaceTheme.mjs +10 -11
- package/dist/esm/replaceTheme.mjs.map +1 -1
- package/dist/esm/replaceTheme.native.js +10 -11
- package/dist/esm/replaceTheme.native.js.map +1 -1
- package/dist/esm/updateTheme.mjs +9 -10
- package/dist/esm/updateTheme.mjs.map +1 -1
- package/dist/esm/updateTheme.native.js +9 -10
- package/dist/esm/updateTheme.native.js.map +1 -1
- package/package.json +7 -6
- package/src/_mutateTheme.ts +17 -15
- package/types/_mutateTheme.d.ts +1 -1
- package/types/_mutateTheme.d.ts.map +1 -1
- package/types/addTheme.d.ts +1 -1
- package/types/replaceTheme.d.ts +1 -1
- package/types/updateTheme.d.ts +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { _mutateTheme } from "./_mutateTheme.native.js";
|
|
2
|
+
|
|
2
3
|
function replaceTheme(param) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
mutationType: "replace"
|
|
12
|
-
});
|
|
13
|
-
return next;
|
|
4
|
+
var { name, theme } = param;
|
|
5
|
+
var next = _mutateTheme({
|
|
6
|
+
name,
|
|
7
|
+
theme,
|
|
8
|
+
insertCSS: true,
|
|
9
|
+
mutationType: "replace"
|
|
10
|
+
});
|
|
11
|
+
return next;
|
|
14
12
|
}
|
|
13
|
+
|
|
15
14
|
export { replaceTheme };
|
|
16
15
|
//# sourceMappingURL=replaceTheme.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"replaceTheme.native.js","names":[],"sources":["esm/replaceTheme.native.js"],"sourcesContent":["import { _mutateTheme } from \"./_mutateTheme\";\nfunction replaceTheme(param) {\n var { name, theme } = param;\n var next = _mutateTheme({\n name,\n theme,\n insertCSS: true,\n mutationType: \"replace\"\n });\n return next;\n}\nexport {\n replaceTheme\n};\n//# sourceMappingURL=replaceTheme.js.map\n"],"mappings":";;;AACA,SAAS,aAAa,OAAO;CAC3B,IAAI,EAAE,MAAM,UAAU;CACtB,IAAI,OAAO,aAAa;EACtB;EACA;EACA,WAAW;EACX,cAAc;CAChB,CAAC;CACD,OAAO;AACT"}
|
package/dist/esm/updateTheme.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { _mutateTheme } from "./_mutateTheme.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
mutationType: "update"
|
|
11
|
-
});
|
|
2
|
+
|
|
3
|
+
function updateTheme({ name, theme }) {
|
|
4
|
+
return _mutateTheme({
|
|
5
|
+
name,
|
|
6
|
+
theme,
|
|
7
|
+
insertCSS: true,
|
|
8
|
+
mutationType: "update"
|
|
9
|
+
});
|
|
12
10
|
}
|
|
11
|
+
|
|
13
12
|
export { updateTheme };
|
|
14
13
|
//# sourceMappingURL=updateTheme.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"updateTheme.js","names":[],"sources":["esm/updateTheme.js"],"sourcesContent":["import { _mutateTheme } from \"./_mutateTheme\";\nfunction updateTheme({\n name,\n theme\n}) {\n return _mutateTheme({ name, theme, insertCSS: true, mutationType: \"update\" });\n}\nexport {\n updateTheme\n};\n//# sourceMappingURL=updateTheme.js.map\n"],"mappings":";;;AACA,SAAS,YAAY,EACnB,MACA,SACC;CACD,OAAO,aAAa;EAAE;EAAM;EAAO,WAAW;EAAM,cAAc;CAAS,CAAC;AAC9E"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { _mutateTheme } from "./_mutateTheme.native.js";
|
|
2
|
+
|
|
2
3
|
function updateTheme(param) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
insertCSS: true,
|
|
11
|
-
mutationType: "update"
|
|
12
|
-
});
|
|
4
|
+
var { name, theme } = param;
|
|
5
|
+
return _mutateTheme({
|
|
6
|
+
name,
|
|
7
|
+
theme,
|
|
8
|
+
insertCSS: true,
|
|
9
|
+
mutationType: "update"
|
|
10
|
+
});
|
|
13
11
|
}
|
|
12
|
+
|
|
14
13
|
export { updateTheme };
|
|
15
14
|
//# sourceMappingURL=updateTheme.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"updateTheme.native.js","names":[],"sources":["esm/updateTheme.native.js"],"sourcesContent":["import { _mutateTheme } from \"./_mutateTheme\";\nfunction updateTheme(param) {\n var { name, theme } = param;\n return _mutateTheme({\n name,\n theme,\n insertCSS: true,\n mutationType: \"update\"\n });\n}\nexport {\n updateTheme\n};\n//# sourceMappingURL=updateTheme.js.map\n"],"mappings":";;;AACA,SAAS,YAAY,OAAO;CAC1B,IAAI,EAAE,MAAM,UAAU;CACtB,OAAO,aAAa;EAClB;EACA;EACA,WAAW;EACX,cAAc;CAChB,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/theme",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1097.1",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"source": "src/index.ts",
|
|
5
6
|
"files": [
|
|
6
7
|
"src",
|
|
@@ -34,13 +35,13 @@
|
|
|
34
35
|
"clean:build": "tamagui-build clean:build"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@tamagui/constants": "
|
|
38
|
-
"@tamagui/start-transition": "
|
|
39
|
-
"@tamagui/web": "
|
|
38
|
+
"@tamagui/constants": "3.0.0-beta.1097.1",
|
|
39
|
+
"@tamagui/start-transition": "3.0.0-beta.1097.1",
|
|
40
|
+
"@tamagui/web": "3.0.0-beta.1097.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "
|
|
43
|
-
"react": "
|
|
43
|
+
"@tamagui/build": "3.0.0-beta.1097.1",
|
|
44
|
+
"react": "19.2.3"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"react": ">=19"
|
package/src/_mutateTheme.ts
CHANGED
|
@@ -2,15 +2,17 @@ import { isServer } from '@tamagui/constants'
|
|
|
2
2
|
import { startTransition } from '@tamagui/start-transition'
|
|
3
3
|
import type { ThemeDefinition, ThemeParsed } from '@tamagui/web'
|
|
4
4
|
import {
|
|
5
|
-
ensureThemeVariable,
|
|
6
5
|
forceUpdateThemes,
|
|
7
6
|
getConfig,
|
|
8
|
-
|
|
9
|
-
mutatedAutoVariables,
|
|
10
|
-
proxyThemeToParents,
|
|
7
|
+
getMutatedAutoVariableCSS,
|
|
11
8
|
simpleHash,
|
|
12
9
|
updateConfig,
|
|
13
10
|
} from '@tamagui/web'
|
|
11
|
+
import {
|
|
12
|
+
ensureThemeVariable,
|
|
13
|
+
getThemeCSSRules,
|
|
14
|
+
proxyThemeToParents,
|
|
15
|
+
} from '@tamagui/web/internal-runtime'
|
|
14
16
|
|
|
15
17
|
type MutateThemeOptions = {
|
|
16
18
|
mutationType: 'replace' | 'update' | 'add'
|
|
@@ -61,10 +63,7 @@ export function mutateThemes({
|
|
|
61
63
|
const cssRules = insertCSS ? insertThemeCSS(allThemesRaw, batch) : []
|
|
62
64
|
|
|
63
65
|
startTransition(() => {
|
|
64
|
-
|
|
65
|
-
const theme = allThemesProxied[themeName]
|
|
66
|
-
updateThemeConfig(themeName, theme)
|
|
67
|
-
}
|
|
66
|
+
updateConfig('themes', allThemesProxied)
|
|
68
67
|
updateThemeStates()
|
|
69
68
|
})
|
|
70
69
|
|
|
@@ -111,7 +110,11 @@ export function _mutateTheme(props: MutateThemeOptions & MutateOneThemeProps) {
|
|
|
111
110
|
|
|
112
111
|
const themeProxied = proxyThemeToParents(themeName, theme)
|
|
113
112
|
|
|
114
|
-
const response
|
|
113
|
+
const response: {
|
|
114
|
+
themeRaw: ThemeParsed
|
|
115
|
+
theme: ThemeParsed
|
|
116
|
+
cssRules: string[]
|
|
117
|
+
} = {
|
|
115
118
|
themeRaw: theme,
|
|
116
119
|
theme: themeProxied,
|
|
117
120
|
cssRules: [] as string[],
|
|
@@ -134,9 +137,7 @@ export function _mutateTheme(props: MutateThemeOptions & MutateOneThemeProps) {
|
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
function updateThemeConfig(themeName: string, theme: ThemeParsed) {
|
|
137
|
-
|
|
138
|
-
config.themes[themeName] = theme
|
|
139
|
-
updateConfig('themes', config.themes)
|
|
140
|
+
updateConfig('themes', { [themeName]: theme })
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
function updateThemeStates() {
|
|
@@ -171,9 +172,10 @@ function insertThemeCSS(themes: Record<string, PartialTheme>, batch: Batch = fal
|
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
// output all mutated auto variables because updateStyle replaces the element
|
|
176
|
+
const mutatedAutoVariableCSS = getMutatedAutoVariableCSS()
|
|
177
|
+
if (mutatedAutoVariableCSS) {
|
|
178
|
+
const autoVarCSS = `:root{${mutatedAutoVariableCSS}}`
|
|
177
179
|
updateStyle(`t_mutate_vars`, [autoVarCSS])
|
|
178
180
|
}
|
|
179
181
|
|
package/types/_mutateTheme.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function mutateThemes({ themes, batch, insertCSS, ...props }: Omi
|
|
|
20
20
|
};
|
|
21
21
|
export declare function _mutateTheme(props: MutateThemeOptions & MutateOneThemeProps): {
|
|
22
22
|
themeRaw: ThemeParsed;
|
|
23
|
-
theme:
|
|
23
|
+
theme: ThemeParsed;
|
|
24
24
|
cssRules: string[];
|
|
25
25
|
} | undefined;
|
|
26
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_mutateTheme.d.ts","sourceRoot":"","sources":["../src/_mutateTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"_mutateTheme.d.ts","sourceRoot":"","sources":["../src/_mutateTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAchE,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAA;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,GAAG,CAAC,CAAC,CAAA;AAE/D,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAGD,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AAG7B,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,SAAgB,EAChB,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,GAAG;IAC5C,MAAM,EAAE,mBAAmB,EAAE,CAAA;IAG7B,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;;;;EA+BA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB;cAqC9D,WAAW;WACd,WAAW;cACR,MAAM,EAAE;cAqBrB"}
|
package/types/addTheme.d.ts
CHANGED
package/types/replaceTheme.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function replaceTheme({ name, theme, }: {
|
|
|
4
4
|
theme: Partial<Record<keyof ThemeDefinition, any>>;
|
|
5
5
|
}): {
|
|
6
6
|
themeRaw: import("@tamagui/web").ThemeParsed;
|
|
7
|
-
theme:
|
|
7
|
+
theme: import("@tamagui/web").ThemeParsed;
|
|
8
8
|
cssRules: string[];
|
|
9
9
|
} | undefined;
|
|
10
10
|
//# sourceMappingURL=replaceTheme.d.ts.map
|
package/types/updateTheme.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function updateTheme({ name, theme, }: {
|
|
|
4
4
|
theme: Partial<Record<keyof ThemeDefinition, any>>;
|
|
5
5
|
}): {
|
|
6
6
|
themeRaw: import("@tamagui/web").ThemeParsed;
|
|
7
|
-
theme:
|
|
7
|
+
theme: import("@tamagui/web").ThemeParsed;
|
|
8
8
|
cssRules: string[];
|
|
9
9
|
} | undefined;
|
|
10
10
|
//# sourceMappingURL=updateTheme.d.ts.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["mutateThemes"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAASA,YAAA,QAAoB","ignoreList":[]}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["mutateThemes"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAASA,YAAA,QAAoB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["mutateThemes"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAASA,YAAA,QAAoB","ignoreList":[]}
|