@tamagui/web 3.0.0-beta.831.1 → 3.0.0-beta.889.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (474) hide show
  1. package/dist/cjs/createComponent.cjs +12 -1
  2. package/dist/cjs/createComponent.native.cjs +12 -1
  3. package/dist/cjs/createComponent.native.js +12 -1
  4. package/dist/cjs/createComponent.native.js.map +1 -1
  5. package/dist/cjs/createStyledHOC.cjs +1 -1
  6. package/dist/cjs/createStyledHOC.native.cjs +1 -1
  7. package/dist/cjs/createStyledHOC.native.js +1 -1
  8. package/dist/cjs/createStyledHOC.native.js.map +1 -1
  9. package/dist/cjs/createVariable.cjs +0 -10
  10. package/dist/cjs/createVariable.native.cjs +0 -10
  11. package/dist/cjs/createVariable.native.js +0 -10
  12. package/dist/cjs/createVariable.native.js.map +1 -1
  13. package/dist/cjs/helpers/borderComponents.cjs +62 -0
  14. package/dist/cjs/helpers/borderComponents.native.cjs +82 -0
  15. package/dist/cjs/helpers/borderComponents.native.js +84 -0
  16. package/dist/cjs/helpers/borderComponents.native.js.map +1 -0
  17. package/dist/cjs/helpers/createDesignSystem.cjs +0 -2
  18. package/dist/cjs/helpers/createStyledContext.cjs +10 -18
  19. package/dist/cjs/helpers/createStyledContext.native.cjs +14 -18
  20. package/dist/cjs/helpers/createStyledContext.native.js +14 -18
  21. package/dist/cjs/helpers/createStyledContext.native.js.map +1 -1
  22. package/dist/cjs/helpers/formatDiagnostic.cjs +6 -6
  23. package/dist/cjs/helpers/formatDiagnostic.native.cjs +6 -6
  24. package/dist/cjs/helpers/formatDiagnostic.native.js +6 -6
  25. package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
  26. package/dist/cjs/helpers/getCSSStylesAtomic.cjs +128 -109
  27. package/dist/cjs/helpers/getCSSStylesAtomic.native.cjs +11 -3
  28. package/dist/cjs/helpers/getCSSStylesAtomic.native.js +11 -3
  29. package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -1
  30. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.cjs +13 -1
  31. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.cjs +15 -1
  32. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +15 -1
  33. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
  34. package/dist/cjs/helpers/getDynamicVal.cjs +5 -1
  35. package/dist/cjs/helpers/getDynamicVal.native.cjs +5 -1
  36. package/dist/cjs/helpers/getDynamicVal.native.js +5 -1
  37. package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -1
  38. package/dist/cjs/helpers/getSplitStyles.cjs +1042 -1715
  39. package/dist/cjs/helpers/getSplitStyles.native.cjs +1081 -1887
  40. package/dist/cjs/helpers/getSplitStyles.native.js +1081 -1887
  41. package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
  42. package/dist/cjs/helpers/grammarConfig.cjs +163 -1
  43. package/dist/cjs/helpers/grammarConfig.native.cjs +186 -1
  44. package/dist/cjs/helpers/grammarConfig.native.js +186 -1
  45. package/dist/cjs/helpers/grammarConfig.native.js.map +1 -1
  46. package/dist/cjs/helpers/insertStyleRule.cjs +5 -1
  47. package/dist/cjs/helpers/insertStyleRule.native.cjs +7 -1
  48. package/dist/cjs/helpers/insertStyleRule.native.js +7 -1
  49. package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
  50. package/dist/cjs/helpers/log.cjs +9 -8
  51. package/dist/cjs/helpers/log.native.cjs +9 -8
  52. package/dist/cjs/helpers/log.native.js +9 -8
  53. package/dist/cjs/helpers/log.native.js.map +1 -1
  54. package/dist/cjs/helpers/mergeVariants.cjs +44 -13
  55. package/dist/cjs/helpers/mergeVariants.native.cjs +79 -14
  56. package/dist/cjs/helpers/mergeVariants.native.js +79 -14
  57. package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
  58. package/dist/cjs/helpers/nativeOnlyProps.cjs +0 -1
  59. package/dist/cjs/helpers/nativeOnlyProps.native.cjs +0 -1
  60. package/dist/cjs/helpers/nativeOnlyProps.native.js +0 -1
  61. package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -1
  62. package/dist/cjs/helpers/nativeStyleEngine.cjs +34 -14
  63. package/dist/cjs/helpers/nativeStyleEngine.native.cjs +36 -14
  64. package/dist/cjs/helpers/nativeStyleEngine.native.js +36 -14
  65. package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
  66. package/dist/cjs/helpers/normalizeValueWithProperty.cjs +7 -8
  67. package/dist/cjs/helpers/normalizeValueWithProperty.native.cjs +9 -8
  68. package/dist/cjs/helpers/normalizeValueWithProperty.native.js +9 -8
  69. package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
  70. package/dist/cjs/helpers/parseBorderShorthand.native.cjs +25 -56
  71. package/dist/cjs/helpers/parseBorderShorthand.native.js +25 -56
  72. package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -1
  73. package/dist/cjs/helpers/parseOutlineShorthand.native.cjs +9 -49
  74. package/dist/cjs/helpers/parseOutlineShorthand.native.js +9 -49
  75. package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -1
  76. package/dist/cjs/helpers/resolveSafeArea.cjs +35 -100
  77. package/dist/cjs/helpers/resolveVariantStyle.cjs +57 -0
  78. package/dist/cjs/helpers/resolveVariantStyle.native.cjs +67 -0
  79. package/dist/cjs/helpers/resolveVariantStyle.native.js +69 -0
  80. package/dist/cjs/helpers/resolveVariantStyle.native.js.map +1 -0
  81. package/dist/cjs/helpers/styleStaticConfig.cjs +1 -50
  82. package/dist/cjs/helpers/styleStaticConfig.native.cjs +1 -51
  83. package/dist/cjs/helpers/styleStaticConfig.native.js +1 -51
  84. package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -1
  85. package/dist/cjs/helpers/styleStaticConfigCore.cjs +107 -0
  86. package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +127 -0
  87. package/dist/cjs/helpers/styleStaticConfigCore.native.js +129 -0
  88. package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -0
  89. package/dist/cjs/helpers/styledDynamic.cjs +160 -0
  90. package/dist/cjs/helpers/styledDynamic.native.cjs +195 -0
  91. package/dist/cjs/helpers/styledDynamic.native.js +197 -0
  92. package/dist/cjs/helpers/styledDynamic.native.js.map +1 -0
  93. package/dist/cjs/helpers/tokenCategories.cjs +15 -38
  94. package/dist/cjs/helpers/tokenCategories.native.cjs +15 -40
  95. package/dist/cjs/helpers/tokenCategories.native.js +15 -40
  96. package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
  97. package/dist/cjs/helpers/variableValue.cjs +17 -12
  98. package/dist/cjs/helpers/variableValue.native.cjs +46 -23
  99. package/dist/cjs/helpers/variableValue.native.js +46 -23
  100. package/dist/cjs/helpers/variableValue.native.js.map +1 -1
  101. package/dist/cjs/helpers/warnOnce.cjs +5 -4
  102. package/dist/cjs/helpers/warnOnce.native.cjs +6 -4
  103. package/dist/cjs/helpers/warnOnce.native.js +6 -4
  104. package/dist/cjs/helpers/warnOnce.native.js.map +1 -1
  105. package/dist/cjs/hooks/useAnimationDriver.cjs +2 -2
  106. package/dist/cjs/hooks/useAnimationDriver.native.cjs +2 -2
  107. package/dist/cjs/hooks/useAnimationDriver.native.js +2 -2
  108. package/dist/cjs/hooks/useAnimationDriver.native.js.map +1 -1
  109. package/dist/cjs/hooks/useComponentState.cjs +41 -82
  110. package/dist/cjs/hooks/useComponentState.native.cjs +45 -84
  111. package/dist/cjs/hooks/useComponentState.native.js +45 -84
  112. package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
  113. package/dist/cjs/hooks/useMedia.cjs +2 -2
  114. package/dist/cjs/hooks/useMedia.native.cjs +2 -2
  115. package/dist/cjs/hooks/useMedia.native.js +2 -2
  116. package/dist/cjs/hooks/useMedia.native.js.map +1 -1
  117. package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.cjs} +16 -8
  118. package/dist/cjs/{helpers/directStyleCSS.native.cjs → hooks/useStyle.native.cjs} +16 -4
  119. package/dist/cjs/hooks/useStyle.native.js +34 -0
  120. package/dist/cjs/hooks/useStyle.native.js.map +1 -0
  121. package/dist/cjs/hooks/useThemeState.cjs +25 -90
  122. package/dist/cjs/hooks/useThemeState.native.cjs +34 -94
  123. package/dist/cjs/hooks/useThemeState.native.js +34 -94
  124. package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
  125. package/dist/cjs/index.cjs +6 -3
  126. package/dist/cjs/index.native.cjs +6 -3
  127. package/dist/cjs/index.native.js +6 -3
  128. package/dist/cjs/index.native.js.map +1 -1
  129. package/dist/cjs/static-resolve.cjs +2 -2
  130. package/dist/cjs/static-resolve.native.cjs +2 -2
  131. package/dist/cjs/static-resolve.native.js +2 -2
  132. package/dist/cjs/static-resolve.native.js.map +1 -1
  133. package/dist/cjs/style.cjs +91 -0
  134. package/dist/cjs/style.native.cjs +98 -0
  135. package/dist/cjs/style.native.js +100 -0
  136. package/dist/cjs/style.native.js.map +1 -0
  137. package/dist/cjs/styled.cjs +11 -6
  138. package/dist/cjs/styled.native.cjs +11 -6
  139. package/dist/cjs/styled.native.js +11 -6
  140. package/dist/cjs/styled.native.js.map +1 -1
  141. package/dist/cjs/types.cjs +6 -4
  142. package/dist/cjs/types.native.cjs +6 -4
  143. package/dist/cjs/types.native.js +6 -4
  144. package/dist/cjs/types.native.js.map +1 -1
  145. package/dist/cjs/views/TamaguiProvider.cjs +1 -2
  146. package/dist/cjs/views/TamaguiProvider.native.cjs +1 -2
  147. package/dist/cjs/views/TamaguiProvider.native.js +1 -2
  148. package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
  149. package/dist/cjs/views/Text.cjs +17 -12
  150. package/dist/cjs/views/Text.native.cjs +1 -0
  151. package/dist/cjs/views/Text.native.js +1 -0
  152. package/dist/cjs/views/Text.native.js.map +1 -1
  153. package/dist/cjs/views/Theme.cjs +3 -3
  154. package/dist/cjs/views/Theme.native.cjs +3 -3
  155. package/dist/cjs/views/Theme.native.js +3 -3
  156. package/dist/cjs/views/Theme.native.js.map +1 -1
  157. package/dist/cjs/views/ThemeDebug.cjs +1 -4
  158. package/dist/esm/createComponent.mjs +12 -1
  159. package/dist/esm/createComponent.mjs.map +1 -1
  160. package/dist/esm/createComponent.native.js +12 -1
  161. package/dist/esm/createComponent.native.js.map +1 -1
  162. package/dist/esm/createStyledHOC.mjs +1 -1
  163. package/dist/esm/createStyledHOC.mjs.map +1 -1
  164. package/dist/esm/createStyledHOC.native.js +1 -1
  165. package/dist/esm/createStyledHOC.native.js.map +1 -1
  166. package/dist/esm/createVariable.mjs +1 -9
  167. package/dist/esm/createVariable.mjs.map +1 -1
  168. package/dist/esm/createVariable.native.js +1 -9
  169. package/dist/esm/createVariable.native.js.map +1 -1
  170. package/dist/esm/helpers/borderComponents.mjs +37 -0
  171. package/dist/esm/helpers/borderComponents.mjs.map +1 -0
  172. package/dist/esm/helpers/borderComponents.native.js +55 -0
  173. package/dist/esm/helpers/borderComponents.native.js.map +1 -0
  174. package/dist/esm/helpers/createDesignSystem.mjs +0 -2
  175. package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
  176. package/dist/esm/helpers/createStyledContext.mjs +10 -18
  177. package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
  178. package/dist/esm/helpers/createStyledContext.native.js +14 -18
  179. package/dist/esm/helpers/createStyledContext.native.js.map +1 -1
  180. package/dist/esm/helpers/formatDiagnostic.mjs +6 -6
  181. package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
  182. package/dist/esm/helpers/formatDiagnostic.native.js +6 -6
  183. package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
  184. package/dist/esm/helpers/getCSSStylesAtomic.mjs +126 -109
  185. package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
  186. package/dist/esm/helpers/getCSSStylesAtomic.native.js +7 -4
  187. package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -1
  188. package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +8 -1
  189. package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -1
  190. package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +10 -1
  191. package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
  192. package/dist/esm/helpers/getDynamicVal.mjs +5 -1
  193. package/dist/esm/helpers/getDynamicVal.mjs.map +1 -1
  194. package/dist/esm/helpers/getDynamicVal.native.js +5 -1
  195. package/dist/esm/helpers/getDynamicVal.native.js.map +1 -1
  196. package/dist/esm/helpers/getSplitStyles.mjs +1034 -1705
  197. package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
  198. package/dist/esm/helpers/getSplitStyles.native.js +1071 -1871
  199. package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
  200. package/dist/esm/helpers/grammarConfig.mjs +164 -2
  201. package/dist/esm/helpers/grammarConfig.mjs.map +1 -1
  202. package/dist/esm/helpers/grammarConfig.native.js +187 -2
  203. package/dist/esm/helpers/grammarConfig.native.js.map +1 -1
  204. package/dist/esm/helpers/insertStyleRule.mjs +5 -2
  205. package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
  206. package/dist/esm/helpers/insertStyleRule.native.js +7 -2
  207. package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
  208. package/dist/esm/helpers/log.mjs +9 -8
  209. package/dist/esm/helpers/log.mjs.map +1 -1
  210. package/dist/esm/helpers/log.native.js +9 -8
  211. package/dist/esm/helpers/log.native.js.map +1 -1
  212. package/dist/esm/helpers/mergeVariants.mjs +44 -13
  213. package/dist/esm/helpers/mergeVariants.mjs.map +1 -1
  214. package/dist/esm/helpers/mergeVariants.native.js +79 -14
  215. package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
  216. package/dist/esm/helpers/nativeOnlyProps.mjs +0 -1
  217. package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -1
  218. package/dist/esm/helpers/nativeOnlyProps.native.js +0 -1
  219. package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -1
  220. package/dist/esm/helpers/nativeStyleEngine.mjs +34 -15
  221. package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
  222. package/dist/esm/helpers/nativeStyleEngine.native.js +36 -15
  223. package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
  224. package/dist/esm/helpers/normalizeValueWithProperty.mjs +7 -8
  225. package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
  226. package/dist/esm/helpers/normalizeValueWithProperty.native.js +9 -8
  227. package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
  228. package/dist/esm/helpers/parseBorderShorthand.native.js +23 -56
  229. package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -1
  230. package/dist/esm/helpers/parseOutlineShorthand.native.js +10 -49
  231. package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -1
  232. package/dist/esm/helpers/resolveSafeArea.mjs +35 -97
  233. package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -1
  234. package/dist/esm/helpers/resolveVariantStyle.mjs +38 -0
  235. package/dist/esm/helpers/resolveVariantStyle.mjs.map +1 -0
  236. package/dist/esm/helpers/resolveVariantStyle.native.js +46 -0
  237. package/dist/esm/helpers/resolveVariantStyle.native.js.map +1 -0
  238. package/dist/esm/helpers/styleStaticConfig.mjs +1 -50
  239. package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -1
  240. package/dist/esm/helpers/styleStaticConfig.native.js +1 -51
  241. package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -1
  242. package/dist/esm/helpers/styleStaticConfigCore.mjs +88 -0
  243. package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -0
  244. package/dist/esm/helpers/styleStaticConfigCore.native.js +106 -0
  245. package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -0
  246. package/dist/esm/helpers/styledDynamic.mjs +136 -0
  247. package/dist/esm/helpers/styledDynamic.mjs.map +1 -0
  248. package/dist/esm/helpers/styledDynamic.native.js +169 -0
  249. package/dist/esm/helpers/styledDynamic.native.js.map +1 -0
  250. package/dist/esm/helpers/tokenCategories.mjs +15 -36
  251. package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
  252. package/dist/esm/helpers/tokenCategories.native.js +15 -38
  253. package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
  254. package/dist/esm/helpers/variableValue.mjs +17 -12
  255. package/dist/esm/helpers/variableValue.mjs.map +1 -1
  256. package/dist/esm/helpers/variableValue.native.js +46 -23
  257. package/dist/esm/helpers/variableValue.native.js.map +1 -1
  258. package/dist/esm/helpers/warnOnce.mjs +5 -4
  259. package/dist/esm/helpers/warnOnce.mjs.map +1 -1
  260. package/dist/esm/helpers/warnOnce.native.js +6 -4
  261. package/dist/esm/helpers/warnOnce.native.js.map +1 -1
  262. package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
  263. package/dist/esm/hooks/useAnimationDriver.mjs.map +1 -1
  264. package/dist/esm/hooks/useAnimationDriver.native.js +2 -2
  265. package/dist/esm/hooks/useAnimationDriver.native.js.map +1 -1
  266. package/dist/esm/hooks/useComponentState.mjs +41 -82
  267. package/dist/esm/hooks/useComponentState.mjs.map +1 -1
  268. package/dist/esm/hooks/useComponentState.native.js +45 -84
  269. package/dist/esm/hooks/useComponentState.native.js.map +1 -1
  270. package/dist/esm/hooks/useMedia.mjs +2 -2
  271. package/dist/esm/hooks/useMedia.mjs.map +1 -1
  272. package/dist/esm/hooks/useMedia.native.js +2 -2
  273. package/dist/esm/hooks/useMedia.native.js.map +1 -1
  274. package/dist/esm/hooks/useStyle.mjs +11 -0
  275. package/dist/esm/hooks/useStyle.mjs.map +1 -0
  276. package/dist/esm/hooks/useStyle.native.js +11 -0
  277. package/dist/esm/hooks/useStyle.native.js.map +1 -0
  278. package/dist/esm/hooks/useThemeState.mjs +25 -90
  279. package/dist/esm/hooks/useThemeState.mjs.map +1 -1
  280. package/dist/esm/hooks/useThemeState.native.js +34 -94
  281. package/dist/esm/hooks/useThemeState.native.js.map +1 -1
  282. package/dist/esm/index.js +6 -4
  283. package/dist/esm/index.mjs +6 -4
  284. package/dist/esm/index.native.js +6 -4
  285. package/dist/esm/static-resolve.mjs +3 -3
  286. package/dist/esm/static-resolve.mjs.map +1 -1
  287. package/dist/esm/static-resolve.native.js +3 -3
  288. package/dist/esm/static-resolve.native.js.map +1 -1
  289. package/dist/esm/style.mjs +58 -0
  290. package/dist/esm/style.mjs.map +1 -0
  291. package/dist/esm/style.native.js +63 -0
  292. package/dist/esm/style.native.js.map +1 -0
  293. package/dist/esm/styled.mjs +12 -6
  294. package/dist/esm/styled.mjs.map +1 -1
  295. package/dist/esm/styled.native.js +12 -6
  296. package/dist/esm/styled.native.js.map +1 -1
  297. package/dist/esm/types.mjs +3 -4
  298. package/dist/esm/types.mjs.map +1 -1
  299. package/dist/esm/types.native.js +3 -4
  300. package/dist/esm/types.native.js.map +1 -1
  301. package/dist/esm/views/TamaguiProvider.mjs +1 -2
  302. package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
  303. package/dist/esm/views/TamaguiProvider.native.js +1 -2
  304. package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
  305. package/dist/esm/views/Text.mjs +17 -12
  306. package/dist/esm/views/Text.mjs.map +1 -1
  307. package/dist/esm/views/Theme.mjs +3 -3
  308. package/dist/esm/views/Theme.mjs.map +1 -1
  309. package/dist/esm/views/Theme.native.js +3 -3
  310. package/dist/esm/views/Theme.native.js.map +1 -1
  311. package/dist/esm/views/ThemeDebug.mjs +1 -4
  312. package/dist/esm/views/ThemeDebug.mjs.map +1 -1
  313. package/package.json +15 -15
  314. package/src/createComponent.tsx +21 -1
  315. package/src/createStyledHOC.tsx +4 -2
  316. package/src/createVariable.ts +0 -10
  317. package/src/helpers/borderComponents.ts +62 -0
  318. package/src/helpers/createDesignSystem.ts +0 -2
  319. package/src/helpers/createStyledContext.tsx +15 -53
  320. package/src/helpers/formatDiagnostic.ts +9 -9
  321. package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
  322. package/src/helpers/getCSSStylesAtomic.ts +192 -207
  323. package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
  324. package/src/helpers/getDynamicVal.ts +4 -0
  325. package/src/helpers/getSplitStyles.tsx +2080 -3270
  326. package/src/helpers/grammarConfig.ts +218 -1
  327. package/src/helpers/insertStyleRule.tsx +4 -2
  328. package/src/helpers/log.ts +12 -11
  329. package/src/helpers/mergeVariants.ts +55 -18
  330. package/src/helpers/nativeOnlyProps.ts +0 -1
  331. package/src/helpers/nativeStyleEngine.ts +55 -14
  332. package/src/helpers/normalizeValueWithProperty.ts +10 -12
  333. package/src/helpers/parseBorderShorthand.native.ts +23 -45
  334. package/src/helpers/parseOutlineShorthand.native.ts +9 -40
  335. package/src/helpers/resolveSafeArea.ts +34 -101
  336. package/src/helpers/resolveVariantStyle.ts +77 -0
  337. package/src/helpers/styleFrontend.ts +8 -5
  338. package/src/helpers/styleStaticConfig.ts +5 -72
  339. package/src/helpers/styleStaticConfigCore.ts +110 -0
  340. package/src/helpers/styledDynamic.ts +191 -0
  341. package/src/helpers/tokenCategories.ts +40 -65
  342. package/src/helpers/variableValue.ts +20 -15
  343. package/src/helpers/warnOnce.ts +5 -4
  344. package/src/hooks/useAnimationDriver.ts +6 -2
  345. package/src/hooks/useComponentState.ts +55 -183
  346. package/src/hooks/useMedia.tsx +10 -8
  347. package/src/hooks/useStyle.ts +10 -0
  348. package/src/hooks/useThemeState.ts +51 -264
  349. package/src/index.ts +6 -6
  350. package/src/internalRuntimeTypes.ts +1 -0
  351. package/src/static-resolve.ts +7 -4
  352. package/src/style.ts +97 -0
  353. package/src/styled.tsx +39 -68
  354. package/src/types.tsx +105 -169
  355. package/src/views/TamaguiProvider.tsx +0 -2
  356. package/src/views/Text.tsx +20 -14
  357. package/src/views/Theme.tsx +13 -9
  358. package/src/views/ThemeDebug.tsx +0 -1
  359. package/types/createComponent.d.ts.map +1 -1
  360. package/types/createStyledHOC.d.ts +1 -1
  361. package/types/createStyledHOC.d.ts.map +1 -1
  362. package/types/createVariable.d.ts +0 -2
  363. package/types/createVariable.d.ts.map +1 -1
  364. package/types/helpers/borderComponents.d.ts +10 -0
  365. package/types/helpers/borderComponents.d.ts.map +1 -0
  366. package/types/helpers/createDesignSystem.d.ts.map +1 -1
  367. package/types/helpers/createStyledContext.d.ts.map +1 -1
  368. package/types/helpers/getCSSStylesAtomic.d.ts +20 -19
  369. package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
  370. package/types/helpers/getCSSStylesAtomic.native.d.ts +5 -0
  371. package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -1
  372. package/types/helpers/getCSSStylesAtomicCompiled.d.ts +6 -1
  373. package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -1
  374. package/types/helpers/getDynamicVal.d.ts.map +1 -1
  375. package/types/helpers/getSplitStyles.d.ts +3 -5
  376. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  377. package/types/helpers/grammarConfig.d.ts +25 -2
  378. package/types/helpers/grammarConfig.d.ts.map +1 -1
  379. package/types/helpers/insertStyleRule.d.ts +1 -0
  380. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  381. package/types/helpers/log.d.ts.map +1 -1
  382. package/types/helpers/mergeVariants.d.ts.map +1 -1
  383. package/types/helpers/nativeOnlyProps.d.ts +0 -1
  384. package/types/helpers/nativeOnlyProps.d.ts.map +1 -1
  385. package/types/helpers/nativeStyleEngine.d.ts +6 -0
  386. package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
  387. package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
  388. package/types/helpers/parseBorderShorthand.native.d.ts +1 -0
  389. package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -1
  390. package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -1
  391. package/types/helpers/resolveSafeArea.d.ts +0 -1
  392. package/types/helpers/resolveSafeArea.d.ts.map +1 -1
  393. package/types/helpers/resolveVariantStyle.d.ts +3 -0
  394. package/types/helpers/resolveVariantStyle.d.ts.map +1 -0
  395. package/types/helpers/styleFrontend.d.ts +3 -5
  396. package/types/helpers/styleFrontend.d.ts.map +1 -1
  397. package/types/helpers/styleStaticConfig.d.ts +4 -9
  398. package/types/helpers/styleStaticConfig.d.ts.map +1 -1
  399. package/types/helpers/styleStaticConfigCore.d.ts +4 -0
  400. package/types/helpers/styleStaticConfigCore.d.ts.map +1 -0
  401. package/types/helpers/styledDynamic.d.ts +18 -0
  402. package/types/helpers/styledDynamic.d.ts.map +1 -0
  403. package/types/helpers/tokenCategories.d.ts +0 -1
  404. package/types/helpers/tokenCategories.d.ts.map +1 -1
  405. package/types/helpers/variableValue.d.ts.map +1 -1
  406. package/types/helpers/warnOnce.d.ts.map +1 -1
  407. package/types/helpers/webPropsToSkip.native.d.ts +68 -68
  408. package/types/hooks/useAnimationDriver.d.ts.map +1 -1
  409. package/types/hooks/useComponentState.d.ts.map +1 -1
  410. package/types/hooks/useMedia.d.ts.map +1 -1
  411. package/types/hooks/useStyle.d.ts +4 -0
  412. package/types/hooks/useStyle.d.ts.map +1 -0
  413. package/types/hooks/useThemeState.d.ts +1 -11
  414. package/types/hooks/useThemeState.d.ts.map +1 -1
  415. package/types/index.d.ts +6 -4
  416. package/types/index.d.ts.map +1 -1
  417. package/types/internalRuntimeTypes.d.ts +1 -1
  418. package/types/internalRuntimeTypes.d.ts.map +1 -1
  419. package/types/static-resolve.d.ts.map +1 -1
  420. package/types/style.d.ts +18 -0
  421. package/types/style.d.ts.map +1 -0
  422. package/types/styled.d.ts +10 -10
  423. package/types/styled.d.ts.map +1 -1
  424. package/types/types.d.ts +74 -49
  425. package/types/types.d.ts.map +1 -1
  426. package/types/views/TamaguiProvider.d.ts +1 -1
  427. package/types/views/TamaguiProvider.d.ts.map +1 -1
  428. package/types/views/Text.d.ts.map +1 -1
  429. package/types/views/Theme.d.ts.map +1 -1
  430. package/types/views/ThemeDebug.d.ts.map +1 -1
  431. package/dist/cjs/helpers/directStyleCSS.cjs +0 -345
  432. package/dist/cjs/helpers/directStyleCSS.native.js.map +0 -1
  433. package/dist/cjs/helpers/directStyleCSSCompiled.cjs +0 -40
  434. package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +0 -46
  435. package/dist/cjs/helpers/directStyleCSSCompiled.native.js +0 -48
  436. package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +0 -1
  437. package/dist/cjs/helpers/getVariantExtras.cjs +0 -91
  438. package/dist/cjs/helpers/getVariantExtras.native.cjs +0 -94
  439. package/dist/cjs/helpers/getVariantExtras.native.js +0 -96
  440. package/dist/cjs/helpers/getVariantExtras.native.js.map +0 -1
  441. package/dist/cjs/helpers/variantResolvers.cjs +0 -87
  442. package/dist/cjs/helpers/variantResolvers.native.cjs +0 -140
  443. package/dist/cjs/helpers/variantResolvers.native.js +0 -142
  444. package/dist/cjs/helpers/variantResolvers.native.js.map +0 -1
  445. package/dist/esm/helpers/directStyleCSS.mjs +0 -317
  446. package/dist/esm/helpers/directStyleCSS.mjs.map +0 -1
  447. package/dist/esm/helpers/directStyleCSS.native.js +0 -1
  448. package/dist/esm/helpers/directStyleCSSCompiled.mjs +0 -11
  449. package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +0 -1
  450. package/dist/esm/helpers/directStyleCSSCompiled.native.js +0 -15
  451. package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +0 -1
  452. package/dist/esm/helpers/getVariantExtras.mjs +0 -69
  453. package/dist/esm/helpers/getVariantExtras.mjs.map +0 -1
  454. package/dist/esm/helpers/getVariantExtras.native.js +0 -70
  455. package/dist/esm/helpers/getVariantExtras.native.js.map +0 -1
  456. package/dist/esm/helpers/variantResolvers.mjs +0 -65
  457. package/dist/esm/helpers/variantResolvers.mjs.map +0 -1
  458. package/dist/esm/helpers/variantResolvers.native.js +0 -116
  459. package/dist/esm/helpers/variantResolvers.native.js.map +0 -1
  460. package/src/helpers/directStyleCSS.native.ts +0 -1
  461. package/src/helpers/directStyleCSS.ts +0 -513
  462. package/src/helpers/directStyleCSSCompiled.ts +0 -32
  463. package/src/helpers/getVariantExtras.tsx +0 -95
  464. package/src/helpers/variantResolvers.ts +0 -121
  465. package/types/helpers/directStyleCSS.d.ts +0 -28
  466. package/types/helpers/directStyleCSS.d.ts.map +0 -1
  467. package/types/helpers/directStyleCSS.native.d.ts +0 -2
  468. package/types/helpers/directStyleCSS.native.d.ts.map +0 -1
  469. package/types/helpers/directStyleCSSCompiled.d.ts +0 -10
  470. package/types/helpers/directStyleCSSCompiled.d.ts.map +0 -1
  471. package/types/helpers/getVariantExtras.d.ts +0 -4
  472. package/types/helpers/getVariantExtras.d.ts.map +0 -1
  473. package/types/helpers/variantResolvers.d.ts +0 -9
  474. package/types/helpers/variantResolvers.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useAnimationDriver.js","names":[],"sources":["esm/hooks/useAnimationDriver.js"],"sourcesContent":["import { useConfiguration } from \"../contexts/ComponentContext\";\nfunction useAnimationDriver() {\n const { animationDriver } = useConfiguration();\n if (!animationDriver || animationDriver.isStub) {\n throw new Error(\n `No animation driver configured. Pass \\`animations\\` to createTamagui. See: https://tamagui.dev/docs/core/animations`\n );\n }\n return animationDriver;\n}\nfunction useAnimatedNumberDriver() {\n const driver = useAnimationDriver();\n const animatedDriver = driver;\n if (typeof animatedDriver.useAnimatedNumber !== \"function\" || typeof animatedDriver.useAnimatedNumberStyle !== \"function\" || typeof animatedDriver.useAnimatedNumbersStyle !== \"function\" || typeof animatedDriver.useAnimatedNumberReaction !== \"function\") {\n throw new Error(\n `The configured animation driver does not include animated-number hooks. When using the CSS driver, import \\`createAnimations\\` from \\`@tamagui/animations-css/extras\\` instead of \\`@tamagui/animations-css\\`. See: https://tamagui.dev/docs/core/animations-css`\n );\n }\n return animatedDriver;\n}\nfunction useAnimatedNumber(initial) {\n return useAnimatedNumberDriver().useAnimatedNumber(initial);\n}\nconst useAnimatedNumberStyle = (value, getStyle) => useAnimatedNumberDriver().useAnimatedNumberStyle(value, getStyle);\nconst useAnimatedNumbersStyle = (values, getStyle) => useAnimatedNumberDriver().useAnimatedNumbersStyle(values, getStyle);\nconst useAnimatedNumberReaction = (opts, onValue) => useAnimatedNumberDriver().useAnimatedNumberReaction(opts, onValue);\nexport {\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n useAnimatedNumbersStyle,\n useAnimationDriver\n};\n//# sourceMappingURL=useAnimationDriver.js.map\n"],"mappings":";;;AACA,SAAS,qBAAqB;CAC5B,MAAM,EAAE,oBAAoB,iBAAiB;CAC7C,IAAI,CAAC,mBAAmB,gBAAgB,QAAQ;EAC9C,MAAM,IAAI,MACR,qHACF;CACF;CACA,OAAO;AACT;AACA,SAAS,0BAA0B;CACjC,MAAM,SAAS,mBAAmB;CAClC,MAAM,iBAAiB;CACvB,IAAI,OAAO,eAAe,sBAAsB,cAAc,OAAO,eAAe,2BAA2B,cAAc,OAAO,eAAe,4BAA4B,cAAc,OAAO,eAAe,8BAA8B,YAAY;EAC3P,MAAM,IAAI,MACR,kQACF;CACF;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,SAAS;CAClC,OAAO,wBAAwB,CAAC,CAAC,kBAAkB,OAAO;AAC5D;AACA,MAAM,0BAA0B,OAAO,aAAa,wBAAwB,CAAC,CAAC,uBAAuB,OAAO,QAAQ;AACpH,MAAM,2BAA2B,QAAQ,aAAa,wBAAwB,CAAC,CAAC,wBAAwB,QAAQ,QAAQ;AACxH,MAAM,6BAA6B,MAAM,YAAY,wBAAwB,CAAC,CAAC,0BAA0B,MAAM,OAAO"}
1
+ {"version":3,"file":"useAnimationDriver.js","names":[],"sources":["esm/hooks/useAnimationDriver.js"],"sourcesContent":["import { useConfiguration } from \"../contexts/ComponentContext\";\nfunction useAnimationDriver() {\n const { animationDriver } = useConfiguration();\n if (!animationDriver || animationDriver.isStub) {\n throw new Error(\n process.env.NODE_ENV !== \"production\" ? `No animation driver configured. Pass \\`animations\\` to createTamagui. See: https://tamagui.dev/docs/core/animations` : \"\\u274C Error 011\"\n );\n }\n return animationDriver;\n}\nfunction useAnimatedNumberDriver() {\n const driver = useAnimationDriver();\n const animatedDriver = driver;\n if (typeof animatedDriver.useAnimatedNumber !== \"function\" || typeof animatedDriver.useAnimatedNumberStyle !== \"function\" || typeof animatedDriver.useAnimatedNumbersStyle !== \"function\" || typeof animatedDriver.useAnimatedNumberReaction !== \"function\") {\n throw new Error(\n process.env.NODE_ENV !== \"production\" ? `The configured animation driver does not include animated-number hooks. When using the CSS driver, import \\`createAnimations\\` from \\`@tamagui/animations-css/extras\\` instead of \\`@tamagui/animations-css\\`. See: https://tamagui.dev/docs/core/animations-css` : \"\\u274C Error 012\"\n );\n }\n return animatedDriver;\n}\nfunction useAnimatedNumber(initial) {\n return useAnimatedNumberDriver().useAnimatedNumber(initial);\n}\nconst useAnimatedNumberStyle = (value, getStyle) => useAnimatedNumberDriver().useAnimatedNumberStyle(value, getStyle);\nconst useAnimatedNumbersStyle = (values, getStyle) => useAnimatedNumberDriver().useAnimatedNumbersStyle(values, getStyle);\nconst useAnimatedNumberReaction = (opts, onValue) => useAnimatedNumberDriver().useAnimatedNumberReaction(opts, onValue);\nexport {\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n useAnimatedNumbersStyle,\n useAnimationDriver\n};\n//# sourceMappingURL=useAnimationDriver.js.map\n"],"mappings":";;;AACA,SAAS,qBAAqB;CAC5B,MAAM,EAAE,oBAAoB,iBAAiB;CAC7C,IAAI,CAAC,mBAAmB,gBAAgB,QAAQ;EAC9C,MAAM,IAAI,MACR,QAAQ,IAAI,aAAa,eAAe,wHAAwH,aAClK;CACF;CACA,OAAO;AACT;AACA,SAAS,0BAA0B;CACjC,MAAM,SAAS,mBAAmB;CAClC,MAAM,iBAAiB;CACvB,IAAI,OAAO,eAAe,sBAAsB,cAAc,OAAO,eAAe,2BAA2B,cAAc,OAAO,eAAe,4BAA4B,cAAc,OAAO,eAAe,8BAA8B,YAAY;EAC3P,MAAM,IAAI,MACR,QAAQ,IAAI,aAAa,eAAe,qQAAqQ,aAC/S;CACF;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,SAAS;CAClC,OAAO,wBAAwB,CAAC,CAAC,kBAAkB,OAAO;AAC5D;AACA,MAAM,0BAA0B,OAAO,aAAa,wBAAwB,CAAC,CAAC,uBAAuB,OAAO,QAAQ;AACpH,MAAM,2BAA2B,QAAQ,aAAa,wBAAwB,CAAC,CAAC,wBAAwB,QAAQ,QAAQ;AACxH,MAAM,6BAA6B,MAAM,YAAY,wBAAwB,CAAC,CAAC,0BAA0B,MAAM,OAAO"}
@@ -3,7 +3,7 @@ import { useConfiguration } from "../contexts/ComponentContext.native.js";
3
3
  function useAnimationDriver() {
4
4
  var { animationDriver } = useConfiguration();
5
5
  if (!animationDriver || animationDriver.isStub) {
6
- throw new Error(`No animation driver configured. Pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);
6
+ throw new Error(process.env.NODE_ENV !== "production" ? `No animation driver configured. Pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations` : "❌ Error 011");
7
7
  }
8
8
  return animationDriver;
9
9
  }
@@ -11,7 +11,7 @@ function useAnimatedNumberDriver() {
11
11
  var driver = useAnimationDriver();
12
12
  var animatedDriver = driver;
13
13
  if (typeof animatedDriver.useAnimatedNumber !== "function" || typeof animatedDriver.useAnimatedNumberStyle !== "function" || typeof animatedDriver.useAnimatedNumbersStyle !== "function" || typeof animatedDriver.useAnimatedNumberReaction !== "function") {
14
- throw new Error(`The configured animation driver does not include animated-number hooks. When using the CSS driver, import \`createAnimations\` from \`@tamagui/animations-css/extras\` instead of \`@tamagui/animations-css\`. See: https://tamagui.dev/docs/core/animations-css`);
14
+ throw new Error(process.env.NODE_ENV !== "production" ? `The configured animation driver does not include animated-number hooks. When using the CSS driver, import \`createAnimations\` from \`@tamagui/animations-css/extras\` instead of \`@tamagui/animations-css\`. See: https://tamagui.dev/docs/core/animations-css` : "❌ Error 012");
15
15
  }
16
16
  return animatedDriver;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useAnimationDriver.native.js","names":[],"sources":["esm/hooks/useAnimationDriver.native.js"],"sourcesContent":["import { useConfiguration } from \"../contexts/ComponentContext\";\nfunction useAnimationDriver() {\n var { animationDriver } = useConfiguration();\n if (!animationDriver || animationDriver.isStub) {\n throw new Error(`No animation driver configured. Pass \\`animations\\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);\n }\n return animationDriver;\n}\nfunction useAnimatedNumberDriver() {\n var driver = useAnimationDriver();\n var animatedDriver = driver;\n if (typeof animatedDriver.useAnimatedNumber !== \"function\" || typeof animatedDriver.useAnimatedNumberStyle !== \"function\" || typeof animatedDriver.useAnimatedNumbersStyle !== \"function\" || typeof animatedDriver.useAnimatedNumberReaction !== \"function\") {\n throw new Error(`The configured animation driver does not include animated-number hooks. When using the CSS driver, import \\`createAnimations\\` from \\`@tamagui/animations-css/extras\\` instead of \\`@tamagui/animations-css\\`. See: https://tamagui.dev/docs/core/animations-css`);\n }\n return animatedDriver;\n}\nfunction useAnimatedNumber(initial) {\n return useAnimatedNumberDriver().useAnimatedNumber(initial);\n}\nvar useAnimatedNumberStyle = function(value, getStyle) {\n return useAnimatedNumberDriver().useAnimatedNumberStyle(value, getStyle);\n};\nvar useAnimatedNumbersStyle = function(values, getStyle) {\n return useAnimatedNumberDriver().useAnimatedNumbersStyle(values, getStyle);\n};\nvar useAnimatedNumberReaction = function(opts, onValue) {\n return useAnimatedNumberDriver().useAnimatedNumberReaction(opts, onValue);\n};\nexport {\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n useAnimatedNumbersStyle,\n useAnimationDriver\n};\n//# sourceMappingURL=useAnimationDriver.js.map\n"],"mappings":";;;AACA,SAAS,qBAAqB;CAC5B,IAAI,EAAE,oBAAoB,iBAAiB;CAC3C,IAAI,CAAC,mBAAmB,gBAAgB,QAAQ;EAC9C,MAAM,IAAI,MAAM,qHAAqH;CACvI;CACA,OAAO;AACT;AACA,SAAS,0BAA0B;CACjC,IAAI,SAAS,mBAAmB;CAChC,IAAI,iBAAiB;CACrB,IAAI,OAAO,eAAe,sBAAsB,cAAc,OAAO,eAAe,2BAA2B,cAAc,OAAO,eAAe,4BAA4B,cAAc,OAAO,eAAe,8BAA8B,YAAY;EAC3P,MAAM,IAAI,MAAM,kQAAkQ;CACpR;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,SAAS;CAClC,OAAO,wBAAwB,CAAC,CAAC,kBAAkB,OAAO;AAC5D;AACA,IAAI,yBAAyB,SAAS,OAAO,UAAU;CACrD,OAAO,wBAAwB,CAAC,CAAC,uBAAuB,OAAO,QAAQ;AACzE;AACA,IAAI,0BAA0B,SAAS,QAAQ,UAAU;CACvD,OAAO,wBAAwB,CAAC,CAAC,wBAAwB,QAAQ,QAAQ;AAC3E;AACA,IAAI,4BAA4B,SAAS,MAAM,SAAS;CACtD,OAAO,wBAAwB,CAAC,CAAC,0BAA0B,MAAM,OAAO;AAC1E"}
1
+ {"version":3,"file":"useAnimationDriver.native.js","names":[],"sources":["esm/hooks/useAnimationDriver.native.js"],"sourcesContent":["import { useConfiguration } from \"../contexts/ComponentContext\";\nfunction useAnimationDriver() {\n var { animationDriver } = useConfiguration();\n if (!animationDriver || animationDriver.isStub) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `No animation driver configured. Pass \\`animations\\` to createTamagui. See: https://tamagui.dev/docs/core/animations` : \"\\u274C Error 011\");\n }\n return animationDriver;\n}\nfunction useAnimatedNumberDriver() {\n var driver = useAnimationDriver();\n var animatedDriver = driver;\n if (typeof animatedDriver.useAnimatedNumber !== \"function\" || typeof animatedDriver.useAnimatedNumberStyle !== \"function\" || typeof animatedDriver.useAnimatedNumbersStyle !== \"function\" || typeof animatedDriver.useAnimatedNumberReaction !== \"function\") {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `The configured animation driver does not include animated-number hooks. When using the CSS driver, import \\`createAnimations\\` from \\`@tamagui/animations-css/extras\\` instead of \\`@tamagui/animations-css\\`. See: https://tamagui.dev/docs/core/animations-css` : \"\\u274C Error 012\");\n }\n return animatedDriver;\n}\nfunction useAnimatedNumber(initial) {\n return useAnimatedNumberDriver().useAnimatedNumber(initial);\n}\nvar useAnimatedNumberStyle = function(value, getStyle) {\n return useAnimatedNumberDriver().useAnimatedNumberStyle(value, getStyle);\n};\nvar useAnimatedNumbersStyle = function(values, getStyle) {\n return useAnimatedNumberDriver().useAnimatedNumbersStyle(values, getStyle);\n};\nvar useAnimatedNumberReaction = function(opts, onValue) {\n return useAnimatedNumberDriver().useAnimatedNumberReaction(opts, onValue);\n};\nexport {\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n useAnimatedNumbersStyle,\n useAnimationDriver\n};\n//# sourceMappingURL=useAnimationDriver.js.map\n"],"mappings":";;;AACA,SAAS,qBAAqB;CAC5B,IAAI,EAAE,oBAAoB,iBAAiB;CAC3C,IAAI,CAAC,mBAAmB,gBAAgB,QAAQ;EAC9C,MAAM,IAAI,MAAM,QAAQ,IAAI,aAAa,eAAe,wHAAwH,aAAkB;CACpM;CACA,OAAO;AACT;AACA,SAAS,0BAA0B;CACjC,IAAI,SAAS,mBAAmB;CAChC,IAAI,iBAAiB;CACrB,IAAI,OAAO,eAAe,sBAAsB,cAAc,OAAO,eAAe,2BAA2B,cAAc,OAAO,eAAe,4BAA4B,cAAc,OAAO,eAAe,8BAA8B,YAAY;EAC3P,MAAM,IAAI,MAAM,QAAQ,IAAI,aAAa,eAAe,qQAAqQ,aAAkB;CACjV;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,SAAS;CAClC,OAAO,wBAAwB,CAAC,CAAC,kBAAkB,OAAO;AAC5D;AACA,IAAI,yBAAyB,SAAS,OAAO,UAAU;CACrD,OAAO,wBAAwB,CAAC,CAAC,uBAAuB,OAAO,QAAQ;AACzE;AACA,IAAI,0BAA0B,SAAS,QAAQ,UAAU;CACvD,OAAO,wBAAwB,CAAC,CAAC,wBAAwB,QAAQ,QAAQ;AAC3E;AACA,IAAI,4BAA4B,SAAS,MAAM,SAAS;CACtD,OAAO,wBAAwB,CAAC,CAAC,0BAA0B,MAAM,OAAO;AAC1E"}
@@ -3,11 +3,9 @@ import { mergeIfNotShallowEqual } from "@tamagui/is-equal-shallow";
3
3
  import { useDidFinishSSR, useIsClientOnly } from "@tamagui/use-did-finish-ssr";
4
4
  import { useRef, useState } from "react";
5
5
  import { getSetting } from "../config.mjs";
6
- import { formatDiagnostic } from "../helpers/formatDiagnostic.mjs";
7
6
  import { isOptimizedForFirstRender } from "./isOptimizedForFirstRender.mjs";
8
7
  import { defaultComponentStateMounted } from "../defaultComponentState.mjs";
9
8
  import { isObj } from "../helpers/isObj.mjs";
10
- import { log } from "../helpers/log.mjs";
11
9
 
12
10
  const useComponentState = (props, animationDriver, staticConfig, config) => {
13
11
  "use no memo";
@@ -16,48 +14,42 @@ const useComponentState = (props, animationDriver, staticConfig, config) => {
16
14
  const useAnimations = animationDriver?.isStub ? void 0 : animationDriver?.useAnimations;
17
15
  const { isHOC } = staticConfig;
18
16
  const stateRef = useRef(void 0);
19
- if (!stateRef.current) {
20
- stateRef.current = {
21
- startedUnhydrated: needsHydration && !isHydrated,
22
- optimizeForFirstRender: isOptimizedForFirstRender()
23
- };
24
- }
17
+ const curStateRef = stateRef.current ||= {
18
+ startedUnhydrated: needsHydration && !isHydrated,
19
+ optimizeForFirstRender: isOptimizedForFirstRender()
20
+ };
25
21
  const hasAnimationProp = Boolean(!isHOC && "transition" in props || props.style && hasAnimatedStyleValue(props.style));
26
22
  const inputStyle = animationDriver?.inputStyle ?? "css";
27
23
  const outputStyle = animationDriver?.outputStyle ?? "css";
28
- const curStateRef = stateRef.current;
29
24
  if (!needsHydration && hasAnimationProp) {
30
25
  curStateRef.hasAnimated = true;
31
26
  }
32
27
  const platformPseudoPossible = Boolean(!isHOC && useAnimations && animationDriver?.avoidReRenders && getPlatformDriver()?.pseudo);
33
- let willBeAnimatedClient = (() => {
34
- const next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);
35
- return Boolean(next || curStateRef.hasAnimated);
36
- })();
37
- let willBeAnimated = !isServer && willBeAnimatedClient;
28
+ const willBeAnimatedClient = Boolean((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations || curStateRef.hasAnimated);
29
+ const willBeAnimated = !isServer && willBeAnimatedClient;
38
30
  if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
39
31
  curStateRef.hasAnimated = true;
40
32
  }
41
33
  const { disableClassName } = props;
42
- if (willBeAnimated && !isHOC && props["animatePresence"] !== false) {
34
+ const animatePresenceOptIn = willBeAnimated && !isHOC && props["animatePresence"] !== false;
35
+ if (animatePresenceOptIn) {
43
36
  curStateRef.shouldRegisterPresence = true;
44
37
  } else {
45
38
  curStateRef.shouldRegisterPresence ??= false;
46
39
  }
47
40
  const presenceResult = animationDriver?.usePresence?.(curStateRef) || null;
48
- const presence = !isHOC && willBeAnimated && props["animatePresence"] !== false ? presenceResult : null;
41
+ const presence = animatePresenceOptIn ? presenceResult : null;
49
42
  const presenceState = presence?.[2];
50
43
  const isExiting = presenceState?.isPresent === false;
51
44
  const isEntering = presenceState?.isPresent === true && presenceState.initial !== false;
52
45
  const hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== "css";
53
- const initialState = { ...defaultComponentStateMounted };
54
46
  const disabled = isDisabled(props);
55
- if (disabled != null) {
56
- initialState.disabled = disabled;
57
- }
58
- const states = useState(initialState);
47
+ const [componentState, reactSetState] = useState(() => disabled != null ? {
48
+ ...defaultComponentStateMounted,
49
+ disabled
50
+ } : defaultComponentStateMounted);
59
51
  const initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;
60
- let state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...states[0] } : states[0];
52
+ let state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...componentState } : componentState;
61
53
  if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
62
54
  state.unmounted = true;
63
55
  }
@@ -65,26 +57,22 @@ const useComponentState = (props, animationDriver, staticConfig, config) => {
65
57
  state.unmounted = initialStyleFrameUnmounted;
66
58
  }
67
59
  if (props.forceStyle) {
68
- if (state === states[0]) state = { ...state };
60
+ if (state === componentState) state = { ...state };
69
61
  state[props.forceStyle] = true;
70
62
  }
71
- if (!curStateRef.setState) {
72
- const reactSetState = states[1];
73
- curStateRef.setState = (stateOrGetState) => {
74
- const pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
75
- curStateRef.initialStyleFrameUnmounted = void 0;
76
- reactSetState((previous) => {
77
- const current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
78
- ...previous,
79
- unmounted: pendingUnmounted
80
- } : previous;
81
- return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
82
- });
83
- };
84
- }
85
- const setState = curStateRef.setState;
63
+ const setState = curStateRef.setState ||= (stateOrGetState) => {
64
+ const pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
65
+ curStateRef.initialStyleFrameUnmounted = void 0;
66
+ reactSetState((previous) => {
67
+ const current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
68
+ ...previous,
69
+ unmounted: pendingUnmounted
70
+ } : previous;
71
+ return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
72
+ });
73
+ };
86
74
  let isAnimated = willBeAnimated;
87
- if (isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {
75
+ if (isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated) {
88
76
  isAnimated = false;
89
77
  curStateRef.willHydrate = true;
90
78
  }
@@ -96,36 +84,14 @@ const useComponentState = (props, animationDriver, staticConfig, config) => {
96
84
  setState((_) => ({ ...state }));
97
85
  }
98
86
  const groupName = props.group;
99
- if (!stateRef.current.baseSetStateShallow) {
100
- const r = stateRef.current;
101
- r.baseSetStateShallow = (stateOrGetState) => {
102
- setState((prev) => {
103
- const next = typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState;
104
- const update = mergeIfNotShallowEqual(prev, next);
105
- if (process.env.NODE_ENV === "development") {
106
- const dbg = r.__debug;
107
- if (dbg && update !== prev) {
108
- console.groupCollapsed(`setStateShallow CHANGE`, "=>", update);
109
- console.info(`previously`, prev);
110
- console.trace();
111
- console.groupEnd();
112
- }
113
- }
114
- return update;
115
- });
116
- };
117
- }
118
- if (process.env.NODE_ENV === "development") {
119
- ;
120
- stateRef.current.__debug = props.debug;
121
- }
122
- const setStateShallow = stateRef.current.baseSetStateShallow;
123
- if (process.env.NODE_ENV === "development" && globalThis.time) globalThis.time`state-useCreateShallowSetState`;
87
+ const setStateShallow = curStateRef.baseSetStateShallow ||= (stateOrGetState) => {
88
+ setState((prev) => {
89
+ const next = typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState;
90
+ return mergeIfNotShallowEqual(prev, next);
91
+ });
92
+ };
124
93
  let outProps = props;
125
94
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
126
- if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
127
- console.warn(formatDiagnostic("TAMAGUI_PRESENCE_STATE", staticConfig.Component?.displayName || staticConfig.Component?.name || "TamaguiComponent", "AnimatePresence supplied lifecycle state to an animated component", "Remove debug=\"verbose\" after inspecting the animation state", "presenceState", presenceState));
128
- }
129
95
  const { custom } = presenceState;
130
96
  if (isObj(custom)) {
131
97
  outProps = {
@@ -134,23 +100,16 @@ const useComponentState = (props, animationDriver, staticConfig, config) => {
134
100
  };
135
101
  }
136
102
  }
137
- let noClass = !isWeb || !!props.forceStyle;
138
- if (!isHydrated) {
139
- noClass = false;
140
- } else {
141
- if (isWeb && isHydrated) {
142
- const isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;
103
+ let noClass = !isWeb || Boolean(props.forceStyle);
104
+ if (isWeb) {
105
+ if (!isHydrated) {
106
+ noClass = false;
107
+ } else {
108
+ const isAnimatedAndHydrated = Boolean((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC);
143
109
  const isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting("disableSSR") || !state.unmounted);
144
- const isDisabledManually = disableClassName && !state.unmounted;
110
+ const isDisabledManually = Boolean(disableClassName && !state.unmounted);
145
111
  if (isAnimatedAndHydrated && outputStyle !== "css" || isDisabledManually || isClassNameDisabled) {
146
112
  noClass = true;
147
- if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
148
- log(`avoiding className`, {
149
- isAnimatedAndHydrated,
150
- isDisabledManually,
151
- isClassNameDisabled
152
- });
153
- }
154
113
  }
155
114
  }
156
115
  }
@@ -195,7 +154,7 @@ const useComponentState = (props, animationDriver, staticConfig, config) => {
195
154
  result.platformPseudo = platformPseudo;
196
155
  result.willBeAnimatedClient = nextWillBeAnimatedClient;
197
156
  result.willBeAnimated = nextWillBeAnimated;
198
- result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;
157
+ result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated ? false : nextWillBeAnimated;
199
158
  if (nextWillBeAnimated && !isHOC && props["animatePresence"] !== false) {
200
159
  curStateRef.shouldRegisterPresence = true;
201
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentState.js","names":[],"sources":["esm/hooks/useComponentState.js"],"sourcesContent":["import { getPlatformDriver, isServer, isWeb } from \"@tamagui/constants\";\nimport { mergeIfNotShallowEqual } from \"@tamagui/is-equal-shallow\";\nimport { useDidFinishSSR, useIsClientOnly } from \"@tamagui/use-did-finish-ssr\";\nimport { useRef, useState } from \"react\";\nimport { getSetting } from \"../config\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { isOptimizedForFirstRender } from \"./isOptimizedForFirstRender\";\nimport {\n defaultComponentStateMounted\n} from \"../defaultComponentState\";\nimport { isObj } from \"../helpers/isObj\";\nimport { log } from \"../helpers/log\";\nconst useComponentState = (props, animationDriver, staticConfig, config) => {\n \"use no memo\";\n const isHydrated = useDidFinishSSR();\n const needsHydration = !useIsClientOnly();\n const useAnimations = animationDriver?.isStub ? void 0 : animationDriver?.useAnimations;\n const { isHOC } = staticConfig;\n const stateRef = useRef(\n // performance: avoid creating object every render\n void 0\n );\n if (!stateRef.current) {\n stateRef.current = {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: isOptimizedForFirstRender()\n };\n }\n const hasAnimationProp = Boolean(\n !isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style)\n );\n const inputStyle = animationDriver?.inputStyle ?? \"css\";\n const outputStyle = animationDriver?.outputStyle ?? \"css\";\n const curStateRef = stateRef.current;\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n const platformPseudoPossible = Boolean(\n !isHOC && useAnimations && animationDriver?.avoidReRenders && getPlatformDriver()?.pseudo\n );\n let willBeAnimatedClient = (() => {\n const next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);\n return Boolean(next || curStateRef.hasAnimated);\n })();\n let willBeAnimated = !isServer && willBeAnimatedClient;\n if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n const { disableClassName } = props;\n if (willBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n } else {\n curStateRef.shouldRegisterPresence ??= false;\n }\n const presenceResult = animationDriver?.usePresence?.(curStateRef) || null;\n const presence = !isHOC && willBeAnimated && props[\"animatePresence\"] !== false ? presenceResult : null;\n const presenceState = presence?.[2];\n const isExiting = presenceState?.isPresent === false;\n const isEntering = presenceState?.isPresent === true && presenceState.initial !== false;\n const hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== \"css\";\n const initialState = { ...defaultComponentStateMounted };\n const disabled = isDisabled(props);\n if (disabled != null) {\n initialState.disabled = disabled;\n }\n const states = useState(initialState);\n const initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;\n let state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...states[0] } : states[0];\n if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {\n state.unmounted = true;\n }\n if (initialStyleFrameUnmounted !== void 0) {\n state.unmounted = initialStyleFrameUnmounted;\n }\n if (props.forceStyle) {\n if (state === states[0]) state = { ...state };\n state[props.forceStyle] = true;\n }\n if (!curStateRef.setState) {\n const reactSetState = states[1];\n curStateRef.setState = (stateOrGetState) => {\n const pendingUnmounted = curStateRef.initialStyleFrameUnmounted;\n curStateRef.initialStyleFrameUnmounted = void 0;\n reactSetState((previous) => {\n const current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? { ...previous, unmounted: pendingUnmounted } : previous;\n return typeof stateOrGetState === \"function\" ? stateOrGetState(current) : stateOrGetState;\n });\n };\n }\n const setState = curStateRef.setState;\n let isAnimated = willBeAnimated;\n if (isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState((_) => ({ ...state }));\n }\n const groupName = props.group;\n if (!stateRef.current.baseSetStateShallow) {\n const r = stateRef.current;\n r.baseSetStateShallow = (stateOrGetState) => {\n setState((prev) => {\n const next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n const update = mergeIfNotShallowEqual(prev, next);\n if (process.env.NODE_ENV === \"development\") {\n const dbg = r.__debug;\n if (dbg && update !== prev) {\n console.groupCollapsed(`setStateShallow CHANGE`, \"=>\", update);\n console.info(`previously`, prev);\n console.trace();\n console.groupEnd();\n }\n }\n return update;\n });\n };\n }\n if (process.env.NODE_ENV === \"development\") {\n ;\n stateRef.current.__debug = props.debug;\n }\n const setStateShallow = stateRef.current.baseSetStateShallow;\n if (process.env.NODE_ENV === \"development\" && globalThis.time)\n globalThis.time`state-useCreateShallowSetState`;\n let outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n console.warn(\n formatDiagnostic(\n \"TAMAGUI_PRESENCE_STATE\",\n staticConfig.Component?.displayName || staticConfig.Component?.name || \"TamaguiComponent\",\n \"AnimatePresence supplied lifecycle state to an animated component\",\n 'Remove debug=\"verbose\" after inspecting the animation state',\n \"presenceState\",\n presenceState\n )\n );\n }\n const { custom } = presenceState;\n if (isObj(custom)) {\n outProps = { ...props, ...custom };\n }\n }\n let noClass = !isWeb || !!props.forceStyle;\n if (!isHydrated) {\n noClass = false;\n } else {\n if (isWeb && isHydrated) {\n const isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;\n const isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting(\"disableSSR\") || !state.unmounted);\n const isDisabledManually = disableClassName && !state.unmounted;\n if (\n // Only disable className for animation drivers that output inline styles (not css)\n isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled\n ) {\n noClass = true;\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n log(`avoiding className`, {\n isAnimatedAndHydrated,\n isDisabledManually,\n isClassNameDisabled\n });\n }\n }\n }\n }\n const result = {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle: false,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo: platformPseudoPossible,\n finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {\n const platformPseudo = platformPseudoPossible && hasPlatformPseudo;\n const nextWillBeAnimatedClient = Boolean(\n (hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated\n );\n const nextWillBeAnimated = !isServer && nextWillBeAnimatedClient;\n if (nextWillBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n if (!curStateRef.didFinalizeInitialStyleFrame) {\n curStateRef.didFinalizeInitialStyleFrame = true;\n const shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);\n const unmounted = shouldEnter ? hasEnterStyle || isEntering ? \"should-enter\" : true : false;\n state.unmounted = unmounted;\n curStateRef.initialStyleFrameUnmounted = unmounted || void 0;\n }\n result.hasEnterStyle = hasEnterStyle;\n result.platformPseudo = platformPseudo;\n result.willBeAnimatedClient = nextWillBeAnimatedClient;\n result.willBeAnimated = nextWillBeAnimated;\n result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;\n if (nextWillBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n }\n return result;\n }\n };\n return result;\n};\nfunction hasAnimatedStyleValue(style) {\n for (const k in style) {\n const val = style[k];\n if (val && typeof val === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nconst isDisabled = (props) => {\n return props.disabled || props.passThrough || props.accessibilityState?.disabled || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\nexport {\n useComponentState\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,qBAAqB,OAAO,iBAAiB,cAAc,WAAW;CAC1E;CACA,MAAM,aAAa,gBAAgB;CACnC,MAAM,iBAAiB,CAAC,gBAAgB;CACxC,MAAM,gBAAgB,iBAAi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M,yBAAyB;AAC/I"}
1
+ {"version":3,"file":"useComponentState.js","names":[],"sources":["esm/hooks/useComponentState.js"],"sourcesContent":["import { getPlatformDriver, isServer, isWeb } from \"@tamagui/constants\";\nimport { mergeIfNotShallowEqual } from \"@tamagui/is-equal-shallow\";\nimport { useDidFinishSSR, useIsClientOnly } from \"@tamagui/use-did-finish-ssr\";\nimport { useRef, useState } from \"react\";\nimport { getSetting } from \"../config\";\nimport { isOptimizedForFirstRender } from \"./isOptimizedForFirstRender\";\nimport { defaultComponentStateMounted } from \"../defaultComponentState\";\nimport { isObj } from \"../helpers/isObj\";\nconst useComponentState = (props, animationDriver, staticConfig, config) => {\n \"use no memo\";\n const isHydrated = useDidFinishSSR();\n const needsHydration = !useIsClientOnly();\n const useAnimations = animationDriver?.isStub ? void 0 : animationDriver?.useAnimations;\n const { isHOC } = staticConfig;\n const stateRef = useRef(\n void 0\n );\n const curStateRef = stateRef.current ||= {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: isOptimizedForFirstRender()\n };\n const hasAnimationProp = Boolean(\n !isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style)\n );\n const inputStyle = animationDriver?.inputStyle ?? \"css\";\n const outputStyle = animationDriver?.outputStyle ?? \"css\";\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n const platformPseudoPossible = Boolean(\n !isHOC && useAnimations && animationDriver?.avoidReRenders && getPlatformDriver()?.pseudo\n );\n const willBeAnimatedClient = Boolean(\n (hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations || curStateRef.hasAnimated\n );\n const willBeAnimated = !isServer && willBeAnimatedClient;\n if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n const { disableClassName } = props;\n const animatePresenceOptIn = willBeAnimated && !isHOC && props[\"animatePresence\"] !== false;\n if (animatePresenceOptIn) {\n curStateRef.shouldRegisterPresence = true;\n } else {\n curStateRef.shouldRegisterPresence ??= false;\n }\n const presenceResult = animationDriver?.usePresence?.(curStateRef) || null;\n const presence = animatePresenceOptIn ? presenceResult : null;\n const presenceState = presence?.[2];\n const isExiting = presenceState?.isPresent === false;\n const isEntering = presenceState?.isPresent === true && presenceState.initial !== false;\n const hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== \"css\";\n const disabled = isDisabled(props);\n const [componentState, reactSetState] = useState(\n () => disabled != null ? { ...defaultComponentStateMounted, disabled } : defaultComponentStateMounted\n );\n const initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;\n let state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...componentState } : componentState;\n if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {\n state.unmounted = true;\n }\n if (initialStyleFrameUnmounted !== void 0) {\n state.unmounted = initialStyleFrameUnmounted;\n }\n if (props.forceStyle) {\n if (state === componentState) state = { ...state };\n state[props.forceStyle] = true;\n }\n const setState = curStateRef.setState ||= (stateOrGetState) => {\n const pendingUnmounted = curStateRef.initialStyleFrameUnmounted;\n curStateRef.initialStyleFrameUnmounted = void 0;\n reactSetState((previous) => {\n const current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? { ...previous, unmounted: pendingUnmounted } : previous;\n return typeof stateOrGetState === \"function\" ? stateOrGetState(current) : stateOrGetState;\n });\n };\n let isAnimated = willBeAnimated;\n if (isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState((_) => ({ ...state }));\n }\n const groupName = props.group;\n const setStateShallow = curStateRef.baseSetStateShallow ||= (stateOrGetState) => {\n setState((prev) => {\n const next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n return mergeIfNotShallowEqual(prev, next);\n });\n };\n let outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n const { custom } = presenceState;\n if (isObj(custom)) {\n outProps = { ...props, ...custom };\n }\n }\n let noClass = !isWeb || Boolean(props.forceStyle);\n if (isWeb) {\n if (!isHydrated) {\n noClass = false;\n } else {\n const isAnimatedAndHydrated = Boolean(\n (hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC\n );\n const isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting(\"disableSSR\") || !state.unmounted);\n const isDisabledManually = Boolean(disableClassName && !state.unmounted);\n if (isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled) {\n noClass = true;\n }\n }\n }\n const result = {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle: false,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo: platformPseudoPossible,\n finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {\n const platformPseudo = platformPseudoPossible && hasPlatformPseudo;\n const nextWillBeAnimatedClient = Boolean(\n (hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated\n );\n const nextWillBeAnimated = !isServer && nextWillBeAnimatedClient;\n if (nextWillBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n if (!curStateRef.didFinalizeInitialStyleFrame) {\n curStateRef.didFinalizeInitialStyleFrame = true;\n const shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);\n const unmounted = shouldEnter ? hasEnterStyle || isEntering ? \"should-enter\" : true : false;\n state.unmounted = unmounted;\n curStateRef.initialStyleFrameUnmounted = unmounted || void 0;\n }\n result.hasEnterStyle = hasEnterStyle;\n result.platformPseudo = platformPseudo;\n result.willBeAnimatedClient = nextWillBeAnimatedClient;\n result.willBeAnimated = nextWillBeAnimated;\n result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated ? false : nextWillBeAnimated;\n if (nextWillBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n }\n return result;\n }\n };\n return result;\n};\nfunction hasAnimatedStyleValue(style) {\n for (const k in style) {\n const val = style[k];\n if (val && typeof val === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nconst isDisabled = (props) => {\n return props.disabled || props.passThrough || props.accessibilityState?.disabled || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\nexport {\n useComponentState\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;;;;;;;;AAQA,MAAM,qBAAqB,OAAO,iBAAiB,cAAc,WAAW;CAC1E;CACA,MAAM,aAAa,gBAAgB;CACnC,MAAM,iBAAiB,CAAC,gBAAgB;CACxC,MAAM,gBAAgB,iBAAiB,SAAS,KAAK,IAAI,iBAAiB;CAC1E,MAAM,EAAE,UAAU;CAClB,MAAM,WAAW,OACf,KAAK,CACP;CACA,MAAM,cAAc,SAAS,YAAY;EACvC,mBAAmB,kBAAkB,CAAC;EACtC,wBAAwB,0BAA0B;CACpD;CACA,MAAM,mBAAmB,QACvB,CAAC,SAAS,gBAAgB,SAAS,MAAM,SAAS,sBAAsB,MAAM,KAAK,CACrF;CACA,MAAM,aAAa,iBAAiB,cAAc;CAClD,MAAM,cAAc,iBAAiB,eAAe;CACpD,IAAI,CAAC,kBAAkB,kBAAkB;EACvC,YAAY,cAAc;CAC5B;CACA,MAAM,yBAAyB,QAC7B,CAAC,SAAS,iBAAiB,iBAAiB,kBAAkB,kBAAkB,CAAC,EAAE,MACrF;CACA,MAAM,uBAAuB,SAC1B,oBAAoB,2BAA2B,CAAC,SAAS,iBAAiB,YAAY,WACzF;CACA,MAAM,iBAAiB,CAAC,YAAY;CACpC,IAAI,kBAAk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AAmB,CAAC,SAAS,iBAAiB,YAAY,WACjF;GACA,MAAM,qBAAqB,CAAC,YAAY;GACxC,IAAI,sBAAsB,CAAC,YAAY,aAAa;IAClD,YAAY,cAAc;GAC5B;GACA,IAAI,CAAC,YAAY,8BAA8B;IAC7C,YAAY,+BAA+B;IAC3C,MAAM,cAAc,CAAC,UAAU,iBAAiB,cAAc,gCAAgC;IAC9F,MAAM,YAAY,cAAc,iBAAiB,aAAa,iBAAiB,OAAO;IACtF,MAAM,YAAY;IAClB,YAAY,6BAA6B,aAAa,KAAK;GAC7D;GACA,OAAO,gBAAgB;GACvB,OAAO,iBAAiB;GACxB,OAAO,uBAAuB;GAC9B,OAAO,iBAAiB;GACxB,OAAO,aAAa,SAAS,gCAAgC,CAAC,SAAS,CAAC,aAAa,QAAQ;GAC7F,IAAI,sBAAsB,CAAC,SAAS,MAAM,uBAAuB,OAAO;IACtE,YAAY,yBAAyB;GACvC;GACA,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,SAAS,sBAAsB,OAAO;CACpC,KAAK,MAAM,KAAK,OAAO;EACrB,MAAM,MAAM,MAAM;EAClB,IAAI,OAAO,OAAO,QAAQ,YAAY,gBAAgB,KAAK;GACzD,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,MAAM,cAAc,UAAU;CAC5B,OAAO,MAAM,YAAY,MAAM,eAAe,MAAM,oBAAoB,YAAY,MAAM,oBAAoB,MAAM,yBAAyB;AAC/I"}
@@ -3,11 +3,9 @@ import { mergeIfNotShallowEqual } from "@tamagui/is-equal-shallow";
3
3
  import { useDidFinishSSR, useIsClientOnly } from "@tamagui/use-did-finish-ssr";
4
4
  import { useRef, useState } from "react";
5
5
  import { getSetting } from "../config.native.js";
6
- import { formatDiagnostic } from "../helpers/formatDiagnostic.native.js";
7
6
  import { isOptimizedForFirstRender } from "./isOptimizedForFirstRender.native.js";
8
7
  import { defaultComponentStateMounted } from "../defaultComponentState.native.js";
9
8
  import { isObj } from "../helpers/isObj.native.js";
10
- import { log } from "../helpers/log.native.js";
11
9
 
12
10
  function _type_of(obj) {
13
11
  "@swc/helpers - typeof";
@@ -16,57 +14,54 @@ function _type_of(obj) {
16
14
  var useComponentState = function(props, animationDriver, staticConfig, config) {
17
15
  "use no memo";
18
16
  var _getPlatformDriver, _animationDriver_usePresence;
17
+ var _stateRef, _curStateRef, _curStateRef1;
19
18
  var isHydrated = useDidFinishSSR();
20
19
  var needsHydration = !useIsClientOnly();
21
20
  var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
22
21
  var { isHOC } = staticConfig;
23
22
  var stateRef = useRef(void 0);
24
- if (!stateRef.current) {
25
- stateRef.current = {
26
- startedUnhydrated: needsHydration && !isHydrated,
27
- optimizeForFirstRender: isOptimizedForFirstRender()
28
- };
29
- }
23
+ var curStateRef = (_stateRef = stateRef).current || (_stateRef.current = {
24
+ startedUnhydrated: needsHydration && !isHydrated,
25
+ optimizeForFirstRender: isOptimizedForFirstRender()
26
+ });
30
27
  var hasAnimationProp = Boolean(!isHOC && "transition" in props || props.style && hasAnimatedStyleValue(props.style));
31
28
  var _animationDriver_inputStyle;
32
29
  var inputStyle = (_animationDriver_inputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.inputStyle) !== null && _animationDriver_inputStyle !== void 0 ? _animationDriver_inputStyle : "css";
33
30
  var _animationDriver_outputStyle;
34
31
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
35
- var curStateRef = stateRef.current;
36
32
  if (!needsHydration && hasAnimationProp) {
37
33
  curStateRef.hasAnimated = true;
38
34
  }
39
35
  var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));
40
- var willBeAnimatedClient = (function() {
41
- var next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);
42
- return Boolean(next || curStateRef.hasAnimated);
43
- })();
36
+ var willBeAnimatedClient = Boolean((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations || curStateRef.hasAnimated);
44
37
  var willBeAnimated = !isServer && willBeAnimatedClient;
45
38
  if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
46
39
  curStateRef.hasAnimated = true;
47
40
  }
48
41
  var { disableClassName } = props;
49
- if (willBeAnimated && !isHOC && props["animatePresence"] !== false) {
42
+ var animatePresenceOptIn = willBeAnimated && !isHOC && props["animatePresence"] !== false;
43
+ if (animatePresenceOptIn) {
50
44
  curStateRef.shouldRegisterPresence = true;
51
45
  } else {
52
- var _curStateRef;
46
+ var _curStateRef2;
53
47
  var _shouldRegisterPresence;
54
- (_shouldRegisterPresence = (_curStateRef = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef.shouldRegisterPresence = false;
48
+ (_shouldRegisterPresence = (_curStateRef2 = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef2.shouldRegisterPresence = false;
55
49
  }
56
50
  var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;
57
- var presence = !isHOC && willBeAnimated && props["animatePresence"] !== false ? presenceResult : null;
51
+ var presence = animatePresenceOptIn ? presenceResult : null;
58
52
  var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
59
53
  var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
60
54
  var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
61
55
  var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== "css";
62
- var initialState = { ...defaultComponentStateMounted };
63
56
  var disabled = isDisabled(props);
64
- if (disabled != null) {
65
- initialState.disabled = disabled;
66
- }
67
- var states = useState(initialState);
57
+ var [componentState, reactSetState] = useState(function() {
58
+ return disabled != null ? {
59
+ ...defaultComponentStateMounted,
60
+ disabled
61
+ } : defaultComponentStateMounted;
62
+ });
68
63
  var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;
69
- var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...states[0] } : states[0];
64
+ var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...componentState } : componentState;
70
65
  if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
71
66
  state.unmounted = true;
72
67
  }
@@ -74,26 +69,22 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
74
69
  state.unmounted = initialStyleFrameUnmounted;
75
70
  }
76
71
  if (props.forceStyle) {
77
- if (state === states[0]) state = { ...state };
72
+ if (state === componentState) state = { ...state };
78
73
  state[props.forceStyle] = true;
79
74
  }
80
- if (!curStateRef.setState) {
81
- var reactSetState = states[1];
82
- curStateRef.setState = function(stateOrGetState) {
83
- var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
84
- curStateRef.initialStyleFrameUnmounted = void 0;
85
- reactSetState(function(previous) {
86
- var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
87
- ...previous,
88
- unmounted: pendingUnmounted
89
- } : previous;
90
- return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
91
- });
92
- };
93
- }
94
- var setState = curStateRef.setState;
75
+ var setState = (_curStateRef = curStateRef).setState || (_curStateRef.setState = function(stateOrGetState) {
76
+ var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
77
+ curStateRef.initialStyleFrameUnmounted = void 0;
78
+ reactSetState(function(previous) {
79
+ var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
80
+ ...previous,
81
+ unmounted: pendingUnmounted
82
+ } : previous;
83
+ return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
84
+ });
85
+ });
95
86
  var isAnimated = willBeAnimated;
96
- if (isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {
87
+ if (isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated) {
97
88
  isAnimated = false;
98
89
  curStateRef.willHydrate = true;
99
90
  }
@@ -107,37 +98,14 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
107
98
  });
108
99
  }
109
100
  var groupName = props.group;
110
- if (!stateRef.current.baseSetStateShallow) {
111
- var r = stateRef.current;
112
- r.baseSetStateShallow = function(stateOrGetState) {
113
- setState(function(prev) {
114
- var next = typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState;
115
- var update = mergeIfNotShallowEqual(prev, next);
116
- if (process.env.NODE_ENV === "development") {
117
- var dbg = r.__debug;
118
- if (dbg && update !== prev) {
119
- console.groupCollapsed(`setStateShallow CHANGE`, "=>", update);
120
- console.info(`previously`, prev);
121
- console.trace();
122
- console.groupEnd();
123
- }
124
- }
125
- return update;
126
- });
127
- };
128
- }
129
- if (process.env.NODE_ENV === "development") {
130
- ;
131
- stateRef.current.__debug = props.debug;
132
- }
133
- var setStateShallow = stateRef.current.baseSetStateShallow;
134
- if (process.env.NODE_ENV === "development" && globalThis.time) globalThis.time`state-useCreateShallowSetState`;
101
+ var setStateShallow = (_curStateRef1 = curStateRef).baseSetStateShallow || (_curStateRef1.baseSetStateShallow = function(stateOrGetState) {
102
+ setState(function(prev) {
103
+ var next = typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState;
104
+ return mergeIfNotShallowEqual(prev, next);
105
+ });
106
+ });
135
107
  var outProps = props;
136
108
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
137
- if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
138
- var _staticConfig_Component, _staticConfig_Component1;
139
- console.warn(formatDiagnostic("TAMAGUI_PRESENCE_STATE", ((_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : _staticConfig_Component.displayName) || ((_staticConfig_Component1 = staticConfig.Component) === null || _staticConfig_Component1 === void 0 ? void 0 : _staticConfig_Component1.name) || "TamaguiComponent", "AnimatePresence supplied lifecycle state to an animated component", "Remove debug=\"verbose\" after inspecting the animation state", "presenceState", presenceState));
140
- }
141
109
  var { custom } = presenceState;
142
110
  if (isObj(custom)) {
143
111
  outProps = {
@@ -146,23 +114,16 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
146
114
  };
147
115
  }
148
116
  }
149
- var noClass = !isWeb || !!props.forceStyle;
150
- if (!isHydrated) {
151
- noClass = false;
152
- } else {
153
- if (isWeb && isHydrated) {
154
- var isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;
117
+ var noClass = !isWeb || Boolean(props.forceStyle);
118
+ if (isWeb) {
119
+ if (!isHydrated) {
120
+ noClass = false;
121
+ } else {
122
+ var isAnimatedAndHydrated = Boolean((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC);
155
123
  var isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting("disableSSR") || !state.unmounted);
156
- var isDisabledManually = disableClassName && !state.unmounted;
124
+ var isDisabledManually = Boolean(disableClassName && !state.unmounted);
157
125
  if (isAnimatedAndHydrated && outputStyle !== "css" || isDisabledManually || isClassNameDisabled) {
158
126
  noClass = true;
159
- if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
160
- log(`avoiding className`, {
161
- isAnimatedAndHydrated,
162
- isDisabledManually,
163
- isClassNameDisabled
164
- });
165
- }
166
127
  }
167
128
  }
168
129
  }
@@ -207,7 +168,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
207
168
  result.platformPseudo = platformPseudo;
208
169
  result.willBeAnimatedClient = nextWillBeAnimatedClient;
209
170
  result.willBeAnimated = nextWillBeAnimated;
210
- result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;
171
+ result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated ? false : nextWillBeAnimated;
211
172
  if (nextWillBeAnimated && !isHOC && props["animatePresence"] !== false) {
212
173
  curStateRef.shouldRegisterPresence = true;
213
174
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentState.native.js","names":[],"sources":["esm/hooks/useComponentState.native.js"],"sourcesContent":["import { getPlatformDriver, isServer, isWeb } from \"@tamagui/constants\";\nimport { mergeIfNotShallowEqual } from \"@tamagui/is-equal-shallow\";\nimport { useDidFinishSSR, useIsClientOnly } from \"@tamagui/use-did-finish-ssr\";\nimport { useRef, useState } from \"react\";\nimport { getSetting } from \"../config\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { isOptimizedForFirstRender } from \"./isOptimizedForFirstRender\";\nimport { defaultComponentStateMounted } from \"../defaultComponentState\";\nimport { isObj } from \"../helpers/isObj\";\nimport { log } from \"../helpers/log\";\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar useComponentState = function(props, animationDriver, staticConfig, config) {\n \"use no memo\";\n var _getPlatformDriver, _animationDriver_usePresence;\n var isHydrated = useDidFinishSSR();\n var needsHydration = !useIsClientOnly();\n var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;\n var { isHOC } = staticConfig;\n var stateRef = useRef(\n // performance: avoid creating object every render\n void 0\n );\n if (!stateRef.current) {\n stateRef.current = {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: isOptimizedForFirstRender()\n };\n }\n var hasAnimationProp = Boolean(!isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style));\n var _animationDriver_inputStyle;\n var inputStyle = (_animationDriver_inputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.inputStyle) !== null && _animationDriver_inputStyle !== void 0 ? _animationDriver_inputStyle : \"css\";\n var _animationDriver_outputStyle;\n var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : \"css\";\n var curStateRef = stateRef.current;\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));\n var willBeAnimatedClient = (function() {\n var next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);\n return Boolean(next || curStateRef.hasAnimated);\n })();\n var willBeAnimated = !isServer && willBeAnimatedClient;\n if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n var { disableClassName } = props;\n if (willBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n } else {\n var _curStateRef;\n var _shouldRegisterPresence;\n (_shouldRegisterPresence = (_curStateRef = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef.shouldRegisterPresence = false;\n }\n var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;\n var presence = !isHOC && willBeAnimated && props[\"animatePresence\"] !== false ? presenceResult : null;\n var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];\n var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;\n var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;\n var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== \"css\";\n var initialState = {\n ...defaultComponentStateMounted\n };\n var disabled = isDisabled(props);\n if (disabled != null) {\n initialState.disabled = disabled;\n }\n var states = useState(initialState);\n var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;\n var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? {\n ...states[0]\n } : states[0];\n if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {\n state.unmounted = true;\n }\n if (initialStyleFrameUnmounted !== void 0) {\n state.unmounted = initialStyleFrameUnmounted;\n }\n if (props.forceStyle) {\n if (state === states[0]) state = {\n ...state\n };\n state[props.forceStyle] = true;\n }\n if (!curStateRef.setState) {\n var reactSetState = states[1];\n curStateRef.setState = function(stateOrGetState) {\n var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;\n curStateRef.initialStyleFrameUnmounted = void 0;\n reactSetState(function(previous) {\n var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {\n ...previous,\n unmounted: pendingUnmounted\n } : previous;\n return typeof stateOrGetState === \"function\" ? stateOrGetState(current) : stateOrGetState;\n });\n };\n }\n var setState = curStateRef.setState;\n var isAnimated = willBeAnimated;\n if (isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState(function(_) {\n return {\n ...state\n };\n });\n }\n var groupName = props.group;\n if (!stateRef.current.baseSetStateShallow) {\n var r = stateRef.current;\n r.baseSetStateShallow = function(stateOrGetState) {\n setState(function(prev) {\n var next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n var update = mergeIfNotShallowEqual(prev, next);\n if (process.env.NODE_ENV === \"development\") {\n var dbg = r.__debug;\n if (dbg && update !== prev) {\n console.groupCollapsed(`setStateShallow CHANGE`, \"=>\", update);\n console.info(`previously`, prev);\n console.trace();\n console.groupEnd();\n }\n }\n return update;\n });\n };\n }\n if (process.env.NODE_ENV === \"development\") {\n ;\n stateRef.current.__debug = props.debug;\n }\n var setStateShallow = stateRef.current.baseSetStateShallow;\n if (process.env.NODE_ENV === \"development\" && globalThis.time) globalThis.time`state-useCreateShallowSetState`;\n var outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n var _staticConfig_Component, _staticConfig_Component1;\n console.warn(formatDiagnostic(\"TAMAGUI_PRESENCE_STATE\", ((_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : _staticConfig_Component.displayName) || ((_staticConfig_Component1 = staticConfig.Component) === null || _staticConfig_Component1 === void 0 ? void 0 : _staticConfig_Component1.name) || \"TamaguiComponent\", \"AnimatePresence supplied lifecycle state to an animated component\", 'Remove debug=\"verbose\" after inspecting the animation state', \"presenceState\", presenceState));\n }\n var { custom } = presenceState;\n if (isObj(custom)) {\n outProps = {\n ...props,\n ...custom\n };\n }\n }\n var noClass = !isWeb || !!props.forceStyle;\n if (!isHydrated) {\n noClass = false;\n } else {\n if (isWeb && isHydrated) {\n var isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;\n var isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting(\"disableSSR\") || !state.unmounted);\n var isDisabledManually = disableClassName && !state.unmounted;\n if (\n // Only disable className for animation drivers that output inline styles (not css)\n isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled\n ) {\n noClass = true;\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n log(`avoiding className`, {\n isAnimatedAndHydrated,\n isDisabledManually,\n isClassNameDisabled\n });\n }\n }\n }\n }\n var result = {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle: false,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo: platformPseudoPossible,\n finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {\n var platformPseudo = platformPseudoPossible && hasPlatformPseudo;\n var nextWillBeAnimatedClient = Boolean((hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated);\n var nextWillBeAnimated = !isServer && nextWillBeAnimatedClient;\n if (nextWillBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n if (!curStateRef.didFinalizeInitialStyleFrame) {\n curStateRef.didFinalizeInitialStyleFrame = true;\n var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);\n var unmounted = shouldEnter ? hasEnterStyle || isEntering ? \"should-enter\" : true : false;\n state.unmounted = unmounted;\n curStateRef.initialStyleFrameUnmounted = unmounted || void 0;\n }\n result.hasEnterStyle = hasEnterStyle;\n result.platformPseudo = platformPseudo;\n result.willBeAnimatedClient = nextWillBeAnimatedClient;\n result.willBeAnimated = nextWillBeAnimated;\n result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;\n if (nextWillBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n }\n return result;\n }\n };\n return result;\n};\nfunction hasAnimatedStyleValue(style) {\n for (var k in style) {\n var val = style[k];\n if (val && (typeof val === \"undefined\" ? \"undefined\" : _type_of(val)) === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nvar isDisabled = function(props) {\n var _props_accessibilityState;\n return props.disabled || props.passThrough || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\nexport {\n useComponentState\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,SAAS,SAAS,KAAK;CACrB;CACA,OAAO,OAAO,OAAO,WAAW,eAAe,IAAI,gBAAgB,SAAS,WAAW,OAAO;AAChG;AACA,IAAI,oBAAoB,SAAS,OAAO,iBAAiB,cAAc,QAAQ;CAC7E;CACA,IAAI,oBAAoB;CACxB,IAAI,aAAa,gBAAgB;CACjC,IAAI,iBAAiB,CAAC,gBAAgB;CACtC,IAAI,iBAAiB,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,UAAU,KAAK,IAAI,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB;CAC5M,IAAI,EAAE,UAAU;CAChB,IAAI,WAAW,OAEb,KAAK,CACP;CACA,IAAI,CAAC,SAAS,SAAS;EACrB,SAAS,UAAU;GACjB,mBAAmB,kBAAkB,CAAC;GACtC,wBAAwB,0BAA0B;EACpD;CACF;CACA,IAAI,mBAAmB,QAAQ,CAAC,SAAS,gBAAgB,SAAS,MAAM,SAAS,sBAAsB,MAAM,KAAK,CAAC;CACnH,IAAI;CACJ,IAAI,cAAc,8BAA8B,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,gBAAgB,QAAQ,gCAAgC,KAAK,IAAI,8BAA8B;CACjO,IAAI;CACJ,IAAI,eAAe,+BAA+B,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,iBAAiB,QAAQ,iCAAiC,KAAK,IAAI,+BAA+B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;GACA,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,SAAS,sBAAsB,OAAO;CACpC,KAAK,IAAI,KAAK,OAAO;EACnB,IAAI,MAAM,MAAM;EAChB,IAAI,QAAQ,OAAO,QAAQ,cAAc,cAAc,SAAS,GAAG,OAAO,YAAY,gBAAgB,KAAK;GACzG,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,IAAI,aAAa,SAAS,OAAO;CAC/B,IAAI;CACJ,OAAO,MAAM,YAAY,MAAM,iBAAiB,4BAA4B,MAAM,wBAAwB,QAAQ,8BAA8B,KAAK,IAAI,KAAK,IAAI,0BAA0B,aAAa,MAAM,oBAAoB,MAAM,yBAAyB;AACpQ"}
1
+ {"version":3,"file":"useComponentState.native.js","names":[],"sources":["esm/hooks/useComponentState.native.js"],"sourcesContent":["import { getPlatformDriver, isServer, isWeb } from \"@tamagui/constants\";\nimport { mergeIfNotShallowEqual } from \"@tamagui/is-equal-shallow\";\nimport { useDidFinishSSR, useIsClientOnly } from \"@tamagui/use-did-finish-ssr\";\nimport { useRef, useState } from \"react\";\nimport { getSetting } from \"../config\";\nimport { isOptimizedForFirstRender } from \"./isOptimizedForFirstRender\";\nimport { defaultComponentStateMounted } from \"../defaultComponentState\";\nimport { isObj } from \"../helpers/isObj\";\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar useComponentState = function(props, animationDriver, staticConfig, config) {\n \"use no memo\";\n var _getPlatformDriver, _animationDriver_usePresence;\n var _stateRef, _curStateRef, _curStateRef1;\n var isHydrated = useDidFinishSSR();\n var needsHydration = !useIsClientOnly();\n var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;\n var { isHOC } = staticConfig;\n var stateRef = useRef(void 0);\n var curStateRef = (_stateRef = stateRef).current || (_stateRef.current = {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: isOptimizedForFirstRender()\n });\n var hasAnimationProp = Boolean(!isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style));\n var _animationDriver_inputStyle;\n var inputStyle = (_animationDriver_inputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.inputStyle) !== null && _animationDriver_inputStyle !== void 0 ? _animationDriver_inputStyle : \"css\";\n var _animationDriver_outputStyle;\n var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : \"css\";\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));\n var willBeAnimatedClient = Boolean((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations || curStateRef.hasAnimated);\n var willBeAnimated = !isServer && willBeAnimatedClient;\n if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n var { disableClassName } = props;\n var animatePresenceOptIn = willBeAnimated && !isHOC && props[\"animatePresence\"] !== false;\n if (animatePresenceOptIn) {\n curStateRef.shouldRegisterPresence = true;\n } else {\n var _curStateRef2;\n var _shouldRegisterPresence;\n (_shouldRegisterPresence = (_curStateRef2 = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef2.shouldRegisterPresence = false;\n }\n var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;\n var presence = animatePresenceOptIn ? presenceResult : null;\n var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];\n var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;\n var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;\n var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== \"css\";\n var disabled = isDisabled(props);\n var [componentState, reactSetState] = useState(function() {\n return disabled != null ? {\n ...defaultComponentStateMounted,\n disabled\n } : defaultComponentStateMounted;\n });\n var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;\n var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? {\n ...componentState\n } : componentState;\n if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {\n state.unmounted = true;\n }\n if (initialStyleFrameUnmounted !== void 0) {\n state.unmounted = initialStyleFrameUnmounted;\n }\n if (props.forceStyle) {\n if (state === componentState) state = {\n ...state\n };\n state[props.forceStyle] = true;\n }\n var setState = (_curStateRef = curStateRef).setState || (_curStateRef.setState = function(stateOrGetState) {\n var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;\n curStateRef.initialStyleFrameUnmounted = void 0;\n reactSetState(function(previous) {\n var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {\n ...previous,\n unmounted: pendingUnmounted\n } : previous;\n return typeof stateOrGetState === \"function\" ? stateOrGetState(current) : stateOrGetState;\n });\n });\n var isAnimated = willBeAnimated;\n if (isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState(function(_) {\n return {\n ...state\n };\n });\n }\n var groupName = props.group;\n var setStateShallow = (_curStateRef1 = curStateRef).baseSetStateShallow || (_curStateRef1.baseSetStateShallow = function(stateOrGetState) {\n setState(function(prev) {\n var next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n return mergeIfNotShallowEqual(prev, next);\n });\n });\n var outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n var { custom } = presenceState;\n if (isObj(custom)) {\n outProps = {\n ...props,\n ...custom\n };\n }\n }\n var noClass = !isWeb || Boolean(props.forceStyle);\n if (isWeb) {\n if (!isHydrated) {\n noClass = false;\n } else {\n var isAnimatedAndHydrated = Boolean((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC);\n var isClassNameDisabled = !staticConfig.acceptsClassName && (getSetting(\"disableSSR\") || !state.unmounted);\n var isDisabledManually = Boolean(disableClassName && !state.unmounted);\n if (isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled) {\n noClass = true;\n }\n }\n }\n var result = {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle: false,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo: platformPseudoPossible,\n finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {\n var platformPseudo = platformPseudoPossible && hasPlatformPseudo;\n var nextWillBeAnimatedClient = Boolean((hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated);\n var nextWillBeAnimated = !isServer && nextWillBeAnimatedClient;\n if (nextWillBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n if (!curStateRef.didFinalizeInitialStyleFrame) {\n curStateRef.didFinalizeInitialStyleFrame = true;\n var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);\n var unmounted = shouldEnter ? hasEnterStyle || isEntering ? \"should-enter\" : true : false;\n state.unmounted = unmounted;\n curStateRef.initialStyleFrameUnmounted = unmounted || void 0;\n }\n result.hasEnterStyle = hasEnterStyle;\n result.platformPseudo = platformPseudo;\n result.willBeAnimatedClient = nextWillBeAnimatedClient;\n result.willBeAnimated = nextWillBeAnimated;\n result.isAnimated = isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated ? false : nextWillBeAnimated;\n if (nextWillBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n }\n return result;\n }\n };\n return result;\n};\nfunction hasAnimatedStyleValue(style) {\n for (var k in style) {\n var val = style[k];\n if (val && (typeof val === \"undefined\" ? \"undefined\" : _type_of(val)) === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nvar isDisabled = function(props) {\n var _props_accessibilityState;\n return props.disabled || props.passThrough || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\nexport {\n useComponentState\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;;;;;;;;AAQA,SAAS,SAAS,KAAK;CACrB;CACA,OAAO,OAAO,OAAO,WAAW,eAAe,IAAI,gBAAgB,SAAS,WAAW,OAAO;AAChG;AACA,IAAI,oBAAoB,SAAS,OAAO,iBAAiB,cAAc,QAAQ;CAC7E;CACA,IAAI,oBAAoB;CACxB,IAAI,WAAW,cAAc;CAC7B,IAAI,aAAa,gBAAgB;CACjC,IAAI,iBAAiB,CAAC,gBAAgB;CACtC,IAAI,iBAAiB,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,UAAU,KAAK,IAAI,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB;CAC5M,IAAI,EAAE,UAAU;CAChB,IAAI,WAAW,OAAO,KAAK,CAAC;CAC5B,IAAI,eAAe,YAAY,SAAQ,CAAE,YAAY,UAAU,UAAU;EACvE,mBAAmB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2BAA2B,SAAS,oBAAoB,mBAAmB,CAAC,SAAS,iBAAiB,YAAY,WAAW;GACjI,IAAI,qBAAqB,CAAC,YAAY;GACtC,IAAI,sBAAsB,CAAC,YAAY,aAAa;IAClD,YAAY,cAAc;GAC5B;GACA,IAAI,CAAC,YAAY,8BAA8B;IAC7C,YAAY,+BAA+B;IAC3C,IAAI,cAAc,CAAC,UAAU,iBAAiB,cAAc,gCAAgC;IAC5F,IAAI,YAAY,cAAc,iBAAiB,aAAa,iBAAiB,OAAO;IACpF,MAAM,YAAY;IAClB,YAAY,6BAA6B,aAAa,KAAK;GAC7D;GACA,OAAO,gBAAgB;GACvB,OAAO,iBAAiB;GACxB,OAAO,uBAAuB;GAC9B,OAAO,iBAAiB;GACxB,OAAO,aAAa,SAAS,gCAAgC,CAAC,SAAS,CAAC,aAAa,QAAQ;GAC7F,IAAI,sBAAsB,CAAC,SAAS,MAAM,uBAAuB,OAAO;IACtE,YAAY,yBAAyB;GACvC;GACA,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,SAAS,sBAAsB,OAAO;CACpC,KAAK,IAAI,KAAK,OAAO;EACnB,IAAI,MAAM,MAAM;EAChB,IAAI,QAAQ,OAAO,QAAQ,cAAc,cAAc,SAAS,GAAG,OAAO,YAAY,gBAAgB,KAAK;GACzG,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,IAAI,aAAa,SAAS,OAAO;CAC/B,IAAI;CACJ,OAAO,MAAM,YAAY,MAAM,iBAAiB,4BAA4B,MAAM,wBAAwB,QAAQ,8BAA8B,KAAK,IAAI,KAAK,IAAI,0BAA0B,aAAa,MAAM,oBAAoB,MAAM,yBAAyB;AACpQ"}
@@ -50,11 +50,11 @@ function setupMediaListeners() {
50
50
  const getMatch = () => matchMedia(str);
51
51
  const match = getMatch();
52
52
  if (!match) {
53
- throw new Error(formatDiagnostic("TAMAGUI_MEDIA_MATCH", "useMedia", "matchMedia returned no MediaQueryList", "Provide a matchMedia implementation that returns a MediaQueryList", "key,query,platform", {
53
+ throw new Error(process.env.NODE_ENV !== "production" ? formatDiagnostic("TAMAGUI_MEDIA_MATCH", "useMedia", "matchMedia returned no MediaQueryList", "Provide a matchMedia implementation that returns a MediaQueryList", "key,query,platform", {
54
54
  key,
55
55
  query: str,
56
56
  platform: isWeb ? "web" : "native"
57
- }));
57
+ }) : "❌ Error 013");
58
58
  }
59
59
  match.addListener(update);
60
60
  dispose.add(() => {