@tamagui/core 1.0.0-beta.9 → 1.0.1-beta.101

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 (582) hide show
  1. package/dist/cjs/Pressability.js +28 -0
  2. package/dist/cjs/Pressability.js.map +7 -0
  3. package/dist/cjs/Pressability.native.js +28 -0
  4. package/dist/cjs/Pressability.native.js.map +7 -0
  5. package/dist/cjs/Tamagui.js +6 -8
  6. package/dist/cjs/Tamagui.js.map +2 -2
  7. package/dist/cjs/ThemeManager.js +25 -32
  8. package/dist/cjs/ThemeManager.js.map +2 -2
  9. package/dist/cjs/conf.js +20 -15
  10. package/dist/cjs/conf.js.map +2 -2
  11. package/dist/cjs/constants/constants.js +1 -1
  12. package/dist/cjs/constants/constants.js.map +1 -1
  13. package/dist/cjs/constants/platform.js +9 -9
  14. package/dist/cjs/constants/platform.js.map +2 -2
  15. package/dist/cjs/constants/rnw.js +5 -19
  16. package/dist/cjs/constants/rnw.js.map +2 -2
  17. package/dist/cjs/constants/rnw.native.js +28 -0
  18. package/dist/cjs/constants/rnw.native.js.map +7 -0
  19. package/dist/cjs/createComponent.js +612 -295
  20. package/dist/cjs/createComponent.js.map +2 -2
  21. package/dist/cjs/createFont.js +2 -3
  22. package/dist/cjs/createFont.js.map +2 -2
  23. package/dist/cjs/createShorthands.js +0 -2
  24. package/dist/cjs/createShorthands.js.map +1 -1
  25. package/dist/cjs/createTamagui.js +147 -100
  26. package/dist/cjs/createTamagui.js.map +2 -2
  27. package/dist/cjs/createTheme.js +3 -2
  28. package/dist/cjs/createTheme.js.map +2 -2
  29. package/dist/cjs/createTokens.js +4 -21
  30. package/dist/cjs/createTokens.js.map +2 -2
  31. package/dist/cjs/createVariable.js +39 -14
  32. package/dist/cjs/createVariable.js.map +2 -2
  33. package/dist/cjs/createVariables.js +55 -0
  34. package/dist/cjs/createVariables.js.map +7 -0
  35. package/dist/cjs/helpers/areEqualSets.js +2 -3
  36. package/dist/cjs/helpers/areEqualSets.js.map +1 -1
  37. package/dist/cjs/helpers/assignNativePropsToWeb.js +187 -0
  38. package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
  39. package/dist/cjs/helpers/assignNativePropsToWeb.native.js +29 -0
  40. package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
  41. package/dist/cjs/helpers/calc.js +70 -0
  42. package/dist/cjs/helpers/calc.js.map +7 -0
  43. package/dist/cjs/helpers/createMediaStyle.js +4 -4
  44. package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
  45. package/dist/cjs/helpers/createPropMapper.js +133 -113
  46. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  47. package/dist/cjs/helpers/createShallowUpdate.js +3 -4
  48. package/dist/cjs/helpers/createShallowUpdate.js.map +2 -2
  49. package/dist/cjs/helpers/createTamaguiProvider.js +16 -18
  50. package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
  51. package/dist/cjs/helpers/cssHash.js +50 -0
  52. package/dist/cjs/helpers/cssHash.js.map +7 -0
  53. package/dist/cjs/helpers/expandStyle.js +111 -0
  54. package/dist/cjs/helpers/expandStyle.js.map +7 -0
  55. package/dist/cjs/helpers/expandStyles.js +126 -0
  56. package/dist/cjs/helpers/expandStyles.js.map +7 -0
  57. package/dist/cjs/helpers/extendStaticConfig.js +25 -17
  58. package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
  59. package/dist/cjs/helpers/fixNativeShadow.js +2 -3
  60. package/dist/cjs/helpers/fixNativeShadow.js.map +1 -1
  61. package/dist/cjs/helpers/getExpandedShorthands.js +0 -2
  62. package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
  63. package/dist/cjs/helpers/getFont.js +61 -0
  64. package/dist/cjs/helpers/getFont.js.map +7 -0
  65. package/dist/cjs/helpers/getSize.js +17 -9
  66. package/dist/cjs/helpers/getSize.js.map +2 -2
  67. package/dist/cjs/helpers/getSplitStyles.js +268 -168
  68. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  69. package/dist/cjs/helpers/getStackSize.js +45 -0
  70. package/dist/cjs/helpers/getStackSize.js.map +7 -0
  71. package/dist/cjs/helpers/getStylesAtomic.js +178 -118
  72. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  73. package/dist/cjs/helpers/getStylesAtomic.native.js +0 -2
  74. package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
  75. package/dist/cjs/helpers/getTextSize.js +3 -4
  76. package/dist/cjs/helpers/getTextSize.js.map +2 -2
  77. package/dist/cjs/helpers/getVariantExtras.js +46 -0
  78. package/dist/cjs/helpers/getVariantExtras.js.map +7 -0
  79. package/dist/cjs/helpers/insertStyleRule.js +55 -37
  80. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  81. package/dist/cjs/helpers/isObj.js +1 -2
  82. package/dist/cjs/helpers/isObj.js.map +1 -1
  83. package/dist/cjs/helpers/isTamaguiComponent.js +36 -0
  84. package/dist/cjs/helpers/isTamaguiComponent.js.map +7 -0
  85. package/dist/cjs/helpers/isTamaguiElement.js +4 -5
  86. package/dist/cjs/helpers/isTamaguiElement.js.map +2 -2
  87. package/dist/cjs/helpers/matchMedia.js +2 -3
  88. package/dist/cjs/helpers/matchMedia.js.map +1 -1
  89. package/dist/cjs/helpers/matchMedia.native.js +1 -2
  90. package/dist/cjs/helpers/matchMedia.native.js.map +1 -1
  91. package/dist/cjs/helpers/mergeProps.js +49 -0
  92. package/dist/cjs/helpers/mergeProps.js.map +7 -0
  93. package/dist/cjs/helpers/mergeTransform.js +41 -0
  94. package/dist/cjs/helpers/mergeTransform.js.map +7 -0
  95. package/dist/cjs/helpers/nativeGestureHandler.native.js +18 -0
  96. package/dist/cjs/helpers/nativeGestureHandler.native.js.map +7 -0
  97. package/dist/cjs/helpers/normalizeColor.js +76 -0
  98. package/dist/cjs/helpers/normalizeColor.js.map +7 -0
  99. package/dist/cjs/helpers/normalizeValueWithProperty.js +90 -0
  100. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
  101. package/dist/cjs/helpers/proxyThemeVariables.js +1 -3
  102. package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
  103. package/dist/cjs/helpers/pseudoDescriptors.js +41 -0
  104. package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
  105. package/dist/cjs/helpers/registerCSSVariable.js +40 -0
  106. package/dist/cjs/helpers/registerCSSVariable.js.map +7 -0
  107. package/dist/cjs/helpers/themeable.js +3 -5
  108. package/dist/cjs/helpers/themeable.js.map +2 -2
  109. package/dist/cjs/helpers/validate.js +39 -37
  110. package/dist/cjs/helpers/validate.js.map +2 -2
  111. package/dist/cjs/helpers/withStaticProperties.js +2 -3
  112. package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
  113. package/dist/cjs/helpers/wrapThemeManagerContext.js +0 -2
  114. package/dist/cjs/helpers/wrapThemeManagerContext.js.map +2 -2
  115. package/dist/cjs/hooks/useConstant.js +0 -2
  116. package/dist/cjs/hooks/useConstant.js.map +1 -1
  117. package/dist/cjs/hooks/useEvent.js +34 -0
  118. package/dist/cjs/hooks/useEvent.js.map +7 -0
  119. package/dist/cjs/hooks/useFeatures.js +22 -20
  120. package/dist/cjs/hooks/useFeatures.js.map +2 -2
  121. package/dist/cjs/hooks/useGet.js +39 -0
  122. package/dist/cjs/hooks/useGet.js.map +7 -0
  123. package/dist/cjs/hooks/useId.js +5 -6
  124. package/dist/cjs/hooks/useId.js.map +2 -2
  125. package/dist/cjs/hooks/useIsMounted.js +2 -4
  126. package/dist/cjs/hooks/useIsMounted.js.map +2 -2
  127. package/dist/cjs/hooks/useIsTouchDevice.js +3 -4
  128. package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
  129. package/dist/cjs/hooks/useMedia.js +11 -15
  130. package/dist/cjs/hooks/useMedia.js.map +1 -1
  131. package/dist/cjs/hooks/usePressable.js +2 -3
  132. package/dist/cjs/hooks/usePressable.js.map +1 -1
  133. package/dist/cjs/hooks/usePrevious.js +1 -0
  134. package/dist/cjs/hooks/usePrevious.js.map +7 -0
  135. package/dist/cjs/hooks/useTheme.js +21 -33
  136. package/dist/cjs/hooks/useTheme.js.map +2 -2
  137. package/dist/cjs/hooks/useUnmountEffect.js +0 -2
  138. package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
  139. package/dist/cjs/index.js +23 -12
  140. package/dist/cjs/index.js.map +2 -2
  141. package/dist/cjs/insertFont.js +89 -0
  142. package/dist/cjs/insertFont.js.map +7 -0
  143. package/dist/cjs/static.js +3 -1
  144. package/dist/cjs/static.js.map +2 -2
  145. package/dist/cjs/styled.js +0 -2
  146. package/dist/cjs/styled.js.map +2 -2
  147. package/dist/cjs/types-rnw.js.map +1 -1
  148. package/dist/cjs/types.js.map +1 -1
  149. package/dist/cjs/views/Slot.js +40 -26
  150. package/dist/cjs/views/Slot.js.map +2 -2
  151. package/dist/cjs/views/Text.js +11 -15
  152. package/dist/cjs/views/Text.js.map +2 -2
  153. package/dist/cjs/views/TextAncestorContext.js +4 -6
  154. package/dist/cjs/views/TextAncestorContext.js.map +2 -2
  155. package/dist/cjs/views/Theme.js +6 -9
  156. package/dist/cjs/views/Theme.js.map +2 -2
  157. package/dist/cjs/views/ThemeInverse.js +7 -5
  158. package/dist/cjs/views/ThemeInverse.js.map +2 -2
  159. package/dist/cjs/views/ThemeProvider.js +6 -6
  160. package/dist/cjs/views/ThemeProvider.js.map +2 -2
  161. package/dist/cjs/views/ThemeReset.js +3 -3
  162. package/dist/cjs/views/ThemeReset.js.map +2 -2
  163. package/dist/esm/Pressability.js +5 -0
  164. package/dist/esm/Pressability.js.map +7 -0
  165. package/dist/esm/Pressability.native.js +5 -0
  166. package/dist/esm/Pressability.native.js.map +7 -0
  167. package/dist/esm/Tamagui.js +5 -8
  168. package/dist/esm/Tamagui.js.map +2 -2
  169. package/dist/esm/ThemeManager.js +25 -33
  170. package/dist/esm/ThemeManager.js.map +2 -2
  171. package/dist/esm/conf.js +18 -15
  172. package/dist/esm/conf.js.map +2 -2
  173. package/dist/esm/constants/constants.js +24 -9
  174. package/dist/esm/constants/constants.js.map +2 -2
  175. package/dist/esm/constants/platform.js +7 -7
  176. package/dist/esm/constants/platform.js.map +2 -2
  177. package/dist/esm/constants/rnw.js +2 -20
  178. package/dist/esm/constants/rnw.js.map +2 -2
  179. package/dist/esm/constants/rnw.native.js +5 -0
  180. package/dist/esm/constants/rnw.native.js.map +7 -0
  181. package/dist/esm/createComponent.js +705 -331
  182. package/dist/esm/createComponent.js.map +2 -2
  183. package/dist/esm/createFont.js +2 -4
  184. package/dist/esm/createFont.js.map +2 -2
  185. package/dist/esm/createShorthands.js +0 -3
  186. package/dist/esm/createShorthands.js.map +1 -1
  187. package/dist/esm/createTamagui.js +172 -105
  188. package/dist/esm/createTamagui.js.map +2 -2
  189. package/dist/esm/createTheme.js +3 -3
  190. package/dist/esm/createTheme.js.map +2 -2
  191. package/dist/esm/createTokens.js +3 -20
  192. package/dist/esm/createTokens.js.map +2 -2
  193. package/dist/esm/createVariable.js +38 -14
  194. package/dist/esm/createVariable.js.map +2 -2
  195. package/dist/esm/createVariables.js +32 -0
  196. package/dist/esm/createVariables.js.map +7 -0
  197. package/dist/esm/helpers/areEqualSets.js +2 -4
  198. package/dist/esm/helpers/areEqualSets.js.map +1 -1
  199. package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
  200. package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
  201. package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
  202. package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
  203. package/dist/esm/helpers/calc.js +47 -0
  204. package/dist/esm/helpers/calc.js.map +7 -0
  205. package/dist/esm/helpers/createMediaStyle.js +4 -5
  206. package/dist/esm/helpers/createMediaStyle.js.map +2 -2
  207. package/dist/esm/helpers/createPropMapper.js +131 -114
  208. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  209. package/dist/esm/helpers/createShallowUpdate.js +19 -5
  210. package/dist/esm/helpers/createShallowUpdate.js.map +2 -2
  211. package/dist/esm/helpers/createTamaguiProvider.js +46 -19
  212. package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
  213. package/dist/esm/helpers/cssHash.js +27 -0
  214. package/dist/esm/helpers/cssHash.js.map +7 -0
  215. package/dist/esm/helpers/expandStyle.js +90 -0
  216. package/dist/esm/helpers/expandStyle.js.map +7 -0
  217. package/dist/esm/helpers/expandStyles.js +103 -0
  218. package/dist/esm/helpers/expandStyles.js.map +7 -0
  219. package/dist/esm/helpers/extendStaticConfig.js +46 -40
  220. package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
  221. package/dist/esm/helpers/fixNativeShadow.js +2 -4
  222. package/dist/esm/helpers/fixNativeShadow.js.map +1 -1
  223. package/dist/esm/helpers/getExpandedShorthands.js +0 -3
  224. package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
  225. package/dist/{jsx/helpers/getTextSize.js → esm/helpers/getFont.js} +12 -7
  226. package/dist/esm/helpers/getFont.js.map +7 -0
  227. package/dist/esm/helpers/getSize.js +15 -9
  228. package/dist/esm/helpers/getSize.js.map +2 -2
  229. package/dist/esm/helpers/getSplitStyles.js +282 -176
  230. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  231. package/dist/esm/helpers/getStackSize.js +22 -0
  232. package/dist/esm/helpers/getStackSize.js.map +7 -0
  233. package/dist/esm/helpers/getStylesAtomic.js +188 -110
  234. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  235. package/dist/esm/helpers/getStylesAtomic.native.js +0 -3
  236. package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
  237. package/dist/esm/helpers/getTextSize.js +3 -5
  238. package/dist/esm/helpers/getTextSize.js.map +2 -2
  239. package/dist/esm/helpers/getVariantExtras.js +23 -0
  240. package/dist/esm/helpers/getVariantExtras.js.map +7 -0
  241. package/dist/esm/helpers/insertStyleRule.js +55 -38
  242. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  243. package/dist/esm/helpers/isObj.js +1 -3
  244. package/dist/esm/helpers/isObj.js.map +1 -1
  245. package/dist/esm/helpers/isTamaguiComponent.js +13 -0
  246. package/dist/esm/helpers/isTamaguiComponent.js.map +7 -0
  247. package/dist/esm/helpers/isTamaguiElement.js +4 -6
  248. package/dist/esm/helpers/isTamaguiElement.js.map +2 -2
  249. package/dist/esm/helpers/matchMedia.js +2 -4
  250. package/dist/esm/helpers/matchMedia.js.map +1 -1
  251. package/dist/esm/helpers/matchMedia.native.js +1 -3
  252. package/dist/esm/helpers/matchMedia.native.js.map +1 -1
  253. package/dist/esm/helpers/mergeProps.js +26 -0
  254. package/dist/esm/helpers/mergeProps.js.map +7 -0
  255. package/dist/esm/helpers/mergeTransform.js +17 -0
  256. package/dist/esm/helpers/mergeTransform.js.map +7 -0
  257. package/dist/esm/helpers/nativeGestureHandler.native.js +2 -0
  258. package/dist/esm/helpers/nativeGestureHandler.native.js.map +7 -0
  259. package/dist/esm/helpers/normalizeColor.js +49 -0
  260. package/dist/esm/helpers/normalizeColor.js.map +7 -0
  261. package/dist/esm/helpers/normalizeValueWithProperty.js +67 -0
  262. package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
  263. package/dist/esm/helpers/proxyThemeVariables.js +1 -4
  264. package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
  265. package/dist/esm/helpers/pseudoDescriptors.js +18 -0
  266. package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
  267. package/dist/esm/helpers/registerCSSVariable.js +15 -0
  268. package/dist/esm/helpers/registerCSSVariable.js.map +7 -0
  269. package/dist/esm/helpers/themeable.js +34 -5
  270. package/dist/esm/helpers/themeable.js.map +2 -2
  271. package/dist/esm/helpers/validate.js +42 -19
  272. package/dist/esm/helpers/validate.js.map +2 -2
  273. package/dist/esm/helpers/withStaticProperties.js +2 -4
  274. package/dist/esm/helpers/withStaticProperties.js.map +1 -1
  275. package/dist/esm/helpers/wrapThemeManagerContext.js +0 -3
  276. package/dist/esm/helpers/wrapThemeManagerContext.js.map +2 -2
  277. package/dist/esm/hooks/useConstant.js +0 -3
  278. package/dist/esm/hooks/useConstant.js.map +1 -1
  279. package/dist/esm/hooks/useEvent.js +11 -0
  280. package/dist/esm/hooks/useEvent.js.map +7 -0
  281. package/dist/esm/hooks/useFeatures.js +59 -26
  282. package/dist/esm/hooks/useFeatures.js.map +2 -2
  283. package/dist/esm/hooks/useGet.js +16 -0
  284. package/dist/esm/hooks/useGet.js.map +7 -0
  285. package/dist/esm/hooks/useId.js +8 -11
  286. package/dist/esm/hooks/useId.js.map +2 -2
  287. package/dist/esm/hooks/useIsMounted.js +1 -4
  288. package/dist/esm/hooks/useIsMounted.js.map +2 -2
  289. package/dist/esm/hooks/useIsTouchDevice.js +4 -6
  290. package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
  291. package/dist/esm/hooks/useMedia.js +28 -21
  292. package/dist/esm/hooks/useMedia.js.map +1 -1
  293. package/dist/esm/hooks/usePressable.js +18 -5
  294. package/dist/esm/hooks/usePressable.js.map +1 -1
  295. package/dist/esm/hooks/usePrevious.js +1 -0
  296. package/dist/esm/hooks/usePrevious.js.map +7 -0
  297. package/dist/esm/hooks/useTheme.js +45 -41
  298. package/dist/esm/hooks/useTheme.js.map +2 -2
  299. package/dist/esm/hooks/useUnmountEffect.js +0 -3
  300. package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
  301. package/dist/esm/index.js +20 -9
  302. package/dist/esm/index.js.map +2 -2
  303. package/dist/esm/insertFont.js +64 -0
  304. package/dist/esm/insertFont.js.map +7 -0
  305. package/dist/esm/static.js +3 -1
  306. package/dist/esm/static.js.map +2 -2
  307. package/dist/esm/styled.js +37 -11
  308. package/dist/esm/styled.js.map +2 -2
  309. package/dist/esm/views/Slot.js +74 -34
  310. package/dist/esm/views/Slot.js.map +2 -2
  311. package/dist/esm/views/Stack.js +21 -3
  312. package/dist/esm/views/Stack.js.map +1 -1
  313. package/dist/esm/views/Text.js +27 -19
  314. package/dist/esm/views/Text.js.map +2 -2
  315. package/dist/esm/views/TextAncestorContext.js +4 -7
  316. package/dist/esm/views/TextAncestorContext.js.map +2 -2
  317. package/dist/esm/views/Theme.js +6 -10
  318. package/dist/esm/views/Theme.js.map +2 -2
  319. package/dist/esm/views/ThemeInverse.js +8 -7
  320. package/dist/esm/views/ThemeInverse.js.map +2 -2
  321. package/dist/esm/views/ThemeProvider.js +6 -7
  322. package/dist/esm/views/ThemeProvider.js.map +2 -2
  323. package/dist/esm/views/ThemeReset.js +3 -4
  324. package/dist/esm/views/ThemeReset.js.map +2 -2
  325. package/package.json +19 -11
  326. package/reset.css +41 -0
  327. package/types/Pressability.d.ts +2 -0
  328. package/types/Pressability.d.ts.map +1 -0
  329. package/types/Pressability.native.d.ts +2 -0
  330. package/types/Pressability.native.d.ts.map +1 -0
  331. package/types/Tamagui.d.ts +4 -6
  332. package/types/Tamagui.d.ts.map +1 -1
  333. package/types/ThemeContext.d.ts +0 -0
  334. package/types/ThemeContext.d.ts.map +0 -0
  335. package/types/ThemeManager.d.ts +10 -7
  336. package/types/ThemeManager.d.ts.map +1 -1
  337. package/types/conf.d.ts +3 -4
  338. package/types/conf.d.ts.map +1 -1
  339. package/types/constants/constants.d.ts +1 -1
  340. package/types/constants/constants.d.ts.map +1 -1
  341. package/types/constants/platform.d.ts +4 -4
  342. package/types/constants/platform.d.ts.map +1 -1
  343. package/types/constants/rnw.d.ts +1 -1
  344. package/types/constants/rnw.d.ts.map +1 -1
  345. package/types/constants/rnw.native.d.ts +2 -0
  346. package/types/constants/rnw.native.d.ts.map +1 -0
  347. package/types/contexts/ButtonInsideButtonContext.d.ts +0 -0
  348. package/types/contexts/ButtonInsideButtonContext.d.ts.map +0 -0
  349. package/types/createComponent.d.ts +40 -15
  350. package/types/createComponent.d.ts.map +1 -1
  351. package/types/createFont.d.ts +0 -0
  352. package/types/createFont.d.ts.map +0 -0
  353. package/types/createShorthands.d.ts +0 -0
  354. package/types/createShorthands.d.ts.map +0 -0
  355. package/types/createTamagui.d.ts +10 -2
  356. package/types/createTamagui.d.ts.map +1 -1
  357. package/types/createTheme.d.ts +1 -1
  358. package/types/createTheme.d.ts.map +1 -1
  359. package/types/createTokens.d.ts +0 -1
  360. package/types/createTokens.d.ts.map +1 -1
  361. package/types/createVariable.d.ts +16 -11
  362. package/types/createVariable.d.ts.map +1 -1
  363. package/types/createVariables.d.ts +10 -0
  364. package/types/createVariables.d.ts.map +1 -0
  365. package/types/defaultComponentState.d.ts +0 -0
  366. package/types/defaultComponentState.d.ts.map +0 -0
  367. package/types/helpers/RNComponents.d.ts +0 -0
  368. package/types/helpers/RNComponents.d.ts.map +0 -0
  369. package/types/helpers/areEqualSets.d.ts +0 -0
  370. package/types/helpers/areEqualSets.d.ts.map +0 -0
  371. package/types/helpers/assignNativePropsToWeb.d.ts +2 -0
  372. package/types/helpers/assignNativePropsToWeb.d.ts.map +1 -0
  373. package/types/helpers/assignNativePropsToWeb.native.d.ts +2 -0
  374. package/types/helpers/assignNativePropsToWeb.native.d.ts.map +1 -0
  375. package/types/helpers/calc.d.ts +12 -0
  376. package/types/helpers/calc.d.ts.map +1 -0
  377. package/types/helpers/createMediaStyle.d.ts +1 -1
  378. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  379. package/types/helpers/createPropMapper.d.ts +4 -3
  380. package/types/helpers/createPropMapper.d.ts.map +1 -1
  381. package/types/helpers/createShallowUpdate.d.ts +1 -2
  382. package/types/helpers/createShallowUpdate.d.ts.map +1 -1
  383. package/types/helpers/createTamaguiProvider.d.ts +2 -5
  384. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  385. package/types/helpers/cssHash.d.ts +2 -0
  386. package/types/helpers/cssHash.d.ts.map +1 -0
  387. package/types/helpers/expandStyle.d.ts +2 -0
  388. package/types/helpers/expandStyle.d.ts.map +1 -0
  389. package/types/helpers/expandStyles.d.ts +7 -0
  390. package/types/helpers/expandStyles.d.ts.map +1 -0
  391. package/types/helpers/extendStaticConfig.d.ts +0 -0
  392. package/types/helpers/extendStaticConfig.d.ts.map +1 -1
  393. package/types/helpers/fixNativeShadow.d.ts +0 -0
  394. package/types/helpers/fixNativeShadow.d.ts.map +0 -0
  395. package/types/helpers/getExpandedShorthands.d.ts +0 -0
  396. package/types/helpers/getExpandedShorthands.d.ts.map +0 -0
  397. package/types/helpers/getFont.d.ts +3 -0
  398. package/types/helpers/getFont.d.ts.map +1 -0
  399. package/types/helpers/getSize.d.ts +3 -2
  400. package/types/helpers/getSize.d.ts.map +1 -1
  401. package/types/helpers/getSplitStyles.d.ts +10 -7
  402. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  403. package/types/helpers/getStackSize.d.ts +8 -0
  404. package/types/helpers/getStackSize.d.ts.map +1 -0
  405. package/types/helpers/getStylesAtomic.d.ts +7 -17
  406. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  407. package/types/helpers/getStylesAtomic.native.d.ts +0 -0
  408. package/types/helpers/getStylesAtomic.native.d.ts.map +0 -0
  409. package/types/helpers/getVariantExtras.d.ts +7 -0
  410. package/types/helpers/getVariantExtras.d.ts.map +1 -0
  411. package/types/helpers/insertStyleRule.d.ts +1 -1
  412. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  413. package/types/helpers/isObj.d.ts +0 -0
  414. package/types/helpers/isObj.d.ts.map +0 -0
  415. package/types/helpers/isTamaguiComponent.d.ts +5 -0
  416. package/types/helpers/isTamaguiComponent.d.ts.map +1 -0
  417. package/types/helpers/isTamaguiElement.d.ts +1 -1
  418. package/types/helpers/isTamaguiElement.d.ts.map +1 -1
  419. package/types/helpers/matchMedia.d.ts +0 -0
  420. package/types/helpers/matchMedia.d.ts.map +0 -0
  421. package/types/helpers/matchMedia.native.d.ts +0 -0
  422. package/types/helpers/matchMedia.native.d.ts.map +0 -0
  423. package/types/helpers/mergeProps.d.ts +2 -0
  424. package/types/helpers/mergeProps.d.ts.map +1 -0
  425. package/types/helpers/mergeTransform.d.ts +7 -0
  426. package/types/helpers/mergeTransform.d.ts.map +1 -0
  427. package/types/helpers/nativeGestureHandler.native.d.ts +2 -0
  428. package/types/helpers/nativeGestureHandler.native.d.ts.map +1 -0
  429. package/types/helpers/normalizeColor.d.ts +3 -0
  430. package/types/helpers/normalizeColor.d.ts.map +1 -0
  431. package/types/helpers/normalizeValueWithProperty.d.ts +2 -0
  432. package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
  433. package/types/helpers/proxyThemeVariables.d.ts +0 -0
  434. package/types/helpers/proxyThemeVariables.d.ts.map +0 -0
  435. package/types/helpers/pseudoDescriptors.d.ts +16 -0
  436. package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
  437. package/types/helpers/registerCSSVariable.d.ts +5 -0
  438. package/types/helpers/registerCSSVariable.d.ts.map +1 -0
  439. package/types/helpers/themeable.d.ts +0 -0
  440. package/types/helpers/themeable.d.ts.map +1 -1
  441. package/types/helpers/validate.d.ts +0 -0
  442. package/types/helpers/validate.d.ts.map +0 -0
  443. package/types/helpers/withStaticProperties.d.ts +0 -0
  444. package/types/helpers/withStaticProperties.d.ts.map +0 -0
  445. package/types/helpers/wrapThemeManagerContext.d.ts +0 -0
  446. package/types/helpers/wrapThemeManagerContext.d.ts.map +0 -0
  447. package/types/hooks/useConstant.d.ts +0 -0
  448. package/types/hooks/useConstant.d.ts.map +0 -0
  449. package/types/hooks/useEvent.d.ts +4 -0
  450. package/types/hooks/useEvent.d.ts.map +1 -0
  451. package/types/hooks/useFeatures.d.ts +11 -5
  452. package/types/hooks/useFeatures.d.ts.map +1 -1
  453. package/types/hooks/useGet.d.ts +2 -0
  454. package/types/hooks/useGet.d.ts.map +1 -0
  455. package/types/hooks/useId.d.ts +0 -0
  456. package/types/hooks/useId.d.ts.map +1 -1
  457. package/types/hooks/useIsMounted.d.ts +0 -0
  458. package/types/hooks/useIsMounted.d.ts.map +1 -1
  459. package/types/hooks/useIsTouchDevice.d.ts +0 -0
  460. package/types/hooks/useIsTouchDevice.d.ts.map +0 -0
  461. package/types/hooks/useMedia.d.ts +0 -0
  462. package/types/hooks/useMedia.d.ts.map +0 -0
  463. package/types/hooks/usePressable.d.ts +0 -0
  464. package/types/hooks/usePressable.d.ts.map +0 -0
  465. package/types/hooks/usePrevious.d.ts +1 -0
  466. package/types/hooks/usePrevious.d.ts.map +1 -0
  467. package/types/hooks/useTheme.d.ts +15 -6
  468. package/types/hooks/useTheme.d.ts.map +1 -1
  469. package/types/hooks/useUnmountEffect.d.ts +0 -0
  470. package/types/hooks/useUnmountEffect.d.ts.map +0 -0
  471. package/types/index.d.ts +18 -6
  472. package/types/index.d.ts.map +1 -1
  473. package/types/insertFont.d.ts +6 -0
  474. package/types/insertFont.d.ts.map +1 -0
  475. package/types/static.d.ts +3 -1
  476. package/types/static.d.ts.map +1 -1
  477. package/types/styled.d.ts +2 -2
  478. package/types/styled.d.ts.map +1 -1
  479. package/types/types-rnw.d.ts +0 -0
  480. package/types/types-rnw.d.ts.map +1 -1
  481. package/types/types.d.ts +71 -51
  482. package/types/types.d.ts.map +1 -1
  483. package/types/views/Slot.d.ts +1 -0
  484. package/types/views/Slot.d.ts.map +1 -1
  485. package/types/views/Stack.d.ts +0 -0
  486. package/types/views/Stack.d.ts.map +0 -0
  487. package/types/views/Text.d.ts +0 -0
  488. package/types/views/Text.d.ts.map +1 -1
  489. package/types/views/TextAncestorContext.d.ts +0 -0
  490. package/types/views/TextAncestorContext.d.ts.map +1 -1
  491. package/types/views/Theme.d.ts +1 -9
  492. package/types/views/Theme.d.ts.map +1 -1
  493. package/types/views/ThemeInverse.d.ts +0 -1
  494. package/types/views/ThemeInverse.d.ts.map +1 -1
  495. package/types/views/ThemeProvider.d.ts +2 -0
  496. package/types/views/ThemeProvider.d.ts.map +1 -1
  497. package/types/views/ThemeReset.d.ts +0 -0
  498. package/types/views/ThemeReset.d.ts.map +0 -0
  499. package/dist/cjs/helpers/addStylesUsingClassname.js +0 -87
  500. package/dist/cjs/helpers/addStylesUsingClassname.js.map +0 -7
  501. package/dist/cjs/helpers/fixNativeShadow.native.js +0 -63
  502. package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
  503. package/dist/cjs/helpers/getButtonSize.js +0 -45
  504. package/dist/cjs/helpers/getButtonSize.js.map +0 -7
  505. package/dist/esm/helpers/addStylesUsingClassname.js +0 -64
  506. package/dist/esm/helpers/addStylesUsingClassname.js.map +0 -7
  507. package/dist/esm/helpers/fixNativeShadow.native.js +0 -41
  508. package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
  509. package/dist/esm/helpers/getButtonSize.js +0 -24
  510. package/dist/esm/helpers/getButtonSize.js.map +0 -7
  511. package/dist/jsx/Tamagui.js +0 -41
  512. package/dist/jsx/ThemeContext.js +0 -5
  513. package/dist/jsx/ThemeManager.js +0 -186
  514. package/dist/jsx/conf.js +0 -35
  515. package/dist/jsx/constants/constants.js +0 -17
  516. package/dist/jsx/constants/platform.js +0 -25
  517. package/dist/jsx/constants/rnw.js +0 -23
  518. package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
  519. package/dist/jsx/createComponent.js +0 -617
  520. package/dist/jsx/createFont.js +0 -27
  521. package/dist/jsx/createShorthands.js +0 -9
  522. package/dist/jsx/createTamagui.js +0 -201
  523. package/dist/jsx/createTheme.js +0 -6
  524. package/dist/jsx/createTokens.js +0 -28
  525. package/dist/jsx/createVariable.js +0 -48
  526. package/dist/jsx/defaultComponentState.js +0 -0
  527. package/dist/jsx/helpers/RNComponents.js +0 -11
  528. package/dist/jsx/helpers/addStylesUsingClassname.js +0 -63
  529. package/dist/jsx/helpers/areEqualSets.js +0 -15
  530. package/dist/jsx/helpers/createMediaStyle.js +0 -30
  531. package/dist/jsx/helpers/createPropMapper.js +0 -237
  532. package/dist/jsx/helpers/createShallowUpdate.js +0 -18
  533. package/dist/jsx/helpers/createTamaguiProvider.js +0 -34
  534. package/dist/jsx/helpers/extendStaticConfig.js +0 -61
  535. package/dist/jsx/helpers/fixNativeShadow.js +0 -7
  536. package/dist/jsx/helpers/fixNativeShadow.native.js +0 -40
  537. package/dist/jsx/helpers/getButtonSize.js +0 -23
  538. package/dist/jsx/helpers/getExpandedShorthands.js +0 -18
  539. package/dist/jsx/helpers/getSize.js +0 -12
  540. package/dist/jsx/helpers/getSplitStyles.js +0 -302
  541. package/dist/jsx/helpers/getStylesAtomic.js +0 -130
  542. package/dist/jsx/helpers/getStylesAtomic.native.js +0 -9
  543. package/dist/jsx/helpers/insertStyleRule.js +0 -94
  544. package/dist/jsx/helpers/isObj.js +0 -6
  545. package/dist/jsx/helpers/isTamaguiElement.js +0 -10
  546. package/dist/jsx/helpers/matchMedia.js +0 -17
  547. package/dist/jsx/helpers/matchMedia.native.js +0 -8
  548. package/dist/jsx/helpers/proxyThemeVariables.js +0 -17
  549. package/dist/jsx/helpers/themeable.js +0 -24
  550. package/dist/jsx/helpers/validate.js +0 -75
  551. package/dist/jsx/helpers/withStaticProperties.js +0 -9
  552. package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -10
  553. package/dist/jsx/hooks/useConstant.js +0 -14
  554. package/dist/jsx/hooks/useFeatures.js +0 -167
  555. package/dist/jsx/hooks/useId.js +0 -34
  556. package/dist/jsx/hooks/useIsMounted.js +0 -18
  557. package/dist/jsx/hooks/useIsTouchDevice.js +0 -16
  558. package/dist/jsx/hooks/useMedia.js +0 -158
  559. package/dist/jsx/hooks/usePressable.js +0 -13
  560. package/dist/jsx/hooks/useTheme.js +0 -177
  561. package/dist/jsx/hooks/useUnmountEffect.js +0 -10
  562. package/dist/jsx/index.js +0 -54
  563. package/dist/jsx/static.js +0 -16
  564. package/dist/jsx/styled.js +0 -47
  565. package/dist/jsx/types-rnw.js +0 -0
  566. package/dist/jsx/types.js +0 -0
  567. package/dist/jsx/views/Slot.js +0 -56
  568. package/dist/jsx/views/Stack.js +0 -12
  569. package/dist/jsx/views/Text.js +0 -61
  570. package/dist/jsx/views/TextAncestorContext.js +0 -15
  571. package/dist/jsx/views/Theme.js +0 -31
  572. package/dist/jsx/views/ThemeInverse.js +0 -22
  573. package/dist/jsx/views/ThemeProvider.js +0 -35
  574. package/dist/jsx/views/ThemeReset.js +0 -34
  575. package/types/helpers/addStylesUsingClassname.d.ts +0 -3
  576. package/types/helpers/addStylesUsingClassname.d.ts.map +0 -1
  577. package/types/helpers/fixNativeShadow.native.d.ts +0 -2
  578. package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
  579. package/types/helpers/getButtonSize.d.ts +0 -8
  580. package/types/helpers/getButtonSize.d.ts.map +0 -1
  581. package/types/helpers/getTextSize.d.ts +0 -3
  582. package/types/helpers/getTextSize.d.ts.map +0 -1
@@ -1,6 +1,41 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { stylePropsView } from "@tamagui/helpers";
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { composeEventHandlers, stylePropsView, validStyles } from "@tamagui/helpers";
33
+ import {
34
+ useElementLayout,
35
+ useMergeRefs,
36
+ usePlatformMethods,
37
+ useResponderEvents
38
+ } from "@tamagui/rnw";
4
39
  import { useForceUpdate } from "@tamagui/use-force-update";
5
40
  import React, {
6
41
  Children,
@@ -10,36 +45,40 @@ import React, {
10
45
  memo,
11
46
  useCallback,
12
47
  useContext,
48
+ useMemo,
13
49
  useRef,
14
50
  useState
15
51
  } from "react";
16
52
  import { StyleSheet, Text, View } from "react-native";
17
- import { onConfiguredOnce } from "./conf";
53
+ import { getConfig, onConfiguredOnce } from "./conf";
18
54
  import { stackDefaultStyles } from "./constants/constants";
19
- import { isAndroid, isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
20
- import { rnw } from "./constants/rnw";
21
- import { isVariable } from "./createVariable";
55
+ import { isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
56
+ import { assignNativePropsToWeb } from "./helpers/assignNativePropsToWeb";
57
+ import { getReturnVariablesAs } from "./helpers/createPropMapper";
22
58
  import { createShallowUpdate } from "./helpers/createShallowUpdate";
23
59
  import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
24
60
  import { insertSplitStyles, useSplitStyles } from "./helpers/getSplitStyles";
25
61
  import { getAllSelectors } from "./helpers/insertStyleRule";
62
+ import { mergeProps } from "./helpers/mergeProps";
26
63
  import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
27
64
  import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
28
65
  import { useFeatures } from "./hooks/useFeatures";
29
66
  import { useIsTouchDevice } from "./hooks/useIsTouchDevice";
67
+ import { mediaState } from "./hooks/useMedia";
30
68
  import { usePressable } from "./hooks/usePressable";
31
69
  import { getThemeManagerIfChanged, useTheme } from "./hooks/useTheme";
32
- import { Slot } from "./views/Slot";
70
+ import { Pressability } from "./Pressability";
71
+ import { Slot, mergeEvent } from "./views/Slot";
33
72
  import { TextAncestorContext } from "./views/TextAncestorContext";
34
73
  React["keep"];
35
- const defaultComponentState = {
74
+ const defaultComponentState = Object.freeze({
36
75
  hover: false,
37
76
  press: false,
38
77
  pressIn: false,
39
78
  focus: false,
40
79
  mounted: false,
41
80
  animation: null
42
- };
81
+ });
43
82
  const mouseUps = /* @__PURE__ */ new Set();
44
83
  if (typeof document !== "undefined") {
45
84
  document.addEventListener("mouseup", () => {
@@ -60,7 +99,6 @@ function mergeShorthands({ defaultProps }, { shorthands }) {
60
99
  defaultProps[shorthands[key] || key] = defaultProps[key];
61
100
  }
62
101
  }
63
- __name(mergeShorthands, "mergeShorthands");
64
102
  let initialTheme;
65
103
  function createComponent(configIn, ParentComponent) {
66
104
  const staticConfig = (() => {
@@ -71,7 +109,7 @@ function createComponent(configIn, ParentComponent) {
71
109
  return parseStaticConfig(config);
72
110
  }
73
111
  })();
74
- const componentClassName = `is_${staticConfig.componentName}`;
112
+ const defaultComponentClassName = `is_${staticConfig.componentName}`;
75
113
  let tamaguiConfig;
76
114
  let AnimatedText;
77
115
  let AnimatedView;
@@ -80,96 +118,327 @@ function createComponent(configIn, ParentComponent) {
80
118
  let defaultNativeStyleSheet;
81
119
  let tamaguiDefaultProps;
82
120
  let initialSplitStyles;
83
- function addPseudoToStyles(styles, name, pseudos) {
84
- const pseudoStyle = pseudos[name];
85
- const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
86
- if (pseudoStyle) {
87
- styles.push(shouldNestObject ? { [name]: pseudoStyle } : pseudoStyle);
88
- }
89
- const defaultPseudoStyle = initialSplitStyles.pseudos[name];
90
- if (defaultPseudoStyle) {
91
- styles.push(shouldNestObject ? { [name]: defaultPseudoStyle } : defaultPseudoStyle);
121
+ const component = forwardRef((propsIn, forwardedRef) => {
122
+ var _a, _d, _e, _f;
123
+ let props;
124
+ if (tamaguiDefaultProps && !propsIn.asChild) {
125
+ props = mergeProps(tamaguiDefaultProps, propsIn)[0];
126
+ } else {
127
+ props = propsIn;
92
128
  }
93
- }
94
- __name(addPseudoToStyles, "addPseudoToStyles");
95
- const component = forwardRef((props, forwardedRef) => {
96
- var _a, _b, _c, _d;
97
- props = tamaguiDefaultProps && !props.asChild ? { ...tamaguiDefaultProps, ...props } : props;
98
- const { Component, componentName, isText, isZStack } = staticConfig;
129
+ const hostRef = useRef(null);
130
+ const { Component, isText, isZStack } = staticConfig;
131
+ const componentName = props.componentName || staticConfig.componentName;
132
+ const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
99
133
  if (process.env.NODE_ENV === "development") {
100
134
  if (props["debug"]) {
101
- console.warn(staticConfig.componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
102
- console.log("props in:", props, Object.keys(props));
103
- if (props["debug"] === "break")
135
+ const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
136
+ const banner = `${name} ${propsIn["data-is"] || ""}`;
137
+ console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
138
+ console.log("props", propsIn);
139
+ console.log("ref", hostRef);
140
+ if (props["debug"] === "break") {
104
141
  debugger;
142
+ }
105
143
  }
106
144
  }
107
145
  const forceUpdate = useForceUpdate();
108
- const theme = useTheme(props.theme, staticConfig.componentName, props, forceUpdate);
109
- const [state, set_] = useState(defaultComponentState);
110
- const setStateShallow = createShallowUpdate(set_);
146
+ const theme = useTheme(props.theme, componentName, props, forceUpdate);
147
+ const statesUsed = useState(defaultComponentState);
148
+ const setStateShallow = createShallowUpdate(statesUsed[1]);
149
+ let state = statesUsed[0];
150
+ if (propsIn.forceStyle) {
151
+ state = __spreadProps(__spreadValues({}, state), {
152
+ [propsIn.forceStyle]: true
153
+ });
154
+ }
111
155
  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);
156
+ const shouldForcePseudo = !!propsIn.forceStyle;
157
+ const hasTextAncestor = !!(isWeb ? useContext(TextAncestorContext) : false);
158
+ const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? __spreadProps(__spreadValues({}, state), {
159
+ hasTextAncestor,
160
+ dynamicStylesInline: true
161
+ }) : __spreadProps(__spreadValues({}, state), {
162
+ noClassNames: true,
163
+ dynamicStylesInline: true,
164
+ hasTextAncestor,
165
+ resolveVariablesAs: "value"
166
+ });
167
+ const splitStyles = useSplitStyles(props, staticConfig, theme, splitStyleState, props.asChild ? null : initialSplitStyles.classNames, props["debug"]);
113
168
  const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
114
169
  const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
115
170
  const isAnimated = !!(useAnimations && props.animation);
116
171
  const hasEnterStyle = !!props.enterStyle;
172
+ const animationFeatureStylesIn = props.animation ? __spreadValues(__spreadValues({}, defaultNativeStyle), style) : null;
117
173
  const features = useFeatures(props, {
118
174
  forceUpdate,
119
175
  setStateShallow,
120
176
  useAnimations,
121
177
  state,
122
- style: props.animation ? { ...defaultNativeStyle, ...style } : null,
178
+ style: animationFeatureStylesIn,
123
179
  pseudos,
124
180
  staticConfig,
125
181
  theme,
182
+ hostRef,
126
183
  onDidAnimate: props.onDidAnimate
127
184
  });
128
- const {
185
+ const _b = viewPropsIn, {
129
186
  tag,
130
187
  hitSlop,
131
188
  asChild,
132
189
  children,
133
- pointerEvents,
134
190
  onPress,
135
191
  onPressIn,
136
192
  onPressOut,
137
193
  onHoverIn,
138
194
  onHoverOut,
139
- space,
140
- disabled,
195
+ space: spaceProp,
196
+ spaceDirection: _spaceDirection,
197
+ disabled: disabledProp,
198
+ onMouseUp,
199
+ onMouseDown,
141
200
  onMouseEnter,
142
201
  onMouseLeave,
143
202
  hrefAttrs,
144
- onMoveShouldSetResponder,
145
- onMoveShouldSetResponderCapture,
146
- onResponderEnd,
147
- onResponderGrant,
148
- onResponderMove,
149
- onResponderReject,
150
- onResponderRelease,
151
- onResponderStart,
152
- onResponderTerminate,
153
- onResponderTerminationRequest,
154
- onScrollShouldSetResponder,
155
- onScrollShouldSetResponderCapture,
156
- onSelectionChangeShouldSetResponder,
157
- onSelectionChangeShouldSetResponderCapture,
158
- onStartShouldSetResponder,
159
- onStartShouldSetResponderCapture,
160
- onMouseDown,
161
- nativeID,
162
- accessible,
163
- accessibilityRole,
164
- collapsable,
165
- focusable,
203
+ separator,
204
+ forceStyle: _forceStyle,
166
205
  onClick,
167
206
  theme: _themeProp,
168
- defaultVariants,
169
- onLayout,
170
- ...viewPropsRest
171
- } = viewPropsIn;
172
- let viewProps = viewPropsRest;
207
+ defaultVariants
208
+ } = _b, nonTamaguiProps = __objRest(_b, [
209
+ "tag",
210
+ "hitSlop",
211
+ "asChild",
212
+ "children",
213
+ "onPress",
214
+ "onPressIn",
215
+ "onPressOut",
216
+ "onHoverIn",
217
+ "onHoverOut",
218
+ "space",
219
+ "spaceDirection",
220
+ "disabled",
221
+ "onMouseUp",
222
+ "onMouseDown",
223
+ "onMouseEnter",
224
+ "onMouseLeave",
225
+ "hrefAttrs",
226
+ "separator",
227
+ "forceStyle",
228
+ "onClick",
229
+ "theme",
230
+ "defaultVariants"
231
+ ]);
232
+ const isTaggable = !Component || typeof Component === "string";
233
+ const element = isWeb ? isTaggable ? tag || Component : Component : Component;
234
+ const BaseTextComponent = !isWeb ? Text : element || "span";
235
+ const BaseViewComponent = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
236
+ let elementType = isText ? (isAnimated ? AnimatedText || Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || View : null) || BaseViewComponent;
237
+ elementType = Component || elementType;
238
+ const isStringElement = typeof elementType === "string";
239
+ const disabled = props.accessibilityState != null && props.accessibilityState.disabled === true || props.accessibilityDisabled;
240
+ let viewProps;
241
+ if (process.env.TAMAGUI_TARGET === "web" && !staticConfig.isReactNativeWeb) {
242
+ const _c = nonTamaguiProps, {
243
+ onMoveShouldSetResponder,
244
+ onMoveShouldSetResponderCapture,
245
+ onResponderEnd,
246
+ onResponderGrant,
247
+ onResponderMove,
248
+ onResponderReject,
249
+ onResponderRelease,
250
+ onResponderStart,
251
+ onResponderTerminate,
252
+ onResponderTerminationRequest,
253
+ onScrollShouldSetResponder,
254
+ onScrollShouldSetResponderCapture,
255
+ onSelectionChangeShouldSetResponder,
256
+ onSelectionChangeShouldSetResponderCapture,
257
+ onStartShouldSetResponder,
258
+ onStartShouldSetResponderCapture,
259
+ nativeID,
260
+ accessibilityActiveDescendant,
261
+ accessibilityAtomic,
262
+ accessibilityAutoComplete,
263
+ accessibilityBusy,
264
+ accessibilityChecked,
265
+ accessibilityColumnCount,
266
+ accessibilityColumnIndex,
267
+ accessibilityColumnSpan,
268
+ accessibilityControls,
269
+ accessibilityCurrent,
270
+ accessibilityDescribedBy,
271
+ accessibilityDetails,
272
+ accessibilityDisabled,
273
+ accessibilityErrorMessage,
274
+ accessibilityExpanded,
275
+ accessibilityFlowTo,
276
+ accessibilityHasPopup,
277
+ accessibilityHidden,
278
+ accessibilityInvalid,
279
+ accessibilityKeyShortcuts,
280
+ accessibilityLabel,
281
+ accessibilityLabelledBy,
282
+ accessibilityLevel,
283
+ accessibilityLiveRegion,
284
+ accessibilityModal,
285
+ accessibilityMultiline,
286
+ accessibilityMultiSelectable,
287
+ accessibilityOrientation,
288
+ accessibilityOwns,
289
+ accessibilityPlaceholder,
290
+ accessibilityPosInSet,
291
+ accessibilityPressed,
292
+ accessibilityReadOnly,
293
+ accessibilityRequired,
294
+ accessibilityRole,
295
+ accessibilityRoleDescription,
296
+ accessibilityRowCount,
297
+ accessibilityRowIndex,
298
+ accessibilityRowSpan,
299
+ accessibilitySelected,
300
+ accessibilitySetSize,
301
+ accessibilitySort,
302
+ accessibilityValueMax,
303
+ accessibilityValueMin,
304
+ accessibilityValueNow,
305
+ accessibilityValueText,
306
+ accessible,
307
+ accessibilityState,
308
+ accessibilityValue,
309
+ collapsable,
310
+ focusable,
311
+ onLayout
312
+ } = _c, webProps = __objRest(_c, [
313
+ "onMoveShouldSetResponder",
314
+ "onMoveShouldSetResponderCapture",
315
+ "onResponderEnd",
316
+ "onResponderGrant",
317
+ "onResponderMove",
318
+ "onResponderReject",
319
+ "onResponderRelease",
320
+ "onResponderStart",
321
+ "onResponderTerminate",
322
+ "onResponderTerminationRequest",
323
+ "onScrollShouldSetResponder",
324
+ "onScrollShouldSetResponderCapture",
325
+ "onSelectionChangeShouldSetResponder",
326
+ "onSelectionChangeShouldSetResponderCapture",
327
+ "onStartShouldSetResponder",
328
+ "onStartShouldSetResponderCapture",
329
+ "nativeID",
330
+ "accessibilityActiveDescendant",
331
+ "accessibilityAtomic",
332
+ "accessibilityAutoComplete",
333
+ "accessibilityBusy",
334
+ "accessibilityChecked",
335
+ "accessibilityColumnCount",
336
+ "accessibilityColumnIndex",
337
+ "accessibilityColumnSpan",
338
+ "accessibilityControls",
339
+ "accessibilityCurrent",
340
+ "accessibilityDescribedBy",
341
+ "accessibilityDetails",
342
+ "accessibilityDisabled",
343
+ "accessibilityErrorMessage",
344
+ "accessibilityExpanded",
345
+ "accessibilityFlowTo",
346
+ "accessibilityHasPopup",
347
+ "accessibilityHidden",
348
+ "accessibilityInvalid",
349
+ "accessibilityKeyShortcuts",
350
+ "accessibilityLabel",
351
+ "accessibilityLabelledBy",
352
+ "accessibilityLevel",
353
+ "accessibilityLiveRegion",
354
+ "accessibilityModal",
355
+ "accessibilityMultiline",
356
+ "accessibilityMultiSelectable",
357
+ "accessibilityOrientation",
358
+ "accessibilityOwns",
359
+ "accessibilityPlaceholder",
360
+ "accessibilityPosInSet",
361
+ "accessibilityPressed",
362
+ "accessibilityReadOnly",
363
+ "accessibilityRequired",
364
+ "accessibilityRole",
365
+ "accessibilityRoleDescription",
366
+ "accessibilityRowCount",
367
+ "accessibilityRowIndex",
368
+ "accessibilityRowSpan",
369
+ "accessibilitySelected",
370
+ "accessibilitySetSize",
371
+ "accessibilitySort",
372
+ "accessibilityValueMax",
373
+ "accessibilityValueMin",
374
+ "accessibilityValueNow",
375
+ "accessibilityValueText",
376
+ "accessible",
377
+ "accessibilityState",
378
+ "accessibilityValue",
379
+ "collapsable",
380
+ "focusable",
381
+ "onLayout"
382
+ ]);
383
+ viewProps = webProps;
384
+ assignNativePropsToWeb(elementType, viewProps, nonTamaguiProps);
385
+ useElementLayout(hostRef, onLayout);
386
+ useResponderEvents(hostRef, {
387
+ onMoveShouldSetResponder,
388
+ onMoveShouldSetResponderCapture,
389
+ onResponderEnd,
390
+ onResponderGrant,
391
+ onResponderMove,
392
+ onResponderReject,
393
+ onResponderRelease,
394
+ onResponderStart,
395
+ onResponderTerminate,
396
+ onResponderTerminationRequest,
397
+ onScrollShouldSetResponder,
398
+ onScrollShouldSetResponderCapture,
399
+ onSelectionChangeShouldSetResponder,
400
+ onSelectionChangeShouldSetResponderCapture,
401
+ onStartShouldSetResponder,
402
+ onStartShouldSetResponderCapture
403
+ });
404
+ const platformMethodsRef = usePlatformMethods(viewProps);
405
+ const setRef = useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
406
+ viewProps.ref = setRef;
407
+ if (props.href != void 0 && hrefAttrs != void 0) {
408
+ const { download, rel, target } = hrefAttrs;
409
+ if (download != null) {
410
+ viewProps.download = download;
411
+ }
412
+ if (rel != null) {
413
+ viewProps.rel = rel;
414
+ }
415
+ if (typeof target === "string") {
416
+ viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
417
+ }
418
+ }
419
+ const _focusable = focusable != void 0 ? focusable : accessible;
420
+ const role = viewProps.role;
421
+ if (_focusable === false) {
422
+ viewProps.tabIndex = "-1";
423
+ }
424
+ if (elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea") {
425
+ if (_focusable === false || accessibilityDisabled === true) {
426
+ viewProps.tabIndex = "-1";
427
+ }
428
+ } else if (role === "button" || role === "checkbox" || role === "link" || role === "radio" || role === "textbox" || role === "switch") {
429
+ if (_focusable !== false) {
430
+ viewProps.tabIndex = "0";
431
+ }
432
+ }
433
+ if (_focusable === true) {
434
+ viewProps.tabIndex = "0";
435
+ }
436
+ } else {
437
+ viewProps = nonTamaguiProps;
438
+ if (forwardedRef) {
439
+ viewProps.ref = forwardedRef;
440
+ }
441
+ }
173
442
  if (process.env.NODE_ENV === "development" && !isText && isWeb) {
174
443
  Children.toArray(props.children).forEach((item) => {
175
444
  if (typeof item === "string") {
@@ -177,8 +446,6 @@ function createComponent(configIn, ParentComponent) {
177
446
  }
178
447
  });
179
448
  }
180
- const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
181
- const hostRef = useRef(null);
182
449
  const internal = useRef();
183
450
  if (!internal.current) {
184
451
  internal.current = {
@@ -193,133 +460,76 @@ function createComponent(configIn, ParentComponent) {
193
460
  }
194
461
  internal.current.isMounted = true;
195
462
  return () => {
463
+ var _a2;
196
464
  mouseUps.delete(unPress);
197
465
  internal.current.isMounted = false;
466
+ (_a2 = internal.current.unmountEffects) == null ? void 0 : _a2.forEach((cb) => cb());
198
467
  };
199
468
  }, [hasEnterStyle, props.animation]);
200
- if (nativeID) {
201
- viewProps.id = nativeID;
202
- }
203
- if (isAndroid) {
204
- if (collapsable)
205
- viewProps.collapsable = collapsable;
206
- if (focusable)
207
- viewProps.focusable = focusable;
208
- }
209
- if (!isWeb) {
210
- if (accessible)
211
- viewProps.accessible = accessible;
212
- if (accessibilityRole)
213
- viewProps.accessibilityRole = accessibilityRole;
214
- }
215
- if (isWeb && !asChild) {
216
- rnw.useResponderEvents(hostRef, {
217
- onMoveShouldSetResponder,
218
- onMoveShouldSetResponderCapture,
219
- onResponderEnd,
220
- onResponderGrant,
221
- onResponderMove,
222
- onResponderReject,
223
- onResponderRelease,
224
- onResponderStart,
225
- onResponderTerminate,
226
- onResponderTerminationRequest,
227
- onScrollShouldSetResponder,
228
- onScrollShouldSetResponderCapture,
229
- onSelectionChangeShouldSetResponder,
230
- onSelectionChangeShouldSetResponderCapture,
231
- onStartShouldSetResponder,
232
- onStartShouldSetResponderCapture
233
- });
234
- }
235
- const isTaggable = !Component || typeof Component === "string";
236
- const element = isWeb ? isTaggable ? tag || Component : Component : Component;
237
- const BaseTextComponent = !isWeb ? Text : element || "span";
238
- const BaseViewComponent = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
239
- let ViewComponent = isText ? (isAnimated ? AnimatedText || Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || View : null) || BaseViewComponent;
240
- ViewComponent = Component || ViewComponent;
241
469
  let styles;
242
- const isStringElement = typeof ViewComponent === "string";
243
470
  const animationStyles = state.animation ? state.animation.style : null;
244
- if (isStringElement && shouldAvoidClasses) {
245
- styles = {
246
- ...defaultNativeStyle,
247
- ...animationStyles,
248
- ...medias
249
- };
471
+ if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {
472
+ styles = __spreadValues(__spreadValues(__spreadValues({}, defaultNativeStyle), animationStyles ?? style), medias);
250
473
  } else {
251
474
  styles = [
252
475
  isWeb ? null : defaultNativeStyleSheet ? defaultNativeStyleSheet.base : null,
253
- animationStyles ? animationStyles : style,
476
+ animationStyles ?? style,
254
477
  medias
255
478
  ];
256
479
  if (!animationStyles) {
257
- !state.mounted && addPseudoToStyles(styles, "enterStyle", pseudos);
258
- state.hover && addPseudoToStyles(styles, "hoverStyle", pseudos);
259
- state.focus && addPseudoToStyles(styles, "focusStyle", pseudos);
260
- state.press && addPseudoToStyles(styles, "pressStyle", pseudos);
480
+ const initPseudos = initialSplitStyles.pseudos;
481
+ const force = shouldForcePseudo;
482
+ !state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
483
+ state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle", force);
484
+ state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle", force);
485
+ state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle", force);
261
486
  }
262
- }
263
- if (isWeb) {
264
- if (!shouldAvoidClasses) {
265
- const fontFamilyName = isText ? props.fontFamily || staticConfig.defaultProps.fontFamily : null;
266
- const fontFamily = fontFamilyName && fontFamilyName[0] === "$" ? fontFamilyName.slice(1) : null;
267
- const classList = [
268
- componentName ? componentClassName : "",
269
- fontFamily ? `font_${fontFamily}` : "",
270
- theme.className,
271
- classNames ? Object.values(classNames).join(" ") : ""
272
- ];
273
- const className = classList.join(" ");
274
- if (process.env.NODE_ENV === "development") {
275
- if (props["debug"]) {
276
- 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]])) });
487
+ if (shouldForcePseudo) {
488
+ const next = {};
489
+ for (const style2 of styles) {
490
+ if (style2) {
491
+ Object.assign(next, style2);
277
492
  }
278
493
  }
279
- viewProps.className = className;
280
- viewProps.style = animationStyles;
281
- } else {
282
- viewProps.style = styles;
494
+ Object.assign(splitStyles.style, next);
283
495
  }
284
- } else {
285
- viewProps.style = styles;
286
- }
287
- if (pointerEvents) {
288
- viewProps.pointerEvents = pointerEvents;
289
496
  }
290
- if (isWeb) {
291
- const platformMethodsRef = rnw.usePlatformMethods(viewProps);
292
- const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
293
- if (!isAnimated) {
294
- viewProps.ref = setRef;
295
- } else {
296
- if (forwardedRef) {
297
- viewProps.ref = forwardedRef;
298
- }
299
- }
300
- if (props.href != null && hrefAttrs != null) {
301
- const { download, rel, target } = hrefAttrs;
302
- if (download != null) {
303
- viewProps.download = download;
304
- }
305
- if (rel != null) {
306
- viewProps.rel = rel;
307
- }
308
- if (typeof target === "string") {
309
- viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
497
+ if (process.env.TAMAGUI_TARGET === "web") {
498
+ const fontFamilyName = isText ? props.fontFamily || staticConfig.defaultProps.fontFamily : null;
499
+ const fontFamily = fontFamilyName && fontFamilyName[0] === "$" ? fontFamilyName.slice(1) : null;
500
+ const classList = [
501
+ componentName ? componentClassName : "",
502
+ fontFamily ? `font_${fontFamily}` : "",
503
+ theme.className,
504
+ classNames ? Object.values(classNames).join(" ") : ""
505
+ ];
506
+ const className = classList.join(" ");
507
+ const style2 = animationStyles ?? splitStyles.style;
508
+ const isAnimatedReactNativeWeb = props.animation && avoidClasses;
509
+ if (staticConfig.isReactNativeWeb || isAnimatedReactNativeWeb) {
510
+ viewProps.dataSet = __spreadProps(__spreadValues({}, viewProps.dataSet), {
511
+ className,
512
+ id: props.id
513
+ });
514
+ if (props["data-is"]) {
515
+ viewProps.dataSet.is = props["data-is"];
310
516
  }
517
+ } else {
518
+ viewProps.className = className;
311
519
  }
520
+ viewProps.style = style2;
312
521
  } else {
313
- if (forwardedRef) {
314
- viewProps.ref = forwardedRef;
315
- }
522
+ viewProps.style = styles;
316
523
  }
317
524
  const initialPseudos = initialSplitStyles.pseudos;
318
- const attachPress = !!(pseudos && pseudos.pressStyle || initialPseudos && initialPseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
525
+ const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
319
526
  const isTouch = useIsTouchDevice();
320
527
  const isHoverable = isWeb && !isTouch;
321
528
  const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
322
- const pressEventKey = isStringElement ? "onClick" : "onPress";
529
+ const handlesPressEvents = !isStringElement && !asChild;
530
+ const pressKey = handlesPressEvents ? "onPress" : "onClick";
531
+ const pressInKey = handlesPressEvents ? "onPressIn" : "onMouseDown";
532
+ const pressOutKey = handlesPressEvents ? "onPressOut" : "onMouseUp";
323
533
  const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props));
324
534
  const unPress = useCallback(() => {
325
535
  if (!internal.current.isMounted)
@@ -329,46 +539,45 @@ function createComponent(configIn, ParentComponent) {
329
539
  pressIn: false
330
540
  });
331
541
  }, []);
332
- const events = shouldAttach ? {
333
- ...!isWeb && {
334
- onPressOut: (e) => {
335
- unPress();
336
- onPressOut == null ? void 0 : onPressOut(e);
542
+ const events = shouldAttach ? __spreadValues(__spreadProps(__spreadValues({
543
+ [pressOutKey]: attachPress ? (e) => {
544
+ unPress();
545
+ onPressOut == null ? void 0 : onPressOut(e);
546
+ onMouseUp == null ? void 0 : onMouseUp(e);
547
+ } : void 0
548
+ }, isHoverable && {
549
+ onMouseEnter: attachHover ? (e) => {
550
+ const next = {};
551
+ if (attachHover) {
552
+ next.hover = true;
337
553
  }
338
- },
339
- ...isHoverable && {
340
- onMouseEnter: attachHover ? (e) => {
341
- let next = {};
342
- if (attachHover) {
343
- next.hover = true;
344
- }
345
- if (state.pressIn) {
346
- next.press = true;
347
- }
348
- if (Object.keys(next).length) {
349
- setStateShallow(next);
350
- }
351
- onHoverIn == null ? void 0 : onHoverIn(e);
352
- onMouseEnter == null ? void 0 : onMouseEnter(e);
353
- } : void 0,
354
- onMouseLeave: attachHover ? (e) => {
355
- let next = {};
356
- mouseUps.add(unPress);
357
- if (attachHover) {
358
- next.hover = false;
359
- }
360
- if (state.pressIn) {
361
- next.press = false;
362
- next.pressIn = false;
363
- }
364
- if (Object.keys(next).length) {
365
- setStateShallow(next);
366
- }
367
- onHoverOut == null ? void 0 : onHoverOut(e);
368
- onMouseLeave == null ? void 0 : onMouseLeave(e);
369
- } : void 0
370
- },
371
- onMouseDown: attachPress ? (e) => {
554
+ if (state.pressIn) {
555
+ next.press = true;
556
+ }
557
+ if (Object.keys(next).length) {
558
+ setStateShallow(next);
559
+ }
560
+ onHoverIn == null ? void 0 : onHoverIn(e);
561
+ onMouseEnter == null ? void 0 : onMouseEnter(e);
562
+ } : void 0,
563
+ onMouseLeave: attachHover ? (e) => {
564
+ const next = {};
565
+ mouseUps.add(unPress);
566
+ if (attachHover) {
567
+ next.hover = false;
568
+ }
569
+ if (state.pressIn) {
570
+ next.press = false;
571
+ next.pressIn = false;
572
+ }
573
+ if (Object.keys(next).length) {
574
+ setStateShallow(next);
575
+ }
576
+ onHoverOut == null ? void 0 : onHoverOut(e);
577
+ onMouseLeave == null ? void 0 : onMouseLeave(e);
578
+ } : void 0
579
+ }), {
580
+ [pressInKey]: attachPress ? (e) => {
372
581
  setStateShallow({
373
582
  press: true,
374
583
  pressIn: true
@@ -379,83 +588,145 @@ function createComponent(configIn, ParentComponent) {
379
588
  mouseUps.add(unPress);
380
589
  }
381
590
  } : null,
382
- [pressEventKey]: attachPress ? (e) => {
591
+ [pressKey]: attachPress ? (e) => {
592
+ unPress();
383
593
  onClick == null ? void 0 : onClick(e);
384
594
  onPress == null ? void 0 : onPress(e);
385
- unPress();
386
- onPressOut == null ? void 0 : onPressOut(e);
387
595
  } : null
388
- } : null;
596
+ }), !isWeb && {
597
+ cancelable: !props.rejectResponderTermination,
598
+ disabled: props.disabled !== null ? props.disabled : (_d = props.accessibilityState) == null ? void 0 : _d.disabled,
599
+ hitSlop: props.hitSlop,
600
+ delayLongPress: props.delayLongPress,
601
+ delayPressIn: props.delayPressIn,
602
+ delayPressOut: props.delayPressOut,
603
+ focusable: viewProps.focusable ?? true,
604
+ minPressDuration: 0
605
+ }) : null;
606
+ let space = spaceProp;
607
+ if (features.enabled.mediaQuery) {
608
+ for (const key in mediaState) {
609
+ if (!mediaState[key])
610
+ continue;
611
+ if (props[key] && props[key].space !== void 0) {
612
+ space = props[key].space;
613
+ }
614
+ }
615
+ }
389
616
  const childEls = !children || asChild ? children : wrapThemeManagerContext(spacedChildren({
617
+ separator,
390
618
  children,
391
619
  space,
392
- flexDirection: props.flexDirection || ((_b = staticConfig.defaultProps) == null ? void 0 : _b.flexDirection),
620
+ direction: props.spaceDirection || "both",
393
621
  isZStack
394
622
  }), getThemeManagerIfChanged(theme));
395
- const [pressProps] = usePressable(events ? {
396
- disabled,
397
- ...hitSlop && {
398
- hitSlop
399
- },
400
- onPressIn: events.onMouseDown,
401
- onPressOut: events.onPressOut,
402
- onPress: events[pressEventKey]
403
- } : {
404
- disabled: true
405
- });
406
623
  let content;
624
+ if (asChild) {
625
+ elementType = Slot;
626
+ viewProps = __spreadProps(__spreadValues({}, viewProps), {
627
+ onPress,
628
+ onPressIn,
629
+ onPressOut
630
+ });
631
+ }
407
632
  if (isWeb) {
408
- if (staticConfig.isReactNativeWeb) {
409
- viewProps.dataSet = {
410
- ...viewProps.dataSet,
411
- className: viewProps.className
412
- };
413
- } else {
414
- const rnProps = rnw.createDOMProps(viewProps);
415
- const className = rnProps.className && rnProps.className !== viewProps.className ? `${rnProps.className} ${viewProps.className}` : viewProps.className;
416
- Object.assign(viewProps, rnProps);
417
- if (className) {
418
- viewProps.className = className;
633
+ const [pressableProps] = usePressable(events ? __spreadProps(__spreadValues({
634
+ disabled
635
+ }, hitSlop && {
636
+ hitSlop
637
+ }), {
638
+ onPressOut: events[pressOutKey],
639
+ onPressIn: events[pressInKey],
640
+ onPress: events[pressKey]
641
+ }) : {
642
+ disabled: true
643
+ });
644
+ if (events) {
645
+ if (handlesPressEvents) {
646
+ Object.assign(viewProps, pressableProps);
647
+ } else {
648
+ Object.assign(viewProps, events);
419
649
  }
420
650
  }
421
651
  }
422
- if (events) {
423
- if (!isStringElement) {
424
- Object.assign(viewProps, pressProps);
425
- } else {
426
- Object.assign(viewProps, events);
652
+ if (process.env.TAMAGUI_TARGET === "native") {
653
+ const attachFocus = !!(pseudos && pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
654
+ if (attachFocus) {
655
+ viewProps.onFocus = mergeEvent(viewProps.onFocus, () => {
656
+ setStateShallow({ focus: true });
657
+ });
658
+ viewProps.onBlur = mergeEvent(viewProps.onBlur, () => {
659
+ setStateShallow({ focus: false });
660
+ });
427
661
  }
428
662
  }
429
- if (asChild) {
430
- ViewComponent = Slot;
431
- const onlyChild = React.Children.only(children);
432
- Object.assign(viewProps, onlyChild.props);
433
- }
434
- content = createElement(ViewComponent, viewProps, childEls);
435
- if (isWeb && events && attachHover) {
436
- content = /* @__PURE__ */ React.createElement("span", {
437
- className: "tui_Hoverable",
438
- style: {
439
- display: "contents"
440
- },
441
- onMouseEnter: events.onMouseEnter,
442
- onMouseLeave: events.onMouseLeave
443
- }, content);
663
+ if (process.env.TAMAGUI_TARGET === "native") {
664
+ const pressability = useMemo(() => {
665
+ if (attachPress && events) {
666
+ const pressability2 = new Pressability(events);
667
+ internal.current.unmountEffects = [
668
+ () => {
669
+ pressability2.reset();
670
+ }
671
+ ];
672
+ return pressability2;
673
+ }
674
+ }, []);
675
+ if (attachPress && events) {
676
+ pressability.configure(events);
677
+ const eventHandlers = pressability.getEventHandlers();
678
+ for (const key in eventHandlers) {
679
+ if (key === "onBlur" || key === "onFocus") {
680
+ continue;
681
+ }
682
+ const og = props[key];
683
+ const val = eventHandlers[key];
684
+ viewProps[key] = og ? composeEventHandlers(og, val) : val;
685
+ }
686
+ }
687
+ }
688
+ content = createElement(elementType, viewProps, childEls);
689
+ if (process.env.TAMAGUI_TARGET === "web") {
690
+ const isAnimatedRNWView = isAnimated && typeof elementType !== "string";
691
+ const shouldWrapWithComponentTheme = isAnimatedRNWView && getReturnVariablesAs(props, splitStyleState) === "non-color-value";
692
+ const shouldWrapWithHover = events && attachHover;
693
+ if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
694
+ const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
695
+ const hoverClassName = shouldWrapWithHover ? "t_Hoverable" : "";
696
+ content = /* @__PURE__ */ React.createElement("span", __spreadValues({
697
+ className: `${hoverClassName} ${themeClassName}`,
698
+ style: {
699
+ display: "contents"
700
+ }
701
+ }, shouldWrapWithHover && {
702
+ onMouseEnter: events.onMouseEnter,
703
+ onMouseLeave: events.onMouseLeave
704
+ }), content);
705
+ }
444
706
  }
445
707
  if (process.env.NODE_ENV === "development") {
446
708
  if (props["debug"]) {
447
- viewProps["debug"] = true;
448
- console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
709
+ console.groupCollapsed(elementType, `props out`, viewProps);
710
+ for (const key in viewProps) {
711
+ console.log(key, viewProps[key]);
712
+ }
713
+ console.groupEnd();
714
+ if (typeof window !== "undefined") {
715
+ console.log(__spreadValues({ state, viewProps, splitStyles, animationStyles, isStringElement, classNamesIn: (_e = props.className) == null ? void 0 : _e.split(" "), classNamesOut: (_f = viewProps.className) == null ? void 0 : _f.split(" "), events, shouldAttach, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles }, typeof window !== "undefined" ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo, classNames: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) } : null));
716
+ }
717
+ console.groupEnd();
449
718
  }
450
719
  }
451
- if (features.length) {
452
- return /* @__PURE__ */ React.createElement(React.Fragment, null, features, content);
720
+ if (features.elements.length) {
721
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, features.elements, content);
453
722
  }
454
723
  return content;
455
724
  });
456
- component.displayName = staticConfig.componentName;
725
+ if (staticConfig.componentName) {
726
+ component.displayName = staticConfig.componentName;
727
+ }
457
728
  onConfiguredOnce((conf) => {
458
- var _a, _b, _c, _d;
729
+ var _a, _b, _c;
459
730
  if (process.env.IS_STATIC === "is_static") {
460
731
  return;
461
732
  }
@@ -465,7 +736,18 @@ function createComponent(configIn, ParentComponent) {
465
736
  AnimatedText = (_b = tamaguiConfig.animations) == null ? void 0 : _b.Text;
466
737
  AnimatedView = (_c = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _c.View;
467
738
  initialTheme = initialTheme || proxyThemeVariables(conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]);
468
- initialSplitStyles = insertSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
739
+ const config = getConfig();
740
+ let defaultPropsIn = staticConfig.defaultProps || {};
741
+ const parentNames = [...staticConfig.parentNames || [], staticConfig.componentName];
742
+ if (config.defaultProps && parentNames && staticConfig.componentName) {
743
+ defaultPropsIn = mergeConfigDefaultProps(staticConfig.componentName, defaultPropsIn, config.defaultProps, parentNames);
744
+ }
745
+ const debug = process.env.NODE_ENV === "development" ? defaultPropsIn["debug"] : false;
746
+ if (process.env.NODE_ENV === "development" && debug === "break") {
747
+ debugger;
748
+ }
749
+ const [parentProps, parentClassNames] = mergeProps(defaultPropsIn, {}, true);
750
+ initialSplitStyles = insertSplitStyles(parentProps, staticConfig, initialTheme, {
469
751
  mounted: true,
470
752
  hover: false,
471
753
  press: false,
@@ -473,28 +755,36 @@ function createComponent(configIn, ParentComponent) {
473
755
  focus: false,
474
756
  resolveVariablesAs: "both",
475
757
  keepVariantsAsProps: true
476
- });
477
- const { style, viewProps } = initialSplitStyles;
758
+ }, void 0, debug);
759
+ const [defaults, defaultsClassnames] = mergeProps(component.defaultProps, initialSplitStyles.viewProps, true);
760
+ initialSplitStyles.classNames = __spreadValues(__spreadValues(__spreadValues({}, parentClassNames), defaultsClassnames), initialSplitStyles.classNames);
478
761
  defaultNativeStyle = {};
479
- for (const key in style) {
480
- const v = style[key];
481
- defaultNativeStyle[key] = isVariable(v) ? v.val : v;
762
+ const validStyles2 = staticConfig.validStyles || stylePropsView;
763
+ if (!isWeb) {
764
+ for (const key in staticConfig.defaultProps) {
765
+ const val = staticConfig.defaultProps[key];
766
+ if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
767
+ defaults[key] = val;
768
+ } else {
769
+ defaultNativeStyle[key] = val;
770
+ }
771
+ }
482
772
  }
483
773
  defaultNativeStyleSheet = StyleSheet.create({
484
774
  base: defaultNativeStyle
485
775
  });
486
- const defaults = {
487
- ...viewProps,
488
- ...component.defaultProps
489
- };
490
776
  if (Object.keys(defaults).length) {
491
777
  tamaguiDefaultProps = defaults;
492
778
  }
493
- if (process.env.NODE_ENV === "development" && ((_d = staticConfig.defaultProps) == null ? void 0 : _d.debug)) {
779
+ if (process.env.NODE_ENV === "development" && debug) {
494
780
  if (process.env.IS_STATIC !== "is_static") {
495
781
  console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
496
782
  staticConfig,
497
- initialSplitStyles
783
+ initialSplitStyles,
784
+ tamaguiDefaultProps,
785
+ defaultNativeStyle,
786
+ defaults,
787
+ defaultPropsIn
498
788
  });
499
789
  }
500
790
  }
@@ -503,41 +793,37 @@ function createComponent(configIn, ParentComponent) {
503
793
  if (configIn.memo) {
504
794
  res = memo(res);
505
795
  }
506
- res["staticConfig"] = {
507
- validStyles: staticConfig.validStyles || stylePropsView,
508
- ...staticConfig
509
- };
510
- if (process.env.NODE_ENV === "development") {
511
- res["whyDidYouRender"] = true;
512
- }
513
- res["extractable"] = (Component, conf) => {
514
- Component["staticConfig"] = extendStaticConfig({
515
- Component,
516
- ...conf,
796
+ res.staticConfig = __spreadValues({
797
+ validStyles: staticConfig.validStyles || stylePropsView
798
+ }, staticConfig);
799
+ res.extractable = (Component, conf) => {
800
+ Component.staticConfig = extendStaticConfig(__spreadProps(__spreadValues({
801
+ Component
802
+ }, conf), {
517
803
  neverFlatten: true,
518
- defaultProps: {
519
- ...Component.defaultProps,
520
- ...conf == null ? void 0 : conf.defaultProps
521
- }
522
- }, res);
804
+ isExtractable: true,
805
+ defaultProps: __spreadValues(__spreadValues({}, Component.defaultProps), conf == null ? void 0 : conf.defaultProps)
806
+ }), res);
523
807
  return Component;
524
808
  };
525
809
  return res;
526
810
  }
527
- __name(createComponent, "createComponent");
811
+ const Unspaced = (props) => {
812
+ return props.children;
813
+ };
814
+ Unspaced["isUnspaced"] = true;
528
815
  const Spacer = createComponent({
529
816
  memo: true,
530
817
  componentName: "Spacer",
531
- defaultProps: {
532
- ...stackDefaultStyles,
818
+ validStyles,
819
+ defaultProps: __spreadProps(__spreadValues({}, stackDefaultStyles), {
533
820
  size: true
534
- },
821
+ }),
535
822
  variants: {
536
823
  size: {
537
824
  "...size": (size, { tokens }) => {
538
- var _a;
539
825
  size = size == true ? "$true" : size;
540
- const sizePx = (_a = tokens.size[size]) != null ? _a : size;
826
+ const sizePx = tokens.space[size] ?? size;
541
827
  return {
542
828
  width: sizePx,
543
829
  height: sizePx,
@@ -548,7 +834,7 @@ const Spacer = createComponent({
548
834
  },
549
835
  flex: {
550
836
  true: {
551
- flex: 1
837
+ flexGrow: 1
552
838
  }
553
839
  },
554
840
  direction: {
@@ -559,73 +845,161 @@ const Spacer = createComponent({
559
845
  vertical: {
560
846
  width: 0,
561
847
  minWidth: 0
562
- }
848
+ },
849
+ both: {}
563
850
  }
851
+ },
852
+ defaultVariants: {
853
+ direction: "both"
564
854
  }
565
855
  });
566
856
  function spacedChildren({
567
857
  isZStack,
568
858
  children,
569
859
  space,
570
- flexDirection,
571
- spaceFlex
860
+ direction,
861
+ spaceFlex,
862
+ separator
572
863
  }) {
573
- var _a;
864
+ const hasSpace = !!(space || spaceFlex);
865
+ const hasSeparator = !(separator === void 0 || separator === null);
866
+ if (!hasSpace && !hasSeparator && !isZStack) {
867
+ return children;
868
+ }
574
869
  const childrenList = Children.toArray(children);
575
- const len = childrenList.length;
576
- if (len === 1) {
870
+ if (childrenList.length <= 1 && !isZStack) {
577
871
  return childrenList;
578
872
  }
579
- const next = [];
873
+ const final = [];
580
874
  for (const [index, child] of childrenList.entries()) {
581
- if (child === null || child === void 0) {
582
- continue;
583
- }
584
- if (!child || child["key"] && !isZStack) {
585
- next.push(child);
875
+ const isEmpty = child === null || child === void 0 || Array.isArray(child) && child.length === 0;
876
+ if (isEmpty || !child || child["key"] && !isZStack) {
877
+ final.push(child);
586
878
  } else {
587
- next.push(/* @__PURE__ */ React.createElement(Fragment, {
879
+ final.push(/* @__PURE__ */ React.createElement(Fragment, {
588
880
  key: index
589
881
  }, isZStack ? /* @__PURE__ */ React.createElement(AbsoluteFill, null, child) : child));
590
882
  }
591
- if ((_a = child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) {
883
+ if (isUnspaced(child) && index === 0) {
884
+ continue;
885
+ }
886
+ if (isZStack) {
592
887
  continue;
593
888
  }
594
- if (index !== len - 1) {
595
- if (space) {
596
- next.push(/* @__PURE__ */ React.createElement(Spacer, {
889
+ const next = childrenList[index + 1];
890
+ if (next && !isUnspaced(next)) {
891
+ if (separator) {
892
+ if (hasSpace) {
893
+ final.push(createSpacer({
894
+ key: `_${index}_before_sep_spacer`,
895
+ direction,
896
+ space,
897
+ spaceFlex
898
+ }));
899
+ }
900
+ final.push(React.isValidElement(separator) ? React.cloneElement(separator, { key: `sep_${index}` }) : separator);
901
+ if (hasSpace) {
902
+ final.push(createSpacer({
903
+ key: `_${index}_after_sep_spacer`,
904
+ direction,
905
+ space,
906
+ spaceFlex
907
+ }));
908
+ }
909
+ } else {
910
+ final.push(createSpacer({
597
911
  key: `_${index}_spacer`,
598
- direction: flexDirection === "row" || flexDirection === "row-reverse" ? "horizontal" : "vertical",
599
- size: space,
600
- ...spaceFlex && {
601
- flex: spaceFlex
602
- }
912
+ direction,
913
+ space,
914
+ spaceFlex
603
915
  }));
604
916
  }
605
917
  }
606
918
  }
607
- return next;
919
+ return final;
920
+ }
921
+ function createSpacer({ key, direction, space, spaceFlex }) {
922
+ return /* @__PURE__ */ React.createElement(Spacer, __spreadValues({
923
+ key,
924
+ size: space,
925
+ direction
926
+ }, spaceFlex && {
927
+ flex: spaceFlex
928
+ }));
929
+ }
930
+ function isUnspaced(child) {
931
+ var _a, _b;
932
+ return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]);
608
933
  }
609
- __name(spacedChildren, "spacedChildren");
610
934
  function AbsoluteFill(props) {
611
- return isWeb ? /* @__PURE__ */ React.createElement("div", {
612
- style: {
613
- position: "absolute",
614
- top: 0,
615
- left: 0,
616
- right: 0,
617
- bottom: 0
618
- }
619
- }, props.children) : /* @__PURE__ */ React.createElement(View, {
935
+ return /* @__PURE__ */ React.createElement(View, {
936
+ pointerEvents: "box-none",
620
937
  style: StyleSheet.absoluteFill
621
- }, props.child);
938
+ }, props.children);
939
+ }
940
+ function processIDRefList(idRefList) {
941
+ return Array.isArray(idRefList) ? idRefList.join(" ") : idRefList;
942
+ }
943
+ const accessibilityRoleToWebRole = {
944
+ adjustable: "slider",
945
+ button: "button",
946
+ header: "heading",
947
+ image: "img",
948
+ imagebutton: null,
949
+ keyboardkey: null,
950
+ label: null,
951
+ link: "link",
952
+ none: "presentation",
953
+ search: "search",
954
+ summary: "region",
955
+ text: null
956
+ };
957
+ function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
958
+ const pseudoStyle = pseudos[name];
959
+ const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
960
+ const defaultPseudoStyle = initialPseudos[name];
961
+ const style = defaultPseudoStyle ? __spreadValues(__spreadValues({}, defaultPseudoStyle), pseudoStyle) : pseudoStyle;
962
+ if (style) {
963
+ styles.push(shouldNestObject && !force ? { [name]: style } : style);
964
+ }
965
+ }
966
+ const DefaultProps = /* @__PURE__ */ new Map();
967
+ function mergeConfigDefaultProps(name, props, configDefaults, parentNames) {
968
+ const len = parentNames.length;
969
+ let prev;
970
+ for (let i = 0; i < len; i++) {
971
+ const n = parentNames[i];
972
+ if (!n)
973
+ continue;
974
+ if (DefaultProps.has(n)) {
975
+ prev = DefaultProps.get(n);
976
+ continue;
977
+ }
978
+ const props2 = configDefaults[n];
979
+ if (!props2) {
980
+ if (prev) {
981
+ DefaultProps.set(n, prev);
982
+ }
983
+ continue;
984
+ }
985
+ prev = mergeProps(prev || {}, props2)[0];
986
+ console.log("set prev", prev);
987
+ DefaultProps.set(n, prev);
988
+ }
989
+ const ourDefaultsMerged = DefaultProps.get(name);
990
+ if (ourDefaultsMerged) {
991
+ return mergeProps(props, ourDefaultsMerged)[0];
992
+ }
993
+ return props;
622
994
  }
623
- __name(AbsoluteFill, "AbsoluteFill");
624
995
  export {
625
996
  AbsoluteFill,
626
997
  Spacer,
998
+ Unspaced,
999
+ accessibilityRoleToWebRole,
627
1000
  createComponent,
628
1001
  mouseUps,
1002
+ processIDRefList,
629
1003
  spacedChildren
630
1004
  };
631
1005
  //# sourceMappingURL=createComponent.js.map