@tamagui/core 1.2.3 → 1.2.5

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 (606) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/hooks/usePlatformMethods.js +48 -0
  3. package/dist/cjs/hooks/usePlatformMethods.js.map +7 -0
  4. package/dist/cjs/index.js +152 -75
  5. package/dist/cjs/index.js.map +3 -3
  6. package/dist/cjs/{types.js → reactNativeTypes.js} +3 -3
  7. package/dist/cjs/reactNativeTypes.js.map +7 -0
  8. package/dist/esm/hooks/usePlatformMethods.js +24 -0
  9. package/dist/esm/hooks/usePlatformMethods.js.map +7 -0
  10. package/dist/esm/index.js +157 -71
  11. package/dist/esm/index.js.map +2 -2
  12. package/dist/esm/reactNativeTypes.js +1 -0
  13. package/dist/esm/{types-rnw.js.map → reactNativeTypes.js.map} +0 -0
  14. package/package.json +5 -11
  15. package/src/hooks/usePlatformMethods.ts +26 -0
  16. package/src/index.ts +214 -71
  17. package/src/reactNativeTypes.ts +104 -0
  18. package/types/hooks/usePlatformMethods.d.ts +3 -0
  19. package/types/hooks/usePlatformMethods.d.ts.map +1 -0
  20. package/types/index.d.ts +6 -54
  21. package/types/index.d.ts.map +1 -1
  22. package/types/reactNativeTypes.d.ts +26 -0
  23. package/types/reactNativeTypes.d.ts.map +1 -0
  24. package/dist/cjs/Tamagui.js +0 -77
  25. package/dist/cjs/Tamagui.js.map +0 -7
  26. package/dist/cjs/addTheme.js +0 -78
  27. package/dist/cjs/addTheme.js.map +0 -7
  28. package/dist/cjs/config.js +0 -91
  29. package/dist/cjs/config.js.map +0 -7
  30. package/dist/cjs/constants/constants.js +0 -49
  31. package/dist/cjs/constants/constants.js.map +0 -7
  32. package/dist/cjs/constants/isDevTools.js +0 -37
  33. package/dist/cjs/constants/isDevTools.js.map +0 -7
  34. package/dist/cjs/contexts/ButtonNestingContext.js +0 -30
  35. package/dist/cjs/contexts/ButtonNestingContext.js.map +0 -7
  36. package/dist/cjs/contexts/FontLanguageContext.js +0 -30
  37. package/dist/cjs/contexts/FontLanguageContext.js.map +0 -7
  38. package/dist/cjs/contexts/TextAncestorContext.js +0 -30
  39. package/dist/cjs/contexts/TextAncestorContext.js.map +0 -7
  40. package/dist/cjs/createComponent.js +0 -993
  41. package/dist/cjs/createComponent.js.map +0 -7
  42. package/dist/cjs/createFont.js +0 -69
  43. package/dist/cjs/createFont.js.map +0 -7
  44. package/dist/cjs/createFont.web.test.js +0 -125
  45. package/dist/cjs/createFont.web.test.js.map +0 -7
  46. package/dist/cjs/createShorthands.js +0 -31
  47. package/dist/cjs/createShorthands.js.map +0 -7
  48. package/dist/cjs/createTamagui.js +0 -206
  49. package/dist/cjs/createTamagui.js.map +0 -7
  50. package/dist/cjs/createTheme.js +0 -31
  51. package/dist/cjs/createTheme.js.map +0 -7
  52. package/dist/cjs/createTokens.js +0 -39
  53. package/dist/cjs/createTokens.js.map +0 -7
  54. package/dist/cjs/createTokens.web.test.js +0 -28
  55. package/dist/cjs/createTokens.web.test.js.map +0 -7
  56. package/dist/cjs/createVariable.js +0 -111
  57. package/dist/cjs/createVariable.js.map +0 -7
  58. package/dist/cjs/createVariable.web.test.js +0 -7
  59. package/dist/cjs/createVariable.web.test.js.map +0 -7
  60. package/dist/cjs/createVariables.js +0 -60
  61. package/dist/cjs/createVariables.js.map +0 -7
  62. package/dist/cjs/helpers/RNComponents.js +0 -40
  63. package/dist/cjs/helpers/RNComponents.js.map +0 -7
  64. package/dist/cjs/helpers/ThemeManager.js +0 -234
  65. package/dist/cjs/helpers/ThemeManager.js.map +0 -7
  66. package/dist/cjs/helpers/ThemeManager.test.js +0 -465
  67. package/dist/cjs/helpers/ThemeManager.test.js.map +0 -7
  68. package/dist/cjs/helpers/ThemeManagerContext.js +0 -30
  69. package/dist/cjs/helpers/ThemeManagerContext.js.map +0 -7
  70. package/dist/cjs/helpers/createMediaStyle.js +0 -67
  71. package/dist/cjs/helpers/createMediaStyle.js.map +0 -7
  72. package/dist/cjs/helpers/createPropMapper.js +0 -411
  73. package/dist/cjs/helpers/createPropMapper.js.map +0 -7
  74. package/dist/cjs/helpers/createProxy.js +0 -43
  75. package/dist/cjs/helpers/createProxy.js.map +0 -7
  76. package/dist/cjs/helpers/expandStyle.js +0 -95
  77. package/dist/cjs/helpers/expandStyle.js.map +0 -7
  78. package/dist/cjs/helpers/expandStyles.js +0 -116
  79. package/dist/cjs/helpers/expandStyles.js.map +0 -7
  80. package/dist/cjs/helpers/extendStaticConfig.js +0 -91
  81. package/dist/cjs/helpers/extendStaticConfig.js.map +0 -7
  82. package/dist/cjs/helpers/fixNativeShadow.js +0 -30
  83. package/dist/cjs/helpers/fixNativeShadow.js.map +0 -7
  84. package/dist/cjs/helpers/getAnimationDriver.js +0 -32
  85. package/dist/cjs/helpers/getAnimationDriver.js.map +0 -7
  86. package/dist/cjs/helpers/getExpandedShorthands.js +0 -40
  87. package/dist/cjs/helpers/getExpandedShorthands.js.map +0 -7
  88. package/dist/cjs/helpers/getFontLanguage.js +0 -29
  89. package/dist/cjs/helpers/getFontLanguage.js.map +0 -7
  90. package/dist/cjs/helpers/getSplitStyles.js +0 -848
  91. package/dist/cjs/helpers/getSplitStyles.js.map +0 -7
  92. package/dist/cjs/helpers/getStylesAtomic.js +0 -226
  93. package/dist/cjs/helpers/getStylesAtomic.js.map +0 -7
  94. package/dist/cjs/helpers/getStylesAtomic.native.js +0 -38
  95. package/dist/cjs/helpers/getStylesAtomic.native.js.map +0 -7
  96. package/dist/cjs/helpers/getThemeCSSRules.js +0 -110
  97. package/dist/cjs/helpers/getThemeCSSRules.js.map +0 -7
  98. package/dist/cjs/helpers/getThemeCSSRules.native.js +0 -31
  99. package/dist/cjs/helpers/getThemeCSSRules.native.js.map +0 -7
  100. package/dist/cjs/helpers/getVariantExtras.js +0 -92
  101. package/dist/cjs/helpers/getVariantExtras.js.map +0 -7
  102. package/dist/cjs/helpers/insertStyleRule.js +0 -218
  103. package/dist/cjs/helpers/insertStyleRule.js.map +0 -7
  104. package/dist/cjs/helpers/isObj.js +0 -29
  105. package/dist/cjs/helpers/isObj.js.map +0 -7
  106. package/dist/cjs/helpers/isTamaguiComponent.js +0 -32
  107. package/dist/cjs/helpers/isTamaguiComponent.js.map +0 -7
  108. package/dist/cjs/helpers/isTamaguiElement.js +0 -33
  109. package/dist/cjs/helpers/isTamaguiElement.js.map +0 -7
  110. package/dist/cjs/helpers/matchMedia.js +0 -42
  111. package/dist/cjs/helpers/matchMedia.js.map +0 -7
  112. package/dist/cjs/helpers/matchMedia.native.js +0 -48
  113. package/dist/cjs/helpers/matchMedia.native.js.map +0 -7
  114. package/dist/cjs/helpers/mergeProps.js +0 -54
  115. package/dist/cjs/helpers/mergeProps.js.map +0 -7
  116. package/dist/cjs/helpers/mergeTransform.js +0 -47
  117. package/dist/cjs/helpers/mergeTransform.js.map +0 -7
  118. package/dist/cjs/helpers/normalizeColor.js +0 -71
  119. package/dist/cjs/helpers/normalizeColor.js.map +0 -7
  120. package/dist/cjs/helpers/normalizeValueWithProperty.js +0 -138
  121. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +0 -7
  122. package/dist/cjs/helpers/proxyThemeVariables.js +0 -40
  123. package/dist/cjs/helpers/proxyThemeVariables.js.map +0 -7
  124. package/dist/cjs/helpers/pseudoDescriptors.js +0 -53
  125. package/dist/cjs/helpers/pseudoDescriptors.js.map +0 -7
  126. package/dist/cjs/helpers/registerCSSVariable.js +0 -40
  127. package/dist/cjs/helpers/registerCSSVariable.js.map +0 -7
  128. package/dist/cjs/helpers/themeable.js +0 -62
  129. package/dist/cjs/helpers/themeable.js.map +0 -7
  130. package/dist/cjs/helpers/themes.js +0 -78
  131. package/dist/cjs/helpers/themes.js.map +0 -7
  132. package/dist/cjs/helpers/timer.js +0 -35
  133. package/dist/cjs/helpers/timer.js.map +0 -7
  134. package/dist/cjs/helpers/useShallowSetState.js +0 -59
  135. package/dist/cjs/helpers/useShallowSetState.js.map +0 -7
  136. package/dist/cjs/helpers/warnOnce.js +0 -38
  137. package/dist/cjs/helpers/warnOnce.js.map +0 -7
  138. package/dist/cjs/helpers/withStaticProperties.js +0 -32
  139. package/dist/cjs/helpers/withStaticProperties.js.map +0 -7
  140. package/dist/cjs/hooks/getThemeUnwrapped.js +0 -34
  141. package/dist/cjs/hooks/getThemeUnwrapped.js.map +0 -7
  142. package/dist/cjs/hooks/useId.js +0 -29
  143. package/dist/cjs/hooks/useId.js.map +0 -7
  144. package/dist/cjs/hooks/useIsTouchDevice.js +0 -33
  145. package/dist/cjs/hooks/useIsTouchDevice.js.map +0 -7
  146. package/dist/cjs/hooks/useMedia.js +0 -263
  147. package/dist/cjs/hooks/useMedia.js.map +0 -7
  148. package/dist/cjs/hooks/useSafeRef.js +0 -59
  149. package/dist/cjs/hooks/useSafeRef.js.map +0 -7
  150. package/dist/cjs/hooks/useServerHooks.js +0 -36
  151. package/dist/cjs/hooks/useServerHooks.js.map +0 -7
  152. package/dist/cjs/hooks/useStyle.js +0 -61
  153. package/dist/cjs/hooks/useStyle.js.map +0 -7
  154. package/dist/cjs/hooks/useTheme.js +0 -230
  155. package/dist/cjs/hooks/useTheme.js.map +0 -7
  156. package/dist/cjs/hooks/useThemeName.js +0 -52
  157. package/dist/cjs/hooks/useThemeName.js.map +0 -7
  158. package/dist/cjs/insertFont.js +0 -93
  159. package/dist/cjs/insertFont.js.map +0 -7
  160. package/dist/cjs/setupReactNative.js +0 -51
  161. package/dist/cjs/setupReactNative.js.map +0 -7
  162. package/dist/cjs/static.js +0 -20
  163. package/dist/cjs/static.js.map +0 -7
  164. package/dist/cjs/styled.js +0 -95
  165. package/dist/cjs/styled.js.map +0 -7
  166. package/dist/cjs/types-rnw.js +0 -17
  167. package/dist/cjs/types-rnw.js.map +0 -7
  168. package/dist/cjs/types.js.map +0 -7
  169. package/dist/cjs/updateTheme.js +0 -47
  170. package/dist/cjs/updateTheme.js.map +0 -7
  171. package/dist/cjs/views/FontLanguage.js +0 -41
  172. package/dist/cjs/views/FontLanguage.js.map +0 -7
  173. package/dist/cjs/views/FontLanguage.native.js +0 -35
  174. package/dist/cjs/views/FontLanguage.native.js.map +0 -7
  175. package/dist/cjs/views/FontLanguage.types.js +0 -17
  176. package/dist/cjs/views/FontLanguage.types.js.map +0 -7
  177. package/dist/cjs/views/Slot.js +0 -92
  178. package/dist/cjs/views/Slot.js.map +0 -7
  179. package/dist/cjs/views/Stack.js +0 -38
  180. package/dist/cjs/views/Stack.js.map +0 -7
  181. package/dist/cjs/views/Stack.web.test.js +0 -22
  182. package/dist/cjs/views/Stack.web.test.js.map +0 -7
  183. package/dist/cjs/views/TamaguiProvider.js +0 -90
  184. package/dist/cjs/views/TamaguiProvider.js.map +0 -7
  185. package/dist/cjs/views/Text.js +0 -94
  186. package/dist/cjs/views/Text.js.map +0 -7
  187. package/dist/cjs/views/Theme.js +0 -88
  188. package/dist/cjs/views/Theme.js.map +0 -7
  189. package/dist/cjs/views/ThemeProvider.js +0 -70
  190. package/dist/cjs/views/ThemeProvider.js.map +0 -7
  191. package/dist/esm/Tamagui.js +0 -41
  192. package/dist/esm/Tamagui.js.map +0 -7
  193. package/dist/esm/addTheme.js +0 -54
  194. package/dist/esm/addTheme.js.map +0 -7
  195. package/dist/esm/config.js +0 -58
  196. package/dist/esm/config.js.map +0 -7
  197. package/dist/esm/constants/constants.js +0 -22
  198. package/dist/esm/constants/constants.js.map +0 -7
  199. package/dist/esm/constants/isDevTools.js +0 -13
  200. package/dist/esm/constants/isDevTools.js.map +0 -7
  201. package/dist/esm/contexts/ButtonNestingContext.js +0 -6
  202. package/dist/esm/contexts/ButtonNestingContext.js.map +0 -7
  203. package/dist/esm/contexts/FontLanguageContext.js +0 -6
  204. package/dist/esm/contexts/FontLanguageContext.js.map +0 -7
  205. package/dist/esm/contexts/TextAncestorContext.js +0 -6
  206. package/dist/esm/contexts/TextAncestorContext.js.map +0 -7
  207. package/dist/esm/createComponent.js +0 -975
  208. package/dist/esm/createComponent.js.map +0 -7
  209. package/dist/esm/createFont.js +0 -45
  210. package/dist/esm/createFont.js.map +0 -7
  211. package/dist/esm/createFont.web.test.js +0 -124
  212. package/dist/esm/createFont.web.test.js.map +0 -7
  213. package/dist/esm/createShorthands.js +0 -7
  214. package/dist/esm/createShorthands.js.map +0 -7
  215. package/dist/esm/createTamagui.js +0 -190
  216. package/dist/esm/createTamagui.js.map +0 -7
  217. package/dist/esm/createTheme.js +0 -7
  218. package/dist/esm/createTheme.js.map +0 -7
  219. package/dist/esm/createTokens.js +0 -15
  220. package/dist/esm/createTokens.js.map +0 -7
  221. package/dist/esm/createTokens.web.test.js +0 -27
  222. package/dist/esm/createTokens.web.test.js.map +0 -7
  223. package/dist/esm/createVariable.js +0 -78
  224. package/dist/esm/createVariable.js.map +0 -7
  225. package/dist/esm/createVariable.web.test.js +0 -6
  226. package/dist/esm/createVariable.web.test.js.map +0 -7
  227. package/dist/esm/createVariables.js +0 -35
  228. package/dist/esm/createVariables.js.map +0 -7
  229. package/dist/esm/helpers/RNComponents.js +0 -16
  230. package/dist/esm/helpers/RNComponents.js.map +0 -7
  231. package/dist/esm/helpers/ThemeManager.js +0 -209
  232. package/dist/esm/helpers/ThemeManager.js.map +0 -7
  233. package/dist/esm/helpers/ThemeManager.test.js +0 -464
  234. package/dist/esm/helpers/ThemeManager.test.js.map +0 -7
  235. package/dist/esm/helpers/ThemeManagerContext.js +0 -6
  236. package/dist/esm/helpers/ThemeManagerContext.js.map +0 -7
  237. package/dist/esm/helpers/createMediaStyle.js +0 -42
  238. package/dist/esm/helpers/createMediaStyle.js.map +0 -7
  239. package/dist/esm/helpers/createPropMapper.js +0 -384
  240. package/dist/esm/helpers/createPropMapper.js.map +0 -7
  241. package/dist/esm/helpers/createProxy.js +0 -19
  242. package/dist/esm/helpers/createProxy.js.map +0 -7
  243. package/dist/esm/helpers/expandStyle.js +0 -71
  244. package/dist/esm/helpers/expandStyle.js.map +0 -7
  245. package/dist/esm/helpers/expandStyles.js +0 -90
  246. package/dist/esm/helpers/expandStyles.js.map +0 -7
  247. package/dist/esm/helpers/extendStaticConfig.js +0 -66
  248. package/dist/esm/helpers/extendStaticConfig.js.map +0 -7
  249. package/dist/esm/helpers/fixNativeShadow.js +0 -6
  250. package/dist/esm/helpers/fixNativeShadow.js.map +0 -7
  251. package/dist/esm/helpers/getAnimationDriver.js +0 -8
  252. package/dist/esm/helpers/getAnimationDriver.js.map +0 -7
  253. package/dist/esm/helpers/getExpandedShorthands.js +0 -16
  254. package/dist/esm/helpers/getExpandedShorthands.js.map +0 -7
  255. package/dist/esm/helpers/getFontLanguage.js +0 -5
  256. package/dist/esm/helpers/getFontLanguage.js.map +0 -7
  257. package/dist/esm/helpers/getSplitStyles.js +0 -847
  258. package/dist/esm/helpers/getSplitStyles.js.map +0 -7
  259. package/dist/esm/helpers/getStylesAtomic.js +0 -200
  260. package/dist/esm/helpers/getStylesAtomic.js.map +0 -7
  261. package/dist/esm/helpers/getStylesAtomic.native.js +0 -12
  262. package/dist/esm/helpers/getStylesAtomic.native.js.map +0 -7
  263. package/dist/esm/helpers/getThemeCSSRules.js +0 -86
  264. package/dist/esm/helpers/getThemeCSSRules.js.map +0 -7
  265. package/dist/esm/helpers/getThemeCSSRules.native.js +0 -7
  266. package/dist/esm/helpers/getThemeCSSRules.native.js.map +0 -7
  267. package/dist/esm/helpers/getVariantExtras.js +0 -67
  268. package/dist/esm/helpers/getVariantExtras.js.map +0 -7
  269. package/dist/esm/helpers/insertStyleRule.js +0 -186
  270. package/dist/esm/helpers/insertStyleRule.js.map +0 -7
  271. package/dist/esm/helpers/isObj.js +0 -5
  272. package/dist/esm/helpers/isObj.js.map +0 -7
  273. package/dist/esm/helpers/isTamaguiComponent.js +0 -8
  274. package/dist/esm/helpers/isTamaguiComponent.js.map +0 -7
  275. package/dist/esm/helpers/isTamaguiElement.js +0 -9
  276. package/dist/esm/helpers/isTamaguiElement.js.map +0 -7
  277. package/dist/esm/helpers/matchMedia.js +0 -17
  278. package/dist/esm/helpers/matchMedia.js.map +0 -7
  279. package/dist/esm/helpers/matchMedia.native.js +0 -23
  280. package/dist/esm/helpers/matchMedia.native.js.map +0 -7
  281. package/dist/esm/helpers/mergeProps.js +0 -30
  282. package/dist/esm/helpers/mergeProps.js.map +0 -7
  283. package/dist/esm/helpers/mergeTransform.js +0 -21
  284. package/dist/esm/helpers/mergeTransform.js.map +0 -7
  285. package/dist/esm/helpers/normalizeColor.js +0 -36
  286. package/dist/esm/helpers/normalizeColor.js.map +0 -7
  287. package/dist/esm/helpers/normalizeValueWithProperty.js +0 -113
  288. package/dist/esm/helpers/normalizeValueWithProperty.js.map +0 -7
  289. package/dist/esm/helpers/proxyThemeVariables.js +0 -16
  290. package/dist/esm/helpers/proxyThemeVariables.js.map +0 -7
  291. package/dist/esm/helpers/pseudoDescriptors.js +0 -29
  292. package/dist/esm/helpers/pseudoDescriptors.js.map +0 -7
  293. package/dist/esm/helpers/registerCSSVariable.js +0 -14
  294. package/dist/esm/helpers/registerCSSVariable.js.map +0 -7
  295. package/dist/esm/helpers/themeable.js +0 -28
  296. package/dist/esm/helpers/themeable.js.map +0 -7
  297. package/dist/esm/helpers/themes.js +0 -53
  298. package/dist/esm/helpers/themes.js.map +0 -7
  299. package/dist/esm/helpers/timer.js +0 -11
  300. package/dist/esm/helpers/timer.js.map +0 -7
  301. package/dist/esm/helpers/useShallowSetState.js +0 -35
  302. package/dist/esm/helpers/useShallowSetState.js.map +0 -7
  303. package/dist/esm/helpers/warnOnce.js +0 -14
  304. package/dist/esm/helpers/warnOnce.js.map +0 -7
  305. package/dist/esm/helpers/withStaticProperties.js +0 -8
  306. package/dist/esm/helpers/withStaticProperties.js.map +0 -7
  307. package/dist/esm/hooks/getThemeUnwrapped.js +0 -9
  308. package/dist/esm/hooks/getThemeUnwrapped.js.map +0 -7
  309. package/dist/esm/hooks/useId.js +0 -5
  310. package/dist/esm/hooks/useId.js.map +0 -7
  311. package/dist/esm/hooks/useIsTouchDevice.js +0 -9
  312. package/dist/esm/hooks/useIsTouchDevice.js.map +0 -7
  313. package/dist/esm/hooks/useMedia.js +0 -225
  314. package/dist/esm/hooks/useMedia.js.map +0 -7
  315. package/dist/esm/hooks/useSafeRef.js +0 -35
  316. package/dist/esm/hooks/useSafeRef.js.map +0 -7
  317. package/dist/esm/hooks/useServerHooks.js +0 -11
  318. package/dist/esm/hooks/useServerHooks.js.map +0 -7
  319. package/dist/esm/hooks/useStyle.js +0 -37
  320. package/dist/esm/hooks/useStyle.js.map +0 -7
  321. package/dist/esm/hooks/useTheme.js +0 -205
  322. package/dist/esm/hooks/useTheme.js.map +0 -7
  323. package/dist/esm/hooks/useThemeName.js +0 -28
  324. package/dist/esm/hooks/useThemeName.js.map +0 -7
  325. package/dist/esm/insertFont.js +0 -67
  326. package/dist/esm/insertFont.js.map +0 -7
  327. package/dist/esm/setupReactNative.js +0 -25
  328. package/dist/esm/setupReactNative.js.map +0 -7
  329. package/dist/esm/static.js +0 -3
  330. package/dist/esm/static.js.map +0 -7
  331. package/dist/esm/styled.js +0 -71
  332. package/dist/esm/styled.js.map +0 -7
  333. package/dist/esm/types-rnw.js +0 -1
  334. package/dist/esm/types.js +0 -1
  335. package/dist/esm/types.js.map +0 -7
  336. package/dist/esm/updateTheme.js +0 -23
  337. package/dist/esm/updateTheme.js.map +0 -7
  338. package/dist/esm/views/FontLanguage.js +0 -17
  339. package/dist/esm/views/FontLanguage.js.map +0 -7
  340. package/dist/esm/views/FontLanguage.native.js +0 -11
  341. package/dist/esm/views/FontLanguage.native.js.map +0 -7
  342. package/dist/esm/views/FontLanguage.types.js +0 -1
  343. package/dist/esm/views/FontLanguage.types.js.map +0 -7
  344. package/dist/esm/views/Slot.js +0 -71
  345. package/dist/esm/views/Slot.js.map +0 -7
  346. package/dist/esm/views/Stack.js +0 -14
  347. package/dist/esm/views/Stack.js.map +0 -7
  348. package/dist/esm/views/Stack.web.test.js +0 -21
  349. package/dist/esm/views/Stack.web.test.js.map +0 -7
  350. package/dist/esm/views/TamaguiProvider.js +0 -56
  351. package/dist/esm/views/TamaguiProvider.js.map +0 -7
  352. package/dist/esm/views/Text.js +0 -70
  353. package/dist/esm/views/Text.js.map +0 -7
  354. package/dist/esm/views/Theme.js +0 -63
  355. package/dist/esm/views/Theme.js.map +0 -7
  356. package/dist/esm/views/ThemeProvider.js +0 -45
  357. package/dist/esm/views/ThemeProvider.js.map +0 -7
  358. package/src/Tamagui.ts +0 -48
  359. package/src/__snapshots__/createTokens.test.ts.snap +0 -772
  360. package/src/__snapshots__/createTokens.web.test.tsx.snap +0 -772
  361. package/src/addTheme.ts +0 -65
  362. package/src/config.ts +0 -62
  363. package/src/constants/constants.ts +0 -17
  364. package/src/constants/isDevTools.ts +0 -12
  365. package/src/contexts/ButtonNestingContext.tsx +0 -3
  366. package/src/contexts/FontLanguageContext.tsx +0 -5
  367. package/src/contexts/TextAncestorContext.tsx +0 -3
  368. package/src/createComponent.tsx +0 -1291
  369. package/src/createFont.ts +0 -50
  370. package/src/createShorthands.ts +0 -7
  371. package/src/createTamagui.ts +0 -253
  372. package/src/createTheme.ts +0 -13
  373. package/src/createTokens.ts +0 -46
  374. package/src/createVariable.ts +0 -93
  375. package/src/createVariables.ts +0 -55
  376. package/src/helpers/RNComponents.tsx +0 -14
  377. package/src/helpers/ThemeManager.tsx +0 -285
  378. package/src/helpers/ThemeManagerContext.tsx +0 -5
  379. package/src/helpers/createMediaStyle.ts +0 -56
  380. package/src/helpers/createPropMapper.ts +0 -544
  381. package/src/helpers/createProxy.ts +0 -16
  382. package/src/helpers/expandStyle.ts +0 -82
  383. package/src/helpers/expandStyles.ts +0 -107
  384. package/src/helpers/extendStaticConfig.ts +0 -78
  385. package/src/helpers/fixNativeShadow.tsx +0 -2
  386. package/src/helpers/getAnimationDriver.tsx +0 -5
  387. package/src/helpers/getExpandedShorthands.ts +0 -17
  388. package/src/helpers/getFontLanguage.ts +0 -2
  389. package/src/helpers/getSplitStyles.tsx +0 -1137
  390. package/src/helpers/getStylesAtomic.native.ts +0 -8
  391. package/src/helpers/getStylesAtomic.ts +0 -274
  392. package/src/helpers/getThemeCSSRules.native.ts +0 -3
  393. package/src/helpers/getThemeCSSRules.ts +0 -120
  394. package/src/helpers/getVariantExtras.tsx +0 -85
  395. package/src/helpers/insertStyleRule.tsx +0 -220
  396. package/src/helpers/isObj.ts +0 -1
  397. package/src/helpers/isTamaguiComponent.tsx +0 -11
  398. package/src/helpers/isTamaguiElement.tsx +0 -15
  399. package/src/helpers/matchMedia.native.ts +0 -23
  400. package/src/helpers/matchMedia.ts +0 -16
  401. package/src/helpers/mergeProps.ts +0 -56
  402. package/src/helpers/mergeTransform.ts +0 -30
  403. package/src/helpers/normalizeColor.ts +0 -38
  404. package/src/helpers/normalizeValueWithProperty.ts +0 -129
  405. package/src/helpers/proxyThemeVariables.tsx +0 -15
  406. package/src/helpers/pseudoDescriptors.ts +0 -40
  407. package/src/helpers/registerCSSVariable.ts +0 -13
  408. package/src/helpers/themeable.tsx +0 -44
  409. package/src/helpers/themes.ts +0 -67
  410. package/src/helpers/timer.ts +0 -9
  411. package/src/helpers/useShallowSetState.tsx +0 -41
  412. package/src/helpers/warnOnce.tsx +0 -11
  413. package/src/helpers/withStaticProperties.tsx +0 -7
  414. package/src/hooks/getThemeUnwrapped.tsx +0 -5
  415. package/src/hooks/useId.tsx +0 -1
  416. package/src/hooks/useIsTouchDevice.tsx +0 -6
  417. package/src/hooks/useMedia.tsx +0 -298
  418. package/src/hooks/useSafeRef.ts +0 -45
  419. package/src/hooks/useServerHooks.tsx +0 -12
  420. package/src/hooks/useStyle.tsx +0 -49
  421. package/src/hooks/useTheme.tsx +0 -274
  422. package/src/hooks/useThemeName.tsx +0 -27
  423. package/src/insertFont.ts +0 -73
  424. package/src/setupReactNative.ts +0 -22
  425. package/src/static.ts +0 -5
  426. package/src/styled.tsx +0 -195
  427. package/src/types-rnw.tsx +0 -162
  428. package/src/types.tsx +0 -1405
  429. package/src/updateTheme.ts +0 -26
  430. package/src/views/FontLanguage.native.tsx +0 -12
  431. package/src/views/FontLanguage.tsx +0 -16
  432. package/src/views/FontLanguage.types.ts +0 -13
  433. package/src/views/Slot.tsx +0 -102
  434. package/src/views/Stack.tsx +0 -25
  435. package/src/views/TamaguiProvider.tsx +0 -65
  436. package/src/views/Text.tsx +0 -88
  437. package/src/views/Theme.tsx +0 -83
  438. package/src/views/ThemeProvider.tsx +0 -55
  439. package/types/Tamagui.d.ts +0 -30
  440. package/types/Tamagui.d.ts.map +0 -1
  441. package/types/addTheme.d.ts +0 -32
  442. package/types/addTheme.d.ts.map +0 -1
  443. package/types/config.d.ts +0 -49
  444. package/types/config.d.ts.map +0 -1
  445. package/types/constants/constants.d.ts +0 -21
  446. package/types/constants/constants.d.ts.map +0 -1
  447. package/types/constants/isDevTools.d.ts +0 -2
  448. package/types/constants/isDevTools.d.ts.map +0 -1
  449. package/types/contexts/ButtonNestingContext.d.ts +0 -3
  450. package/types/contexts/ButtonNestingContext.d.ts.map +0 -1
  451. package/types/contexts/FontLanguageContext.d.ts +0 -5
  452. package/types/contexts/FontLanguageContext.d.ts.map +0 -1
  453. package/types/contexts/TextAncestorContext.d.ts +0 -3
  454. package/types/contexts/TextAncestorContext.d.ts.map +0 -1
  455. package/types/createComponent.d.ts +0 -23
  456. package/types/createComponent.d.ts.map +0 -1
  457. package/types/createFont.d.ts +0 -3
  458. package/types/createFont.d.ts.map +0 -1
  459. package/types/createFont.web.test.d.ts +0 -2
  460. package/types/createFont.web.test.d.ts.map +0 -1
  461. package/types/createShorthands.d.ts +0 -3
  462. package/types/createShorthands.d.ts.map +0 -1
  463. package/types/createTamagui.d.ts +0 -3
  464. package/types/createTamagui.d.ts.map +0 -1
  465. package/types/createTheme.d.ts +0 -7
  466. package/types/createTheme.d.ts.map +0 -1
  467. package/types/createTokens.d.ts +0 -28
  468. package/types/createTokens.d.ts.map +0 -1
  469. package/types/createTokens.web.test.d.ts +0 -2
  470. package/types/createTokens.web.test.d.ts.map +0 -1
  471. package/types/createVariable.d.ts +0 -26
  472. package/types/createVariable.d.ts.map +0 -1
  473. package/types/createVariable.web.test.d.ts +0 -2
  474. package/types/createVariable.web.test.d.ts.map +0 -1
  475. package/types/createVariables.d.ts +0 -11
  476. package/types/createVariables.d.ts.map +0 -1
  477. package/types/helpers/RNComponents.d.ts +0 -2
  478. package/types/helpers/RNComponents.d.ts.map +0 -1
  479. package/types/helpers/ThemeManager.d.ts +0 -36
  480. package/types/helpers/ThemeManager.d.ts.map +0 -1
  481. package/types/helpers/ThemeManager.test.d.ts +0 -2
  482. package/types/helpers/ThemeManager.test.d.ts.map +0 -1
  483. package/types/helpers/ThemeManagerContext.d.ts +0 -4
  484. package/types/helpers/ThemeManagerContext.d.ts.map +0 -1
  485. package/types/helpers/createMediaStyle.d.ts +0 -6
  486. package/types/helpers/createMediaStyle.d.ts.map +0 -1
  487. package/types/helpers/createPropMapper.d.ts +0 -7
  488. package/types/helpers/createPropMapper.d.ts.map +0 -1
  489. package/types/helpers/createProxy.d.ts +0 -2
  490. package/types/helpers/createProxy.d.ts.map +0 -1
  491. package/types/helpers/expandStyle.d.ts +0 -6
  492. package/types/helpers/expandStyle.d.ts.map +0 -1
  493. package/types/helpers/expandStyles.d.ts +0 -26
  494. package/types/helpers/expandStyles.d.ts.map +0 -1
  495. package/types/helpers/extendStaticConfig.d.ts +0 -4
  496. package/types/helpers/extendStaticConfig.d.ts.map +0 -1
  497. package/types/helpers/fixNativeShadow.d.ts +0 -2
  498. package/types/helpers/fixNativeShadow.d.ts.map +0 -1
  499. package/types/helpers/getAnimationDriver.d.ts +0 -6
  500. package/types/helpers/getAnimationDriver.d.ts.map +0 -1
  501. package/types/helpers/getExpandedShorthands.d.ts +0 -3
  502. package/types/helpers/getExpandedShorthands.d.ts.map +0 -1
  503. package/types/helpers/getFontLanguage.d.ts +0 -2
  504. package/types/helpers/getFontLanguage.d.ts.map +0 -1
  505. package/types/helpers/getSplitStyles.d.ts +0 -43
  506. package/types/helpers/getSplitStyles.d.ts.map +0 -1
  507. package/types/helpers/getStylesAtomic.d.ts +0 -18
  508. package/types/helpers/getStylesAtomic.d.ts.map +0 -1
  509. package/types/helpers/getStylesAtomic.native.d.ts +0 -4
  510. package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
  511. package/types/helpers/getThemeCSSRules.d.ts +0 -8
  512. package/types/helpers/getThemeCSSRules.d.ts.map +0 -1
  513. package/types/helpers/getThemeCSSRules.native.d.ts +0 -2
  514. package/types/helpers/getThemeCSSRules.native.d.ts.map +0 -1
  515. package/types/helpers/getVariantExtras.d.ts +0 -5
  516. package/types/helpers/getVariantExtras.d.ts.map +0 -1
  517. package/types/helpers/insertStyleRule.d.ts +0 -13
  518. package/types/helpers/insertStyleRule.d.ts.map +0 -1
  519. package/types/helpers/isObj.d.ts +0 -2
  520. package/types/helpers/isObj.d.ts.map +0 -1
  521. package/types/helpers/isTamaguiComponent.d.ts +0 -5
  522. package/types/helpers/isTamaguiComponent.d.ts.map +0 -1
  523. package/types/helpers/isTamaguiElement.d.ts +0 -7
  524. package/types/helpers/isTamaguiElement.d.ts.map +0 -1
  525. package/types/helpers/matchMedia.d.ts +0 -6
  526. package/types/helpers/matchMedia.d.ts.map +0 -1
  527. package/types/helpers/matchMedia.native.d.ts +0 -4
  528. package/types/helpers/matchMedia.native.d.ts.map +0 -1
  529. package/types/helpers/mergeProps.d.ts +0 -17
  530. package/types/helpers/mergeProps.d.ts.map +0 -1
  531. package/types/helpers/mergeTransform.d.ts +0 -9
  532. package/types/helpers/mergeTransform.d.ts.map +0 -1
  533. package/types/helpers/normalizeColor.d.ts +0 -4
  534. package/types/helpers/normalizeColor.d.ts.map +0 -1
  535. package/types/helpers/normalizeValueWithProperty.d.ts +0 -7
  536. package/types/helpers/normalizeValueWithProperty.d.ts.map +0 -1
  537. package/types/helpers/proxyThemeVariables.d.ts +0 -2
  538. package/types/helpers/proxyThemeVariables.d.ts.map +0 -1
  539. package/types/helpers/pseudoDescriptors.d.ts +0 -10
  540. package/types/helpers/pseudoDescriptors.d.ts.map +0 -1
  541. package/types/helpers/registerCSSVariable.d.ts +0 -5
  542. package/types/helpers/registerCSSVariable.d.ts.map +0 -1
  543. package/types/helpers/themeable.d.ts +0 -12
  544. package/types/helpers/themeable.d.ts.map +0 -1
  545. package/types/helpers/themes.d.ts +0 -4
  546. package/types/helpers/themes.d.ts.map +0 -1
  547. package/types/helpers/timer.d.ts +0 -2
  548. package/types/helpers/timer.d.ts.map +0 -1
  549. package/types/helpers/useShallowSetState.d.ts +0 -5
  550. package/types/helpers/useShallowSetState.d.ts.map +0 -1
  551. package/types/helpers/warnOnce.d.ts +0 -2
  552. package/types/helpers/warnOnce.d.ts.map +0 -1
  553. package/types/helpers/withStaticProperties.d.ts +0 -2
  554. package/types/helpers/withStaticProperties.d.ts.map +0 -1
  555. package/types/hooks/getThemeUnwrapped.d.ts +0 -3
  556. package/types/hooks/getThemeUnwrapped.d.ts.map +0 -1
  557. package/types/hooks/useId.d.ts +0 -2
  558. package/types/hooks/useId.d.ts.map +0 -1
  559. package/types/hooks/useIsTouchDevice.d.ts +0 -2
  560. package/types/hooks/useIsTouchDevice.d.ts.map +0 -1
  561. package/types/hooks/useMedia.d.ts +0 -33
  562. package/types/hooks/useMedia.d.ts.map +0 -1
  563. package/types/hooks/useSafeRef.d.ts +0 -4
  564. package/types/hooks/useSafeRef.d.ts.map +0 -1
  565. package/types/hooks/useServerHooks.d.ts +0 -4
  566. package/types/hooks/useServerHooks.d.ts.map +0 -1
  567. package/types/hooks/useStyle.d.ts +0 -8
  568. package/types/hooks/useStyle.d.ts.map +0 -1
  569. package/types/hooks/useTheme.d.ts +0 -25
  570. package/types/hooks/useTheme.d.ts.map +0 -1
  571. package/types/hooks/useThemeName.d.ts +0 -5
  572. package/types/hooks/useThemeName.d.ts.map +0 -1
  573. package/types/insertFont.d.ts +0 -9
  574. package/types/insertFont.d.ts.map +0 -1
  575. package/types/setupReactNative.d.ts +0 -5
  576. package/types/setupReactNative.d.ts.map +0 -1
  577. package/types/static.d.ts +0 -3
  578. package/types/static.d.ts.map +0 -1
  579. package/types/styled.d.ts +0 -20
  580. package/types/styled.d.ts.map +0 -1
  581. package/types/types-rnw.d.ts +0 -74
  582. package/types/types-rnw.d.ts.map +0 -1
  583. package/types/types.d.ts +0 -673
  584. package/types/types.d.ts.map +0 -1
  585. package/types/updateTheme.d.ts +0 -30
  586. package/types/updateTheme.d.ts.map +0 -1
  587. package/types/views/FontLanguage.d.ts +0 -4
  588. package/types/views/FontLanguage.d.ts.map +0 -1
  589. package/types/views/FontLanguage.native.d.ts +0 -4
  590. package/types/views/FontLanguage.native.d.ts.map +0 -1
  591. package/types/views/FontLanguage.types.d.ts +0 -11
  592. package/types/views/FontLanguage.types.d.ts.map +0 -1
  593. package/types/views/Slot.d.ts +0 -11
  594. package/types/views/Slot.d.ts.map +0 -1
  595. package/types/views/Stack.d.ts +0 -4
  596. package/types/views/Stack.d.ts.map +0 -1
  597. package/types/views/Stack.web.test.d.ts +0 -2
  598. package/types/views/Stack.web.test.d.ts.map +0 -1
  599. package/types/views/TamaguiProvider.d.ts +0 -4
  600. package/types/views/TamaguiProvider.d.ts.map +0 -1
  601. package/types/views/Text.d.ts +0 -4
  602. package/types/views/Text.d.ts.map +0 -1
  603. package/types/views/Theme.d.ts +0 -8
  604. package/types/views/Theme.d.ts.map +0 -1
  605. package/types/views/ThemeProvider.d.ts +0 -12
  606. package/types/views/ThemeProvider.d.ts.map +0 -1
package/src/types.tsx DELETED
@@ -1,1405 +0,0 @@
1
- // TODO split this into own package @tamagui/types to share with animations packages
2
-
3
- import type { Properties } from 'csstype'
4
- import type {
5
- ComponentType,
6
- ForwardRefExoticComponent,
7
- FunctionComponent,
8
- HTMLAttributes,
9
- ReactNode,
10
- RefAttributes,
11
- RefObject,
12
- } from 'react'
13
- import type {
14
- Image,
15
- PressableProps,
16
- TextProps as ReactTextProps,
17
- Text,
18
- TextInput,
19
- TextStyle,
20
- View,
21
- ViewProps,
22
- ViewStyle,
23
- } from 'react-native'
24
-
25
- import type { Variable } from './createVariable'
26
- import type { ResolveVariableTypes } from './helpers/createPropMapper'
27
- import type { TamaguiReactElement } from './static'
28
- import type { RNWTextProps, RNWViewProps } from './types-rnw'
29
- import type { FontLanguageProps } from './views/FontLanguage.types'
30
- import type { ThemeProviderProps } from './views/ThemeProvider'
31
-
32
- export type SpaceDirection = 'vertical' | 'horizontal' | 'both'
33
-
34
- export type TamaguiElement = HTMLElement | View
35
-
36
- export type DebugProp = boolean | 'break' | 'verbose'
37
-
38
- // base props that are accepted by createComponent (additional to react-native-web)
39
-
40
- type DivAttributes = HTMLAttributes<HTMLDivElement>
41
-
42
- export type TamaguiComponentPropsBase = {
43
- hitSlop?: PressableProps['hitSlop']
44
- asChild?: boolean
45
- space?: SpaceTokens | null
46
- spaceDirection?: SpaceDirection
47
- separator?: ReactNode
48
- dangerouslySetInnerHTML?: { __html: string }
49
- animation?: AnimationProp | null
50
- animateOnly?: string[]
51
- children?: any | any[]
52
- debug?: DebugProp
53
- disabled?: boolean
54
- className?: string
55
- themeShallow?: boolean
56
- id?: string
57
- tag?: string
58
- theme?: ThemeName | null
59
- componentName?: string
60
- /**
61
- * Forces the pseudo style state to be on
62
- */
63
- forceStyle?: 'hover' | 'press' | 'focus'
64
- onHoverIn?: DivAttributes['onMouseEnter']
65
- onHoverOut?: DivAttributes['onMouseLeave']
66
- onPress?: PressableProps['onPress']
67
- onPressIn?: PressableProps['onPress']
68
- onPressOut?: PressableProps['onPress']
69
- // WEB ONLY
70
- onMouseEnter?: DivAttributes['onMouseEnter']
71
- onMouseLeave?: DivAttributes['onMouseLeave']
72
- onMouseDown?: DivAttributes['onMouseDown']
73
- }
74
-
75
- export type ReactComponentWithRef<Props, Ref> = ForwardRefExoticComponent<
76
- Props & RefAttributes<Ref>
77
- >
78
-
79
- export type ConfigListener = (conf: TamaguiInternalConfig) => void
80
-
81
- // to prevent things from going circular, hoisting some types in this file
82
- // to generally order them as building up towards TamaguiConfig
83
-
84
- export type VariableVal = number | string | Variable
85
- export type VariableColorVal = string | Variable
86
-
87
- type GenericKey = string | number | symbol
88
-
89
- export interface CreateTokens<Val extends VariableVal = VariableVal> {
90
- color: { [key: GenericKey]: Val }
91
- space: { [key: GenericKey]: Val }
92
- size: { [key: GenericKey]: Val }
93
- radius: { [key: GenericKey]: Val }
94
- zIndex: { [key: GenericKey]: Val }
95
- }
96
-
97
- type Tokenify<A extends GenericTokens> = {
98
- color: TokenifyRecord<A['color']>
99
- space: TokenifyRecord<A['space']>
100
- size: TokenifyRecord<A['size']>
101
- radius: TokenifyRecord<A['radius']>
102
- zIndex: TokenifyRecord<A['zIndex']>
103
- }
104
-
105
- type TokenifyRecord<A extends CreateTokens[keyof CreateTokens]> = {
106
- [Key in keyof A]: A[Key] extends Variable ? A[Key] : Variable<A[Key]>
107
- }
108
-
109
- export type TamaguiBaseTheme = {
110
- // defined for our tamagui kit , we could do this inside `tamagui`
111
- // but maybe helpful to have some sort of universally shared things +
112
- // + enforce if they want their own, redefine in their design sys
113
- background: VariableColorVal
114
- backgroundHover: VariableColorVal
115
- backgroundPress: VariableColorVal
116
- backgroundFocus: VariableColorVal
117
- color: VariableColorVal
118
- colorHover: VariableColorVal
119
- colorPress: VariableColorVal
120
- colorFocus: VariableColorVal
121
- borderColor: VariableColorVal
122
- borderColorHover: VariableColorVal
123
- borderColorPress: VariableColorVal
124
- borderColorFocus: VariableColorVal
125
- shadowColor: VariableColorVal
126
- shadowColorHover: VariableColorVal
127
- shadowColorPress: VariableColorVal
128
- shadowColorFocus: VariableColorVal
129
- }
130
-
131
- type GenericTokens = CreateTokens
132
- type GenericThemes = {
133
- [key: string]:
134
- | Partial<TamaguiBaseTheme> & {
135
- [key: string]: VariableVal
136
- }
137
- }
138
-
139
- type AllStyleKeys = keyof StackStylePropsBase | keyof TextStylePropsBase
140
-
141
- export type CreateShorthands = {
142
- [key: string]: AllStyleKeys
143
- }
144
-
145
- export type GenericShorthands = {}
146
-
147
- // sm: { minWidth: 100 }
148
- type GenericMedia = {
149
- [key: string]: {
150
- [key: string]: number | string
151
- }
152
- }
153
-
154
- export type GenericFonts = Record<string, GenericFont>
155
-
156
- type GenericAnimations = {
157
- [key: string]:
158
- | string
159
- | {
160
- [key: string]: any
161
- }
162
- | any[]
163
- }
164
-
165
- // this is the "main" typed object, which users re-define
166
- // (internal) keep all types directly on this object and reference them from elsewhere
167
- //
168
- // const config = createTamagui(...)
169
- // type MyConfig = typeof config
170
- // declare module 'tamagui' {
171
- // export interface TamaguiCustomConfig extends MyConfig {}
172
- // }
173
- // now your whole app/kit should be typed correctly
174
- //
175
- export interface TamaguiCustomConfig {}
176
-
177
- export interface TamaguiConfig
178
- extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,
179
- TamaguiCustomConfig {}
180
-
181
- export type CreateTamaguiConfig<
182
- A extends GenericTokens,
183
- B extends GenericThemes,
184
- C extends GenericShorthands = GenericShorthands,
185
- D extends GenericMedia = GenericMedia,
186
- E extends GenericAnimations = GenericAnimations,
187
- F extends GenericFonts = GenericFonts
188
- > = {
189
- fonts: RemoveLanguagePostfixes<F>
190
- fontLanguages: GetLanguagePostfixes<F> extends never
191
- ? string[]
192
- : GetLanguagePostfixes<F>[]
193
- tokens: A
194
- // parsed
195
- themes: {
196
- [Name in keyof B]: {
197
- [Key in keyof B[Name]]: Variable
198
- }
199
- }
200
- shorthands: C
201
- media: D
202
- animations: AnimationDriver<E>
203
- }
204
-
205
- type GetLanguagePostfix<Set> = Set extends string
206
- ? Set extends `${string}_${infer Postfix}`
207
- ? Postfix
208
- : never
209
- : never
210
-
211
- type OmitLanguagePostfix<Set> = Set extends string
212
- ? Set extends `${infer Prefix}_${string}`
213
- ? Prefix
214
- : Set
215
- : never
216
-
217
- type RemoveLanguagePostfixes<F extends GenericFonts> = {
218
- [Key in OmitLanguagePostfix<keyof F>]: F[Key]
219
- }
220
-
221
- type GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>
222
-
223
- // test RemoveLanguagePostfixes
224
- // type x = CreateTamaguiConfig<any, any, any, any, any, {
225
- // body: any,
226
- // body_en: any
227
- // }>['fonts']
228
-
229
- type ConfProps<
230
- A extends GenericTokens,
231
- B extends GenericThemes,
232
- C extends GenericShorthands = GenericShorthands,
233
- D extends GenericMedia = GenericMedia,
234
- E extends GenericAnimations = GenericAnimations,
235
- F extends GenericFonts = GenericFonts
236
- > = {
237
- tokens: A
238
- themes: B
239
- shorthands?: C
240
- media?: D
241
- animations?: AnimationDriver<E>
242
- fonts: F
243
- }
244
-
245
- export type InferTamaguiConfig<Conf> = Conf extends ConfProps<
246
- infer A,
247
- infer B,
248
- infer C,
249
- infer D,
250
- infer E,
251
- infer F
252
- >
253
- ? TamaguiInternalConfig<A, B, C, D, E, F>
254
- : unknown
255
-
256
- // for use in creation functions so it doesnt get overwritten
257
- export type GenericTamaguiConfig = CreateTamaguiConfig<
258
- GenericTokens,
259
- GenericThemes,
260
- GenericShorthands,
261
- GenericMedia,
262
- GenericAnimations,
263
- GenericFonts
264
- >
265
-
266
- // since TamaguiConfig will be re-declared, these will all be typed globally
267
- export type ThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]
268
- export type ThemeKeys = keyof ThemeDefinition
269
- export type ThemeParsed = {
270
- [key in ThemeKeys]: Variable<any>
271
- }
272
- export type Tokens = TamaguiConfig['tokens']
273
- export type Shorthands = TamaguiConfig['shorthands']
274
- export type Media = TamaguiConfig['media']
275
- export type Themes = TamaguiConfig['themes']
276
- export type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>
277
- export type ThemeTokens = `$${ThemeKeys}`
278
- export type AnimationKeys = TamaguiConfig['animations'] extends AnimationDriver<
279
- infer Config
280
- >
281
- ? keyof Config
282
- : string
283
- export type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>
284
-
285
- export interface ThemeProps {
286
- className?: string
287
- name?: Exclude<ThemeName, number> | null
288
- componentName?: string
289
- children?: any
290
- reset?: boolean
291
- debug?: boolean | 'verbose'
292
- inverse?: boolean
293
- // on the web, for portals we need to re-insert className
294
- forceClassName?: boolean
295
- // allows for disabling the auto-update behavior
296
- shouldUpdate?: () => boolean
297
- }
298
-
299
- type ArrayIntersection<A extends any[]> = A[keyof A]
300
-
301
- type GetAltThemeNames<S> =
302
- | (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S)
303
- | S
304
-
305
- type SpacerPropsBase = {
306
- size?: number | SpaceTokens | null
307
- flex?: boolean | number
308
- direction?: SpaceDirection
309
- }
310
- type SpacerOwnProps = SpacerPropsBase &
311
- //
312
- WithThemeShorthandsPseudosMediaAnimation<SpacerPropsBase>
313
-
314
- export type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> &
315
- //
316
- SpacerOwnProps
317
-
318
- export type CreateTamaguiProps = {
319
- reactNative?: any
320
- shorthands?: CreateShorthands
321
- media?: GenericTamaguiConfig['media']
322
- animations?: AnimationDriver<any>
323
- fonts: GenericTamaguiConfig['fonts']
324
- tokens: GenericTamaguiConfig['tokens']
325
- themes: {
326
- [key: string]: {
327
- [key: string]: string | number | Variable
328
- }
329
- }
330
-
331
- /**
332
- * *Advanced use case* For all CSS extracted views, this has no effect.
333
- *
334
- * For SSR compatibility on the web, Tamagui will render once with the settings
335
- * from `mediaQueryDefaultActive` set for all media queries. Then, it will render
336
- * again after the initial render using the proper media query values. This is so that
337
- * hydration will match perfectly with the server.
338
- *
339
- * Setting disableSSR will avoid this second render by setting the media query state
340
- * to the actual browser dimensions on initial load. This is only useful for client-only
341
- * apps.
342
- *
343
- */
344
- disableSSR?: boolean
345
-
346
- /**
347
- * Disable inserting a theme class in the DOM or context, allowing you to manually place it higher.
348
- * For custom use cases like integration with next-theme.
349
- */
350
- disableRootThemeClass?: boolean
351
-
352
- defaultProps?: Record<string, any> & {
353
- Stack?: StackProps
354
- Text?: TextProps
355
- Spacer?: SpacerProps
356
- }
357
-
358
- // for the first render, determines which media queries are true
359
- // useful for SSR
360
- mediaQueryDefaultActive?: Record<MediaQueryKey, boolean>
361
-
362
- // what's between each CSS style rule, set to "\n" to be easier to read
363
- // defaults: "\n" when NODE_ENV=development, "" otherwise
364
- cssStyleSeparator?: string
365
-
366
- // (Advanced)
367
- // on the web, tamagui treats `dark` and `light` themes as special and
368
- // generates extra CSS to avoid having to re-render the entire page.
369
- // this CSS relies on specificity hacks that multiply by your sub-themes.
370
- // this sets the maxiumum number of nested dark/light themes you can do
371
- // defaults to 3 for a balance, but can be higher if you nest them deeply.
372
- maxDarkLightNesting?: number
373
-
374
- // adds @media(prefers-color-scheme) media queries for dark/light
375
- shouldAddPrefersColorThemes?: boolean
376
-
377
- // only if you put the theme classname on the html element we have to generate diff
378
- themeClassNameOnRoot?: boolean
379
- }
380
-
381
- // this is the config generated via createTamagui()
382
- export type TamaguiInternalConfig<
383
- A extends GenericTokens = GenericTokens,
384
- B extends GenericThemes = GenericThemes,
385
- C extends GenericShorthands = GenericShorthands,
386
- D extends GenericMedia = GenericMedia,
387
- E extends GenericAnimations = GenericAnimations,
388
- F extends GenericFonts = GenericFonts
389
- > = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> &
390
- Omit<CreateTamaguiConfig<A, B, C, D, E, F>, 'tokens'> & {
391
- // TODO need to make it this but this breaks types, revisit
392
- // animations: E //AnimationDriver<E>
393
- // with $ prefixes for fast lookups (one time cost at startup vs every render)
394
- tokens: Tokenify<A>
395
- tokensParsed: Tokenify<A>
396
- themeConfig: any
397
- fontsParsed: GenericFonts
398
- getCSS: () => string
399
- parsed: boolean
400
- inverseShorthands: Record<string, string>
401
- reactNative?: any
402
- }
403
-
404
- export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']
405
-
406
- // prevents const intersections from being clobbered into string, keeping the consts
407
- export type UnionableString = string & {}
408
- export type UnionableNumber = number & {}
409
- export type PropTypes<A extends TamaguiComponent> = A extends FunctionComponent<
410
- infer Props
411
- >
412
- ? Props
413
- : unknown
414
-
415
- export type GenericFont<Key extends number | string = number | string> = {
416
- size: { [key in Key]: number | Variable }
417
- lineHeight: Partial<{ [key in Key]: number | Variable }>
418
- letterSpacing: Partial<{ [key in Key]: number | Variable }>
419
- weight: Partial<{ [key in Key]: number | string | Variable }>
420
- family: string | Variable
421
- style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>
422
- transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>
423
- color?: Partial<{ [key in Key]: string | Variable }>
424
- // for native use only, lets you map to alternative fonts
425
- face?: Partial<{
426
- [key in FontWeightSteps]: { normal?: string; italic?: string }
427
- }>
428
- }
429
-
430
- // media
431
- export type MediaQueryObject = { [key: string]: string | number | string }
432
- export type MediaQueryKey = keyof Media
433
- export type MediaPropKeys = `$${MediaQueryKey}`
434
- export type MediaQueryState = { [key in MediaQueryKey]: boolean }
435
- export type MediaProps<A> = {
436
- [key in MediaPropKeys]?: A
437
- }
438
- export type MediaQueries = {
439
- [key in MediaQueryKey]: MediaQueryObject
440
- }
441
-
442
- export interface MediaQueryList {
443
- addListener(listener?: any): void
444
- removeListener(listener?: any): void
445
- matches: boolean
446
- }
447
-
448
- export type MatchMedia = (query: string) => MediaQueryList
449
-
450
- export type TransformStyleProps = {
451
- x?: number
452
- y?: number
453
- perspective?: number
454
- scale?: number
455
- scaleX?: number
456
- scaleY?: number
457
- skewX?: string
458
- skewY?: string
459
- matrix?: number[]
460
- rotate?: string
461
- rotateY?: string
462
- rotateX?: string
463
- rotateZ?: string
464
- }
465
-
466
- // createComponent props helpers
467
-
468
- // animation="bouncy"
469
- // animation={['bouncy', { }]}
470
- // { all: 'name' }
471
-
472
- // TODO can override for better types
473
- export type AnimationConfigType = any
474
-
475
- export type AnimationProp =
476
- | AnimationKeys
477
- | {
478
- [key: string]:
479
- | AnimationKeys
480
- | {
481
- type: AnimationKeys
482
- [key: string]: any
483
- }
484
- }
485
- | [
486
- AnimationKeys,
487
- {
488
- [key: string]:
489
- | AnimationKeys
490
- | {
491
- type?: AnimationKeys
492
- [key: string]: any
493
- }
494
- }
495
- ]
496
-
497
- type GetTokenFontKeysFor<
498
- A extends
499
- | 'size'
500
- | 'weight'
501
- | 'letterSpacing'
502
- | 'family'
503
- | 'lineHeight'
504
- | 'transform'
505
- | 'style'
506
- | 'color'
507
- > = keyof TamaguiConfig['fonts']['body'][A]
508
-
509
- type GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`
510
-
511
- // base tokens
512
- export type SizeTokens = GetTokenString<keyof Tokens['size']> | number
513
- export type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean
514
-
515
- export type ColorTokens =
516
- | GetTokenString<keyof Tokens['color']>
517
- | GetTokenString<keyof ThemeParsed>
518
- | CSSColorNames
519
- export type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number
520
- export type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number
521
-
522
- // font tokens
523
- export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>
524
- export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number
525
- export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number
526
- export type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
527
- export type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightSteps
528
- export type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number
529
- export type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number
530
- export type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']
531
- export type FontTransformTokens =
532
- | `$${GetTokenFontKeysFor<'transform'>}`
533
- | TextStyle['textTransform']
534
-
535
- //
536
- // adds theme short values to relevant props
537
- //
538
-
539
- export type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'
540
- ? ThemeTokens
541
- : K extends 'size'
542
- ? SizeTokens
543
- : K extends 'font'
544
- ? FontTokens
545
- : K extends 'fontSize'
546
- ? FontSizeTokens
547
- : K extends 'space'
548
- ? SpaceTokens
549
- : K extends 'color'
550
- ? ColorTokens
551
- : K extends 'zIndex'
552
- ? ZIndexTokens
553
- : K extends 'lineHeight'
554
- ? FontLineHeightTokens
555
- : K extends 'fontWeight'
556
- ? FontWeightTokens
557
- : K extends 'letterSpacing'
558
- ? FontLetterSpacingTokens
559
- : {}
560
-
561
- type FontKeys = 'fontFamily'
562
- type FontSizeKeys = 'fontSize'
563
- type FontWeightKeys = 'fontWeight'
564
- type FontLetterSpacingKeys = 'letterSpacing'
565
- type LineHeightKeys = 'lineHeight'
566
- type ZIndexKeys = 'zIndex'
567
-
568
- export type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'
569
- ? ThemeTokens
570
- : K extends SizeKeys
571
- ? SizeTokens
572
- : K extends FontKeys
573
- ? FontTokens
574
- : K extends FontSizeKeys
575
- ? FontSizeTokens
576
- : K extends `${`border${string | ''}Radius`}`
577
- ? RadiusTokens
578
- : K extends SpaceKeys
579
- ? K extends 'shadowOffset'
580
- ? { width: SpaceTokens; height: SpaceTokens }
581
- : SpaceTokens
582
- : K extends ColorKeys
583
- ? ColorTokens
584
- : K extends ZIndexKeys
585
- ? ZIndexTokens
586
- : K extends LineHeightKeys
587
- ? FontLineHeightTokens
588
- : K extends FontWeightKeys
589
- ? FontWeightTokens
590
- : K extends FontLetterSpacingKeys
591
- ? FontLetterSpacingTokens
592
- : never
593
-
594
- export type ThemeValueFallback = UnionableString | Variable
595
-
596
- export type WithThemeValues<T extends object> = {
597
- [K in keyof T]: ThemeValueGet<K> extends never
598
- ? T[K]
599
- : ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback
600
- }
601
-
602
- // adds shorthand props
603
- export type WithShorthands<StyleProps> = {
604
- [Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps
605
- ? StyleProps[Shorthands[Key]] | null
606
- : undefined
607
- }
608
-
609
- // adds pseudo props
610
- export type PseudoProps<A> = {
611
- hoverStyle?: A | null
612
- pressStyle?: A | null
613
- focusStyle?: A | null
614
- exitStyle?: A | null
615
- enterStyle?: A | null
616
- }
617
-
618
- export type PseudoPropKeys = keyof PseudoProps<any>
619
-
620
- export type PseudoStyles = {
621
- hoverStyle?: ViewStyle
622
- pressStyle?: ViewStyle
623
- focusStyle?: ViewStyle
624
- enterStyle?: ViewStyle
625
- exitStyle?: ViewStyle
626
- }
627
-
628
- //
629
- // add both theme and shorthands
630
- //
631
- type WithThemeAndShorthands<A extends object> = WithThemeValues<A> &
632
- WithShorthands<WithThemeValues<A>>
633
-
634
- //
635
- // combines all of theme, shorthands, pseudos...
636
- //
637
- type WithThemeShorthandsAndPseudos<A extends object> =
638
- | WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>
639
-
640
- //
641
- // ... media queries and animations
642
- //
643
- type WithThemeShorthandsPseudosMediaAnimation<A extends object> =
644
- WithThemeShorthandsAndPseudos<A> & MediaProps<WithThemeShorthandsAndPseudos<A>>
645
-
646
- /**
647
- * Base style-only props (no media, pseudo):
648
- */
649
-
650
- type PropsWebOnly = {
651
- pointerEvents?: ViewProps['pointerEvents']
652
- cursor?: Properties['cursor']
653
- contain?: Properties['contain']
654
- display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'
655
- userSelect?: Properties['userSelect']
656
- outlineColor?: Properties['outlineColor']
657
- outlineStyle?: Properties['outlineStyle']
658
- outlineOffset?: Properties['outlineOffset']
659
- outlineWidth?: Properties['outlineWidth']
660
- tabIndex?: string | number
661
- role?: string
662
- }
663
-
664
- export type StackStylePropsBase = Omit<
665
- ViewStyle,
666
- 'display' | 'backfaceVisibility' | 'elevation'
667
- > &
668
- TransformStyleProps &
669
- PropsWebOnly
670
-
671
- export type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &
672
- TransformStyleProps &
673
- PropsWebOnly & {
674
- ellipse?: boolean
675
- textDecorationDistance?: number
676
- textOverflow?: Properties['textOverflow']
677
- whiteSpace?: Properties['whiteSpace']
678
- wordWrap?: Properties['wordWrap']
679
- }
680
-
681
- //
682
- // Stack
683
- //
684
-
685
- export type StackNonStyleProps = Omit<ViewProps, 'display' | 'children'> &
686
- RNWViewProps &
687
- TamaguiComponentPropsBase
688
-
689
- export type StackStyleProps =
690
- WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>
691
- export type StackPropsBase = StackNonStyleProps &
692
- WithThemeAndShorthands<StackStylePropsBase>
693
- export type StackProps = StackNonStyleProps & StackStyleProps
694
-
695
- //
696
- // Text props
697
- //
698
-
699
- export type TextNonStyleProps = Omit<ReactTextProps, 'children'> &
700
- RNWTextProps &
701
- TamaguiComponentPropsBase
702
-
703
- export type TextPropsBase = TextNonStyleProps & WithThemeAndShorthands<TextStylePropsBase>
704
- export type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>
705
- export type TextProps = TextNonStyleProps & TextStyleProps
706
-
707
- // could actually infer from parent
708
- export type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<
709
- Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase
710
- >
711
-
712
- //
713
- // StaticComponent
714
- //
715
-
716
- export type TamaguiComponent<
717
- Props = any,
718
- Ref = any,
719
- BaseProps = {},
720
- VariantProps = {}
721
- > = ReactComponentWithRef<Props, Ref> & StaticComponentObject
722
-
723
- type StaticComponentObject = {
724
- staticConfig: StaticConfigParsed
725
- /*
726
- * Only needed for more complex components
727
- * If you create a styled frame component this is a HoC to extract
728
- * styles from all parents.
729
- */
730
- extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X
731
- }
732
-
733
- export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
734
- config: TamaguiInternalConfig
735
- disableInjectCSS?: boolean
736
- children?: ReactNode
737
- }
738
-
739
- export type PropMapper = (
740
- key: string,
741
- value: any,
742
- theme: ThemeParsed,
743
- props: Record<string, any>,
744
- state: Partial<SplitStyleState>,
745
- languageContext?: FontLanguageProps,
746
- avoidDefaultProps?: boolean,
747
- debug?: DebugProp
748
- ) => undefined | [string, any][]
749
-
750
- export type StaticConfigParsed = StaticConfig & {
751
- parsed: true
752
- propMapper: PropMapper
753
- variantsParsed?: {
754
- [key: string]: {
755
- [key: string]: any
756
- }
757
- }
758
- }
759
-
760
- export type GenericVariantDefinitions = {
761
- [key: string]: {
762
- [key: string]:
763
- | ((a: any, b: any) => any)
764
- | {
765
- [key: string]: any
766
- }
767
- }
768
- }
769
-
770
- export type StaticConfigPublic = {
771
- /**
772
- * (compiler) If you need to pass context or something, prevents from ever
773
- * flattening. The 'jsx' option means it will never flatten. if you
774
- * pass JSX as a children (if its purely string, it will still flatten).
775
- */
776
- neverFlatten?: boolean | 'jsx'
777
-
778
- /**
779
- * Determines ultimate output tag (Text vs View)
780
- */
781
- isText?: boolean
782
-
783
- /**
784
- * Which style keys are allowed to be extracted.
785
- */
786
- validStyles?: { [key: string]: boolean }
787
-
788
- /**
789
- * (compiler) If these props are encountered, bail on all optimization.
790
- */
791
- deoptProps?: Set<string>
792
-
793
- /**
794
- * (compiler) If these props are encountered, leave them un-extracted.
795
- */
796
- inlineProps?: Set<string>
797
-
798
- /**
799
- * (compiler) If not flattening, leave this prop as original value.
800
- * Only applies to style attributes
801
- */
802
- inlineWhenUnflattened?: Set<string>
803
-
804
- /**
805
- * (compiler) A bit odd, only for more advanced heirarchies.
806
- * Indicates that the component will set this prop so the
807
- * static extraction can ensure it sets them to ={undefined}
808
- * so they get overriddent. In the future, this can be smarter.
809
- */
810
- ensureOverriddenProp?: { [key: string]: boolean }
811
-
812
- /**
813
- * Auto-detected, but can ovverride. Wraps children to space them on top
814
- */
815
- isZStack?: boolean
816
-
817
- /**
818
- * Auto-detect, but can override, passes styles properly to react-native-web
819
- */
820
- isReactNative?: boolean
821
-
822
- /**
823
- * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,
824
- * it will assume the passed in component only accepts style={} for react-native compatibility.
825
- * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.
826
- */
827
- acceptsClassName?: boolean
828
- }
829
-
830
- export type StaticConfig = StaticConfigPublic & {
831
- Component?: FunctionComponent<any> & StaticComponentObject
832
-
833
- variants?: GenericVariantDefinitions
834
-
835
- /**
836
- * Used for applying sub theme style
837
- */
838
- componentName?: string
839
-
840
- /**
841
- * Same as React.defaultProps, be sure to sync
842
- */
843
- defaultProps: Record<string, any>
844
-
845
- /**
846
- * Merges into defaultProps later on, used internally yonly
847
- */
848
- defaultVariants?: { [key: string]: any }
849
-
850
- /**
851
- * Memoize the component
852
- */
853
- memo?: boolean
854
-
855
- /**
856
- * Used insternally to attach default props to names
857
- */
858
- parentNames?: string[]
859
-
860
- /**
861
- * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,
862
- * it will assume the passed in component only accepts style={} for react-native compatibility.
863
- * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.
864
- */
865
- acceptsClassName?: boolean
866
-
867
- /**
868
- * Used internally for handling focus
869
- */
870
- isInput?: boolean
871
- }
872
-
873
- /**
874
- * --------------------------------------------
875
- * variants
876
- * --------------------------------------------
877
- */
878
-
879
- export type StylableComponent =
880
- | TamaguiComponent
881
- // * excessively deep type instantiation
882
- // | TamaguiReactElement
883
- | ComponentType<any>
884
- | ForwardRefExoticComponent<any>
885
- | ReactComponentWithRef<any, any>
886
- | (new (props: any) => any)
887
- | typeof View
888
- | typeof Text
889
- | typeof TextInput
890
- | typeof Image
891
-
892
- export type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<
893
- any,
894
- any,
895
- any,
896
- infer Variants
897
- >
898
- ? Variants
899
- : never
900
-
901
- export type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<
902
- any,
903
- any,
904
- infer BaseProps
905
- >
906
- ? BaseProps
907
- : never
908
-
909
- export type GetProps<A extends StylableComponent> = A extends TamaguiComponent<
910
- infer Props
911
- >
912
- ? Props
913
- : A extends TamaguiReactElement<infer Props>
914
- ? Props
915
- : A extends ComponentType<infer Props>
916
- ? GetGenericComponentTamaguiProps<Props>
917
- : A extends new (props: infer Props) => any
918
- ? GetGenericComponentTamaguiProps<Props>
919
- : {}
920
-
921
- type GetGenericComponentTamaguiProps<P> = P &
922
- Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>
923
-
924
- export type SpreadKeys =
925
- | '...fontSize'
926
- | '...fontStyle'
927
- | '...fontTransform'
928
- | '...lineHeight'
929
- | '...letterSpacing'
930
- | '...size'
931
- | '...space'
932
- | '...color'
933
- | '...zIndex'
934
- | '...theme'
935
- | '...radius'
936
-
937
- export type VariantDefinitions<
938
- Parent extends StylableComponent = TamaguiComponent,
939
- MyProps extends Object = GetProps<Parent>,
940
- Val = any
941
- > = VariantDefinitionFromProps<MyProps, Val>
942
-
943
- export type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object
944
- ? {
945
- [propName: string]:
946
- | VariantSpreadFunction<MyProps, Val>
947
- | ({
948
- [Key in SpreadKeys]?: Key extends '...fontSize'
949
- ? FontSizeVariantSpreadFunction<MyProps>
950
- : Key extends '...size'
951
- ? SizeVariantSpreadFunction<MyProps>
952
- : Key extends '...space'
953
- ? SpaceVariantSpreadFunction<MyProps>
954
- : Key extends '...color'
955
- ? ColorVariantSpreadFunction<MyProps>
956
- : Key extends '...lineHeight'
957
- ? FontLineHeightVariantSpreadFunction<MyProps>
958
- : Key extends '...fontTransform'
959
- ? FontTransformVariantSpreadFunction<MyProps>
960
- : Key extends '...fontStyle'
961
- ? FontStyleVariantSpreadFunction<MyProps>
962
- : Key extends '...letterSpacing'
963
- ? FontLetterSpacingVariantSpreadFunction<MyProps>
964
- : Key extends '...zIndex'
965
- ? ZIndexVariantSpreadFunction<MyProps>
966
- : Key extends '...radius'
967
- ? RadiusVariantSpreadFunction<MyProps>
968
- : Key extends '...theme'
969
- ? ThemeVariantSpreadFunction<MyProps>
970
- : never
971
- } & {
972
- [Key in string | number | 'true' | 'false']?:
973
- | MyProps
974
- | VariantSpreadFunction<MyProps, Val>
975
- } & {
976
- [Key in VariantTypeKeys]?: Key extends ':number'
977
- ? VariantSpreadFunction<MyProps, number>
978
- : Key extends ':boolean'
979
- ? VariantSpreadFunction<MyProps, boolean>
980
- : Key extends ':string'
981
- ? VariantSpreadFunction<MyProps, string>
982
- : never
983
- })
984
- }
985
- : never
986
-
987
- export type GenericStackVariants = VariantDefinitionFromProps<StackProps, any>
988
- export type GenericTextVariants = VariantDefinitionFromProps<StackProps, any>
989
-
990
- export type GetVariantProps<Variants> = {
991
- [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>
992
- ? Val
993
- : GetVariantValues<keyof Variants[Key]>
994
- }
995
-
996
- export type VariantSpreadExtras<Props> = {
997
- fonts: TamaguiConfig['fonts']
998
- tokens: TamaguiConfig['tokens']
999
- theme: Themes extends { [key: string]: infer B } ? B : unknown
1000
- props: Props
1001
- }
1002
-
1003
- type PropLike = { [key: string]: any }
1004
-
1005
- export type VariantSpreadFunction<Props extends PropLike, Val = any> = (
1006
- val: Val,
1007
- config: VariantSpreadExtras<Props>
1008
- ) =>
1009
- | {
1010
- [Key in keyof Props]: Props[Key] | Variable
1011
- }
1012
- | null
1013
- | undefined
1014
-
1015
- export type VariantTypeKeys = ':string' | ':boolean' | ':number'
1016
-
1017
- export type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`
1018
- ? ThemeValueByCategory<VariantSpread>
1019
- : Key extends 'true' | 'false'
1020
- ? boolean
1021
- : Key extends ':string'
1022
- ? string
1023
- : Key extends ':boolean'
1024
- ? boolean
1025
- : Key extends ':number'
1026
- ? number
1027
- : Key
1028
-
1029
- export type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1030
- A,
1031
- FontSizeTokens
1032
- >
1033
- export type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1034
- A,
1035
- SizeTokens
1036
- >
1037
- export type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1038
- A,
1039
- SpaceTokens
1040
- >
1041
- export type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1042
- A,
1043
- ColorTokens
1044
- >
1045
- export type FontLineHeightVariantSpreadFunction<A extends PropLike> =
1046
- VariantSpreadFunction<A, FontLineHeightTokens>
1047
- export type FontLetterSpacingVariantSpreadFunction<A extends PropLike> =
1048
- VariantSpreadFunction<A, FontLetterSpacingTokens>
1049
- export type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1050
- A,
1051
- FontStyleTokens
1052
- >
1053
- export type FontTransformVariantSpreadFunction<A extends PropLike> =
1054
- VariantSpreadFunction<A, FontTransformTokens>
1055
- export type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1056
- A,
1057
- ZIndexTokens
1058
- >
1059
- export type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1060
- A,
1061
- RadiusTokens
1062
- >
1063
- export type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
1064
- A,
1065
- ThemeTokens
1066
- >
1067
-
1068
- /**
1069
- * --------------------------------------------
1070
- * end variants
1071
- * --------------------------------------------
1072
- */
1073
-
1074
- type SizeKeys =
1075
- | 'width'
1076
- | 'height'
1077
- | 'minWidth'
1078
- | 'minHeight'
1079
- | 'maxWidth'
1080
- | 'maxHeight'
1081
- | 'shadowRadius'
1082
-
1083
- type ColorKeys =
1084
- | 'color'
1085
- | 'backgroundColor'
1086
- | 'borderColor'
1087
- | 'borderBottomColor'
1088
- | 'borderTopColor'
1089
- | 'borderLeftColor'
1090
- | 'borderRightColor'
1091
- | 'shadowColor'
1092
- | 'textShadowColor'
1093
-
1094
- type SpaceKeys =
1095
- | 'space'
1096
- | 'padding'
1097
- | 'paddingHorizontal'
1098
- | 'paddingVertical'
1099
- | 'paddingLeft'
1100
- | 'paddingTop'
1101
- | 'paddingBottom'
1102
- | 'paddingLeft'
1103
- | 'paddingRight'
1104
- | 'paddingEnd'
1105
- | 'paddingStart'
1106
- | 'margin'
1107
- | 'marginHorizontal'
1108
- | 'marginVertical'
1109
- | 'marginLeft'
1110
- | 'marginTop'
1111
- | 'marginBottom'
1112
- | 'marginLeft'
1113
- | 'marginRight'
1114
- | 'marginEnd'
1115
- | 'marginStart'
1116
- | 'x'
1117
- | 'y'
1118
- | 'scale'
1119
- | 'scaleX'
1120
- | 'scaleY'
1121
- | 'borderTopEndRadius'
1122
- | 'borderTopLeftRadius'
1123
- | 'borderTopRightRadius'
1124
- | 'borderTopStartRadius'
1125
- | 'borderBottomEndRadius'
1126
- | 'borderBottomLeftRadius'
1127
- | 'borderBottomRightRadius'
1128
- | 'borderBottomStartRadius'
1129
- | 'borderBottomWidth'
1130
- | 'borderLeftWidth'
1131
- | 'borderRadius'
1132
- | 'borderRightWidth'
1133
- | 'borderTopEndRadius'
1134
- | 'borderTopLeftRadius'
1135
- | 'borderTopRightRadius'
1136
- | 'borderEndWidth'
1137
- | 'borderStartWidth'
1138
- | 'borderTopStartRadius'
1139
- | 'borderTopWidth'
1140
- | 'borderWidth'
1141
- | 'left'
1142
- | 'top'
1143
- | 'right'
1144
- | 'bottom'
1145
- | 'shadowOffset'
1146
-
1147
- type CSSColorNames =
1148
- | 'aliceblue'
1149
- | 'antiquewhite'
1150
- | 'aqua'
1151
- | 'aquamarine'
1152
- | 'azure'
1153
- | 'beige'
1154
- | 'bisque'
1155
- | 'black'
1156
- | 'blanchedalmond'
1157
- | 'blue'
1158
- | 'blueviolet'
1159
- | 'brown'
1160
- | 'burlywood'
1161
- | 'cadetblue'
1162
- | 'chartreuse'
1163
- | 'chocolate'
1164
- | 'coral'
1165
- | 'cornflowerblue'
1166
- | 'cornsilk'
1167
- | 'crimson'
1168
- | 'cyan'
1169
- | 'darkblue'
1170
- | 'darkcyan'
1171
- | 'darkgoldenrod'
1172
- | 'darkgray'
1173
- | 'darkgreen'
1174
- | 'darkkhaki'
1175
- | 'darkmagenta'
1176
- | 'darkolivegreen'
1177
- | 'darkorange'
1178
- | 'darkorchid'
1179
- | 'darkred'
1180
- | 'darksalmon'
1181
- | 'darkseagreen'
1182
- | 'darkslateblue'
1183
- | 'darkslategray'
1184
- | 'darkturquoise'
1185
- | 'darkviolet'
1186
- | 'deeppink'
1187
- | 'deepskyblue'
1188
- | 'dimgray'
1189
- | 'dodgerblue'
1190
- | 'firebrick'
1191
- | 'floralwhite'
1192
- | 'forestgreen'
1193
- | 'fuchsia'
1194
- | 'gainsboro'
1195
- | 'ghostwhite'
1196
- | 'gold'
1197
- | 'goldenrod'
1198
- | 'gray'
1199
- | 'green'
1200
- | 'greenyellow'
1201
- | 'honeydew'
1202
- | 'hotpink'
1203
- | 'indianred '
1204
- | 'indigo '
1205
- | 'ivory'
1206
- | 'khaki'
1207
- | 'lavender'
1208
- | 'lavenderblush'
1209
- | 'lawngreen'
1210
- | 'lemonchiffon'
1211
- | 'lightblue'
1212
- | 'lightcoral'
1213
- | 'lightcyan'
1214
- | 'lightgoldenrodyellow'
1215
- | 'lightgrey'
1216
- | 'lightgreen'
1217
- | 'lightpink'
1218
- | 'lightsalmon'
1219
- | 'lightseagreen'
1220
- | 'lightskyblue'
1221
- | 'lightslategray'
1222
- | 'lightsteelblue'
1223
- | 'lightyellow'
1224
- | 'lime'
1225
- | 'limegreen'
1226
- | 'linen'
1227
- | 'magenta'
1228
- | 'maroon'
1229
- | 'mediumaquamarine'
1230
- | 'mediumblue'
1231
- | 'mediumorchid'
1232
- | 'mediumpurple'
1233
- | 'mediumseagreen'
1234
- | 'mediumslateblue'
1235
- | 'mediumspringgreen'
1236
- | 'mediumturquoise'
1237
- | 'mediumvioletred'
1238
- | 'midnightblue'
1239
- | 'mintcream'
1240
- | 'mistyrose'
1241
- | 'moccasin'
1242
- | 'navajowhite'
1243
- | 'navy'
1244
- | 'oldlace'
1245
- | 'olive'
1246
- | 'olivedrab'
1247
- | 'orange'
1248
- | 'orangered'
1249
- | 'orchid'
1250
- | 'palegoldenrod'
1251
- | 'palegreen'
1252
- | 'paleturquoise'
1253
- | 'palevioletred'
1254
- | 'papayawhip'
1255
- | 'peachpuff'
1256
- | 'peru'
1257
- | 'pink'
1258
- | 'plum'
1259
- | 'powderblue'
1260
- | 'purple'
1261
- | 'red'
1262
- | 'rosybrown'
1263
- | 'royalblue'
1264
- | 'saddlebrown'
1265
- | 'salmon'
1266
- | 'sandybrown'
1267
- | 'seagreen'
1268
- | 'seashell'
1269
- | 'sienna'
1270
- | 'silver'
1271
- | 'skyblue'
1272
- | 'slateblue'
1273
- | 'slategray'
1274
- | 'snow'
1275
- | 'springgreen'
1276
- | 'steelblue'
1277
- | 'tan'
1278
- | 'teal'
1279
- | 'thistle'
1280
- | 'tomato'
1281
- | 'turquoise'
1282
- | 'violet'
1283
- | 'wheat'
1284
- | 'white'
1285
- | 'whitesmoke'
1286
- | 'yellow'
1287
- | 'yellowgreen'
1288
-
1289
- export type TamaguiComponentState = {
1290
- hover: boolean
1291
- press: boolean
1292
- pressIn: boolean
1293
- focus: boolean
1294
- unmounted: boolean
1295
- animation?: null | {
1296
- style?: any
1297
- avoidClasses?: boolean
1298
- }
1299
- }
1300
-
1301
- export type SplitStyleState = TamaguiComponentState & {
1302
- mediaState?: Record<string, boolean>
1303
- noClassNames?: boolean
1304
- dynamicStylesInline?: boolean
1305
- resolveVariablesAs?: ResolveVariableTypes
1306
- fallbackProps?: Record<string, any>
1307
- keepVariantsAsProps?: boolean
1308
- hasTextAncestor?: boolean
1309
-
1310
- // for animations
1311
- isExiting?: boolean
1312
- exitVariant?: string
1313
- enterVariant?: string
1314
- }
1315
-
1316
- // Presence
1317
-
1318
- export interface PresenceContextProps {
1319
- id: string
1320
- isPresent: boolean
1321
- register: (id: string) => () => void
1322
- onExitComplete?: (id: string) => void
1323
- initial?: false | string | string[]
1324
- custom?: any
1325
- exitVariant?: string | null
1326
- enterVariant?: string | null
1327
- }
1328
-
1329
- type SafeToRemoveCallback = () => void
1330
- type AlwaysPresent = [true, null, null]
1331
- type Present = [true, undefined, PresenceContextProps]
1332
- type NotPresent = [false, SafeToRemoveCallback, PresenceContextProps]
1333
-
1334
- export type UsePresenceResult = AlwaysPresent | Present | NotPresent
1335
-
1336
- // Animations:
1337
-
1338
- type AnimationConfig = {
1339
- [key: string]: any
1340
- }
1341
-
1342
- // includes a very limited adapter between various impls for number => style
1343
- // this is useful only in limited scenarios like `Sheet`, but necessary in those cases
1344
-
1345
- export type AnimatedNumberStrategy =
1346
- // only values shared between reanimated/react-native for now
1347
- | {
1348
- type: 'spring'
1349
- stiffness?: number
1350
- damping?: number
1351
- mass?: number
1352
- overshootClamping?: boolean
1353
- restSpeedThreshold?: number
1354
- restDisplacementThreshold?: number
1355
- }
1356
- | { type: 'timing'; duration: number }
1357
- | { type: 'direct' }
1358
-
1359
- export type UniversalAnimatedNumber<A> = {
1360
- getInstance(): A
1361
- getValue(): number
1362
- setValue(next: number, config?: AnimatedNumberStrategy): void
1363
- stop(): void
1364
- }
1365
-
1366
- export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
1367
- isReactNative?: boolean
1368
- useAnimations: UseAnimationHook
1369
- usePresence: () => UsePresenceResult
1370
- useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>
1371
- useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(
1372
- val: V,
1373
- getStyle: (current: any) => any
1374
- ) => any
1375
- useAnimatedNumberReaction: (
1376
- val: UniversalAnimatedNumber<any>,
1377
- onValue: (current: number) => void
1378
- ) => void
1379
- animations: A
1380
- View?: any
1381
- Text?: any
1382
- }
1383
-
1384
- export type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>
1385
-
1386
- export type UseAnimationHook = (props: {
1387
- style: Record<string, any>
1388
- props: Record<string, any>
1389
- presence?: UsePresenceResult | null
1390
- hostRef: RefObject<HTMLElement | View>
1391
- staticConfig: StaticConfigParsed
1392
- state: SplitStyleState
1393
- pseudos: PseudoProps<ViewStyle> | null
1394
- onDidAnimate?: any
1395
- delay?: number
1396
- }) => null | {
1397
- style?: StackStylePropsBase | StackStylePropsBase[]
1398
- }
1399
-
1400
- export type GestureReponderEvent = Exclude<
1401
- View['props']['onResponderMove'],
1402
- void
1403
- > extends (event: infer Event) => void
1404
- ? Event
1405
- : never