@tamagui/web 1.15.23 → 1.15.24

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 (49) hide show
  1. package/dist/cjs/createComponent.js +28 -22
  2. package/dist/cjs/createComponent.js.map +1 -1
  3. package/dist/cjs/helpers/ThemeManager.js +5 -2
  4. package/dist/cjs/helpers/ThemeManager.js.map +1 -1
  5. package/dist/cjs/helpers/getThemeCSSRules.js +2 -1
  6. package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
  7. package/dist/cjs/views/ThemeDebug.js +5 -3
  8. package/dist/cjs/views/ThemeDebug.js.map +1 -1
  9. package/dist/esm/createComponent.js +28 -22
  10. package/dist/esm/createComponent.js.map +1 -1
  11. package/dist/esm/createComponent.mjs +28 -22
  12. package/dist/esm/createComponent.mjs.map +1 -1
  13. package/dist/esm/helpers/ThemeManager.js +5 -2
  14. package/dist/esm/helpers/ThemeManager.js.map +1 -1
  15. package/dist/esm/helpers/ThemeManager.mjs +5 -2
  16. package/dist/esm/helpers/ThemeManager.mjs.map +1 -1
  17. package/dist/esm/helpers/getThemeCSSRules.js +2 -1
  18. package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
  19. package/dist/esm/helpers/getThemeCSSRules.mjs +2 -1
  20. package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
  21. package/dist/esm/views/ThemeDebug.js +5 -3
  22. package/dist/esm/views/ThemeDebug.js.map +1 -1
  23. package/dist/esm/views/ThemeDebug.mjs +5 -3
  24. package/dist/esm/views/ThemeDebug.mjs.map +1 -1
  25. package/package.json +9 -9
  26. package/src/createComponent.tsx +30 -24
  27. package/src/helpers/ThemeManager.tsx +7 -2
  28. package/src/helpers/getThemeCSSRules.ts +2 -1
  29. package/src/views/ThemeDebug.tsx +5 -3
  30. package/types/createComponent.d.ts.map +1 -1
  31. package/types/helpers/ThemeManager.d.ts.map +1 -1
  32. package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
  33. package/types/views/ThemeDebug.d.ts.map +1 -1
  34. package/dist/cjs/addTheme.js +0 -78
  35. package/dist/cjs/addTheme.js.map +0 -6
  36. package/dist/cjs/updateTheme.js +0 -47
  37. package/dist/cjs/updateTheme.js.map +0 -6
  38. package/dist/esm/addTheme.js +0 -54
  39. package/dist/esm/addTheme.js.map +0 -6
  40. package/dist/esm/addTheme.mjs +0 -54
  41. package/dist/esm/addTheme.mjs.map +0 -6
  42. package/dist/esm/updateTheme.js +0 -23
  43. package/dist/esm/updateTheme.js.map +0 -6
  44. package/dist/esm/updateTheme.mjs +0 -23
  45. package/dist/esm/updateTheme.mjs.map +0 -6
  46. package/types/addTheme.d.ts +0 -33
  47. package/types/addTheme.d.ts.map +0 -1
  48. package/types/updateTheme.d.ts +0 -31
  49. package/types/updateTheme.d.ts.map +0 -1
@@ -1,54 +0,0 @@
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
@@ -1,6 +0,0 @@
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
- }
@@ -1,54 +0,0 @@
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
@@ -1,6 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
@@ -1,6 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
@@ -1,6 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
1
- import { ThemeDefinition } from './types.js';
2
- /** @deprecated import from @tamagui/theme instead */
3
- export declare function addTheme(props: {
4
- name: string;
5
- theme: Partial<Record<keyof ThemeDefinition, any>>;
6
- insertCSS?: boolean;
7
- update?: boolean;
8
- }): {
9
- theme: {
10
- [x: string]: import("./createVariable.js").Variable<any>;
11
- background?: import("./createVariable.js").Variable<any> | undefined;
12
- backgroundHover?: import("./createVariable.js").Variable<any> | undefined;
13
- backgroundPress?: import("./createVariable.js").Variable<any> | undefined;
14
- backgroundFocus?: import("./createVariable.js").Variable<any> | undefined;
15
- color?: import("./createVariable.js").Variable<any> | undefined;
16
- colorHover?: import("./createVariable.js").Variable<any> | undefined;
17
- colorPress?: import("./createVariable.js").Variable<any> | undefined;
18
- colorFocus?: import("./createVariable.js").Variable<any> | undefined;
19
- borderColor?: import("./createVariable.js").Variable<any> | undefined;
20
- borderColorHover?: import("./createVariable.js").Variable<any> | undefined;
21
- borderColorPress?: import("./createVariable.js").Variable<any> | undefined;
22
- borderColorFocus?: import("./createVariable.js").Variable<any> | undefined;
23
- shadowColor?: import("./createVariable.js").Variable<any> | undefined;
24
- shadowColorHover?: import("./createVariable.js").Variable<any> | undefined;
25
- shadowColorPress?: import("./createVariable.js").Variable<any> | undefined;
26
- shadowColorFocus?: import("./createVariable.js").Variable<any> | undefined;
27
- };
28
- cssRules?: undefined;
29
- } | {
30
- theme: any;
31
- cssRules: string[];
32
- };
33
- //# sourceMappingURL=addTheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addTheme.d.ts","sourceRoot":"","sources":["../src/addTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAe,MAAM,YAAY,CAAA;AAEzD,qDAAqD;AACrD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,GAAG,CAAC,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;;;;;;;;;;;;;;;;;;;;;;;;EAoDA"}
@@ -1,31 +0,0 @@
1
- import type { ThemeDefinition } from './types.js';
2
- /** @deprecated import from @tamagui/theme instead */
3
- export declare function updateTheme({ name, theme, }: {
4
- name: string;
5
- theme: Partial<Record<keyof ThemeDefinition, any>>;
6
- }): {
7
- theme: {
8
- [x: string]: import("./createVariable.js").Variable<any>;
9
- background?: import("./createVariable.js").Variable<any> | undefined;
10
- backgroundHover?: import("./createVariable.js").Variable<any> | undefined;
11
- backgroundPress?: import("./createVariable.js").Variable<any> | undefined;
12
- backgroundFocus?: import("./createVariable.js").Variable<any> | undefined;
13
- color?: import("./createVariable.js").Variable<any> | undefined;
14
- colorHover?: import("./createVariable.js").Variable<any> | undefined;
15
- colorPress?: import("./createVariable.js").Variable<any> | undefined;
16
- colorFocus?: import("./createVariable.js").Variable<any> | undefined;
17
- borderColor?: import("./createVariable.js").Variable<any> | undefined;
18
- borderColorHover?: import("./createVariable.js").Variable<any> | undefined;
19
- borderColorPress?: import("./createVariable.js").Variable<any> | undefined;
20
- borderColorFocus?: import("./createVariable.js").Variable<any> | undefined;
21
- shadowColor?: import("./createVariable.js").Variable<any> | undefined;
22
- shadowColorHover?: import("./createVariable.js").Variable<any> | undefined;
23
- shadowColorPress?: import("./createVariable.js").Variable<any> | undefined;
24
- shadowColorFocus?: import("./createVariable.js").Variable<any> | undefined;
25
- };
26
- cssRules?: undefined;
27
- } | {
28
- theme: any;
29
- cssRules: string[];
30
- };
31
- //# sourceMappingURL=updateTheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateTheme.d.ts","sourceRoot":"","sources":["../src/updateTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,GAAG,CAAC,CAAC,CAAA;CACnD;;;;;;;;;;;;;;;;;;;;;;;;EAeA"}