@tamagui/web 3.0.0-beta.807.1 → 3.0.0-beta.831.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.
Files changed (266) hide show
  1. package/dist/cjs/config.cjs +1 -1
  2. package/dist/cjs/config.native.cjs +1 -1
  3. package/dist/cjs/config.native.js +1 -1
  4. package/dist/cjs/config.native.js.map +1 -1
  5. package/dist/cjs/createComponent.cjs +28 -18
  6. package/dist/cjs/createComponent.native.cjs +30 -20
  7. package/dist/cjs/createComponent.native.js +30 -20
  8. package/dist/cjs/createComponent.native.js.map +1 -1
  9. package/dist/cjs/createStyledHOC.cjs +54 -4
  10. package/dist/cjs/createStyledHOC.native.cjs +55 -4
  11. package/dist/cjs/createStyledHOC.native.js +55 -4
  12. package/dist/cjs/createStyledHOC.native.js.map +1 -1
  13. package/dist/cjs/createTokens.cjs +1 -1
  14. package/dist/cjs/createTokens.native.cjs +1 -1
  15. package/dist/cjs/createTokens.native.js +1 -1
  16. package/dist/cjs/createTokens.native.js.map +1 -1
  17. package/dist/cjs/dom/html.cjs +147 -99
  18. package/dist/cjs/dom/htmlRuntime.native.cjs +6 -2
  19. package/dist/cjs/dom/htmlRuntime.native.js +6 -2
  20. package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
  21. package/dist/cjs/dom/primitives.native.cjs +16 -13
  22. package/dist/cjs/dom/primitives.native.js +16 -13
  23. package/dist/cjs/dom/primitives.native.js.map +1 -1
  24. package/dist/cjs/helpers/componentDisplayName.cjs +1 -11
  25. package/dist/cjs/helpers/componentDisplayName.native.cjs +1 -11
  26. package/dist/cjs/helpers/componentDisplayName.native.js +1 -11
  27. package/dist/cjs/helpers/componentDisplayName.native.js.map +1 -1
  28. package/dist/cjs/helpers/directStyleCSS.cjs +101 -104
  29. package/dist/cjs/helpers/formatDiagnostic.cjs +2 -4
  30. package/dist/cjs/helpers/formatDiagnostic.native.cjs +2 -4
  31. package/dist/cjs/helpers/formatDiagnostic.native.js +2 -4
  32. package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
  33. package/dist/cjs/helpers/getCSSStylesAtomic.cjs +10 -10
  34. package/dist/cjs/helpers/getSplitStyles.cjs +168 -600
  35. package/dist/cjs/helpers/getSplitStyles.native.cjs +168 -762
  36. package/dist/cjs/helpers/getSplitStyles.native.js +168 -762
  37. package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
  38. package/dist/cjs/helpers/splitStyleProps.cjs +46 -0
  39. package/dist/cjs/helpers/splitStyleProps.native.cjs +49 -0
  40. package/dist/cjs/helpers/splitStyleProps.native.js +51 -0
  41. package/dist/cjs/helpers/splitStyleProps.native.js.map +1 -0
  42. package/dist/cjs/helpers/styleStaticConfig.cjs +76 -0
  43. package/dist/cjs/helpers/styleStaticConfig.native.cjs +79 -0
  44. package/dist/cjs/helpers/styleStaticConfig.native.js +81 -0
  45. package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -0
  46. package/dist/cjs/helpers/tokenCategories.cjs +32 -71
  47. package/dist/cjs/helpers/tokenCategories.native.cjs +34 -73
  48. package/dist/cjs/helpers/tokenCategories.native.js +34 -73
  49. package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
  50. package/dist/cjs/helpers/variantResolvers.cjs +87 -0
  51. package/dist/cjs/helpers/variantResolvers.native.cjs +140 -0
  52. package/dist/cjs/helpers/variantResolvers.native.js +142 -0
  53. package/dist/cjs/helpers/variantResolvers.native.js.map +1 -0
  54. package/dist/cjs/hooks/useSplitStyles.cjs +2 -2
  55. package/dist/cjs/hooks/useSplitStyles.native.cjs +2 -2
  56. package/dist/cjs/hooks/useSplitStyles.native.js +2 -2
  57. package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -1
  58. package/dist/cjs/index.cjs +3 -9
  59. package/dist/cjs/index.native.cjs +3 -9
  60. package/dist/cjs/index.native.js +3 -9
  61. package/dist/cjs/index.native.js.map +1 -1
  62. package/dist/cjs/internal-runtime.cjs +8 -7
  63. package/dist/cjs/internal-runtime.native.cjs +8 -7
  64. package/dist/cjs/internal-runtime.native.js +8 -7
  65. package/dist/cjs/internal-runtime.native.js.map +1 -1
  66. package/dist/cjs/static-resolve.cjs +6 -5
  67. package/dist/cjs/static-resolve.native.cjs +6 -5
  68. package/dist/cjs/static-resolve.native.js +6 -5
  69. package/dist/cjs/static-resolve.native.js.map +1 -1
  70. package/dist/cjs/styled.cjs +4 -56
  71. package/dist/cjs/styled.native.cjs +4 -58
  72. package/dist/cjs/styled.native.js +4 -58
  73. package/dist/cjs/styled.native.js.map +1 -1
  74. package/dist/cjs/types.cjs +1 -21
  75. package/dist/cjs/types.native.cjs +1 -21
  76. package/dist/cjs/types.native.js +1 -21
  77. package/dist/cjs/types.native.js.map +1 -1
  78. package/dist/cjs/views/Text.cjs +4 -2
  79. package/dist/cjs/views/Text.native.cjs +4 -2
  80. package/dist/cjs/views/Text.native.js +4 -2
  81. package/dist/cjs/views/Text.native.js.map +1 -1
  82. package/dist/cjs/views/View.cjs +4 -2
  83. package/dist/cjs/views/View.native.cjs +4 -2
  84. package/dist/cjs/views/View.native.js +4 -2
  85. package/dist/cjs/views/View.native.js.map +1 -1
  86. package/dist/esm/config.mjs +1 -1
  87. package/dist/esm/config.mjs.map +1 -1
  88. package/dist/esm/config.native.js +1 -1
  89. package/dist/esm/config.native.js.map +1 -1
  90. package/dist/esm/createComponent.mjs +29 -19
  91. package/dist/esm/createComponent.mjs.map +1 -1
  92. package/dist/esm/createComponent.native.js +31 -21
  93. package/dist/esm/createComponent.native.js.map +1 -1
  94. package/dist/esm/createStyledHOC.mjs +55 -5
  95. package/dist/esm/createStyledHOC.mjs.map +1 -1
  96. package/dist/esm/createStyledHOC.native.js +56 -5
  97. package/dist/esm/createStyledHOC.native.js.map +1 -1
  98. package/dist/esm/createTokens.mjs +1 -1
  99. package/dist/esm/createTokens.mjs.map +1 -1
  100. package/dist/esm/createTokens.native.js +1 -1
  101. package/dist/esm/createTokens.native.js.map +1 -1
  102. package/dist/esm/dom/html.mjs +147 -99
  103. package/dist/esm/dom/html.mjs.map +1 -1
  104. package/dist/esm/dom/htmlRuntime.native.js +7 -3
  105. package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
  106. package/dist/esm/dom/primitives.native.js +16 -13
  107. package/dist/esm/dom/primitives.native.js.map +1 -1
  108. package/dist/esm/helpers/componentDisplayName.mjs +1 -8
  109. package/dist/esm/helpers/componentDisplayName.mjs.map +1 -1
  110. package/dist/esm/helpers/componentDisplayName.native.js +1 -8
  111. package/dist/esm/helpers/componentDisplayName.native.js.map +1 -1
  112. package/dist/esm/helpers/directStyleCSS.mjs +101 -104
  113. package/dist/esm/helpers/directStyleCSS.mjs.map +1 -1
  114. package/dist/esm/helpers/formatDiagnostic.mjs +2 -4
  115. package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
  116. package/dist/esm/helpers/formatDiagnostic.native.js +2 -4
  117. package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
  118. package/dist/esm/helpers/getCSSStylesAtomic.mjs +10 -10
  119. package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
  120. package/dist/esm/helpers/getSplitStyles.mjs +166 -594
  121. package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
  122. package/dist/esm/helpers/getSplitStyles.native.js +166 -757
  123. package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
  124. package/dist/esm/helpers/splitStyleProps.mjs +27 -0
  125. package/dist/esm/helpers/splitStyleProps.mjs.map +1 -0
  126. package/dist/esm/helpers/splitStyleProps.native.js +28 -0
  127. package/dist/esm/helpers/splitStyleProps.native.js.map +1 -0
  128. package/dist/esm/helpers/styleStaticConfig.mjs +57 -0
  129. package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -0
  130. package/dist/esm/helpers/styleStaticConfig.native.js +58 -0
  131. package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -0
  132. package/dist/esm/helpers/tokenCategories.mjs +33 -72
  133. package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
  134. package/dist/esm/helpers/tokenCategories.native.js +35 -74
  135. package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
  136. package/dist/esm/helpers/variantResolvers.mjs +65 -0
  137. package/dist/esm/helpers/variantResolvers.mjs.map +1 -0
  138. package/dist/esm/helpers/variantResolvers.native.js +116 -0
  139. package/dist/esm/helpers/variantResolvers.native.js.map +1 -0
  140. package/dist/esm/hooks/useSplitStyles.mjs +2 -2
  141. package/dist/esm/hooks/useSplitStyles.mjs.map +1 -1
  142. package/dist/esm/hooks/useSplitStyles.native.js +2 -2
  143. package/dist/esm/hooks/useSplitStyles.native.js.map +1 -1
  144. package/dist/esm/index.js +3 -5
  145. package/dist/esm/index.mjs +3 -5
  146. package/dist/esm/index.native.js +3 -5
  147. package/dist/esm/internal-runtime.mjs +8 -7
  148. package/dist/esm/internal-runtime.mjs.map +1 -1
  149. package/dist/esm/internal-runtime.native.js +8 -7
  150. package/dist/esm/internal-runtime.native.js.map +1 -1
  151. package/dist/esm/static-resolve.mjs +8 -6
  152. package/dist/esm/static-resolve.mjs.map +1 -1
  153. package/dist/esm/static-resolve.native.js +8 -6
  154. package/dist/esm/static-resolve.native.js.map +1 -1
  155. package/dist/esm/styled.mjs +6 -57
  156. package/dist/esm/styled.mjs.map +1 -1
  157. package/dist/esm/styled.native.js +6 -59
  158. package/dist/esm/styled.native.js.map +1 -1
  159. package/dist/esm/types.mjs +1 -18
  160. package/dist/esm/types.mjs.map +1 -1
  161. package/dist/esm/types.native.js +1 -18
  162. package/dist/esm/types.native.js.map +1 -1
  163. package/dist/esm/views/Text.mjs +4 -2
  164. package/dist/esm/views/Text.mjs.map +1 -1
  165. package/dist/esm/views/Text.native.js +4 -2
  166. package/dist/esm/views/Text.native.js.map +1 -1
  167. package/dist/esm/views/View.mjs +4 -2
  168. package/dist/esm/views/View.mjs.map +1 -1
  169. package/dist/esm/views/View.native.js +4 -2
  170. package/dist/esm/views/View.native.js.map +1 -1
  171. package/package.json +15 -15
  172. package/src/config.ts +1 -1
  173. package/src/createComponent.tsx +41 -30
  174. package/src/createStyledHOC.tsx +56 -9
  175. package/src/createTokens.ts +1 -1
  176. package/src/dom/html.tsx +778 -877
  177. package/src/dom/htmlRuntime.native.tsx +7 -3
  178. package/src/dom/primitives.native.tsx +30 -39
  179. package/src/helpers/componentDisplayName.ts +0 -11
  180. package/src/helpers/directStyleCSS.ts +91 -112
  181. package/src/helpers/formatDiagnostic.ts +2 -4
  182. package/src/helpers/getCSSStylesAtomic.ts +32 -26
  183. package/src/helpers/getSplitStyles.tsx +315 -1119
  184. package/src/helpers/getVariantExtras.tsx +3 -3
  185. package/src/helpers/splitStyleProps.ts +166 -0
  186. package/src/helpers/styleFrontend.ts +8 -4
  187. package/src/helpers/styleStaticConfig.ts +88 -0
  188. package/src/helpers/tokenCategories.ts +62 -93
  189. package/src/helpers/variantResolvers.ts +121 -0
  190. package/src/hooks/useSplitStyles.tsx +17 -2
  191. package/src/hooks/useTheme.tsx +1 -1
  192. package/src/index.ts +8 -4
  193. package/src/internal-runtime.ts +10 -9
  194. package/src/static-resolve.ts +18 -14
  195. package/src/styled.tsx +7 -264
  196. package/src/types.tsx +19 -40
  197. package/src/views/Text.tsx +6 -7
  198. package/src/views/View.tsx +6 -7
  199. package/types/createComponent.d.ts.map +1 -1
  200. package/types/createStyledHOC.d.ts.map +1 -1
  201. package/types/dom/html.d.ts.map +1 -1
  202. package/types/dom/htmlRuntime.native.d.ts.map +1 -1
  203. package/types/dom/primitives.native.d.ts.map +1 -1
  204. package/types/helpers/componentDisplayName.d.ts +0 -3
  205. package/types/helpers/componentDisplayName.d.ts.map +1 -1
  206. package/types/helpers/directStyleCSS.d.ts.map +1 -1
  207. package/types/helpers/formatDiagnostic.d.ts.map +1 -1
  208. package/types/helpers/getCSSStylesAtomic.d.ts +17 -15
  209. package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
  210. package/types/helpers/getSplitStyles.d.ts +6 -6
  211. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  212. package/types/helpers/splitStyleProps.d.ts +44 -0
  213. package/types/helpers/splitStyleProps.d.ts.map +1 -0
  214. package/types/helpers/styleFrontend.d.ts +4 -4
  215. package/types/helpers/styleFrontend.d.ts.map +1 -1
  216. package/types/helpers/styleStaticConfig.d.ts +19 -0
  217. package/types/helpers/styleStaticConfig.d.ts.map +1 -0
  218. package/types/helpers/tokenCategories.d.ts +1 -1
  219. package/types/helpers/tokenCategories.d.ts.map +1 -1
  220. package/types/helpers/variantResolvers.d.ts +9 -0
  221. package/types/helpers/variantResolvers.d.ts.map +1 -0
  222. package/types/hooks/useSplitStyles.d.ts.map +1 -1
  223. package/types/index.d.ts +2 -4
  224. package/types/index.d.ts.map +1 -1
  225. package/types/internal-runtime.d.ts.map +1 -1
  226. package/types/static-resolve.d.ts +2 -2
  227. package/types/static-resolve.d.ts.map +1 -1
  228. package/types/styled.d.ts +3 -39
  229. package/types/styled.d.ts.map +1 -1
  230. package/types/types.d.ts +2 -12
  231. package/types/types.d.ts.map +1 -1
  232. package/types/views/Text.d.ts.map +1 -1
  233. package/types/views/View.d.ts.map +1 -1
  234. package/dist/cjs/helpers/getDefaultProps.cjs +0 -24
  235. package/dist/cjs/helpers/getDefaultProps.native.cjs +0 -28
  236. package/dist/cjs/helpers/getDefaultProps.native.js +0 -30
  237. package/dist/cjs/helpers/getDefaultProps.native.js.map +0 -1
  238. package/dist/cjs/helpers/themeable.cjs +0 -92
  239. package/dist/cjs/helpers/themeable.native.cjs +0 -95
  240. package/dist/cjs/helpers/themeable.native.js +0 -97
  241. package/dist/cjs/helpers/themeable.native.js.map +0 -1
  242. package/dist/cjs/hooks/useProps.cjs +0 -129
  243. package/dist/cjs/hooks/useProps.native.cjs +0 -135
  244. package/dist/cjs/hooks/useProps.native.js +0 -137
  245. package/dist/cjs/hooks/useProps.native.js.map +0 -1
  246. package/dist/esm/helpers/getDefaultProps.mjs +0 -4
  247. package/dist/esm/helpers/getDefaultProps.mjs.map +0 -1
  248. package/dist/esm/helpers/getDefaultProps.native.js +0 -6
  249. package/dist/esm/helpers/getDefaultProps.native.js.map +0 -1
  250. package/dist/esm/helpers/themeable.mjs +0 -67
  251. package/dist/esm/helpers/themeable.mjs.map +0 -1
  252. package/dist/esm/helpers/themeable.native.js +0 -68
  253. package/dist/esm/helpers/themeable.native.js.map +0 -1
  254. package/dist/esm/hooks/useProps.mjs +0 -100
  255. package/dist/esm/hooks/useProps.mjs.map +0 -1
  256. package/dist/esm/hooks/useProps.native.js +0 -104
  257. package/dist/esm/hooks/useProps.native.js.map +0 -1
  258. package/src/helpers/getDefaultProps.ts +0 -3
  259. package/src/helpers/themeable.tsx +0 -96
  260. package/src/hooks/useProps.tsx +0 -186
  261. package/types/helpers/getDefaultProps.d.ts +0 -3
  262. package/types/helpers/getDefaultProps.d.ts.map +0 -1
  263. package/types/helpers/themeable.d.ts +0 -3
  264. package/types/helpers/themeable.d.ts.map +0 -1
  265. package/types/hooks/useProps.d.ts +0 -39
  266. package/types/hooks/useProps.d.ts.map +0 -1
@@ -1,68 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { Theme } from "../views/Theme.native.js";
4
- import { getDefaultProps } from "./getDefaultProps.native.js";
5
-
6
- function themeable(Component, staticConfig) {
7
- var optimize = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
8
- var withThemeComponent = function WithTheme(props) {
9
- "use no memo";
10
- var userDefaults = getDefaultProps(staticConfig);
11
- var defaultTheme = userDefaults === null || userDefaults === void 0 ? void 0 : userDefaults.theme;
12
- var defaultResetTheme = userDefaults === null || userDefaults === void 0 ? void 0 : userDefaults.themeReset;
13
- var { theme, themeReset, ref, ...rest } = props;
14
- var overriddenContextProps;
15
- var context = staticConfig === null || staticConfig === void 0 ? void 0 : staticConfig.context;
16
- if (context) {
17
- for (var key in context.props) {
18
- var val = props[key];
19
- if (val !== void 0) {
20
- overriddenContextProps = overriddenContextProps || {};
21
- overriddenContextProps[key] = val;
22
- }
23
- }
24
- }
25
- var element = /* @__PURE__ */ jsx(Component, {
26
- ref,
27
- ...rest,
28
- "data-disable-theme": true
29
- });
30
- var filteredProps = null;
31
- if ("debug" in props) {
32
- filteredProps = filteredProps || {};
33
- filteredProps.debug = props.debug;
34
- }
35
- if ("theme" in props || defaultTheme) {
36
- filteredProps = filteredProps || {};
37
- filteredProps.name = "theme" in props ? props.theme : defaultTheme;
38
- }
39
- if ("themeReset" in props || defaultResetTheme) {
40
- filteredProps = filteredProps || {};
41
- filteredProps.reset = "themeReset" in props ? themeReset : defaultResetTheme;
42
- }
43
- if (optimize && !filteredProps) {
44
- return element;
45
- }
46
- var contents = /* @__PURE__ */ jsx(Theme, {
47
- "disable-child-theme": true,
48
- ...filteredProps,
49
- children: element
50
- });
51
- if (context) {
52
- var Provider = context.Provider;
53
- var contextValue = React.useContext(context);
54
- contents = /* @__PURE__ */ jsx(Provider, {
55
- ...contextValue,
56
- ...overriddenContextProps,
57
- children: contents
58
- });
59
- }
60
- return contents;
61
- };
62
- var withTheme = withThemeComponent;
63
- withTheme.displayName = `Themed(${(Component === null || Component === void 0 ? void 0 : Component.displayName) || (Component === null || Component === void 0 ? void 0 : Component.name) || "Anonymous"})`;
64
- return withTheme;
65
- }
66
-
67
- export { themeable };
68
- //# sourceMappingURL=themeable.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"themeable.native.js","names":[],"sources":["esm/helpers/themeable.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { Theme } from \"../views/Theme\";\nimport { getDefaultProps } from \"./getDefaultProps\";\nfunction themeable(Component, staticConfig) {\n var optimize = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n var withThemeComponent = function WithTheme(props) {\n \"use no memo\";\n var userDefaults = getDefaultProps(staticConfig);\n var defaultTheme = userDefaults === null || userDefaults === void 0 ? void 0 : userDefaults.theme;\n var defaultResetTheme = userDefaults === null || userDefaults === void 0 ? void 0 : userDefaults.themeReset;\n var { theme, themeReset, ref, ...rest } = props;\n var overriddenContextProps;\n var context = staticConfig === null || staticConfig === void 0 ? void 0 : staticConfig.context;\n if (context) {\n for (var key in context.props) {\n var val = props[key];\n if (val !== void 0) {\n overriddenContextProps = overriddenContextProps || {};\n overriddenContextProps[key] = val;\n }\n }\n }\n var element = (\n // @ts-expect-error its ok\n /* @__PURE__ */ _jsx(Component, {\n ref,\n ...rest,\n \"data-disable-theme\": true\n })\n );\n var filteredProps = null;\n if (\"debug\" in props) {\n filteredProps = filteredProps || {};\n filteredProps.debug = props.debug;\n }\n if (\"theme\" in props || defaultTheme) {\n filteredProps = filteredProps || {};\n filteredProps.name = \"theme\" in props ? props.theme : defaultTheme;\n }\n if (\"themeReset\" in props || defaultResetTheme) {\n filteredProps = filteredProps || {};\n filteredProps.reset = \"themeReset\" in props ? themeReset : defaultResetTheme;\n }\n if (optimize && !filteredProps) {\n return element;\n }\n var contents = /* @__PURE__ */ _jsx(Theme, {\n \"disable-child-theme\": true,\n ...filteredProps,\n children: element\n });\n if (context) {\n var Provider = context.Provider;\n var contextValue = React.useContext(context);\n contents = /* @__PURE__ */ _jsx(Provider, {\n ...contextValue,\n ...overriddenContextProps,\n children: contents\n });\n }\n return contents;\n };\n var withTheme = withThemeComponent;\n withTheme.displayName = `Themed(${(Component === null || Component === void 0 ? void 0 : Component.displayName) || (Component === null || Component === void 0 ? void 0 : Component.name) || \"Anonymous\"})`;\n return withTheme;\n}\nexport {\n themeable\n};\n//# sourceMappingURL=themeable.js.map\n"],"mappings":";;;;;;AAIA,SAAS,UAAU,WAAW,cAAc;CAC1C,IAAI,WAAW,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAChF,IAAI,qBAAqB,SAAS,UAAU,OAAO;EACjD;EACA,IAAI,eAAe,gBAAgB,YAAY;EAC/C,IAAI,eAAe,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa;EAC5F,IAAI,oBAAoB,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa;EACjG,IAAI,EAAE,OAAO,YAAY,KAAK,GAAG,SAAS;EAC1C,IAAI;EACJ,IAAI,UAAU,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa;EACvF,IAAI,SAAS;GACX,KAAK,IAAI,OAAO,QAAQ,OAAO;IAC7B,IAAI,MAAM,MAAM;IAChB,IAAI,QAAQ,KAAK,GAAG;KAClB,yBAAyB,0BAA0B,CAAC;KACpD,uBAAuB,OAAO;IAChC;GACF;EACF;EACA,IAAI,UAEc,oBAAK,WAAW;GAC9B;GACA,GAAG;GACH,sBAAsB;EACxB,CAAC;EAEH,IAAI,gBAAgB;EACpB,IAAI,WAAW,OAAO;GACpB,gBAAgB,iBAAiB,CAAC;GAClC,cAAc,QAAQ,MAAM;EAC9B;EACA,IAAI,WAAW,SAAS,cAAc;GACpC,gBAAgB,iBAAiB,CAAC;GAClC,cAAc,OAAO,WAAW,QAAQ,MAAM,QAAQ;EACxD;EACA,IAAI,gBAAgB,SAAS,mBAAmB;GAC9C,gBAAgB,iBAAiB,CAAC;GAClC,cAAc,QAAQ,gBAAgB,QAAQ,aAAa;EAC7D;EACA,IAAI,YAAY,CAAC,eAAe;GAC9B,OAAO;EACT;EACA,IAAI,WAA2B,oBAAK,OAAO;GACzC,uBAAuB;GACvB,GAAG;GACH,UAAU;EACZ,CAAC;EACD,IAAI,SAAS;GACX,IAAI,WAAW,QAAQ;GACvB,IAAI,eAAe,MAAM,WAAW,OAAO;GAC3C,WAA2B,oBAAK,UAAU;IACxC,GAAG;IACH,GAAG;IACH,UAAU;GACZ,CAAC;EACH;EACA,OAAO;CACT;CACA,IAAI,YAAY;CAChB,UAAU,cAAc,WAAW,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU,iBAAiB,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU,SAAS,YAAY;CACzM,OAAO;AACT"}
@@ -1,100 +0,0 @@
1
- import { useIsomorphicLayoutEffect } from "@tamagui/constants";
2
- import React from "react";
3
- import { getConfig } from "../config.mjs";
4
- import { ComponentContext } from "../contexts/ComponentContext.mjs";
5
- import { GroupContext } from "../contexts/GroupContext.mjs";
6
- import { useSplitStyles } from "./useSplitStyles.mjs";
7
- import { subscribeToSafeArea } from "../helpers/resolveSafeAreaVariable.mjs";
8
- import { subscribeToContextGroup, useGroupSetRevision } from "../helpers/subscribeToContextGroup.mjs";
9
- import { View } from "../views/View.mjs";
10
- import { useComponentState } from "./useComponentState.mjs";
11
- import { mediaState } from "../helpers/mediaState.mjs";
12
- import { useMedia } from "./useMedia.mjs";
13
- import { useThemeWithState } from "./useTheme.mjs";
14
-
15
- function useProps(props, opts) {
16
- const [propsOut, styleOut] = usePropsAndStyle(props, {
17
- ...opts,
18
- noExpand: true,
19
- noNormalize: true,
20
- resolveValues: "none"
21
- });
22
- return {
23
- ...propsOut,
24
- ...styleOut
25
- };
26
- }
27
- function useStyle(props, opts) {
28
- return usePropsAndStyle(props, opts)[1] || {};
29
- }
30
- function usePropsAndStyle(props, opts) {
31
- const staticConfig = opts?.forComponent?.staticConfig ?? View.staticConfig;
32
- const [theme, themeState] = useThemeWithState({
33
- name: "theme" in props ? props.theme : void 0,
34
- needsUpdate() {
35
- return true;
36
- }
37
- });
38
- const componentContext = React.useContext(ComponentContext);
39
- const groupContext = React.useContext(GroupContext);
40
- const componentState = useComponentState(props, componentContext.animationDriver, staticConfig, getConfig());
41
- const { props: statefulProps, state, disabled, setState, setStateShallow } = componentState;
42
- const mediaStateNow = opts?.noMedia ? mediaState : useMedia();
43
- const splitStyles = useSplitStyles(statefulProps, staticConfig, theme, themeState?.name || "", state, {
44
- isAnimated: false,
45
- mediaState: mediaStateNow,
46
- noSkip: true,
47
- noMergeStyle: true,
48
- noClass: true,
49
- resolveValues: "auto",
50
- ...opts
51
- }, null, componentContext, groupContext);
52
- componentState.finalizeStyleFlags(!!splitStyles?.hasEnterStyle, !!splitStyles?.platformPseudo);
53
- const { mediaGroups, pseudoGroups } = splitStyles || {};
54
- const groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups);
55
- useIsomorphicLayoutEffect(() => {
56
- let disposeSafeArea;
57
- if (splitStyles?.usesSafeArea) {
58
- const updateSafeArea = () => {
59
- setState((previous) => ({ ...previous }));
60
- };
61
- disposeSafeArea = subscribeToSafeArea(updateSafeArea);
62
- updateSafeArea();
63
- }
64
- if (disabled) {
65
- return disposeSafeArea;
66
- }
67
- if (state.unmounted) {
68
- setStateShallow({ unmounted: false });
69
- return disposeSafeArea;
70
- }
71
- if (groupContext) {
72
- const disposeGroup = subscribeToContextGroup({
73
- groupContext,
74
- setStateShallow,
75
- mediaGroups,
76
- pseudoGroups
77
- });
78
- if (!disposeSafeArea) return disposeGroup;
79
- return () => {
80
- disposeSafeArea();
81
- disposeGroup?.();
82
- };
83
- }
84
- return disposeSafeArea;
85
- }, [
86
- disabled,
87
- groupContext,
88
- splitStyles?.usesSafeArea,
89
- groupSetRevision
90
- ]);
91
- return [
92
- splitStyles?.viewProps || {},
93
- splitStyles?.style || {},
94
- theme,
95
- mediaState
96
- ];
97
- }
98
-
99
- export { useProps, usePropsAndStyle, useStyle };
100
- //# sourceMappingURL=useProps.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProps.js","names":[],"sources":["esm/hooks/useProps.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport React from \"react\";\nimport { getConfig } from \"../config\";\nimport { ComponentContext } from \"../contexts/ComponentContext\";\nimport { GroupContext } from \"../contexts/GroupContext\";\nimport { useSplitStyles } from \"./useSplitStyles\";\nimport { subscribeToSafeArea } from \"../helpers/resolveSafeAreaVariable\";\nimport {\n subscribeToContextGroup,\n useGroupSetRevision\n} from \"../helpers/subscribeToContextGroup\";\nimport { View } from \"../views/View\";\nimport { useComponentState } from \"./useComponentState\";\nimport { mediaState } from \"../helpers/mediaState\";\nimport { useMedia } from \"./useMedia\";\nimport { useThemeWithState } from \"./useTheme\";\nfunction useProps(props, opts) {\n const [propsOut, styleOut] = usePropsAndStyle(props, {\n ...opts,\n noExpand: true,\n noNormalize: true,\n resolveValues: \"none\"\n });\n return {\n ...propsOut,\n ...styleOut\n };\n}\nfunction useStyle(props, opts) {\n return usePropsAndStyle(props, opts)[1] || {};\n}\nfunction usePropsAndStyle(props, opts) {\n const staticConfig = opts?.forComponent?.staticConfig ?? View.staticConfig;\n const [theme, themeState] = useThemeWithState({\n name: \"theme\" in props ? props.theme : void 0,\n needsUpdate() {\n return true;\n }\n });\n const componentContext = React.useContext(ComponentContext);\n const groupContext = React.useContext(GroupContext);\n const componentState = useComponentState(\n props,\n componentContext.animationDriver,\n staticConfig,\n getConfig()\n );\n const {\n props: statefulProps,\n state,\n disabled,\n setState,\n setStateShallow\n } = componentState;\n const mediaStateNow = opts?.noMedia ? (\n // not safe to use mediaState but really marginal to hit this\n mediaState\n ) : useMedia();\n const splitStyles = useSplitStyles(\n statefulProps,\n staticConfig,\n theme,\n themeState?.name || \"\",\n state,\n {\n isAnimated: false,\n mediaState: mediaStateNow,\n noSkip: true,\n noMergeStyle: true,\n noClass: true,\n resolveValues: \"auto\",\n ...opts\n },\n null,\n componentContext,\n groupContext\n );\n componentState.finalizeStyleFlags(\n !!splitStyles?.hasEnterStyle,\n !!splitStyles?.platformPseudo\n );\n const { mediaGroups, pseudoGroups } = splitStyles || {};\n const groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups);\n useIsomorphicLayoutEffect(() => {\n let disposeSafeArea;\n if (splitStyles?.usesSafeArea) {\n const updateSafeArea = () => {\n setState((previous) => ({ ...previous }));\n };\n disposeSafeArea = subscribeToSafeArea(updateSafeArea);\n updateSafeArea();\n }\n if (disabled) {\n return disposeSafeArea;\n }\n if (state.unmounted) {\n setStateShallow({ unmounted: false });\n return disposeSafeArea;\n }\n if (groupContext) {\n const disposeGroup = subscribeToContextGroup({\n groupContext,\n setStateShallow,\n mediaGroups,\n pseudoGroups\n });\n if (!disposeSafeArea) return disposeGroup;\n return () => {\n disposeSafeArea();\n disposeGroup?.();\n };\n }\n return disposeSafeArea;\n }, [disabled, groupContext, splitStyles?.usesSafeArea, groupSetRevision]);\n return [\n splitStyles?.viewProps || {},\n splitStyles?.style || {},\n theme,\n mediaState\n ];\n}\nexport {\n useProps,\n usePropsAndStyle,\n useStyle\n};\n//# sourceMappingURL=useProps.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAS,SAAS,OAAO,MAAM;CAC7B,MAAM,CAAC,UAAU,YAAY,iBAAiB,OAAO;EACnD,GAAG;EACH,UAAU;EACV,aAAa;EACb,eAAe;CACjB,CAAC;CACD,OAAO;EACL,GAAG;EACH,GAAG;CACL;AACF;AACA,SAAS,SAAS,OAAO,MAAM;CAC7B,OAAO,iBAAiB,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC;AAC9C;AACA,SAAS,iBAAiB,OAAO,MAAM;CACrC,MAAM,eAAe,MAAM,cAAc,gBAAgB,KAAK;CAC9D,MAAM,CAAC,OAAO,cAAc,kBAAkB;EAC5C,MAAM,WAAW,QAAQ,MAAM,QAAQ,KAAK;EAC5C,cAAc;GACZ,OAAO;EACT;CACF,CAAC;CACD,MAAM,mBAAmB,MAAM,WAAW,gBAAgB;CAC1D,MAAM,eAAe,MAAM,WAAW,YAAY;CAClD,MAAM,iBAAiB,kBACrB,OACA,iBAAiB,iBACjB,cACA,UAAU,CACZ;CACA,MAAM,EACJ,OAAO,eACP,OACA,UACA,UACA,oBACE;CACJ,MAAM,gBAAgB,MAAM,UAE1B,aACE,SAAS;CACb,MAAM,cAAc,eAClB,eACA,cACA,OACA,YAAY,QAAQ,IACpB,OACA;EACE,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,cAAc;EACd,SAAS;EACT,eAAe;EACf,GAAG;CACL,GACA,MACA,kBACA,YACF;CACA,eAAe,mBACb,CAAC,CAAC,aAAa,eACf,CAAC,CAAC,aAAa,cACjB;CACA,MAAM,EAAE,aAAa,iBAAiB,eAAe,CAAC;CACtD,MAAM,mBAAmB,oBAAoB,cAAc,WAAW;CACtE,gCAAgC;EAC9B,IAAI;EACJ,IAAI,aAAa,cAAc;GAC7B,MAAM,uBAAuB;IAC3B,UAAU,cAAc,EAAE,GAAG,SAAS,EAAE;GAC1C;GACA,kBAAkB,oBAAoB,cAAc;GACpD,eAAe;EACjB;EACA,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,MAAM,WAAW;GACnB,gBAAgB,EAAE,WAAW,MAAM,CAAC;GACpC,OAAO;EACT;EACA,IAAI,cAAc;GAChB,MAAM,eAAe,wBAAwB;IAC3C;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,CAAC,iBAAiB,OAAO;GAC7B,aAAa;IACX,gBAAgB;IAChB,eAAe;GACjB;EACF;EACA,OAAO;CACT,GAAG;EAAC;EAAU;EAAc,aAAa;EAAc;CAAgB,CAAC;CACxE,OAAO;EACL,aAAa,aAAa,CAAC;EAC3B,aAAa,SAAS,CAAC;EACvB;EACA;CACF;AACF"}
@@ -1,104 +0,0 @@
1
- import { useIsomorphicLayoutEffect } from "@tamagui/constants";
2
- import React from "react";
3
- import { getConfig } from "../config.native.js";
4
- import { ComponentContext } from "../contexts/ComponentContext.native.js";
5
- import { GroupContext } from "../contexts/GroupContext.native.js";
6
- import { useSplitStyles } from "./useSplitStyles.native.js";
7
- import { subscribeToSafeArea } from "../helpers/resolveSafeAreaVariable.native.js";
8
- import { subscribeToContextGroup, useGroupSetRevision } from "../helpers/subscribeToContextGroup.native.js";
9
- import { View } from "../views/View.native.js";
10
- import { useComponentState } from "./useComponentState.native.js";
11
- import { mediaState } from "../helpers/mediaState.native.js";
12
- import { useMedia } from "./useMedia.native.js";
13
- import { useThemeWithState } from "./useTheme.native.js";
14
-
15
- function useProps(props, opts) {
16
- var [propsOut, styleOut] = usePropsAndStyle(props, {
17
- ...opts,
18
- noExpand: true,
19
- noNormalize: true,
20
- resolveValues: "none"
21
- });
22
- return {
23
- ...propsOut,
24
- ...styleOut
25
- };
26
- }
27
- function useStyle(props, opts) {
28
- return usePropsAndStyle(props, opts)[1] || {};
29
- }
30
- function usePropsAndStyle(props, opts) {
31
- var _opts_forComponent;
32
- var _opts_forComponent_staticConfig;
33
- var staticConfig = (_opts_forComponent_staticConfig = opts === null || opts === void 0 ? void 0 : (_opts_forComponent = opts.forComponent) === null || _opts_forComponent === void 0 ? void 0 : _opts_forComponent.staticConfig) !== null && _opts_forComponent_staticConfig !== void 0 ? _opts_forComponent_staticConfig : View.staticConfig;
34
- var [theme, themeState] = useThemeWithState({
35
- name: "theme" in props ? props.theme : void 0,
36
- needsUpdate() {
37
- return true;
38
- }
39
- });
40
- var componentContext = React.useContext(ComponentContext);
41
- var groupContext = React.useContext(GroupContext);
42
- var componentState = useComponentState(props, componentContext.animationDriver, staticConfig, getConfig());
43
- var { props: statefulProps, state, disabled, setState, setStateShallow } = componentState;
44
- var mediaStateNow = (opts === null || opts === void 0 ? void 0 : opts.noMedia) ? mediaState : useMedia();
45
- var splitStyles = useSplitStyles(statefulProps, staticConfig, theme, (themeState === null || themeState === void 0 ? void 0 : themeState.name) || "", state, {
46
- isAnimated: false,
47
- mediaState: mediaStateNow,
48
- noSkip: true,
49
- noMergeStyle: true,
50
- noClass: true,
51
- resolveValues: "auto",
52
- ...opts
53
- }, null, componentContext, groupContext);
54
- componentState.finalizeStyleFlags(!!(splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.hasEnterStyle), !!(splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.platformPseudo));
55
- var { mediaGroups, pseudoGroups } = splitStyles || {};
56
- var groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups);
57
- useIsomorphicLayoutEffect(function() {
58
- var disposeSafeArea;
59
- if (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.usesSafeArea) {
60
- var updateSafeArea = function() {
61
- setState(function(previous) {
62
- return { ...previous };
63
- });
64
- };
65
- disposeSafeArea = subscribeToSafeArea(updateSafeArea);
66
- updateSafeArea();
67
- }
68
- if (disabled) {
69
- return disposeSafeArea;
70
- }
71
- if (state.unmounted) {
72
- setStateShallow({ unmounted: false });
73
- return disposeSafeArea;
74
- }
75
- if (groupContext) {
76
- var disposeGroup = subscribeToContextGroup({
77
- groupContext,
78
- setStateShallow,
79
- mediaGroups,
80
- pseudoGroups
81
- });
82
- if (!disposeSafeArea) return disposeGroup;
83
- return function() {
84
- disposeSafeArea();
85
- disposeGroup === null || disposeGroup === void 0 ? void 0 : disposeGroup();
86
- };
87
- }
88
- return disposeSafeArea;
89
- }, [
90
- disabled,
91
- groupContext,
92
- splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.usesSafeArea,
93
- groupSetRevision
94
- ]);
95
- return [
96
- (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.viewProps) || {},
97
- (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.style) || {},
98
- theme,
99
- mediaState
100
- ];
101
- }
102
-
103
- export { useProps, usePropsAndStyle, useStyle };
104
- //# sourceMappingURL=useProps.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProps.native.js","names":[],"sources":["esm/hooks/useProps.native.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport React from \"react\";\nimport { getConfig } from \"../config\";\nimport { ComponentContext } from \"../contexts/ComponentContext\";\nimport { GroupContext } from \"../contexts/GroupContext\";\nimport { useSplitStyles } from \"./useSplitStyles\";\nimport { subscribeToSafeArea } from \"../helpers/resolveSafeAreaVariable\";\nimport { subscribeToContextGroup, useGroupSetRevision } from \"../helpers/subscribeToContextGroup\";\nimport { View } from \"../views/View\";\nimport { useComponentState } from \"./useComponentState\";\nimport { mediaState } from \"../helpers/mediaState\";\nimport { useMedia } from \"./useMedia\";\nimport { useThemeWithState } from \"./useTheme\";\nfunction useProps(props, opts) {\n var [propsOut, styleOut] = usePropsAndStyle(props, {\n ...opts,\n noExpand: true,\n noNormalize: true,\n resolveValues: \"none\"\n });\n return {\n ...propsOut,\n ...styleOut\n };\n}\nfunction useStyle(props, opts) {\n return usePropsAndStyle(props, opts)[1] || {};\n}\nfunction usePropsAndStyle(props, opts) {\n var _opts_forComponent;\n var _opts_forComponent_staticConfig;\n var staticConfig = (_opts_forComponent_staticConfig = opts === null || opts === void 0 ? void 0 : (_opts_forComponent = opts.forComponent) === null || _opts_forComponent === void 0 ? void 0 : _opts_forComponent.staticConfig) !== null && _opts_forComponent_staticConfig !== void 0 ? _opts_forComponent_staticConfig : View.staticConfig;\n var [theme, themeState] = useThemeWithState({\n name: \"theme\" in props ? props.theme : void 0,\n needsUpdate() {\n return true;\n }\n });\n var componentContext = React.useContext(ComponentContext);\n var groupContext = React.useContext(GroupContext);\n var componentState = useComponentState(props, componentContext.animationDriver, staticConfig, getConfig());\n var { props: statefulProps, state, disabled, setState, setStateShallow } = componentState;\n var mediaStateNow = (opts === null || opts === void 0 ? void 0 : opts.noMedia) ? (\n // not safe to use mediaState but really marginal to hit this\n mediaState\n ) : useMedia();\n var splitStyles = useSplitStyles(statefulProps, staticConfig, theme, (themeState === null || themeState === void 0 ? void 0 : themeState.name) || \"\", state, {\n isAnimated: false,\n mediaState: mediaStateNow,\n noSkip: true,\n noMergeStyle: true,\n noClass: true,\n resolveValues: \"auto\",\n ...opts\n }, null, componentContext, groupContext);\n componentState.finalizeStyleFlags(!!(splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.hasEnterStyle), !!(splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.platformPseudo));\n var { mediaGroups, pseudoGroups } = splitStyles || {};\n var groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups);\n useIsomorphicLayoutEffect(function() {\n var disposeSafeArea;\n if (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.usesSafeArea) {\n var updateSafeArea = function() {\n setState(function(previous) {\n return {\n ...previous\n };\n });\n };\n disposeSafeArea = subscribeToSafeArea(updateSafeArea);\n updateSafeArea();\n }\n if (disabled) {\n return disposeSafeArea;\n }\n if (state.unmounted) {\n setStateShallow({\n unmounted: false\n });\n return disposeSafeArea;\n }\n if (groupContext) {\n var disposeGroup = subscribeToContextGroup({\n groupContext,\n setStateShallow,\n mediaGroups,\n pseudoGroups\n });\n if (!disposeSafeArea) return disposeGroup;\n return function() {\n disposeSafeArea();\n disposeGroup === null || disposeGroup === void 0 ? void 0 : disposeGroup();\n };\n }\n return disposeSafeArea;\n }, [\n disabled,\n groupContext,\n splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.usesSafeArea,\n groupSetRevision\n ]);\n return [\n (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.viewProps) || {},\n (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.style) || {},\n theme,\n mediaState\n ];\n}\nexport {\n useProps,\n usePropsAndStyle,\n useStyle\n};\n//# sourceMappingURL=useProps.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAS,SAAS,OAAO,MAAM;CAC7B,IAAI,CAAC,UAAU,YAAY,iBAAiB,OAAO;EACjD,GAAG;EACH,UAAU;EACV,aAAa;EACb,eAAe;CACjB,CAAC;CACD,OAAO;EACL,GAAG;EACH,GAAG;CACL;AACF;AACA,SAAS,SAAS,OAAO,MAAM;CAC7B,OAAO,iBAAiB,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC;AAC9C;AACA,SAAS,iBAAiB,OAAO,MAAM;CACrC,IAAI;CACJ,IAAI;CACJ,IAAI,gBAAgB,kCAAkC,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,KAAK,qBAAqB,KAAK,kBAAkB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,kBAAkB,QAAQ,oCAAoC,KAAK,IAAI,kCAAkC,KAAK;CACjU,IAAI,CAAC,OAAO,cAAc,kBAAkB;EAC1C,MAAM,WAAW,QAAQ,MAAM,QAAQ,KAAK;EAC5C,cAAc;GACZ,OAAO;EACT;CACF,CAAC;CACD,IAAI,mBAAmB,MAAM,WAAW,gBAAgB;CACxD,IAAI,eAAe,MAAM,WAAW,YAAY;CAChD,IAAI,iBAAiB,kBAAkB,OAAO,iBAAiB,iBAAiB,cAAc,UAAU,CAAC;CACzG,IAAI,EAAE,OAAO,eAAe,OAAO,UAAU,UAAU,oBAAoB;CAC3E,IAAI,iBAAiB,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,WAEpE,aACE,SAAS;CACb,IAAI,cAAc,eAAe,eAAe,cAAc,QAAQ,eAAe,QAAQ,eAAe,KAAK,IAAI,KAAK,IAAI,WAAW,SAAS,IAAI,OAAO;EAC3J,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,cAAc;EACd,SAAS;EACT,eAAe;EACf,GAAG;CACL,GAAG,MAAM,kBAAkB,YAAY;CACvC,eAAe,mBAAmB,CAAC,EAAE,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,gBAAgB,CAAC,EAAE,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,eAAe;CACnN,IAAI,EAAE,aAAa,iBAAiB,eAAe,CAAC;CACpD,IAAI,mBAAmB,oBAAoB,cAAc,WAAW;CACpE,0BAA0B,WAAW;EACnC,IAAI;EACJ,IAAI,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,cAAc;GACtF,IAAI,iBAAiB,WAAW;IAC9B,SAAS,SAAS,UAAU;KAC1B,OAAO,EACL,GAAG,SACL;IACF,CAAC;GACH;GACA,kBAAkB,oBAAoB,cAAc;GACpD,eAAe;EACjB;EACA,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,MAAM,WAAW;GACnB,gBAAgB,EACd,WAAW,MACb,CAAC;GACD,OAAO;EACT;EACA,IAAI,cAAc;GAChB,IAAI,eAAe,wBAAwB;IACzC;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,CAAC,iBAAiB,OAAO;GAC7B,OAAO,WAAW;IAChB,gBAAgB;IAChB,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa;GAC3E;EACF;EACA,OAAO;CACT,GAAG;EACD;EACA;EACA,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;EACtE;CACF,CAAC;CACD,OAAO;GACJ,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,cAAc,CAAC;GACrF,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,UAAU,CAAC;EAClF;EACA;CACF;AACF"}
@@ -1,3 +0,0 @@
1
- import type { StaticConfig } from '../types'
2
-
3
- export const getDefaultProps = (staticConfig: StaticConfig) => staticConfig.defaultProps
@@ -1,96 +0,0 @@
1
- import React from 'react'
2
-
3
- import type { StaticConfig, ThemeableProps, ThemeProps } from '../types'
4
- import { Theme } from '../views/Theme'
5
- import { getDefaultProps } from './getDefaultProps'
6
-
7
- export function themeable<ComponentType extends (props: any) => any>(
8
- Component: ComponentType,
9
- staticConfig: Partial<StaticConfig>,
10
- optimize = false
11
- ) {
12
- const withThemeComponent = function WithTheme(props: ThemeableProps & { ref?: any }) {
13
- 'use no memo'
14
-
15
- const userDefaults = getDefaultProps(staticConfig)
16
- const defaultTheme = userDefaults?.theme
17
- const defaultResetTheme = userDefaults?.themeReset
18
- const { theme, themeReset, ref, ...rest } = props
19
-
20
- let overriddenContextProps: object | undefined
21
- const context = staticConfig?.context
22
- if (context) {
23
- for (const key in context.props) {
24
- const val = props[key]
25
- if (val !== undefined) {
26
- overriddenContextProps = overriddenContextProps || {}
27
- overriddenContextProps[key] = val
28
- }
29
- }
30
- }
31
-
32
- const element = (
33
- // @ts-expect-error its ok
34
- <Component ref={ref} {...rest} data-disable-theme />
35
- )
36
-
37
- // we filter out the props here, why?
38
- // Theme internally avoids wrapping <span /> unless 'theme' in props
39
- // reason for this is to avoid wrapping every single component with span
40
- // *if* ever it themes once, it leaves the span, to avoid reparenting
41
- // its expected if users want to avoid re-parenting, they keep the theme prop
42
- // and just set it to null. but we need to "respect" that here by filtering
43
- // one example of a bug caused by not doing this is in <Select native> on web
44
- // where it renders to an <option />, and then Theme would wrap a <span /> in that
45
- // which is not allowed in HTML and causes hydration errors / logs
46
- let filteredProps: Partial<ThemeProps> | null = null
47
-
48
- if ('debug' in props) {
49
- filteredProps = filteredProps || {}
50
- filteredProps.debug = props.debug
51
- }
52
- if ('theme' in props || defaultTheme) {
53
- filteredProps = filteredProps || {}
54
- filteredProps.name = 'theme' in props ? props.theme : defaultTheme
55
- }
56
- if ('themeReset' in props || defaultResetTheme) {
57
- filteredProps = filteredProps || {}
58
- filteredProps.reset = 'themeReset' in props ? themeReset : defaultResetTheme
59
- }
60
-
61
- if (optimize && !filteredProps) {
62
- // optimize by avoiding theme! this can re-parent but we should just document that to avoid performance
63
- // in cases where you remove/add themes, just keep a theme={x ? '' : null} pattern
64
- return element
65
- }
66
-
67
- let contents = (
68
- <Theme disable-child-theme {...filteredProps}>
69
- {element}
70
- </Theme>
71
- )
72
-
73
- if (context) {
74
- const Provider = context.Provider
75
- const contextValue = React.useContext(context)
76
- contents = (
77
- <Provider {...contextValue} {...overriddenContextProps}>
78
- {contents}
79
- </Provider>
80
- )
81
- }
82
-
83
- return contents
84
- }
85
-
86
- const withTheme: any = withThemeComponent
87
- withTheme.displayName = `Themed(${
88
- (Component as any)?.displayName || (Component as any)?.name || 'Anonymous'
89
- })`
90
-
91
- type FinalComponentType = ComponentType extends (props: infer P) => infer R
92
- ? (props: Omit<P, 'theme'> & ThemeableProps) => R
93
- : unknown
94
-
95
- return withTheme as FinalComponentType
96
- }
@@ -1,186 +0,0 @@
1
- import { useIsomorphicLayoutEffect } from '@tamagui/constants'
2
- import React from 'react'
3
- import { getConfig } from '../config'
4
- import { ComponentContext } from '../contexts/ComponentContext'
5
- import { GroupContext } from '../contexts/GroupContext'
6
- import { useSplitStyles } from './useSplitStyles'
7
- import { subscribeToSafeArea } from '../helpers/resolveSafeAreaVariable'
8
- import {
9
- subscribeToContextGroup,
10
- useGroupSetRevision,
11
- } from '../helpers/subscribeToContextGroup'
12
- import type { SplitStyleProps, StaticConfig, ThemeParsed, UseMediaState } from '../types'
13
- import type { ViewProps, ViewStyle } from '../views/View'
14
- import { View } from '../views/View'
15
- import { useComponentState } from './useComponentState'
16
- import { mediaState } from '../helpers/mediaState'
17
- import { useMedia } from './useMedia'
18
- import { useThemeWithState } from './useTheme'
19
-
20
- type UsePropsOptions = Pick<
21
- SplitStyleProps,
22
- 'noExpand' | 'noNormalize' | 'noClass' | 'resolveValues'
23
- > & {
24
- disableExpandShorthands?: boolean
25
- forComponent?: { staticConfig: StaticConfig }
26
- noClass?: boolean
27
-
28
- /**
29
- * Disable watching for media queries
30
- */
31
- noMedia?: boolean
32
- }
33
-
34
- export type PropsWithoutMediaStyles<A> = Partial<A>
35
-
36
- type PropsLikeObject = (ViewProps & Record<string, any>) | object
37
- type StyleLikeObject = (ViewStyle & Record<string, any>) | object
38
-
39
- /**
40
- * Returns props and style as a single object, expanding and merging shorthands and media queries.
41
- *
42
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
43
- *
44
- * */
45
- export function useProps<A extends PropsLikeObject>(
46
- props: A,
47
- opts?: UsePropsOptions
48
- ): PropsWithoutMediaStyles<A> {
49
- const [propsOut, styleOut] = usePropsAndStyle(props, {
50
- ...opts,
51
- noExpand: true,
52
- noNormalize: true,
53
- resolveValues: 'none',
54
- })
55
- return {
56
- ...propsOut,
57
- ...styleOut,
58
- }
59
- }
60
-
61
- /**
62
- * Returns only style values fully resolved and flattened with merged media queries and shorthands with all theme and token values resolved.
63
- *
64
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
65
- *
66
- * */
67
- export function useStyle<A extends StyleLikeObject>(
68
- props: A,
69
- opts?: UsePropsOptions
70
- ): PropsWithoutMediaStyles<A> {
71
- return usePropsAndStyle(props, opts)[1] || {}
72
- }
73
-
74
- /**
75
- * Returns [props, styles, theme, media] fully resolved and flattened with merged media queries and shorthands with all theme and token values resolved.
76
- *
77
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
78
- *
79
- * */
80
- export function usePropsAndStyle<A extends PropsLikeObject>(
81
- props: A,
82
- opts?: UsePropsOptions
83
- ): [PropsWithoutMediaStyles<A>, PropsWithoutMediaStyles<A>, ThemeParsed, UseMediaState] {
84
- const staticConfig = opts?.forComponent?.staticConfig ?? View.staticConfig
85
- const [theme, themeState] = useThemeWithState({
86
- name: 'theme' in props ? props.theme : undefined,
87
- needsUpdate() {
88
- return true
89
- },
90
- })
91
- const componentContext = React.useContext(ComponentContext)
92
- const groupContext = React.useContext(GroupContext)
93
- // useComponentState injects enter/exit presence variants onto a fresh copy
94
- // (it no longer mutates our `props` in place), so use the returned object for
95
- // style resolution below to keep those variants applied
96
- const componentState = useComponentState(
97
- props,
98
- componentContext.animationDriver,
99
- staticConfig,
100
- getConfig()
101
- )
102
- const {
103
- props: statefulProps,
104
- state,
105
- disabled,
106
- setState,
107
- setStateShallow,
108
- } = componentState
109
-
110
- const mediaStateNow = opts?.noMedia
111
- ? // not safe to use mediaState but really marginal to hit this
112
- mediaState
113
- : useMedia()
114
-
115
- const splitStyles = useSplitStyles(
116
- statefulProps,
117
- staticConfig,
118
- theme,
119
- themeState?.name || '',
120
- state,
121
- {
122
- isAnimated: false,
123
- mediaState: mediaStateNow,
124
- noSkip: true,
125
- noMergeStyle: true,
126
- noClass: true,
127
- resolveValues: 'auto',
128
- ...opts,
129
- },
130
- null,
131
- componentContext,
132
- groupContext
133
- )
134
-
135
- componentState.finalizeStyleFlags(
136
- !!splitStyles?.hasEnterStyle,
137
- !!splitStyles?.platformPseudo
138
- )
139
-
140
- const { mediaGroups, pseudoGroups } = splitStyles || {}
141
- const groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups)
142
-
143
- useIsomorphicLayoutEffect(() => {
144
- let disposeSafeArea: (() => void) | undefined
145
- if (splitStyles?.usesSafeArea) {
146
- const updateSafeArea = () => {
147
- setState((previous) => ({ ...previous }))
148
- }
149
- disposeSafeArea = subscribeToSafeArea(updateSafeArea)
150
- // close the render-to-subscribe race: the provider tracker may have
151
- // published new insets after this hook evaluated its styles.
152
- updateSafeArea()
153
- }
154
-
155
- if (disabled) {
156
- return disposeSafeArea
157
- }
158
-
159
- if (state.unmounted) {
160
- setStateShallow({ unmounted: false })
161
- return disposeSafeArea
162
- }
163
-
164
- if (groupContext) {
165
- const disposeGroup = subscribeToContextGroup({
166
- groupContext,
167
- setStateShallow,
168
- mediaGroups,
169
- pseudoGroups,
170
- })
171
- if (!disposeSafeArea) return disposeGroup
172
- return () => {
173
- disposeSafeArea()
174
- disposeGroup?.()
175
- }
176
- }
177
- return disposeSafeArea
178
- }, [disabled, groupContext, splitStyles?.usesSafeArea, groupSetRevision])
179
-
180
- return [
181
- splitStyles?.viewProps || {},
182
- splitStyles?.style || {},
183
- theme,
184
- mediaState,
185
- ] as any
186
- }
@@ -1,3 +0,0 @@
1
- import type { StaticConfig } from '../types';
2
- export declare const getDefaultProps: (staticConfig: StaticConfig) => Record<string, any> | undefined;
3
- //# sourceMappingURL=getDefaultProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDefaultProps.d.ts","sourceRoot":"","sources":["../../src/helpers/getDefaultProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,eAAO,MAAM,eAAe,iBAAkB,YAAY,oCAA8B,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { StaticConfig, ThemeableProps } from '../types';
2
- export declare function themeable<ComponentType extends (props: any) => any>(Component: ComponentType, staticConfig: Partial<StaticConfig>, optimize?: boolean): ComponentType extends (props: infer P) => infer R ? (props: Omit<P, 'theme'> & ThemeableProps) => R : unknown;
3
- //# sourceMappingURL=themeable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"themeable.d.ts","sourceRoot":"","sources":["../../src/helpers/themeable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAc,MAAM,UAAU,CAAA;AAIxE,wBAAgB,SAAS,CAAC,aAAa,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EACjE,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,EACnC,QAAQ,UAAQ,iCAiFwC,MAAM,CAAC,KAAK,MAAM,CAAC,WAC/D,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,cAAc,KAAK,CAAC,WAIpD"}
@@ -1,39 +0,0 @@
1
- import type { SplitStyleProps, StaticConfig, ThemeParsed, UseMediaState } from '../types';
2
- import type { ViewProps, ViewStyle } from '../views/View';
3
- type UsePropsOptions = Pick<SplitStyleProps, 'noExpand' | 'noNormalize' | 'noClass' | 'resolveValues'> & {
4
- disableExpandShorthands?: boolean;
5
- forComponent?: {
6
- staticConfig: StaticConfig;
7
- };
8
- noClass?: boolean;
9
- /**
10
- * Disable watching for media queries
11
- */
12
- noMedia?: boolean;
13
- };
14
- export type PropsWithoutMediaStyles<A> = Partial<A>;
15
- type PropsLikeObject = (ViewProps & Record<string, any>) | object;
16
- type StyleLikeObject = (ViewStyle & Record<string, any>) | object;
17
- /**
18
- * Returns props and style as a single object, expanding and merging shorthands and media queries.
19
- *
20
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
21
- *
22
- * */
23
- export declare function useProps<A extends PropsLikeObject>(props: A, opts?: UsePropsOptions): PropsWithoutMediaStyles<A>;
24
- /**
25
- * Returns only style values fully resolved and flattened with merged media queries and shorthands with all theme and token values resolved.
26
- *
27
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
28
- *
29
- * */
30
- export declare function useStyle<A extends StyleLikeObject>(props: A, opts?: UsePropsOptions): PropsWithoutMediaStyles<A>;
31
- /**
32
- * Returns [props, styles, theme, media] fully resolved and flattened with merged media queries and shorthands with all theme and token values resolved.
33
- *
34
- * Use sparingly, it will loop props and trigger re-render on all media queries you access.
35
- *
36
- * */
37
- export declare function usePropsAndStyle<A extends PropsLikeObject>(props: A, opts?: UsePropsOptions): [PropsWithoutMediaStyles<A>, PropsWithoutMediaStyles<A>, ThemeParsed, UseMediaState];
38
- export {};
39
- //# sourceMappingURL=useProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProps.d.ts","sourceRoot":"","sources":["../../src/hooks/useProps.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzD,KAAK,eAAe,GAAG,IAAI,CACzB,eAAe,EACf,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,eAAe,CACzD,GAAG;IACF,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,YAAY,CAAC,EAAE;QAAE,YAAY,EAAE,YAAY,CAAA;KAAE,CAAA;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA;AAEnD,KAAK,eAAe,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CAAA;AACjE,KAAK,eAAe,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CAAA;AAEjE;;;;;KAKK;AACL,wBAAgB,QAAQ,CAAC,CAAC,SAAS,eAAe,EAChD,KAAK,EAAE,CAAC,EACR,IAAI,CAAC,EAAE,eAAe,GACrB,uBAAuB,CAAC,CAAC,CAAC,CAW5B;AAED;;;;;KAKK;AACL,wBAAgB,QAAQ,CAAC,CAAC,SAAS,eAAe,EAChD,KAAK,EAAE,CAAC,EACR,IAAI,CAAC,EAAE,eAAe,GACrB,uBAAuB,CAAC,CAAC,CAAC,CAE5B;AAED;;;;;KAKK;AACL,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,eAAe,EACxD,KAAK,EAAE,CAAC,EACR,IAAI,CAAC,EAAE,eAAe,GACrB,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,CAuGtF"}