@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,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/types.tsx"],
4
- "sourcesContent": ["// TODO split this into own package @tamagui/types to share with animations packages\n\nimport CSS from 'csstype'\nimport React from 'react'\nimport {\n GestureResponderEvent,\n Image,\n TextProps as ReactTextProps,\n Text,\n TextInput,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport { Variable } from './createVariable'\nimport { ResolveVariableTypes } from './helpers/createPropMapper'\nimport { RNWTextProps, RNWViewProps } from './types-rnw'\nimport { ThemeProviderProps } from './views/ThemeProvider'\n\nexport type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<\n Props & React.RefAttributes<Ref>\n>\n\nexport type ConfigListener = (conf: TamaguiInternalConfig) => void\n\n// to prevent things from going circular, hoisting some types in this file\n// to generally order them as building up towards TamaguiConfig\n\nexport type VariableVal = number | string | Variable\nexport type VariableColorVal = string | Variable\n\ntype GenericKey = string | number | symbol\n\nexport interface CreateTokens<Val extends VariableVal = VariableVal> {\n color: { [key: GenericKey]: Val }\n space: { [key: GenericKey]: Val }\n size: { [key: GenericKey]: Val }\n radius: { [key: GenericKey]: Val }\n zIndex: { [key: GenericKey]: Val }\n}\n\nexport type TamaguiBaseTheme = {\n // defined for our tamagui kit , we could do this inside `tamagui`\n // but maybe helpful to have some sort of universally shared things +\n // + enforce if they want their own, redefine in their design sys\n background: VariableColorVal\n backgroundHover: VariableColorVal\n backgroundPress: VariableColorVal\n backgroundFocus: VariableColorVal\n color: VariableColorVal\n colorHover: VariableColorVal\n colorPress: VariableColorVal\n colorFocus: VariableColorVal\n borderColor: VariableColorVal\n borderColorHover: VariableColorVal\n borderColorPress: VariableColorVal\n borderColorFocus: VariableColorVal\n shadowColor: VariableColorVal\n shadowColorHover: VariableColorVal\n shadowColorPress: VariableColorVal\n shadowColorFocus: VariableColorVal\n}\n\ntype GenericTokens = CreateTokens\ntype GenericThemes = {\n [key: string]:\n | Partial<TamaguiBaseTheme> & {\n [key: string]: VariableVal\n }\n}\ntype GenericShorthands = {\n // [key: string]: string\n}\n\ntype GenericMedia<K extends string = string> = {\n // name => media shorthand name (camelCase) => value\n [key in K]: {\n [key: string]: number | string\n }\n}\n\ntype GenericFonts = {\n [key: string]: GenericFont\n}\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\n}\n\n// this is the \"main\" typed object, which users re-define\n// (internal) keep all types directly on this object and reference them from elsewhere\n//\n// const config = createTamagui(...)\n// type MyConfig = typeof config\n// declare module 'tamagui' {\n// export interface TamaguiCustomConfig extends MyConfig {}\n// }\n// now your whole app/kit should be typed correctly\n//\nexport interface TamaguiCustomConfig {}\n\nexport interface TamaguiConfig\n extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,\n TamaguiCustomConfig {}\n\nexport type CreateTamaguiConfig<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = Partial<Pick<ThemeProviderProps, 'defaultTheme' | 'disableRootThemeClass'>> & {\n fonts: F\n tokens: A\n themes: B\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n}\n\n// for use in creation functions so it doesnt get overwrtitten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// since TamaguiConfig will be re-declared, these will all be typed globally\nexport type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type Tokens = TamaguiConfig['tokens']\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = GetAltThemeNames<keyof Themes>\n// export type ThemeNameWithSubThemes = GetSubThemes<ThemeName>\nexport type ThemeKeys = keyof ThemeObject\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>\n\ntype GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S\n\n// this is the config generated via createTamagui()\nexport type TamaguiInternalConfig<\n A extends GenericTokens = GenericTokens,\n B extends GenericThemes = GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = CreateTamaguiConfig<A, B, C, D, E, F> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n Provider: (props: TamaguiProviderProps) => any\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokensParsed: CreateTokens<Variable>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n}\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\nexport type PropTypes<A extends TamaguiComponent> = A extends React.FunctionComponent<infer Props>\n ? Props\n : unknown\n\nexport type GenericFont<Key extends number | string = number | string> = {\n size: { [key in Key]: number | Variable }\n lineHeight: Partial<{ [key in Key]: number | Variable }>\n letterSpacing: Partial<{ [key in Key]: number | Variable }>\n weight: Partial<{ [key in Key]: number | string | Variable }>\n family: string | Variable\n style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>\n transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>\n color?: Partial<{ [key in Key]: string | Variable }>\n}\n\n// media\nexport type MediaKeys = keyof Media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaPropKeys]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\nexport type ConfigureMediaQueryOptions = {\n queries?: MediaQueries\n defaultActive?: MediaQueryKey[]\n}\n\nexport type TransformStyleProps = {\n x?: number\n y?: number\n perspective?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n skewX?: string\n skewY?: string\n matrix?: number[]\n rotate?: string\n rotateY?: string\n rotateX?: string\n rotateZ?: string\n}\n\n// createComponent props helpers\n\n// animation=\"bouncy\"\n// animation={['bouncy', { }]}\n// { all: 'name' }\n\n// TODO can override for better types\nexport type AnimationConfigType = any\n\nexport type AnimationProp =\n | AnimationKeys\n | {\n [key: string]:\n | AnimationKeys\n | {\n type: AnimationKeys\n [key: string]: any\n }\n }\n | [\n AnimationKeys,\n {\n [key: string]:\n | AnimationKeys\n | {\n type?: AnimationKeys\n [key: string]: any\n }\n }\n ]\n\n//\n// base props that are accepted by createComponent (additional to react-native-web)\n//\nexport type TamaguiComponentPropsBase = {\n asChild?: boolean\n space?: SpaceTokens\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp\n animateOnly?: string[]\n children?: any | any[]\n debug?: boolean | 'break' | 'verbose'\n disabled?: boolean\n className?: string\n id?: string\n tag?: string\n theme?: ThemeName | null\n onHoverIn?: (e: MouseEvent) => any\n onHoverOut?: (e: MouseEvent) => any\n onPress?: (e: GestureResponderEvent) => any\n onPressIn?: (e: GestureResponderEvent) => any\n onPressOut?: (e: GestureResponderEvent) => any\n // WEB ONLY\n onMouseEnter?: (e: MouseEvent) => any\n onMouseLeave?: (e: MouseEvent) => any\n onMouseDown?: (e: MouseEvent) => any\n}\n\ntype GetTokenFontKeysFor<\n A extends\n | 'size'\n | 'weight'\n | 'letterSpacing'\n | 'family'\n | 'lineHeight'\n | 'transform'\n | 'style'\n | 'color'\n> = keyof TamaguiConfig['fonts'][keyof TamaguiConfig['fonts']][A]\n\ntype GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`\n\n// base tokens\nexport type SizeTokens = GetTokenString<keyof Tokens['size']> | number\nexport type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeObject>\n | CSSColorNames\nexport type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number\nexport type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number\n\n// font tokens\nexport type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>\nexport type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number\nexport type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number\nexport type FontWeightTokens =\n | `$${GetTokenFontKeysFor<'weight'>}`\n | `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\nexport type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number\nexport type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number\nexport type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']\nexport type FontTransformTokens =\n | `$${GetTokenFontKeysFor<'transform'>}`\n | TextStyle['textTransform']\n\n//\n// adds theme short values to relevant props\n//\n\nexport type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends 'size'\n ? SizeTokens\n : K extends 'font'\n ? FontTokens\n : K extends 'fontSize'\n ? FontSizeTokens\n : K extends 'space'\n ? SpaceTokens\n : K extends 'color'\n ? ColorTokens\n : K extends 'zIndex'\n ? ZIndexTokens\n : K extends 'lineHeight'\n ? FontLineHeightTokens\n : K extends 'fontWeight'\n ? FontWeightTokens\n : K extends 'letterSpacing'\n ? FontLetterSpacingTokens\n : {}\n\ntype FontKeys = 'fontFamily'\ntype FontSizeKeys = 'fontSize'\ntype FontWeightKeys = 'fontWeight'\ntype FontLetterSpacingKeys = 'letterSpacing'\ntype LineHeightKeys = 'lineHeight'\ntype ZIndexKeys = 'zIndex'\n\nexport type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends SizeKeys\n ? SizeTokens\n : K extends FontKeys\n ? FontTokens\n : K extends FontSizeKeys\n ? FontSizeTokens\n : K extends SpaceKeys\n ? K extends 'shadowOffset'\n ? { width: SpaceTokens; height: SpaceTokens }\n : SpaceTokens\n : K extends ColorKeys\n ? ColorTokens\n : K extends ZIndexKeys\n ? ZIndexTokens\n : K extends LineHeightKeys\n ? FontLineHeightTokens\n : K extends FontWeightKeys\n ? FontWeightTokens\n : K extends FontLetterSpacingKeys\n ? FontLetterSpacingTokens\n : never\n\nexport type ThemeValueFallback = UnionableString | Variable\n\nexport type WithThemeValues<T extends object> = {\n [K in keyof T]: ThemeValueGet<K> extends never\n ? T[K]\n : ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback\n}\n\n// adds shorthand props\nexport type WithShorthands<StyleProps> = {\n [Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps\n ? StyleProps[Shorthands[Key]] | null\n : undefined\n}\n\n// adds pseudo props\nexport type PseudoProps<A> = {\n hoverStyle?: A | null\n pressStyle?: A | null\n focusStyle?: A | null\n exitStyle?: A | null\n enterStyle?: A | null\n}\n\nexport type PsuedoPropKeys = keyof PseudoProps<any>\n\nexport type PseudoStyles = {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n enterStyle?: ViewStyle\n exitStyle?: ViewStyle\n}\n\n//\n// add both theme and shorthands\n//\ntype WithThemeAndShorthands<A extends object> = WithThemeValues<A> &\n WithShorthands<WithThemeValues<A>>\n\n//\n// combines all of theme, shorthands, psuedos...\n//\ntype WithThemeShorthandsAndPseudos<A extends object> =\n | WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>\n\n//\n// ... media queries and animations\n//\ntype WithThemeShorthandsPseudosMediaAnimation<A extends object> = WithThemeShorthandsAndPseudos<A> &\n MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n//\n// Stack\n//\n\ntype WebOnlyStyleProps = {\n // WEB ONLY\n cursor?: string\n // WEB ONLY\n contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string\n // WEB ONLY values: inherit, inline, block, content\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n // WEB ONLY pointerEvents can be a style prop\n pointerEvents?: ViewProps['pointerEvents']\n}\n\nexport type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &\n TransformStyleProps &\n WebOnlyStyleProps\n\nexport type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> &\n RNWViewProps &\n TamaguiComponentPropsBase\nexport type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackPropsBaseShared & StackStyleProps\n\n//\n// Text props\n//\n\nexport type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &\n TransformStyleProps &\n WebOnlyStyleProps & {\n ellipse?: boolean\n selectable?: boolean\n textDecorationDistance?: number\n userSelect?: CSS.Properties['userSelect']\n textOverflow?: CSS.Properties['textOverflow']\n whiteSpace?: CSS.Properties['whiteSpace']\n wordWrap?: CSS.Properties['wordWrap']\n cursor?: CSS.Properties['cursor']\n }\n\nexport type TextPropsBaseShared = Omit<ReactTextProps, 'children'> &\n RNWTextProps &\n TamaguiComponentPropsBase\nexport type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextPropsBaseShared & TextStyleProps\n\n// could actually infer from parent\nexport type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<\n Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase\n>\n\n//\n// StaticComponent\n//\n\nexport type TamaguiComponent<\n Props = any,\n Ref = any,\n BaseProps = {},\n VariantProps = {}\n> = ReactComponentWithRef<Props, Ref> & StaticComponentObject\n\ntype StaticComponentObject = {\n staticConfig: StaticConfig\n /*\n * Only needed for more complex components\n * If you create a styled frame component this is a HoC to extract\n * styles from all parents.\n */\n extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X\n}\n\nexport type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {\n injectCSS?: boolean\n children?: React.ReactNode\n}\n\nexport type StaticConfigParsed = StaticConfig & {\n parsed: true\n propMapper: (\n key: string,\n value: any,\n theme: ThemeObject,\n props: any,\n resolveVariablesAs?: ResolveVariableTypes,\n avoidDefaultProps?: boolean\n ) => undefined | boolean | { [key: string]: any }\n variantsParsed?: {\n [key: string]: {\n [key: string]: any\n }\n }\n}\n\nexport type StaticConfig = {\n Component?: React.FunctionComponent<any> & StaticComponentObject\n\n variants?: {\n [key: string]: {\n [key: string]:\n | ((a: any, b: any) => any)\n | {\n [key: string]: any\n }\n }\n }\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\n /**\n * If you need to pass context or something, prevents from ever\n * flattening. The 'jsx' option means it will never flatten. if you\n * pass JSX as a children (if its purely string, it will still flatten).\n */\n neverFlatten?: boolean | 'jsx'\n\n /**\n * Determines ultimate output tag (Text vs View)\n */\n isText?: boolean\n\n /**\n * Attempts to attach focus styles at runtime (useful for native)\n */\n isInput?: boolean\n\n /**\n * React native web images need special handling for className support\n */\n isImage?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps?: any\n\n /**\n * If these props are encountered, bail on all optimization.\n */\n deoptProps?: Set<string>\n\n /**\n * If these props are encountered, leave them un-extracted.\n */\n inlineProps?: Set<string>\n\n /**\n * A bit odd, only for more advanced heirarchies.\n * Indicates that the component will set this prop so the\n * static extraction can ensure it sets them to ={undefined}\n * so they get overriddent. In the future, this can be smarter.\n */\n ensureOverriddenProp?: { [key: string]: boolean }\n\n /**\n * Auto-detected, but can ovverride. Wraps children to space them on top\n */\n isZStack?: boolean\n\n /**\n * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isReactNativeWeb?: boolean\n\n /**\n * Used internally to keep reference to the original rnw component\n */\n reactNativeWebComponent?: any\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isTamagui?: boolean\n}\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n | React.Component\n | React.ForwardRefExoticComponent<any>\n | (new (props: any) => any)\n | typeof View\n | typeof Text\n | typeof TextInput\n | typeof Image\n\nexport type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<\n any,\n any,\n infer BaseProps\n>\n ? BaseProps\n : never\n\nexport type GetProps<A extends StylableComponent> = A extends TamaguiComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? GetGenericComponentTamaguiProps<Props>\n : A extends new (props: infer Props) => any\n ? GetGenericComponentTamaguiProps<Props>\n : {}\n\ntype GetGenericComponentTamaguiProps<P> = P &\n Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>\n\nexport type SpreadKeys =\n | '...fontSize'\n | '...fontStyle'\n | '...fontTransform'\n | '...lineHeight'\n | '...letterSpacing'\n | '...size'\n | '...color'\n | '...zIndex'\n | '...theme'\n | '...radius'\n\nexport type VariantDefinitions<\n Parent extends StylableComponent = TamaguiComponent,\n MyProps extends Object = GetProps<Parent>,\n Val = any\n> = VariantDefinitionFromProps<MyProps, Val>\n\nexport type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object\n ? {\n [propName: string]:\n | VariantSpreadFunction<MyProps, Val>\n | ({\n [Key in SpreadKeys]?: Key extends '...fontSize'\n ? FontSizeVariantSpreadFunction<MyProps>\n : Key extends '...size'\n ? SizeVariantSpreadFunction<MyProps>\n : Key extends '...color'\n ? ColorVariantSpreadFunction<MyProps>\n : Key extends '...lineHeight'\n ? FontLineHeightVariantSpreadFunction<MyProps>\n : Key extends '...fontTransform'\n ? FontTransformVariantSpreadFunction<MyProps>\n : Key extends '...fontStyle'\n ? FontStyleVariantSpreadFunction<MyProps>\n : Key extends '...letterSpacing'\n ? FontLetterSpacingVariantSpreadFunction<MyProps>\n : Key extends '...zIndex'\n ? ZIndexVariantSpreadFunction<MyProps>\n : Key extends '...radius'\n ? RadiusVariantSpreadFunction<MyProps>\n : Key extends '...theme'\n ? ThemeVariantSpreadFunction<MyProps>\n : never\n } & {\n [Key in string | number]?: MyProps | VariantSpreadFunction<MyProps, Val>\n } & {\n [Key in VariantTypeKeys]?: Key extends ':number'\n ? VariantSpreadFunction<MyProps, number>\n : Key extends ':boolean'\n ? VariantSpreadFunction<MyProps, boolean>\n : Key extends ':string'\n ? VariantSpreadFunction<MyProps, string>\n : never\n })\n }\n : never\n\nexport type GetVariantProps<Variants> = {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n}\n\nexport type VariantSpreadExtras<Props> = {\n fonts: TamaguiConfig['fonts']\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: Props\n}\n\ntype PropLike = { [key: string]: any }\n\nexport type VariantSpreadFunction<Props extends PropLike, Val = any> = (\n val: Val,\n config: VariantSpreadExtras<Props>\n) =>\n | {\n [Key in keyof Props]: Props[Key] | Variable\n }\n | null\n | undefined\n\nexport type VariantTypeKeys = ':string' | ':boolean' | ':number'\n\nexport type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`\n ? ThemeValueByCategory<VariantSpread>\n : Key extends 'true' | 'false'\n ? boolean\n : Key extends ':string'\n ? string\n : Key extends ':boolean'\n ? boolean\n : Key extends ':number'\n ? number\n : Key\n\nexport type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontSizeTokens\n>\nexport type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, SizeTokens>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ColorTokens>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLineHeightTokens\n>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLetterSpacingTokens\n>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontTransformTokens\n>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>\n\n/**\n * --------------------------------------------\n * end variants\n * --------------------------------------------\n */\n\ntype SizeKeys =\n | 'width'\n | 'height'\n | 'minWidth'\n | 'minHeight'\n | 'maxWidth'\n | 'maxHeight'\n | 'shadowRadius'\n\ntype ColorKeys =\n | 'color'\n | 'backgroundColor'\n | 'borderColor'\n | 'borderBottomColor'\n | 'borderTopColor'\n | 'borderLeftColor'\n | 'borderRightColor'\n | 'shadowColor'\n | 'textShadowColor'\n\ntype SpaceKeys =\n | 'space'\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingLeft'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingEnd'\n | 'paddingStart'\n | 'margin'\n | 'marginHorizontal'\n | 'marginVertical'\n | 'marginLeft'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'marginEnd'\n | 'marginStart'\n | 'x'\n | 'y'\n | 'scale'\n | 'scaleX'\n | 'scaleY'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderTopStartRadius'\n | 'borderBottomEndRadius'\n | 'borderBottomLeftRadius'\n | 'borderBottomRightRadius'\n | 'borderBottomStartRadius'\n | 'borderBottomWidth'\n | 'borderLeftWidth'\n | 'borderRadius'\n | 'borderRightWidth'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderEndWidth'\n | 'borderStartWidth'\n | 'borderTopStartRadius'\n | 'borderTopWidth'\n | 'borderWidth'\n | 'left'\n | 'top'\n | 'right'\n | 'bottom'\n | 'shadowOffset'\n\ntype CSSColorNames =\n | 'aliceblue'\n | 'antiquewhite'\n | 'aqua'\n | 'aquamarine'\n | 'azure'\n | 'beige'\n | 'bisque'\n | 'black'\n | 'blanchedalmond'\n | 'blue'\n | 'blueviolet'\n | 'brown'\n | 'burlywood'\n | 'cadetblue'\n | 'chartreuse'\n | 'chocolate'\n | 'coral'\n | 'cornflowerblue'\n | 'cornsilk'\n | 'crimson'\n | 'cyan'\n | 'darkblue'\n | 'darkcyan'\n | 'darkgoldenrod'\n | 'darkgray'\n | 'darkgreen'\n | 'darkkhaki'\n | 'darkmagenta'\n | 'darkolivegreen'\n | 'darkorange'\n | 'darkorchid'\n | 'darkred'\n | 'darksalmon'\n | 'darkseagreen'\n | 'darkslateblue'\n | 'darkslategray'\n | 'darkturquoise'\n | 'darkviolet'\n | 'deeppink'\n | 'deepskyblue'\n | 'dimgray'\n | 'dodgerblue'\n | 'firebrick'\n | 'floralwhite'\n | 'forestgreen'\n | 'fuchsia'\n | 'gainsboro'\n | 'ghostwhite'\n | 'gold'\n | 'goldenrod'\n | 'gray'\n | 'green'\n | 'greenyellow'\n | 'honeydew'\n | 'hotpink'\n | 'indianred '\n | 'indigo '\n | 'ivory'\n | 'khaki'\n | 'lavender'\n | 'lavenderblush'\n | 'lawngreen'\n | 'lemonchiffon'\n | 'lightblue'\n | 'lightcoral'\n | 'lightcyan'\n | 'lightgoldenrodyellow'\n | 'lightgrey'\n | 'lightgreen'\n | 'lightpink'\n | 'lightsalmon'\n | 'lightseagreen'\n | 'lightskyblue'\n | 'lightslategray'\n | 'lightsteelblue'\n | 'lightyellow'\n | 'lime'\n | 'limegreen'\n | 'linen'\n | 'magenta'\n | 'maroon'\n | 'mediumaquamarine'\n | 'mediumblue'\n | 'mediumorchid'\n | 'mediumpurple'\n | 'mediumseagreen'\n | 'mediumslateblue'\n | 'mediumspringgreen'\n | 'mediumturquoise'\n | 'mediumvioletred'\n | 'midnightblue'\n | 'mintcream'\n | 'mistyrose'\n | 'moccasin'\n | 'navajowhite'\n | 'navy'\n | 'oldlace'\n | 'olive'\n | 'olivedrab'\n | 'orange'\n | 'orangered'\n | 'orchid'\n | 'palegoldenrod'\n | 'palegreen'\n | 'paleturquoise'\n | 'palevioletred'\n | 'papayawhip'\n | 'peachpuff'\n | 'peru'\n | 'pink'\n | 'plum'\n | 'powderblue'\n | 'purple'\n | 'red'\n | 'rosybrown'\n | 'royalblue'\n | 'saddlebrown'\n | 'salmon'\n | 'sandybrown'\n | 'seagreen'\n | 'seashell'\n | 'sienna'\n | 'silver'\n | 'skyblue'\n | 'slateblue'\n | 'slategray'\n | 'snow'\n | 'springgreen'\n | 'steelblue'\n | 'tan'\n | 'teal'\n | 'thistle'\n | 'tomato'\n | 'turquoise'\n | 'violet'\n | 'wheat'\n | 'white'\n | 'whitesmoke'\n | 'yellow'\n | 'yellowgreen'\n\nexport type TamaguiComponentState = {\n hover: boolean\n press: boolean\n pressIn: boolean\n focus: boolean\n mounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n noClassNames?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Object\n}\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n avoidClasses?: boolean\n useAnimations: UseAnimationHook\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHelpers = {\n staticConfig: StaticConfigParsed\n getStyle: (props?: {\n isEntering?: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n }) => ViewStyle\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle>\n // style: ViewStyle | null | undefined\n // isMounted: boolean\n // exitStyle?: ViewStyle | null\n onDidAnimate?: any\n delay?: number\n // mergedStyles(props?: { isExiting?: boolean }): ViewStyle\n}\n\nexport type UseAnimationHook = (\n props: UseAnimationProps,\n helpers: UseAnimationHelpers\n) => {\n style?: StackStylePropsBase | StackStylePropsBase[]\n safeToUnmount?: () => void\n}\n"],
4
+ "sourcesContent": ["// TODO split this into own package @tamagui/types to share with animations packages\n\nimport { Properties } from 'csstype'\nimport React from 'react'\nimport {\n GestureResponderEvent,\n Image,\n TextProps as ReactTextProps,\n Text,\n TextInput,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport { Variable } from './createVariable'\nimport { ResolveVariableTypes } from './helpers/createPropMapper'\nimport { RNWTextProps, RNWViewProps } from './types-rnw'\nimport { ThemeProviderProps } from './views/ThemeProvider'\n\nexport type SpaceDirection = 'vertical' | 'horizontal' | 'both'\n\nexport type TamaguiElement = HTMLElement | View\n\nexport type DebugProp = boolean | 'break' | 'verbose'\n\n//\n// base props that are accepted by createComponent (additional to react-native-web)\n//\nexport type TamaguiComponentPropsBase = {\n asChild?: boolean\n space?: SpaceTokens | null\n spaceDirection?: SpaceDirection\n separator?: React.ReactNode\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp\n animateOnly?: string[]\n children?: any | any[]\n debug?: DebugProp\n disabled?: boolean\n className?: string\n id?: string\n tag?: string\n theme?: ThemeName | null\n componentName?: string\n forceStyle?: 'hover' | 'press' | 'focus'\n onHoverIn?: (e: MouseEvent) => any\n onHoverOut?: (e: MouseEvent) => any\n onPress?: (e: GestureResponderEvent) => any\n onPressIn?: (e: GestureResponderEvent) => any\n onPressOut?: (e: GestureResponderEvent) => any\n // WEB ONLY\n onMouseEnter?: (e: MouseEvent) => any\n onMouseLeave?: (e: MouseEvent) => any\n onMouseDown?: (e: MouseEvent) => any\n // WEB STYLES\n userSelect?: Properties['userSelect']\n cursor?: Properties['cursor']\n}\n\nexport type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<\n Props & React.RefAttributes<Ref>\n>\n\nexport type ConfigListener = (conf: TamaguiInternalConfig) => void\n\n// to prevent things from going circular, hoisting some types in this file\n// to generally order them as building up towards TamaguiConfig\n\nexport type VariableVal = number | string | Variable\nexport type VariableColorVal = string | Variable\n\ntype GenericKey = string | number | symbol\n\nexport interface CreateTokens<Val extends VariableVal = VariableVal> {\n color: { [key: GenericKey]: Val }\n space: { [key: GenericKey]: Val }\n size: { [key: GenericKey]: Val }\n radius: { [key: GenericKey]: Val }\n zIndex: { [key: GenericKey]: Val }\n}\n\nexport type TamaguiBaseTheme = {\n // defined for our tamagui kit , we could do this inside `tamagui`\n // but maybe helpful to have some sort of universally shared things +\n // + enforce if they want their own, redefine in their design sys\n background: VariableColorVal\n backgroundHover: VariableColorVal\n backgroundPress: VariableColorVal\n backgroundFocus: VariableColorVal\n color: VariableColorVal\n colorHover: VariableColorVal\n colorPress: VariableColorVal\n colorFocus: VariableColorVal\n borderColor: VariableColorVal\n borderColorHover: VariableColorVal\n borderColorPress: VariableColorVal\n borderColorFocus: VariableColorVal\n shadowColor: VariableColorVal\n shadowColorHover: VariableColorVal\n shadowColorPress: VariableColorVal\n shadowColorFocus: VariableColorVal\n}\n\ntype GenericTokens = CreateTokens\ntype GenericThemes = {\n [key: string]:\n | Partial<TamaguiBaseTheme> & {\n [key: string]: VariableVal\n }\n}\ntype GenericShorthands = {\n // [key: string]: string\n}\n\ntype GenericMedia<K extends string = string> = {\n // name => media shorthand name (camelCase) => value\n [key in K]: {\n [key: string]: number | string\n }\n}\n\nexport type GenericFonts = {\n [key: string]: GenericFont\n}\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\n}\n\n// this is the \"main\" typed object, which users re-define\n// (internal) keep all types directly on this object and reference them from elsewhere\n//\n// const config = createTamagui(...)\n// type MyConfig = typeof config\n// declare module 'tamagui' {\n// export interface TamaguiCustomConfig extends MyConfig {}\n// }\n// now your whole app/kit should be typed correctly\n//\nexport interface TamaguiCustomConfig {}\n\nexport interface TamaguiConfig\n extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,\n TamaguiCustomConfig {}\n\nexport type CreateTamaguiConfig<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = Partial<Pick<ThemeProviderProps, 'defaultTheme' | 'disableRootThemeClass'>> & {\n fonts: F\n tokens: A\n themes: B\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n defaultProps?: Record<string, Object>\n}\n\n// for use in creation functions so it doesnt get overwrtitten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// since TamaguiConfig will be re-declared, these will all be typed globally\nexport type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type Tokens = TamaguiConfig['tokens']\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = GetAltThemeNames<keyof Themes>\n// export type ThemeNameWithSubThemes = GetSubThemes<ThemeName>\nexport type ThemeKeys = keyof ThemeObject\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>\n\ntype GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S\n\n// this is the config generated via createTamagui()\nexport type TamaguiInternalConfig<\n A extends GenericTokens = GenericTokens,\n B extends GenericThemes = GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = CreateTamaguiConfig<A, B, C, D, E, F> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n Provider: (props: TamaguiProviderProps) => any\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokensParsed: CreateTokens<Variable>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n\n // just passed in from CreateTamaguiProps\n themeClassNameOnRoot?: boolean\n}\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\nexport type PropTypes<A extends TamaguiComponent> = A extends React.FunctionComponent<infer Props>\n ? Props\n : unknown\n\nexport type GenericFont<Key extends number | string = number | string> = {\n size: { [key in Key]: number | Variable }\n lineHeight: Partial<{ [key in Key]: number | Variable }>\n letterSpacing: Partial<{ [key in Key]: number | Variable }>\n weight: Partial<{ [key in Key]: number | string | Variable }>\n family: string | Variable\n style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>\n transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>\n color?: Partial<{ [key in Key]: string | Variable }>\n}\n\n// media\nexport type MediaKeys = keyof Media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaPropKeys]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\nexport type ConfigureMediaQueryOptions = {\n queries?: MediaQueries\n defaultActive?: MediaQueryKey[]\n}\n\nexport type TransformStyleProps = {\n x?: number\n y?: number\n perspective?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n skewX?: string\n skewY?: string\n matrix?: number[]\n rotate?: string\n rotateY?: string\n rotateX?: string\n rotateZ?: string\n}\n\n// createComponent props helpers\n\n// animation=\"bouncy\"\n// animation={['bouncy', { }]}\n// { all: 'name' }\n\n// TODO can override for better types\nexport type AnimationConfigType = any\n\nexport type AnimationProp =\n | AnimationKeys\n | {\n [key: string]:\n | AnimationKeys\n | {\n type: AnimationKeys\n [key: string]: any\n }\n }\n | [\n AnimationKeys,\n {\n [key: string]:\n | AnimationKeys\n | {\n type?: AnimationKeys\n [key: string]: any\n }\n }\n ]\n\ntype GetTokenFontKeysFor<\n A extends\n | 'size'\n | 'weight'\n | 'letterSpacing'\n | 'family'\n | 'lineHeight'\n | 'transform'\n | 'style'\n | 'color'\n> = keyof TamaguiConfig['fonts']['body'][A]\n\ntype GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`\n\n// base tokens\nexport type SizeTokens = GetTokenString<keyof Tokens['size']> | number\nexport type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeObject>\n | CSSColorNames\nexport type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number\nexport type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number\n\n// font tokens\nexport type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>\nexport type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number\nexport type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number\nexport type FontWeightTokens =\n | `$${GetTokenFontKeysFor<'weight'>}`\n | `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\nexport type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number\nexport type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number\nexport type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']\nexport type FontTransformTokens =\n | `$${GetTokenFontKeysFor<'transform'>}`\n | TextStyle['textTransform']\n\n//\n// adds theme short values to relevant props\n//\n\nexport type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends 'size'\n ? SizeTokens\n : K extends 'font'\n ? FontTokens\n : K extends 'fontSize'\n ? FontSizeTokens\n : K extends 'space'\n ? SpaceTokens\n : K extends 'color'\n ? ColorTokens\n : K extends 'zIndex'\n ? ZIndexTokens\n : K extends 'lineHeight'\n ? FontLineHeightTokens\n : K extends 'fontWeight'\n ? FontWeightTokens\n : K extends 'letterSpacing'\n ? FontLetterSpacingTokens\n : {}\n\ntype FontKeys = 'fontFamily'\ntype FontSizeKeys = 'fontSize'\ntype FontWeightKeys = 'fontWeight'\ntype FontLetterSpacingKeys = 'letterSpacing'\ntype LineHeightKeys = 'lineHeight'\ntype ZIndexKeys = 'zIndex'\n\nexport type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends SizeKeys\n ? SizeTokens\n : K extends FontKeys\n ? FontTokens\n : K extends FontSizeKeys\n ? FontSizeTokens\n : K extends SpaceKeys\n ? K extends 'shadowOffset'\n ? { width: SpaceTokens; height: SpaceTokens }\n : SpaceTokens\n : K extends ColorKeys\n ? ColorTokens\n : K extends ZIndexKeys\n ? ZIndexTokens\n : K extends LineHeightKeys\n ? FontLineHeightTokens\n : K extends FontWeightKeys\n ? FontWeightTokens\n : K extends FontLetterSpacingKeys\n ? FontLetterSpacingTokens\n : never\n\nexport type ThemeValueFallback = UnionableString | Variable\n\nexport type WithThemeValues<T extends object> = {\n [K in keyof T]: ThemeValueGet<K> extends never\n ? T[K]\n : ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback\n}\n\n// adds shorthand props\nexport type WithShorthands<StyleProps> = {\n [Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps\n ? StyleProps[Shorthands[Key]] | null\n : undefined\n}\n\n// adds pseudo props\nexport type PseudoProps<A> = {\n hoverStyle?: A | null\n pressStyle?: A | null\n focusStyle?: A | null\n exitStyle?: A | null\n enterStyle?: A | null\n}\n\nexport type PseudoPropKeys = keyof PseudoProps<any>\n\nexport type PseudoStyles = {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n enterStyle?: ViewStyle\n exitStyle?: ViewStyle\n}\n\n//\n// add both theme and shorthands\n//\ntype WithThemeAndShorthands<A extends object> = WithThemeValues<A> &\n WithShorthands<WithThemeValues<A>>\n\n//\n// combines all of theme, shorthands, pseudos...\n//\ntype WithThemeShorthandsAndPseudos<A extends object> =\n | WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>\n\n//\n// ... media queries and animations\n//\ntype WithThemeShorthandsPseudosMediaAnimation<A extends object> = WithThemeShorthandsAndPseudos<A> &\n MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n//\n// Stack\n//\n\ntype WebOnlyStyleProps = {\n // WEB ONLY\n cursor?: string\n // WEB ONLY\n contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string\n // WEB ONLY values: inherit, inline, block, content\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n // WEB ONLY pointerEvents can be a style prop\n pointerEvents?: ViewProps['pointerEvents']\n}\n\nexport type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &\n TransformStyleProps &\n WebOnlyStyleProps\n\nexport type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> &\n RNWViewProps &\n TamaguiComponentPropsBase\n\nexport type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackPropsBaseShared & StackStyleProps\n\nexport type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (\n event: infer Event\n) => void\n ? Event\n : never\n\n//\n// Text props\n//\n\nexport type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &\n TransformStyleProps &\n WebOnlyStyleProps & {\n ellipse?: boolean\n selectable?: boolean\n textDecorationDistance?: number\n textOverflow?: Properties['textOverflow']\n whiteSpace?: Properties['whiteSpace']\n wordWrap?: Properties['wordWrap']\n }\n\nexport type TextPropsBaseShared = Omit<ReactTextProps, 'children'> &\n RNWTextProps &\n TamaguiComponentPropsBase\nexport type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextPropsBaseShared & TextStyleProps\n\n// could actually infer from parent\nexport type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<\n Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase\n>\n\n//\n// StaticComponent\n//\n\nexport type TamaguiComponent<\n Props = any,\n Ref = any,\n BaseProps = {},\n VariantProps = {}\n> = ReactComponentWithRef<Props, Ref> & StaticComponentObject\n\ntype StaticComponentObject = {\n staticConfig: StaticConfig\n /*\n * Only needed for more complex components\n * If you create a styled frame component this is a HoC to extract\n * styles from all parents.\n */\n extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X\n}\n\nexport type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {\n disableInjectCSS?: boolean\n children?: React.ReactNode\n}\n\nexport type PropMapper = (\n key: string,\n value: any,\n theme: ThemeObject,\n props: Record<string, any>,\n state: Partial<SplitStyleState>,\n avoidDefaultProps?: boolean,\n debug?: DebugProp\n) => undefined | [string, any][]\n\nexport type StaticConfigParsed = StaticConfig & {\n parsed: true\n propMapper: PropMapper\n variantsParsed?: {\n [key: string]: {\n [key: string]: any\n }\n }\n}\n\nexport type GenericVariantDefinitions = {\n [key: string]: {\n [key: string]:\n | ((a: any, b: any) => any)\n | {\n [key: string]: any\n }\n }\n}\n\nexport type StaticConfig = {\n Component?: React.FunctionComponent<any> & StaticComponentObject\n\n variants?: GenericVariantDefinitions\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\n /**\n * (compiler) If you need to pass context or something, prevents from ever\n * flattening. The 'jsx' option means it will never flatten. if you\n * pass JSX as a children (if its purely string, it will still flatten).\n */\n neverFlatten?: boolean | 'jsx'\n\n /**\n * Determines ultimate output tag (Text vs View)\n */\n isText?: boolean\n\n /**\n * Attempts to attach focus styles at runtime (useful for native)\n */\n isInput?: boolean\n\n /**\n * React native web images need special handling for className support\n */\n isImage?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps: Record<string, any>\n\n /**\n * (compiler) If these props are encountered, bail on all optimization.\n */\n deoptProps?: Set<string>\n\n /**\n * (compiler) If these props are encountered, leave them un-extracted.\n */\n inlineProps?: Set<string>\n\n /**\n * (compiler) If not flattening, leave this prop as original value.\n * Only applies to style attributes\n */\n inlineWhenUnflattened?: Set<string>\n\n /**\n * (compiler) A bit odd, only for more advanced heirarchies.\n * Indicates that the component will set this prop so the\n * static extraction can ensure it sets them to ={undefined}\n * so they get overriddent. In the future, this can be smarter.\n */\n ensureOverriddenProp?: { [key: string]: boolean }\n\n /**\n * Auto-detected, but can ovverride. Wraps children to space them on top\n */\n isZStack?: boolean\n\n /**\n * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isReactNativeWeb?: boolean\n\n /**\n * Used internally to keep reference to the original rnw component\n */\n reactNativeWebComponent?: any\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isTamagui?: boolean\n\n /**\n * Used internally to handle extractable HoC separate\n */\n isExtractable?: boolean\n\n /**\n * Used insternally to attach default props to names\n */\n parentNames?: string[]\n}\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n | React.Component\n | React.ForwardRefExoticComponent<any>\n | ReactComponentWithRef<any, any>\n | (new (props: any) => any)\n | typeof View\n | typeof Text\n | typeof TextInput\n | typeof Image\n\nexport type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<\n any,\n any,\n any,\n infer Variants\n>\n ? Variants\n : never\n\nexport type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<\n any,\n any,\n infer BaseProps\n>\n ? BaseProps\n : never\n\nexport type GetProps<A extends StylableComponent> = A extends TamaguiComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? GetGenericComponentTamaguiProps<Props>\n : A extends new (props: infer Props) => any\n ? GetGenericComponentTamaguiProps<Props>\n : {}\n\ntype GetGenericComponentTamaguiProps<P> = P &\n Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>\n\nexport type SpreadKeys =\n | '...fontSize'\n | '...fontStyle'\n | '...fontTransform'\n | '...lineHeight'\n | '...letterSpacing'\n | '...size'\n | '...space'\n | '...color'\n | '...zIndex'\n | '...theme'\n | '...radius'\n\nexport type VariantDefinitions<\n Parent extends StylableComponent = TamaguiComponent,\n MyProps extends Object = GetProps<Parent>,\n Val = any\n> = VariantDefinitionFromProps<MyProps, Val>\n\nexport type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object\n ? {\n [propName: string]:\n | VariantSpreadFunction<MyProps, Val>\n | ({\n [Key in SpreadKeys]?: Key extends '...fontSize'\n ? FontSizeVariantSpreadFunction<MyProps>\n : Key extends '...size'\n ? SizeVariantSpreadFunction<MyProps>\n : Key extends '...space'\n ? SpaceVariantSpreadFunction<MyProps>\n : Key extends '...color'\n ? ColorVariantSpreadFunction<MyProps>\n : Key extends '...lineHeight'\n ? FontLineHeightVariantSpreadFunction<MyProps>\n : Key extends '...fontTransform'\n ? FontTransformVariantSpreadFunction<MyProps>\n : Key extends '...fontStyle'\n ? FontStyleVariantSpreadFunction<MyProps>\n : Key extends '...letterSpacing'\n ? FontLetterSpacingVariantSpreadFunction<MyProps>\n : Key extends '...zIndex'\n ? ZIndexVariantSpreadFunction<MyProps>\n : Key extends '...radius'\n ? RadiusVariantSpreadFunction<MyProps>\n : Key extends '...theme'\n ? ThemeVariantSpreadFunction<MyProps>\n : never\n } & {\n [Key in string | number | 'true' | 'false']?:\n | MyProps\n | VariantSpreadFunction<MyProps, Val>\n } & {\n [Key in VariantTypeKeys]?: Key extends ':number'\n ? VariantSpreadFunction<MyProps, number>\n : Key extends ':boolean'\n ? VariantSpreadFunction<MyProps, boolean>\n : Key extends ':string'\n ? VariantSpreadFunction<MyProps, string>\n : never\n })\n }\n : never\n\nexport type GenericStackVariants = VariantDefinitionFromProps<StackProps, any>\nexport type GenericTextVariants = VariantDefinitionFromProps<StackProps, any>\n\nexport type GetVariantProps<Variants> = {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n}\n\nexport type VariantSpreadExtras<Props> = {\n fonts: TamaguiConfig['fonts']\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: Props\n}\n\ntype PropLike = { [key: string]: any }\n\nexport type VariantSpreadFunction<Props extends PropLike, Val = any> = (\n val: Val,\n config: VariantSpreadExtras<Props>\n) =>\n | {\n [Key in keyof Props]: Props[Key] | Variable\n }\n | null\n | undefined\n\nexport type VariantTypeKeys = ':string' | ':boolean' | ':number'\n\nexport type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`\n ? ThemeValueByCategory<VariantSpread>\n : Key extends 'true' | 'false'\n ? boolean\n : Key extends ':string'\n ? string\n : Key extends ':boolean'\n ? boolean\n : Key extends ':number'\n ? number\n : Key\n\nexport type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontSizeTokens\n>\nexport type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, SizeTokens>\nexport type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, SpaceTokens>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ColorTokens>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLineHeightTokens\n>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLetterSpacingTokens\n>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontTransformTokens\n>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>\n\n/**\n * --------------------------------------------\n * end variants\n * --------------------------------------------\n */\n\ntype SizeKeys =\n | 'width'\n | 'height'\n | 'minWidth'\n | 'minHeight'\n | 'maxWidth'\n | 'maxHeight'\n | 'shadowRadius'\n\ntype ColorKeys =\n | 'color'\n | 'backgroundColor'\n | 'borderColor'\n | 'borderBottomColor'\n | 'borderTopColor'\n | 'borderLeftColor'\n | 'borderRightColor'\n | 'shadowColor'\n | 'textShadowColor'\n\ntype SpaceKeys =\n | 'space'\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingLeft'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingEnd'\n | 'paddingStart'\n | 'margin'\n | 'marginHorizontal'\n | 'marginVertical'\n | 'marginLeft'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'marginEnd'\n | 'marginStart'\n | 'x'\n | 'y'\n | 'scale'\n | 'scaleX'\n | 'scaleY'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderTopStartRadius'\n | 'borderBottomEndRadius'\n | 'borderBottomLeftRadius'\n | 'borderBottomRightRadius'\n | 'borderBottomStartRadius'\n | 'borderBottomWidth'\n | 'borderLeftWidth'\n | 'borderRadius'\n | 'borderRightWidth'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderEndWidth'\n | 'borderStartWidth'\n | 'borderTopStartRadius'\n | 'borderTopWidth'\n | 'borderWidth'\n | 'left'\n | 'top'\n | 'right'\n | 'bottom'\n | 'shadowOffset'\n\ntype CSSColorNames =\n | 'aliceblue'\n | 'antiquewhite'\n | 'aqua'\n | 'aquamarine'\n | 'azure'\n | 'beige'\n | 'bisque'\n | 'black'\n | 'blanchedalmond'\n | 'blue'\n | 'blueviolet'\n | 'brown'\n | 'burlywood'\n | 'cadetblue'\n | 'chartreuse'\n | 'chocolate'\n | 'coral'\n | 'cornflowerblue'\n | 'cornsilk'\n | 'crimson'\n | 'cyan'\n | 'darkblue'\n | 'darkcyan'\n | 'darkgoldenrod'\n | 'darkgray'\n | 'darkgreen'\n | 'darkkhaki'\n | 'darkmagenta'\n | 'darkolivegreen'\n | 'darkorange'\n | 'darkorchid'\n | 'darkred'\n | 'darksalmon'\n | 'darkseagreen'\n | 'darkslateblue'\n | 'darkslategray'\n | 'darkturquoise'\n | 'darkviolet'\n | 'deeppink'\n | 'deepskyblue'\n | 'dimgray'\n | 'dodgerblue'\n | 'firebrick'\n | 'floralwhite'\n | 'forestgreen'\n | 'fuchsia'\n | 'gainsboro'\n | 'ghostwhite'\n | 'gold'\n | 'goldenrod'\n | 'gray'\n | 'green'\n | 'greenyellow'\n | 'honeydew'\n | 'hotpink'\n | 'indianred '\n | 'indigo '\n | 'ivory'\n | 'khaki'\n | 'lavender'\n | 'lavenderblush'\n | 'lawngreen'\n | 'lemonchiffon'\n | 'lightblue'\n | 'lightcoral'\n | 'lightcyan'\n | 'lightgoldenrodyellow'\n | 'lightgrey'\n | 'lightgreen'\n | 'lightpink'\n | 'lightsalmon'\n | 'lightseagreen'\n | 'lightskyblue'\n | 'lightslategray'\n | 'lightsteelblue'\n | 'lightyellow'\n | 'lime'\n | 'limegreen'\n | 'linen'\n | 'magenta'\n | 'maroon'\n | 'mediumaquamarine'\n | 'mediumblue'\n | 'mediumorchid'\n | 'mediumpurple'\n | 'mediumseagreen'\n | 'mediumslateblue'\n | 'mediumspringgreen'\n | 'mediumturquoise'\n | 'mediumvioletred'\n | 'midnightblue'\n | 'mintcream'\n | 'mistyrose'\n | 'moccasin'\n | 'navajowhite'\n | 'navy'\n | 'oldlace'\n | 'olive'\n | 'olivedrab'\n | 'orange'\n | 'orangered'\n | 'orchid'\n | 'palegoldenrod'\n | 'palegreen'\n | 'paleturquoise'\n | 'palevioletred'\n | 'papayawhip'\n | 'peachpuff'\n | 'peru'\n | 'pink'\n | 'plum'\n | 'powderblue'\n | 'purple'\n | 'red'\n | 'rosybrown'\n | 'royalblue'\n | 'saddlebrown'\n | 'salmon'\n | 'sandybrown'\n | 'seagreen'\n | 'seashell'\n | 'sienna'\n | 'silver'\n | 'skyblue'\n | 'slateblue'\n | 'slategray'\n | 'snow'\n | 'springgreen'\n | 'steelblue'\n | 'tan'\n | 'teal'\n | 'thistle'\n | 'tomato'\n | 'turquoise'\n | 'violet'\n | 'wheat'\n | 'white'\n | 'whitesmoke'\n | 'yellow'\n | 'yellowgreen'\n\nexport type TamaguiComponentState = {\n hover: boolean\n press: boolean\n pressIn: boolean\n focus: boolean\n mounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n noClassNames?: boolean\n dynamicStylesInline?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Record<string, any>\n keepVariantsAsProps?: boolean\n hasTextAncestor?: boolean\n}\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n avoidClasses?: boolean\n useAnimations: UseAnimationHook\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHelpers = {\n staticConfig: StaticConfigParsed\n getStyle: (props?: {\n isEntering?: boolean\n isExiting?: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n }) => ViewStyle\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle>\n // style: ViewStyle | null | undefined\n // isMounted: boolean\n // exitStyle?: ViewStyle | null\n onDidAnimate?: any\n delay?: number\n // mergedStyles(props?: { isExiting?: boolean }): ViewStyle\n}\n\nexport type UseAnimationHook = (\n props: UseAnimationProps,\n helpers: UseAnimationHelpers\n) => {\n style?: StackStylePropsBase | StackStylePropsBase[]\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
21
21
  return a;
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
25
24
  var __objRest = (source, exclude) => {
26
25
  var target = {};
27
26
  for (var prop in source)
@@ -51,20 +50,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
51
50
  var Slot_exports = {};
52
51
  __export(Slot_exports, {
53
52
  Slot: () => Slot,
54
- Slottable: () => Slottable
53
+ Slottable: () => Slottable,
54
+ mergeEvent: () => mergeEvent
55
55
  });
56
56
  module.exports = __toCommonJS(Slot_exports);
57
57
  var import_compose_refs = require("@tamagui/compose-refs");
58
58
  var React = __toESM(require("react"));
59
+ var import_platform = require("../constants/platform");
59
60
  const Slot = React.forwardRef((props, forwardedRef) => {
60
61
  const _a = props, { children } = _a, slotProps = __objRest(_a, ["children"]);
61
- if (React.Children.toArray(children).some(isSlottable)) {
62
- return /* @__PURE__ */ React.createElement(React.Fragment, null, React.Children.map(children, (child) => {
63
- return isSlottable(child) ? /* @__PURE__ */ React.createElement(SlotClone, __spreadProps(__spreadValues({}, slotProps), {
64
- ref: forwardedRef
65
- }), child.props.children) : child;
66
- }));
67
- }
68
62
  return /* @__PURE__ */ React.createElement(SlotClone, __spreadProps(__spreadValues({}, slotProps), {
69
63
  ref: forwardedRef
70
64
  }), children);
@@ -73,31 +67,44 @@ Slot.displayName = "Slot";
73
67
  const SlotClone = React.forwardRef((props, forwardedRef) => {
74
68
  const _a = props, { children } = _a, slotProps = __objRest(_a, ["children"]);
75
69
  if (React.isValidElement(children)) {
76
- return React.cloneElement(children, __spreadProps(__spreadValues({}, mergeProps(slotProps, children.props)), {
70
+ const childProps = __spreadProps(__spreadValues({}, mergeProps(children, slotProps)), {
77
71
  ref: (0, import_compose_refs.composeRefs)(forwardedRef, children.ref)
78
- }));
72
+ });
73
+ return React.cloneElement(children, childProps);
79
74
  }
80
75
  return React.Children.count(children) > 1 ? React.Children.only(null) : null;
81
76
  });
82
77
  SlotClone.displayName = "SlotClone";
83
- const Slottable = /* @__PURE__ */ __name(({ children }) => {
78
+ const Slottable = ({ children }) => {
84
79
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
85
- }, "Slottable");
86
- function isSlottable(child) {
87
- return React.isValidElement(child);
88
- }
89
- __name(isSlottable, "isSlottable");
90
- function mergeProps(slotProps, childProps) {
80
+ };
81
+ const pressMap = import_platform.isWeb ? {
82
+ onPress: "onClick",
83
+ onPressOut: "onMouseUp",
84
+ onPressIn: "onMouseDown"
85
+ } : {};
86
+ function mergeProps(child, slotProps) {
87
+ const childProps = child.props;
91
88
  const overrideProps = __spreadValues({}, childProps);
92
- for (const propName in childProps) {
89
+ const isHTMLChild = typeof child.type === "string";
90
+ if (isHTMLChild) {
91
+ for (const key in pressMap) {
92
+ if (key in slotProps) {
93
+ slotProps[pressMap[key]] = slotProps[key];
94
+ delete slotProps[key];
95
+ }
96
+ }
97
+ }
98
+ for (let propName in childProps) {
93
99
  const slotPropValue = slotProps[propName];
94
100
  const childPropValue = childProps[propName];
95
- const isHandler = /^on[A-Z]/.test(propName);
101
+ if (isHTMLChild && pressMap[propName]) {
102
+ propName = pressMap[propName];
103
+ delete overrideProps[propName];
104
+ }
105
+ const isHandler = handleRegex.test(propName);
96
106
  if (isHandler) {
97
- overrideProps[propName] = (...args) => {
98
- childPropValue == null ? void 0 : childPropValue(...args);
99
- slotPropValue == null ? void 0 : slotPropValue(...args);
100
- };
107
+ overrideProps[propName] = mergeEvent(childPropValue, slotPropValue);
101
108
  } else if (propName === "style") {
102
109
  overrideProps[propName] = __spreadValues(__spreadValues({}, slotPropValue), childPropValue);
103
110
  } else if (propName === "className") {
@@ -106,10 +113,17 @@ function mergeProps(slotProps, childProps) {
106
113
  }
107
114
  return __spreadValues(__spreadValues({}, slotProps), overrideProps);
108
115
  }
109
- __name(mergeProps, "mergeProps");
116
+ const handleRegex = /^on[A-Z]/;
117
+ function mergeEvent(a, b) {
118
+ return (...args) => {
119
+ a == null ? void 0 : a(...args);
120
+ b == null ? void 0 : b(...args);
121
+ };
122
+ }
110
123
  // Annotate the CommonJS export names for ESM import in node:
111
124
  0 && (module.exports = {
112
125
  Slot,
113
- Slottable
126
+ Slottable,
127
+ mergeEvent
114
128
  });
115
129
  //# sourceMappingURL=Slot.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Slot.tsx"],
4
- "sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.Children.toArray(children).some(isSlottable)) {\n return (\n <>\n {React.Children.map(children, (child) => {\n return isSlottable(child) ? (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {child.props.children}\n </SlotClone>\n ) : (\n child\n )\n })}\n </>\n )\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n ref: composeRefs(forwardedRef, (children as any).ref),\n })\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n return React.isValidElement(child)\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps }\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName]\n const childPropValue = childProps[propName]\n\n const isHandler = /^on[A-Z]/.test(propName)\n // if it's a handler, modify the override by composing the base handler\n if (isHandler) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue?.(...args)\n slotPropValue?.(...args)\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue }\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')\n }\n }\n\n return { ...slotProps, ...overrideProps }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;AAC5B,YAAuB;AAUhB,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAmC,YAA3B,eAA2B,IAAd,sBAAc,IAAd,CAAb;AAER,MAAI,MAAM,SAAS,QAAQ,QAAQ,EAAE,KAAK,WAAW,GAAG;AACtD,WACE,0DACG,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,aAAO,YAAY,KAAK,IACtB,oCAAC,4CAAc,YAAd;AAAA,QAAyB,KAAK;AAAA,UAC5B,MAAM,MAAM,QACf,IAEA;AAAA,IAEJ,CAAC,CACH;AAAA,EAEJ;AAEA,SACE,oCAAC,4CAAc,YAAd;AAAA,IAAyB,KAAK;AAAA,MAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAmC,YAA3B,eAA2B,IAAd,sBAAc,IAAd,CAAb;AAER,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,WAAO,MAAM,aAAa,UAAU,iCAC/B,WAAW,WAAW,SAAS,KAAK,IADL;AAAA,MAElC,KAAK,qCAAY,cAAe,SAAiB,GAAG;AAAA,IACtD,EAAC;AAAA,EACH;AAEA,SAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAC1E,CAAC;AAED,UAAU,cAAc;AAMjB,MAAM,YAAY,wBAAC,EAAE,eAA8C;AACxE,SAAO,0DAAG,QAAS;AACrB,GAFyB;AAQzB,qBAAqB,OAAqD;AACxE,SAAO,MAAM,eAAe,KAAK;AACnC;AAFS;AAIT,oBAAoB,WAAqB,YAAsB;AAE7D,QAAM,gBAAgB,mBAAK;AAE3B,aAAW,YAAY,YAAY;AACjC,UAAM,gBAAgB,UAAU;AAChC,UAAM,iBAAiB,WAAW;AAElC,UAAM,YAAY,WAAW,KAAK,QAAQ;AAE1C,QAAI,WAAW;AACb,oBAAc,YAAY,IAAI,SAAoB;AAChD,yDAAiB,GAAG;AACpB,uDAAgB,GAAG;AAAA,MACrB;AAAA,IACF,WAES,aAAa,SAAS;AAC7B,oBAAc,YAAY,kCAAK,gBAAkB;AAAA,IACnD,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,kCAAK,YAAc;AAC5B;AAzBS;",
4
+ "sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\nimport { isWeb } from '../constants/platform'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n const childProps = {\n ...mergeProps(children, slotProps),\n ref: composeRefs(forwardedRef, (children as any).ref),\n }\n return React.cloneElement(children, childProps)\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\n// function isSlottable(child: React.ReactNode): child is React.ReactElement {\n// return React.isValidElement(child)\n// }\n\nconst pressMap = isWeb\n ? {\n onPress: 'onClick',\n onPressOut: 'onMouseUp',\n onPressIn: 'onMouseDown',\n }\n : {}\n\nfunction mergeProps(child: any, slotProps: AnyProps) {\n const childProps = child.props\n\n // all child props should override\n const overrideProps = { ...childProps }\n const isHTMLChild = typeof child.type === 'string'\n\n if (isHTMLChild) {\n for (const key in pressMap) {\n if (key in slotProps) {\n slotProps[pressMap[key]] = slotProps[key]\n delete slotProps[key]\n }\n }\n }\n\n for (let propName in childProps) {\n const slotPropValue = slotProps[propName]\n const childPropValue = childProps[propName]\n\n if (isHTMLChild && pressMap[propName]) {\n propName = pressMap[propName]\n delete overrideProps[propName]\n }\n\n const isHandler = handleRegex.test(propName)\n // if it's a handler, modify the override by composing the base handler\n if (isHandler) {\n overrideProps[propName] = mergeEvent(childPropValue, slotPropValue)\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue }\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')\n }\n }\n\n return { ...slotProps, ...overrideProps }\n}\n\nconst handleRegex = /^on[A-Z]/\n\nexport function mergeEvent(a?: Function, b?: Function) {\n return (...args: unknown[]) => {\n a?.(...args)\n b?.(...args)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;AAC5B,YAAuB;AAEvB,sBAAsB;AAUf,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAmC,YAA3B,eAA2B,IAAd,sBAAc,IAAd,CAAb;AACR,SACE,oCAAC,4CAAc,YAAd;AAAA,IAAyB,KAAK;AAAA,MAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAmC,YAA3B,eAA2B,IAAd,sBAAc,IAAd,CAAb;AAER,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,UAAM,aAAa,iCACd,WAAW,UAAU,SAAS,IADhB;AAAA,MAEjB,KAAK,qCAAY,cAAe,SAAiB,GAAG;AAAA,IACtD;AACA,WAAO,MAAM,aAAa,UAAU,UAAU;AAAA,EAChD;AAEA,SAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAC1E,CAAC;AAED,UAAU,cAAc;AAMjB,MAAM,YAAY,CAAC,EAAE,eAA8C;AACxE,SAAO,0DAAG,QAAS;AACrB;AAUA,MAAM,WAAW,wBACb;AAAA,EACE,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AACb,IACA,CAAC;AAEL,oBAAoB,OAAY,WAAqB;AACnD,QAAM,aAAa,MAAM;AAGzB,QAAM,gBAAgB,mBAAK;AAC3B,QAAM,cAAc,OAAO,MAAM,SAAS;AAE1C,MAAI,aAAa;AACf,eAAW,OAAO,UAAU;AAC1B,UAAI,OAAO,WAAW;AACpB,kBAAU,SAAS,QAAQ,UAAU;AACrC,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,WAAS,YAAY,YAAY;AAC/B,UAAM,gBAAgB,UAAU;AAChC,UAAM,iBAAiB,WAAW;AAElC,QAAI,eAAe,SAAS,WAAW;AACrC,iBAAW,SAAS;AACpB,aAAO,cAAc;AAAA,IACvB;AAEA,UAAM,YAAY,YAAY,KAAK,QAAQ;AAE3C,QAAI,WAAW;AACb,oBAAc,YAAY,WAAW,gBAAgB,aAAa;AAAA,IACpE,WAES,aAAa,SAAS;AAC7B,oBAAc,YAAY,kCAAK,gBAAkB;AAAA,IACnD,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,kCAAK,YAAc;AAC5B;AAEA,MAAM,cAAc;AAEb,oBAAoB,GAAc,GAAc;AACrD,SAAO,IAAI,SAAoB;AAC7B,2BAAI,GAAG;AACP,2BAAI,GAAG;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -46,16 +46,18 @@ const ellipseStyle = {
46
46
  const Text = (0, import_createComponent.createComponent)({
47
47
  componentName: "Text",
48
48
  isText: true,
49
- defaultProps: {
50
- display: import_platform.isWeb ? "inline" : "flex",
49
+ defaultProps: __spreadValues({
50
+ display: "flex",
51
+ fontFamily: "System"
52
+ }, import_platform.isWeb && {
53
+ display: "inline",
51
54
  boxSizing: "border-box",
52
- fontFamily: "System",
53
55
  wordWrap: "break-word"
54
- },
56
+ }),
55
57
  variants: {
56
58
  numberOfLines: {
57
- 1: ellipseStyle,
58
- ":number": (lines) => lines > 1 ? { WebkitLineClamp: 1 } : null
59
+ 1: import_platform.isWeb ? ellipseStyle : { numberOfLines: 1 },
60
+ ":number": (numberOfLines) => import_platform.isWeb ? numberOfLines >= 1 ? { WebkitLineClamp: numberOfLines } : null : { numberOfLines }
59
61
  },
60
62
  selectable: {
61
63
  true: {
@@ -63,7 +65,8 @@ const Text = (0, import_createComponent.createComponent)({
63
65
  cursor: "text"
64
66
  },
65
67
  false: {
66
- userSelect: "none"
68
+ userSelect: "none",
69
+ cursor: "inherit"
67
70
  }
68
71
  },
69
72
  pressable: {
@@ -79,14 +82,7 @@ const Text = (0, import_createComponent.createComponent)({
79
82
  }
80
83
  },
81
84
  deoptProps: new Set(import_platform.isWeb ? [] : ["ellipse"]),
82
- validStyles: __spreadValues(__spreadValues(__spreadValues({}, import_helpers.validStyles), import_helpers.stylePropsTextOnly), import_platform.isWeb && {
83
- userSelect: true,
84
- textOverflow: true,
85
- whiteSpace: true,
86
- wordWrap: true,
87
- selectable: true,
88
- cursor: true
89
- })
85
+ validStyles: __spreadValues(__spreadValues({}, import_helpers.validStyles), import_helpers.stylePropsTextOnly)
90
86
  });
91
87
  // Annotate the CommonJS export names for ESM import in node:
92
88
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Text.tsx"],
4
- "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n ':number': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgD;AAGhD,sBAAsB;AACtB,6BAAgC;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,4CAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,wBAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,WAAW,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAC9D;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,wBACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EACA,YAAY,IAAI,IAAI,wBAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAC5C,aAAa,iDACR,6BACA,oCACC,yBAAS;AAAA,IACX,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAEJ,CAAC;",
4
+ "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n variants: {\n numberOfLines: {\n 1: isWeb ? ellipseStyle : { numberOfLines: 1 },\n\n ':number': (numberOfLines) =>\n isWeb\n ? numberOfLines >= 1\n ? { WebkitLineClamp: numberOfLines }\n : null\n : { numberOfLines },\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'inherit',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgD;AAGhD,sBAAsB;AACtB,6BAAgC;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,4CAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,KACR,yBAAS;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,UAAU;AAAA,EACZ;AAAA,EAGF,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG,wBAAQ,eAAe,EAAE,eAAe,EAAE;AAAA,MAE7C,WAAW,CAAC,kBACV,wBACI,iBAAiB,IACf,EAAE,iBAAiB,cAAc,IACjC,OACF,EAAE,cAAc;AAAA,IACxB;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,wBACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,wBAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa,kCACR,6BACA;AAEP,CAAC;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,16 +25,15 @@ __export(TextAncestorContext_exports, {
26
25
  TextAncestorProvider: () => TextAncestorProvider
27
26
  });
28
27
  module.exports = __toCommonJS(TextAncestorContext_exports);
28
+ var import_rnw = require("@tamagui/rnw");
29
29
  var import_react = __toESM(require("react"));
30
- var import_rnw = require("../constants/rnw");
31
- var _a;
32
30
  const FallbackNativeContext = (0, import_react.createContext)(false);
33
- const TextAncestorContext = ((_a = import_rnw.rnw) == null ? void 0 : _a.TextAncestorContext) ?? FallbackNativeContext;
34
- const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
31
+ const TextAncestorContext = import_rnw.TextAncestorContext ?? FallbackNativeContext;
32
+ const TextAncestorProvider = (props) => {
35
33
  return /* @__PURE__ */ import_react.default.createElement(TextAncestorContext.Provider, {
36
34
  value: false
37
35
  }, props.children);
38
- }, "TextAncestorProvider");
36
+ };
39
37
  // Annotate the CommonJS export names for ESM import in node:
40
38
  0 && (module.exports = {
41
39
  FallbackNativeContext,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/TextAncestorContext.tsx"],
4
- "sourcesContent": ["import React, { createContext } from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const FallbackNativeContext = createContext(false)\n\nexport const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext\n\nexport const TextAncestorProvider = (props) => {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,iBAAoB;AAFpB;AAIO,MAAM,wBAAwB,gCAAc,KAAK;AAEjD,MAAM,sBAAsB,6CAAK,wBAAuB;AAExD,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,SAAO,mDAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAAQ,MAAM,QAAS;AACrE,GAFoC;",
4
+ "sourcesContent": ["import { TextAncestorContext as RNWTextAncestorContext } from '@tamagui/rnw'\nimport React, { createContext } from 'react'\n\nexport const FallbackNativeContext = createContext(false)\n\nexport const TextAncestorContext = RNWTextAncestorContext ?? FallbackNativeContext\n\nexport const TextAncestorProvider = (props) => {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA8D;AAC9D,mBAAqC;AAE9B,MAAM,wBAAwB,gCAAc,KAAK;AAEjD,MAAM,sBAAsB,kCAA0B;AAEtD,MAAM,uBAAuB,CAAC,UAAU;AAC7C,SAAO,mDAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAAQ,MAAM,QAAS;AACrE;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -29,22 +28,20 @@ var import_platform = require("../constants/platform");
29
28
  var import_wrapThemeManagerContext = require("../helpers/wrapThemeManagerContext");
30
29
  var import_useTheme = require("../hooks/useTheme");
31
30
  import_react.default["createElement"];
32
- const Theme = (0, import_react.memo)(/* @__PURE__ */ __name(function Theme2(props) {
31
+ const Theme = (0, import_react.memo)(function Theme2(props) {
33
32
  var _a, _b;
34
33
  const { name, theme, themeManager, themes, className } = (0, import_useTheme.useChangeThemeEffect)(props.name, props.componentName, props);
35
- if (!themes || !name || !theme) {
34
+ const missingTheme = !themes || !name || !theme;
35
+ const contents = (0, import_react.useMemo)(() => missingTheme ? null : (0, import_wrapThemeManagerContext.wrapThemeManagerContext)(props.children, themeManager), [props.children, themeManager]);
36
+ if (missingTheme) {
36
37
  if (name && !theme && process.env.NODE_ENV === "development") {
37
38
  console.warn(`No theme found by name ${name}`);
38
39
  }
39
40
  return props.children;
40
41
  }
41
- const contents = (0, import_react.useMemo)(() => (0, import_wrapThemeManagerContext.wrapThemeManagerContext)(props.children, themeManager), [props.children, themeManager]);
42
42
  if (import_platform.isWeb) {
43
43
  return /* @__PURE__ */ import_react.default.createElement("span", {
44
- className: [
45
- `tui_Theme`,
46
- ...!props.disableThemeClass ? [props.className, className].filter(Boolean) : []
47
- ].join(" "),
44
+ className: (!props.disableThemeClass ? [props.className, className].filter(Boolean) : []).join(" "),
48
45
  style: {
49
46
  display: "contents",
50
47
  color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
@@ -52,7 +49,7 @@ const Theme = (0, import_react.memo)(/* @__PURE__ */ __name(function Theme2(prop
52
49
  }, contents);
53
50
  }
54
51
  return contents;
55
- }, "Theme"));
52
+ });
56
53
  // Annotate the CommonJS export names for ESM import in node:
57
54
  0 && (module.exports = {
58
55
  Theme
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <span\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAWC,MAAM,QAAQ,uBAAK,uCAAe,OAAmB;AAnB5D;AAoBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,0BACf,MAAM,4DAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GAxC0B,QAwCzB;",
4
+ "sourcesContent": ["import React, { memo, useEffect, useMemo, useRef } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwD;AAExD,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAEC,MAAM,QAAQ,uBAAK,gBAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,0BACf,MAAO,eAAe,OAAO,4DAAwB,MAAM,UAAU,YAAY,GACjF,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAY,EAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +25,7 @@ __export(ThemeInverse_exports, {
26
25
  });
27
26
  module.exports = __toCommonJS(ThemeInverse_exports);
28
27
  var import_react = __toESM(require("react"));
28
+ var import_platform = require("../constants/platform");
29
29
  var import_useTheme = require("../hooks/useTheme");
30
30
  var import_Theme = require("./Theme");
31
31
  let inversions = {
@@ -35,15 +35,17 @@ let inversions = {
35
35
  function setThemeInversions(next) {
36
36
  inversions = next;
37
37
  }
38
- __name(setThemeInversions, "setThemeInversions");
39
- const ThemeInverse = /* @__PURE__ */ __name((props) => {
38
+ const ThemeInverse = (props) => {
40
39
  const themeName = (0, import_useTheme.useThemeName)();
41
40
  const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
42
- const name = inversions[themeName] || inversions[defaultTheme || ""] || null;
41
+ const [name, setName] = (0, import_react.useState)(null);
42
+ (0, import_platform.useIsomorphicLayoutEffect)(() => {
43
+ setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
44
+ }, [defaultTheme, themeName]);
43
45
  return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
44
46
  name
45
47
  }, props.children);
46
- }, "ThemeInverse");
48
+ };
47
49
  // Annotate the CommonJS export names for ESM import in node:
48
50
  0 && (module.exports = {
49
51
  ThemeInverse,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeInverse.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme || ''] || null\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,sBAAkD;AAClD,mBAAsB;AAItB,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAFgB;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY,kCAAa;AAC/B,QAAM,eAAe,yCAAoB;AACzC,QAAM,OAAO,WAAW,cAAc,WAAW,gBAAgB,OAAO;AACxE,SAAO,mDAAC;AAAA,IAAM;AAAA,KAAa,MAAM,QAAS;AAC5C,GAL4B;",
4
+ "sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n setName(inversions[themeName] || inversions[defaultTheme || ''] || null)\n }, [defaultTheme, themeName])\n\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAEhC,sBAA0C;AAC1C,sBAAkD;AAClD,mBAAsB;AAItB,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,YAAY,kCAAa;AAC/B,QAAM,eAAe,yCAAoB;AACzC,QAAM,CAAC,MAAM,WAAW,2BAAwB,IAAI;AAGpD,iDAA0B,MAAM;AAC9B,YAAQ,WAAW,cAAc,WAAW,gBAAgB,OAAO,IAAI;AAAA,EACzE,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,SAAO,mDAAC;AAAA,IAAM;AAAA,KAAa,MAAM,QAAS;AAC5C;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,7 +29,7 @@ var import_constants = require("../constants/constants");
30
29
  var import_ThemeContext = require("../ThemeContext");
31
30
  var import_Theme = require("./Theme");
32
31
  import_react.default["createElement"];
33
- const ThemeProvider = /* @__PURE__ */ __name((props) => {
32
+ const ThemeProvider = (props) => {
34
33
  if (!(0, import_conf.getHasConfigured)()) {
35
34
  throw new Error(`Missing configureThemes() call, add to your root file`);
36
35
  }
@@ -40,11 +39,12 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
40
39
  return;
41
40
  }
42
41
  const cn = `${import_constants.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`;
43
- document.body.classList.add(cn);
42
+ const target = props.themeClassNameOnRoot ? document.documentElement : document.body;
43
+ target.classList.add(cn);
44
44
  return () => {
45
- document.body.classList.remove(cn);
45
+ target.classList.remove(cn);
46
46
  };
47
- }, [props.disableRootThemeClass]);
47
+ }, [props.defaultTheme, props.disableRootThemeClass]);
48
48
  }
49
49
  const themeContext = (0, import_react.useMemo)(() => {
50
50
  return {
@@ -59,7 +59,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
59
59
  name: props.defaultTheme,
60
60
  disableThemeClass: props.disableRootThemeClass
61
61
  }, props.children));
62
- }, "ThemeProvider");
62
+ };
63
63
  // Annotate the CommonJS export names for ESM import in node:
64
64
  0 && (module.exports = {
65
65
  ThemeProvider
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeProvider.tsx"],
4
- "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD;AAEhD,kBAAiC;AACjC,uBAAuC;AACvC,0BAA6B;AAC7B,mBAAsB;AAGtB,qBAAM;AAUC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,kCAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,sCAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,0CAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,MAAM,qBAAqB,CAAC;AAAA,EAClC;AAEA,QAAM,eAAe,0BAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,mDAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,mDAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GArC6B;",
4
+ "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD;AAEhD,kBAAiC;AACjC,uBAAuC;AACvC,0BAA6B;AAC7B,mBAAsB;AAGtB,qBAAM;AAYC,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,MAAI,CAAC,kCAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,sCAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,0CAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,qBAAqB,CAAC;AAAA,EACtD;AAEA,QAAM,eAAe,0BAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,mDAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,mDAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ;",
6
6
  "names": []
7
7
  }