@tamagui/core 1.0.1-beta.28 → 1.0.1-beta.29

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 (113) hide show
  1. package/dist/cjs/ThemeManager.js +18 -8
  2. package/dist/cjs/ThemeManager.js.map +2 -2
  3. package/dist/cjs/constants/platform.js +6 -6
  4. package/dist/cjs/constants/platform.js.map +2 -2
  5. package/dist/cjs/constants/rnw.js.map +2 -2
  6. package/dist/cjs/createComponent.js +23 -20
  7. package/dist/cjs/createComponent.js.map +2 -2
  8. package/dist/cjs/createTamagui.js +10 -2
  9. package/dist/cjs/createTamagui.js.map +2 -2
  10. package/dist/cjs/helpers/createMediaStyle.js +1 -0
  11. package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
  12. package/dist/cjs/helpers/createPropMapper.js +9 -39
  13. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  14. package/dist/cjs/helpers/generateAtomicStyles.js +453 -0
  15. package/dist/cjs/helpers/generateAtomicStyles.js.map +7 -0
  16. package/dist/cjs/helpers/getSplitStyles.js +67 -65
  17. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  18. package/dist/cjs/helpers/getStylesAtomic.js +31 -40
  19. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  20. package/dist/cjs/helpers/mergeTransform.js +42 -0
  21. package/dist/cjs/helpers/mergeTransform.js.map +7 -0
  22. package/dist/cjs/helpers/prefixStyles.js +192 -0
  23. package/dist/cjs/helpers/prefixStyles.js.map +7 -0
  24. package/dist/cjs/hooks/useIsTouchDevice.js +1 -1
  25. package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
  26. package/dist/cjs/hooks/useTheme.js +8 -7
  27. package/dist/cjs/hooks/useTheme.js.map +2 -2
  28. package/dist/cjs/types.js.map +1 -1
  29. package/dist/cjs/views/Theme.js.map +2 -2
  30. package/dist/cjs/views/ThemeProvider.js +1 -1
  31. package/dist/cjs/views/ThemeProvider.js.map +2 -2
  32. package/dist/cjs/views/ThemeReset.js +1 -0
  33. package/dist/cjs/views/ThemeReset.js.map +2 -2
  34. package/dist/esm/ThemeManager.js +18 -8
  35. package/dist/esm/ThemeManager.js.map +2 -2
  36. package/dist/esm/constants/platform.js +4 -4
  37. package/dist/esm/constants/platform.js.map +2 -2
  38. package/dist/esm/constants/rnw.js.map +2 -2
  39. package/dist/esm/createComponent.js +24 -20
  40. package/dist/esm/createComponent.js.map +2 -2
  41. package/dist/esm/createTamagui.js +8 -1
  42. package/dist/esm/createTamagui.js.map +2 -2
  43. package/dist/esm/helpers/createMediaStyle.js +1 -0
  44. package/dist/esm/helpers/createMediaStyle.js.map +2 -2
  45. package/dist/esm/helpers/createPropMapper.js +9 -40
  46. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  47. package/dist/esm/helpers/generateAtomicStyles.js +425 -0
  48. package/dist/esm/helpers/generateAtomicStyles.js.map +7 -0
  49. package/dist/esm/helpers/getSplitStyles.js +70 -73
  50. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  51. package/dist/esm/helpers/getStylesAtomic.js +26 -39
  52. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  53. package/dist/esm/helpers/mergeTransform.js +19 -0
  54. package/dist/esm/helpers/mergeTransform.js.map +7 -0
  55. package/dist/esm/helpers/prefixStyles.js +166 -0
  56. package/dist/esm/helpers/prefixStyles.js.map +7 -0
  57. package/dist/esm/hooks/useIsTouchDevice.js +2 -2
  58. package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
  59. package/dist/esm/hooks/useTheme.js +8 -7
  60. package/dist/esm/hooks/useTheme.js.map +2 -2
  61. package/dist/esm/views/Theme.js.map +2 -2
  62. package/dist/esm/views/ThemeProvider.js +1 -1
  63. package/dist/esm/views/ThemeProvider.js.map +2 -2
  64. package/dist/esm/views/ThemeReset.js +1 -0
  65. package/dist/esm/views/ThemeReset.js.map +2 -2
  66. package/dist/jsx/ThemeManager.js +18 -8
  67. package/dist/jsx/constants/platform.js +4 -4
  68. package/dist/jsx/createComponent.js +24 -20
  69. package/dist/jsx/createTamagui.js +8 -1
  70. package/dist/jsx/helpers/createMediaStyle.js +1 -0
  71. package/dist/jsx/helpers/createPropMapper.js +9 -40
  72. package/dist/jsx/helpers/generateAtomicStyles.js +424 -0
  73. package/dist/jsx/helpers/getSplitStyles.js +70 -73
  74. package/dist/jsx/helpers/getStylesAtomic.js +26 -39
  75. package/dist/jsx/helpers/mergeTransform.js +18 -0
  76. package/dist/jsx/helpers/prefixStyles.js +165 -0
  77. package/dist/jsx/hooks/useIsTouchDevice.js +2 -2
  78. package/dist/jsx/hooks/useTheme.js +8 -7
  79. package/dist/jsx/views/ThemeProvider.js +1 -1
  80. package/dist/jsx/views/ThemeReset.js +1 -1
  81. package/package.json +8 -5
  82. package/reset.css +2 -1
  83. package/types/Tamagui.d.ts +1 -1
  84. package/types/Tamagui.d.ts.map +1 -1
  85. package/types/ThemeManager.d.ts +9 -6
  86. package/types/ThemeManager.d.ts.map +1 -1
  87. package/types/constants/platform.d.ts +2 -2
  88. package/types/constants/platform.d.ts.map +1 -1
  89. package/types/constants/rnw.d.ts +1 -1
  90. package/types/constants/rnw.d.ts.map +1 -1
  91. package/types/createComponent.d.ts.map +1 -1
  92. package/types/createTamagui.d.ts +1 -0
  93. package/types/createTamagui.d.ts.map +1 -1
  94. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  95. package/types/helpers/createPropMapper.d.ts +2 -2
  96. package/types/helpers/createPropMapper.d.ts.map +1 -1
  97. package/types/helpers/generateAtomicStyles.d.ts +22 -0
  98. package/types/helpers/generateAtomicStyles.d.ts.map +1 -0
  99. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  100. package/types/helpers/getStylesAtomic.d.ts +10 -10
  101. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  102. package/types/helpers/mergeTransform.d.ts +7 -0
  103. package/types/helpers/mergeTransform.d.ts.map +1 -0
  104. package/types/helpers/prefixStyles.d.ts +5 -0
  105. package/types/helpers/prefixStyles.d.ts.map +1 -0
  106. package/types/hooks/useTheme.d.ts +13 -4
  107. package/types/hooks/useTheme.d.ts.map +1 -1
  108. package/types/types.d.ts +3 -4
  109. package/types/types.d.ts.map +1 -1
  110. package/types/views/Theme.d.ts +1 -9
  111. package/types/views/Theme.d.ts.map +1 -1
  112. package/types/views/ThemeProvider.d.ts +1 -0
  113. package/types/views/ThemeProvider.d.ts.map +1 -1
@@ -0,0 +1,166 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import createPrefixer from "inline-style-prefixer/lib/createPrefixer";
4
+ import backgroundClip from "inline-style-prefixer/lib/plugins/backgroundClip";
5
+ import crossFade from "inline-style-prefixer/lib/plugins/crossFade";
6
+ import cursor from "inline-style-prefixer/lib/plugins/cursor";
7
+ import filter from "inline-style-prefixer/lib/plugins/filter";
8
+ import flex from "inline-style-prefixer/lib/plugins/flex";
9
+ import flexboxIE from "inline-style-prefixer/lib/plugins/flexboxIE";
10
+ import flexboxOld from "inline-style-prefixer/lib/plugins/flexboxOld";
11
+ import gradient from "inline-style-prefixer/lib/plugins/gradient";
12
+ import grid from "inline-style-prefixer/lib/plugins/grid";
13
+ import imageSet from "inline-style-prefixer/lib/plugins/imageSet";
14
+ import logical from "inline-style-prefixer/lib/plugins/logical";
15
+ import position from "inline-style-prefixer/lib/plugins/position";
16
+ import sizing from "inline-style-prefixer/lib/plugins/sizing";
17
+ import transition from "inline-style-prefixer/lib/plugins/transition";
18
+ const prefixInlineStyles = /* @__PURE__ */ __name((style) => {
19
+ const prefixedStyles = prefixStyles(style);
20
+ Object.keys(prefixedStyles).forEach((prop) => {
21
+ const value = prefixedStyles[prop];
22
+ if (Array.isArray(value)) {
23
+ prefixedStyles[prop] = value[value.length - 1];
24
+ }
25
+ });
26
+ return prefixedStyles;
27
+ }, "prefixInlineStyles");
28
+ const w = ["Webkit"];
29
+ const m = ["Moz"];
30
+ const ms = ["ms"];
31
+ const wm = ["Webkit", "Moz"];
32
+ const wms = ["Webkit", "ms"];
33
+ const wmms = ["Webkit", "Moz", "ms"];
34
+ const staticData = {
35
+ plugins: [
36
+ backgroundClip,
37
+ crossFade,
38
+ cursor,
39
+ filter,
40
+ flex,
41
+ flexboxIE,
42
+ flexboxOld,
43
+ gradient,
44
+ grid,
45
+ imageSet,
46
+ logical,
47
+ position,
48
+ sizing,
49
+ transition
50
+ ],
51
+ prefixMap: {
52
+ animation: w,
53
+ animationDelay: w,
54
+ animationDirection: w,
55
+ animationFillMode: w,
56
+ animationDuration: w,
57
+ animationIterationCount: w,
58
+ animationName: w,
59
+ animationPlayState: w,
60
+ animationTimingFunction: w,
61
+ appearance: wm,
62
+ userSelect: wmms,
63
+ textEmphasisPosition: w,
64
+ textEmphasis: w,
65
+ textEmphasisStyle: w,
66
+ textEmphasisColor: w,
67
+ boxDecorationBreak: w,
68
+ clipPath: w,
69
+ maskImage: w,
70
+ maskMode: w,
71
+ maskRepeat: w,
72
+ maskPosition: w,
73
+ maskClip: w,
74
+ maskOrigin: w,
75
+ maskSize: w,
76
+ maskComposite: w,
77
+ mask: w,
78
+ maskBorderSource: w,
79
+ maskBorderMode: w,
80
+ maskBorderSlice: w,
81
+ maskBorderWidth: w,
82
+ maskBorderOutset: w,
83
+ maskBorderRepeat: w,
84
+ maskBorder: w,
85
+ maskType: w,
86
+ textDecorationStyle: w,
87
+ textDecorationSkip: w,
88
+ textDecorationLine: w,
89
+ textDecorationColor: w,
90
+ filter: w,
91
+ fontFeatureSettings: w,
92
+ breakAfter: wmms,
93
+ breakBefore: wmms,
94
+ breakInside: wmms,
95
+ columnCount: wm,
96
+ columnFill: wm,
97
+ columnGap: wm,
98
+ columnRule: wm,
99
+ columnRuleColor: wm,
100
+ columnRuleStyle: wm,
101
+ columnRuleWidth: wm,
102
+ columns: wm,
103
+ columnSpan: wm,
104
+ columnWidth: wm,
105
+ writingMode: wms,
106
+ flex: wms,
107
+ flexBasis: w,
108
+ flexDirection: wms,
109
+ flexGrow: w,
110
+ flexFlow: wms,
111
+ flexShrink: w,
112
+ flexWrap: wms,
113
+ alignContent: w,
114
+ alignItems: w,
115
+ alignSelf: w,
116
+ justifyContent: w,
117
+ order: w,
118
+ transform: w,
119
+ transformOrigin: w,
120
+ transformOriginX: w,
121
+ transformOriginY: w,
122
+ backfaceVisibility: w,
123
+ perspective: w,
124
+ perspectiveOrigin: w,
125
+ transformStyle: w,
126
+ transformOriginZ: w,
127
+ backdropFilter: w,
128
+ fontKerning: w,
129
+ scrollSnapType: wms,
130
+ scrollSnapPointsX: wms,
131
+ scrollSnapPointsY: wms,
132
+ scrollSnapDestination: wms,
133
+ scrollSnapCoordinate: wms,
134
+ shapeImageThreshold: w,
135
+ shapeImageMargin: w,
136
+ shapeImageOutside: w,
137
+ hyphens: wmms,
138
+ flowInto: wms,
139
+ flowFrom: wms,
140
+ regionFragment: wms,
141
+ textOrientation: w,
142
+ textAlignLast: m,
143
+ tabSize: m,
144
+ wrapFlow: ms,
145
+ wrapThrough: ms,
146
+ wrapMargin: ms,
147
+ touchAction: ms,
148
+ textSizeAdjust: ["ms", "Webkit"],
149
+ borderImage: w,
150
+ borderImageOutset: w,
151
+ borderImageRepeat: w,
152
+ borderImageSlice: w,
153
+ borderImageSource: w,
154
+ borderImageWidth: w,
155
+ transitionDelay: w,
156
+ transitionDuration: w,
157
+ transitionProperty: w,
158
+ transitionTimingFunction: w
159
+ }
160
+ };
161
+ const prefixStyles = createPrefixer(staticData);
162
+ export {
163
+ prefixInlineStyles,
164
+ prefixStyles
165
+ };
166
+ //# sourceMappingURL=prefixStyles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/helpers/prefixStyles.ts"],
4
+ "sourcesContent": ["import createPrefixer from 'inline-style-prefixer/lib/createPrefixer'\nimport backgroundClip from 'inline-style-prefixer/lib/plugins/backgroundClip'\nimport crossFade from 'inline-style-prefixer/lib/plugins/crossFade'\nimport cursor from 'inline-style-prefixer/lib/plugins/cursor'\nimport filter from 'inline-style-prefixer/lib/plugins/filter'\nimport flex from 'inline-style-prefixer/lib/plugins/flex'\nimport flexboxIE from 'inline-style-prefixer/lib/plugins/flexboxIE'\nimport flexboxOld from 'inline-style-prefixer/lib/plugins/flexboxOld'\nimport gradient from 'inline-style-prefixer/lib/plugins/gradient'\nimport grid from 'inline-style-prefixer/lib/plugins/grid'\nimport imageSet from 'inline-style-prefixer/lib/plugins/imageSet'\nimport logical from 'inline-style-prefixer/lib/plugins/logical'\nimport position from 'inline-style-prefixer/lib/plugins/position'\nimport sizing from 'inline-style-prefixer/lib/plugins/sizing'\nimport transition from 'inline-style-prefixer/lib/plugins/transition'\n\ntype StyleModifier = (style: Object) => Object\n\nexport const prefixInlineStyles: StyleModifier = (style) => {\n const prefixedStyles = prefixStyles(style)\n\n // React@15 removed undocumented support for fallback values in\n // inline-styles. Revert array values to the standard CSS value\n Object.keys(prefixedStyles).forEach((prop) => {\n const value = prefixedStyles[prop]\n if (Array.isArray(value)) {\n prefixedStyles[prop] = value[value.length - 1]\n }\n })\n\n return prefixedStyles\n}\n\nconst w = ['Webkit']\nconst m = ['Moz']\nconst ms = ['ms']\nconst wm = ['Webkit', 'Moz']\nconst wms = ['Webkit', 'ms']\nconst wmms = ['Webkit', 'Moz', 'ms']\nconst staticData = {\n plugins: [\n backgroundClip,\n crossFade,\n cursor,\n filter,\n flex,\n flexboxIE,\n flexboxOld,\n gradient,\n grid,\n imageSet,\n logical,\n position,\n sizing,\n transition,\n ],\n prefixMap: {\n animation: w,\n animationDelay: w,\n animationDirection: w,\n animationFillMode: w,\n animationDuration: w,\n animationIterationCount: w,\n animationName: w,\n animationPlayState: w,\n animationTimingFunction: w,\n appearance: wm,\n userSelect: wmms,\n textEmphasisPosition: w,\n textEmphasis: w,\n textEmphasisStyle: w,\n textEmphasisColor: w,\n boxDecorationBreak: w,\n clipPath: w,\n maskImage: w,\n maskMode: w,\n maskRepeat: w,\n maskPosition: w,\n maskClip: w,\n maskOrigin: w,\n maskSize: w,\n maskComposite: w,\n mask: w,\n maskBorderSource: w,\n maskBorderMode: w,\n maskBorderSlice: w,\n maskBorderWidth: w,\n maskBorderOutset: w,\n maskBorderRepeat: w,\n maskBorder: w,\n maskType: w,\n textDecorationStyle: w,\n textDecorationSkip: w,\n textDecorationLine: w,\n textDecorationColor: w,\n filter: w,\n fontFeatureSettings: w,\n breakAfter: wmms,\n breakBefore: wmms,\n breakInside: wmms,\n columnCount: wm,\n columnFill: wm,\n columnGap: wm,\n columnRule: wm,\n columnRuleColor: wm,\n columnRuleStyle: wm,\n columnRuleWidth: wm,\n columns: wm,\n columnSpan: wm,\n columnWidth: wm,\n writingMode: wms,\n flex: wms,\n flexBasis: w,\n flexDirection: wms,\n flexGrow: w,\n flexFlow: wms,\n flexShrink: w,\n flexWrap: wms,\n alignContent: w,\n alignItems: w,\n alignSelf: w,\n justifyContent: w,\n order: w,\n transform: w,\n transformOrigin: w,\n transformOriginX: w,\n transformOriginY: w,\n backfaceVisibility: w,\n perspective: w,\n perspectiveOrigin: w,\n transformStyle: w,\n transformOriginZ: w,\n backdropFilter: w,\n fontKerning: w,\n scrollSnapType: wms,\n scrollSnapPointsX: wms,\n scrollSnapPointsY: wms,\n scrollSnapDestination: wms,\n scrollSnapCoordinate: wms,\n shapeImageThreshold: w,\n shapeImageMargin: w,\n shapeImageOutside: w,\n hyphens: wmms,\n flowInto: wms,\n flowFrom: wms,\n regionFragment: wms,\n textOrientation: w,\n textAlignLast: m,\n tabSize: m,\n wrapFlow: ms,\n wrapThrough: ms,\n wrapMargin: ms,\n touchAction: ms,\n textSizeAdjust: ['ms', 'Webkit'],\n borderImage: w,\n borderImageOutset: w,\n borderImageRepeat: w,\n borderImageSlice: w,\n borderImageSource: w,\n borderImageWidth: w,\n transitionDelay: w,\n transitionDuration: w,\n transitionProperty: w,\n transitionTimingFunction: w,\n },\n}\n\nexport const prefixStyles: StyleModifier = createPrefixer(staticData)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,IAChB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,gBAAgB,CAAC,MAAM,QAAQ;AAAA,IAC/B,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,EAC5B;AACF;AAEO,MAAM,eAA8B,eAAe,UAAU;",
6
+ "names": []
7
+ }
@@ -1,11 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { useState } from "react";
4
- import { isTouchDevice, useIsomorphicLayoutEffect } from "../constants/platform";
4
+ import { isTouchable, useIsomorphicLayoutEffect } from "../constants/platform";
5
5
  const useIsTouchDevice = /* @__PURE__ */ __name(() => {
6
6
  const [touchOnly, setTouchOnly] = useState(false);
7
7
  useIsomorphicLayoutEffect(() => {
8
- if (isTouchDevice) {
8
+ if (isTouchable) {
9
9
  setTouchOnly(true);
10
10
  }
11
11
  }, []);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useIsTouchDevice.tsx"],
4
- "sourcesContent": ["import { useState } from 'react'\n\nimport { isTouchDevice, useIsomorphicLayoutEffect } from '../constants/platform'\n\n// ssr friendly\n\nexport const useIsTouchDevice = () => {\n const [touchOnly, setTouchOnly] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n if (isTouchDevice) {\n setTouchOnly(true)\n }\n }, [])\n\n return touchOnly\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AAIO,MAAM,mBAAmB,6BAAM;AACpC,QAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;AAEhD,4BAA0B,MAAM;AAC9B,QAAI,eAAe;AACjB,mBAAa,IAAI;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT,GAVgC;",
4
+ "sourcesContent": ["import { useState } from 'react'\n\nimport { isTouchable, useIsomorphicLayoutEffect } from '../constants/platform'\n\n// ssr friendly\n\nexport const useIsTouchDevice = () => {\n const [touchOnly, setTouchOnly] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n if (isTouchable) {\n setTouchOnly(true)\n }\n }, [])\n\n return touchOnly\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AAIO,MAAM,mBAAmB,6BAAM;AACpC,QAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;AAEhD,4BAA0B,MAAM;AAC9B,QAAI,aAAa;AACf,mBAAa,IAAI;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT,GAVgC;",
6
6
  "names": []
7
7
  }
@@ -11,7 +11,7 @@ import { useConstant } from "./useConstant";
11
11
  const useTheme = /* @__PURE__ */ __name((themeName, componentName, props, forceUpdate) => {
12
12
  const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(themeName, componentName, props, forceUpdate);
13
13
  if (process.env.NODE_ENV === "development") {
14
- if ((props == null ? void 0 : props["debug"]) === "verbose") {
14
+ if ((props == null ? void 0 : props.debug) === "verbose") {
15
15
  console.log(" \xBB useTheme", { themeName, componentName, name, className });
16
16
  }
17
17
  }
@@ -52,7 +52,7 @@ const useTheme = /* @__PURE__ */ __name((themeName, componentName, props, forceU
52
52
  if (!name || key === "__proto__" || typeof key === "symbol") {
53
53
  if (key === GetThemeManager) {
54
54
  if (process.env.NODE_ENV === "development") {
55
- if (props["debug"]) {
55
+ if (props == null ? void 0 : props.debug) {
56
56
  console.log("did change", { themeName, didChangeTheme, name, componentName }, themeManager == null ? void 0 : themeManager.parentName);
57
57
  }
58
58
  }
@@ -131,13 +131,14 @@ const useChangeThemeEffect = /* @__PURE__ */ __name((name, componentName, props,
131
131
  const debug = props && props["debug"];
132
132
  const parentManager = useContext(ThemeManagerContext) || emptyManager;
133
133
  const { themes } = useContext(ThemeContext);
134
- const next = parentManager.getNextTheme({ name, componentName, themes }, props);
134
+ const reset = (props == null ? void 0 : props.reset) || false;
135
+ const getThemeProps = { name, componentName, themes, reset };
136
+ const next = parentManager.getNextTheme(getThemeProps, debug);
135
137
  const forceUpdate = forceUpdateProp || useForceUpdate();
136
138
  const themeManager = useConstant(() => {
137
- if (!next) {
139
+ if (!next)
138
140
  return null;
139
- }
140
- return new ThemeManager(next.name, next.theme, parentManager);
141
+ return new ThemeManager(next.name, next.theme, parentManager, reset);
141
142
  });
142
143
  if (typeof document !== "undefined") {
143
144
  useLayoutEffect(() => {
@@ -147,7 +148,7 @@ const useChangeThemeEffect = /* @__PURE__ */ __name((name, componentName, props,
147
148
  themeManager.update(next);
148
149
  }
149
150
  return parentManager.onChangeTheme(() => {
150
- const next2 = parentManager.getNextTheme({ name, componentName, themes }, debug);
151
+ const next2 = parentManager.getNextTheme(getThemeProps, debug);
151
152
  if (!next2)
152
153
  return;
153
154
  if (themeManager.update(next2)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useTheme.tsx"],
4
- "sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeObject } from '../types'\nimport { useConstant } from './useConstant'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: any,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n return useMemo(() => {\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme', { themeName, theme, componentName, className })\n }\n return themes[getConfig().defaultTheme || 'light' || Object.keys(themes)[0]]\n }\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (!name || key === '__proto__' || typeof key === 'symbol') {\n // TODO make this pattern better\n if (key === GetThemeManager) {\n if (process.env.NODE_ENV === 'development') {\n if (props['debug']) {\n // prettier-ignore\n console.log('did change', { themeName, didChangeTheme, name, componentName }, themeManager?.parentName)\n }\n }\n if (!didChangeTheme) {\n return null\n }\n return themeManager\n }\n return Reflect.get(_, key)\n }\n if (typeof key !== 'string' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n if (process.env.NODE_ENV === 'development') {\n if (key === '__state') {\n return state.current\n }\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n const val = themeManager.getValue(key)\n if (val) {\n if (state.current.isRendering) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB tracking theme key', key)\n }\n }\n }\n return val\n }\n // react native debuger uses toJSON\n if (process.env.NODE_ENV === 'development') {\n console.log(`No theme value \"${String(key)}\" in ${name}`)\n }\n return Reflect.get(_, key)\n },\n })\n }, [name, theme, className, didChangeTheme])\n}\n\nconst GetThemeManager = Symbol('GetThemeManager')\n\nexport const getThemeManagerIfChanged = (theme: any) => {\n return theme?.[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: any,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const next = parentManager.getNextTheme({ name, componentName, themes }, props)\n const forceUpdate = forceUpdateProp || useForceUpdate()\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) {\n return null\n }\n return new ThemeManager(next.name, next.theme, parentManager)\n })\n\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (next?.name) {\n themeManager.update(next)\n }\n return parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme({ name, componentName, themes }, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n }, [themes, name, componentName, debug, next?.name])\n }\n\n const didChangeTheme = next && parentManager && next.name !== parentManager.fullName\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n didChangeTheme,\n themes,\n themeManager,\n }\n}\n"],
5
- "mappings": ";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA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O,cAAc,aAAa,EAAE,MAAM,eAAe,OAAO,GAAG,KAAK;AAC9E,YAAI,CAAC;AAAM;AACX,YAAI,aAAa,OAAO,KAAI,GAAG;AAC7B,sBAAY;AAAA,QACd;AAAA,MACF,CAAC;AAAA,IACH,GAAG,CAAC,QAAQ,MAAM,eAAe,OAAO,6BAAM,IAAI,CAAC;AAAA,EACrD;AAEA,QAAM,iBAAiB,QAAQ,iBAAiB,KAAK,SAAS,cAAc;AAE5E,SAAO;AAAA,OACD,iBAAiB;AAAA,MACnB,MAAM,cAAc;AAAA,MACpB,OAAO,cAAc;AAAA,IACvB;AAAA,OACG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA9CoC;",
4
+ "sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { GetNextThemeProps, ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { useConstant } from './useConstant'\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n console.log(' \u00BB useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n return useMemo(() => {\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme', { themeName, theme, componentName, className })\n }\n return themes[getConfig().defaultTheme || 'light' || Object.keys(themes)[0]]\n }\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (!name || key === '__proto__' || typeof key === 'symbol') {\n // TODO make this pattern better\n if (key === GetThemeManager) {\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug) {\n // prettier-ignore\n console.log('did change', { themeName, didChangeTheme, name, componentName }, themeManager?.parentName)\n }\n }\n if (!didChangeTheme) {\n return null\n }\n return themeManager\n }\n return Reflect.get(_, key)\n }\n if (typeof key !== 'string' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n if (process.env.NODE_ENV === 'development') {\n if (key === '__state') {\n return state.current\n }\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n const val = themeManager.getValue(key)\n if (val) {\n if (state.current.isRendering) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB tracking theme key', key)\n }\n }\n }\n return val\n }\n // react native debuger uses toJSON\n if (process.env.NODE_ENV === 'development') {\n console.log(`No theme value \"${String(key)}\" in ${name}`)\n }\n return Reflect.get(_, key)\n },\n })\n }, [name, theme, className, didChangeTheme])\n}\n\nconst GetThemeManager = Symbol('GetThemeManager')\n\nexport const getThemeManagerIfChanged = (theme: any) => {\n return theme?.[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = { name, componentName, themes, reset }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n const forceUpdate = forceUpdateProp || useForceUpdate()\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) return null\n return new ThemeManager(next.name, next.theme, parentManager, reset)\n })\n\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (next?.name) {\n themeManager.update(next)\n }\n return parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n }, [themes, name, componentName, debug, next?.name])\n }\n\n const didChangeTheme = next && parentManager && next.name !== parentManager.fullName\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n didChangeTheme,\n themes,\n themeManager,\n }\n}\n"],
5
+ "mappings": ";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAkBO,MAAM,WAAW,wBACtB,WACA,eACA,OACA,gBACgB;AAChB,QAAM,EAAE,MAAM,OAAO,QAAQ,cAAc,WAAW,mBAAmB,qBACvE,WACA,eACA,OACA,WACF;AAEA,MAAI,QAAQ,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AY;AAAA,QACd;AAAA,MACF,CAAC;AAAA,IACH,GAAG,CAAC,QAAQ,MAAM,eAAe,OAAO,6BAAM,IAAI,CAAC;AAAA,EACrD;AAEA,QAAM,iBAAiB,QAAQ,iBAAiB,KAAK,SAAS,cAAc;AAE5E,SAAO;AAAA,OACD,iBAAiB;AAAA,MACnB,MAAM,cAAc;AAAA,MACpB,OAAO,cAAc;AAAA,IACvB;AAAA,OACG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA9CoC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <span\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAWC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAnB5D;AAoBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GAxC0B,QAwCzB;",
4
+ "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <span\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAEC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GAxC0B,QAwCzB;",
6
6
  "names": []
7
7
  }
@@ -20,7 +20,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
20
20
  return () => {
21
21
  document.body.classList.remove(cn);
22
22
  };
23
- }, [props.disableRootThemeClass]);
23
+ }, [props.defaultTheme, props.disableRootThemeClass]);
24
24
  }
25
25
  const themeContext = useMemo(() => {
26
26
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeProvider.tsx"],
4
- "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AAGA,MAAM;AAUC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,iBAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,MAAM,qBAAqB,CAAC;AAAA,EAClC;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,oCAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,oCAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GArC6B;",
4
+ "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AAGA,MAAM;AAWC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,iBAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,qBAAqB,CAAC;AAAA,EACtD;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,oCAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,oCAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GArC6B;",
6
6
  "names": []
7
7
  }
@@ -29,6 +29,7 @@ const ThemeReset = /* @__PURE__ */ __name((props) => {
29
29
  }
30
30
  return /* @__PURE__ */ React.createElement(Theme, {
31
31
  className: "tui-theme-reset",
32
+ reset: true,
32
33
  name
33
34
  }, props.children);
34
35
  }, "ThemeReset");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeReset.tsx"],
4
- "sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAGA,MAAM;AAGC,MAAM,aAAa,wBAAC,UAA8B;AACvD,QAAM,eAAe,WAAW,mBAAmB;AACnD,QAAM,CAAC,MAAM,WAAW,SAAwB,IAAI;AAKpD,MAAI,CAAC,SAAS,OAAO,aAAa,aAAa;AAC7C,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,oCAAC;AAAA,IAAM,WAAU;AAAA,IAAkB;AAAA,KAChC,MAAM,QACT;AAEJ,GAhC0B;",
4
+ "sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAGA,MAAM;AAGC,MAAM,aAAa,wBAAC,UAA8B;AACvD,QAAM,eAAe,WAAW,mBAAmB;AACnD,QAAM,CAAC,MAAM,WAAW,SAAwB,IAAI;AAKpD,MAAI,CAAC,SAAS,OAAO,aAAa,aAAa;AAC7C,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,oCAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,KACtC,MAAM,QACT;AAEJ,GAhC0B;",
6
6
  "names": []
7
7
  }
@@ -18,10 +18,11 @@ import { createContext } from "react";
18
18
  import { getThemes } from "./conf";
19
19
  import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "./constants/constants";
20
20
  class ThemeManager {
21
- constructor(name = "", theme = null, parentManager = null) {
21
+ constructor(name = "", theme = null, parentManager = null, reset = false) {
22
22
  this.name = name;
23
23
  this.theme = theme;
24
24
  this.parentManager = parentManager;
25
+ this.reset = reset;
25
26
  __privateAdd(this, _getClassName);
26
27
  this.keys = /* @__PURE__ */ new Map();
27
28
  this.listeners = /* @__PURE__ */ new Map();
@@ -71,8 +72,8 @@ class ThemeManager {
71
72
  }
72
73
  }
73
74
  update({ name, theme, className } = {}) {
74
- const sameNameOrClassName = this.className ? className == this.className : name === this.name;
75
- if (sameNameOrClassName) {
75
+ const nameChanged = name !== this.name;
76
+ if (!nameChanged) {
76
77
  return false;
77
78
  }
78
79
  this.className = className || null;
@@ -81,8 +82,17 @@ class ThemeManager {
81
82
  this.notifyListeners();
82
83
  return true;
83
84
  }
84
- getNextTheme(opts = {}, props) {
85
- const { themes = getThemes(), name, componentName } = opts;
85
+ getNextTheme(props = {}, debug) {
86
+ var _a;
87
+ const { themes = getThemes(), name, componentName } = props;
88
+ if (props.reset && name) {
89
+ return {
90
+ name,
91
+ theme: themes[name],
92
+ className: __privateMethod(this, _getClassName, getClassName_fn).call(this, name)
93
+ };
94
+ }
95
+ const parentIsReset = (_a = this.parentManager) == null ? void 0 : _a.reset;
86
96
  if (!name) {
87
97
  if (componentName) {
88
98
  const names = [
@@ -102,7 +112,7 @@ class ThemeManager {
102
112
  };
103
113
  }
104
114
  let nextName = name || this.name || "";
105
- let parentName = this.fullName;
115
+ let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
106
116
  while (true) {
107
117
  if (nextName in themes) {
108
118
  break;
@@ -132,8 +142,8 @@ class ThemeManager {
132
142
  if (!theme) {
133
143
  theme = themes[`light_${nextName}`];
134
144
  }
135
- if (process.env.NODE_ENV === "development" && props && props["debug"]) {
136
- console.log("getNextTheme", { name: opts.name, nextName, parentName });
145
+ if (process.env.NODE_ENV === "development" && debug) {
146
+ console.log("getNextTheme", { props, nextName, parentName }, this);
137
147
  }
138
148
  return {
139
149
  name: nextName,
@@ -8,8 +8,8 @@ const isSSR = isWeb && typeof window === "undefined";
8
8
  const isClient = isWeb && typeof window !== "undefined";
9
9
  const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
10
10
  const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
11
- const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
12
- const isTouchDevice = !isWeb || supportsTouchWeb;
11
+ const isWebTouchable = typeof window !== "undefined" && "ontouchstart" in window;
12
+ const isTouchable = !isWeb || isWebTouchable;
13
13
  const isWebIOS = isWeb && typeof navigator !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window["MSStream"];
14
14
  export {
15
15
  isAndroid,
@@ -17,9 +17,9 @@ export {
17
17
  isClient,
18
18
  isIOS,
19
19
  isSSR,
20
- isTouchDevice,
20
+ isTouchable,
21
21
  isWeb,
22
22
  isWebIOS,
23
- supportsTouchWeb,
23
+ isWebTouchable,
24
24
  useIsomorphicLayoutEffect
25
25
  };
@@ -109,7 +109,11 @@ function createComponent(configIn, ParentComponent) {
109
109
  const [state, set_] = useState(defaultComponentState);
110
110
  const setStateShallow = createShallowUpdate(set_);
111
111
  const shouldAvoidClasses = !!(props.animation && avoidClasses);
112
- const splitStyles = useSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames);
112
+ const splitStyles = useSplitStyles(props, staticConfig, theme, !shouldAvoidClasses ? state : {
113
+ ...state,
114
+ noClassNames: true,
115
+ resolveVariablesAs: "value"
116
+ }, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames);
113
117
  const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
114
118
  const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
115
119
  const isAnimated = !!(useAnimations && props.animation);
@@ -246,13 +250,13 @@ function createComponent(configIn, ParentComponent) {
246
250
  if (isStringElement && shouldAvoidClasses) {
247
251
  styles = {
248
252
  ...defaultNativeStyle,
249
- ...animationStyles,
253
+ ...animationStyles != null ? animationStyles : style,
250
254
  ...medias
251
255
  };
252
256
  } else {
253
257
  styles = [
254
258
  isWeb ? null : defaultNativeStyleSheet ? defaultNativeStyleSheet.base : null,
255
- animationStyles ? animationStyles : style,
259
+ animationStyles != null ? animationStyles : style,
256
260
  medias
257
261
  ];
258
262
  if (!animationStyles) {
@@ -263,26 +267,26 @@ function createComponent(configIn, ParentComponent) {
263
267
  }
264
268
  }
265
269
  if (isWeb) {
270
+ const fontFamilyName = isText ? props.fontFamily || staticConfig.defaultProps.fontFamily : null;
271
+ const fontFamily = fontFamilyName && fontFamilyName[0] === "$" ? fontFamilyName.slice(1) : null;
272
+ const classList = [
273
+ componentName ? componentClassName : "",
274
+ fontFamily ? `font_${fontFamily}` : "",
275
+ theme.className,
276
+ classNames ? Object.values(classNames).join(" ") : ""
277
+ ];
266
278
  if (!shouldAvoidClasses) {
267
- const fontFamilyName = isText ? props.fontFamily || staticConfig.defaultProps.fontFamily : null;
268
- const fontFamily = fontFamilyName && fontFamilyName[0] === "$" ? fontFamilyName.slice(1) : null;
269
- const classList = [
270
- componentName ? componentClassName : "",
271
- fontFamily ? `font_${fontFamily}` : "",
272
- theme.className,
273
- classNames ? Object.values(classNames).join(" ") : ""
274
- ];
275
- const className = classList.join(" ");
276
- if (process.env.NODE_ENV === "development") {
277
- if (props["debug"]) {
278
- console.log(" \xBB className", { isStringElement, pseudos, state, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
279
- }
279
+ if (classNames) {
280
+ classList.push(Object.values(classNames).join(" "));
280
281
  }
281
- viewProps.className = className;
282
- viewProps.style = animationStyles;
283
- } else {
284
- viewProps.style = styles;
285
282
  }
283
+ const className = classList.join(" ");
284
+ const style2 = animationStyles != null ? animationStyles : splitStyles.style;
285
+ if (process.env.NODE_ENV === "development" && props["debug"]) {
286
+ console.log(" \xBB className", { splitStyles, style: style2, isStringElement, pseudos, state, classNames, propsClassName: props.className, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
287
+ }
288
+ viewProps.className = className;
289
+ viewProps.style = style2;
286
290
  } else {
287
291
  viewProps.style = styles;
288
292
  }
@@ -143,6 +143,11 @@ function createTamagui(config) {
143
143
  return `${themeConfig.css}
144
144
  ${getInsertedRules().join("\n")}`;
145
145
  }, "getCSS");
146
+ if (config.shorthands) {
147
+ for (const key in config.shorthands) {
148
+ reversedShorthands[config.shorthands[key]] = key;
149
+ }
150
+ }
146
151
  const next = {
147
152
  fonts: {},
148
153
  animations: {},
@@ -169,6 +174,7 @@ ${getInsertedRules().join("\n")}`;
169
174
  return next;
170
175
  }
171
176
  __name(createTamagui, "createTamagui");
177
+ const reversedShorthands = {};
172
178
  const parseTokens = /* @__PURE__ */ __name((tokens) => {
173
179
  const res = {};
174
180
  for (const key in tokens) {
@@ -197,5 +203,6 @@ function ensureThemeVariable(theme, key) {
197
203
  }
198
204
  __name(ensureThemeVariable, "ensureThemeVariable");
199
205
  export {
200
- createTamagui
206
+ createTamagui,
207
+ reversedShorthands
201
208
  };
@@ -19,6 +19,7 @@ const createMediaStyle = /* @__PURE__ */ __name(({ identifier, rules }, mediaKey
19
19
  } else {
20
20
  styleRule = `@media ${mediaQuery} { ${precendencePrefix} ${styleInner} }`;
21
21
  }
22
+ styleRule = styleRule.replace(";}", " !important;}");
22
23
  return {
23
24
  styleRule,
24
25
  identifier: nextIdentifier