@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,329 +1,226 @@
1
- import { isClient, platformMatches } from "@tamagui/constants";
2
- import { nonAnimatableStyleProps, propToTokenCategoryCode, stylePropsAll, stylePropsText, stylePropsTransform, validStyles } from "@tamagui/helpers";
3
- import { addTransformValue, canonicalStateModifierNames, createTransformAccumulator, finalizeTransformAccumulator, getTransformPartKeys, isContainerSizeQueryText, isModifierName, modifierKindMedia, modifierKindPlatform, modifierKindState, modifierKindTheme, removeTransformValue, scanFlatValue, stateModifierSelectors } from "@tamagui/style-grammar/runtime";
4
- import { getConfig } from "../config.mjs";
1
+ import { isClient } from "@tamagui/constants";
2
+ import { nonAnimatableStyleProps, stylePropsAll, stylePropsInput, stylePropsText, stylePropsTransform, validStyles } from "@tamagui/helpers";
3
+ import { addTransformValue, createTransformAccumulator, finalizeTransformAccumulator, getTransformPartKeys, removeTransformValue } from "@tamagui/style-grammar/runtime";
4
+ import { getConfig, getConfigMaybe } from "../config.mjs";
5
5
  import { isDevTools } from "../constants/isDevTools.mjs";
6
+ import { defaultComponentStateMounted } from "../defaultComponentState.mjs";
6
7
  import { isVariable } from "../createVariable.mjs";
7
- import { addComposition, canGenerateCSS, clearFrameAtomic, completeStreamingCSS, directStyleSignature, flushDirectStyles, flushDirectStyles as flushDirectStyles2, requestBorderStyleDefault, streamAtomic } from "./directStyleCSS.mjs";
8
- import { expandStyle } from "./expandStyle.mjs";
9
- import { fixStyles } from "./expandStyles.mjs";
8
+ import { stylePieceSymbol } from "../types.mjs";
9
+ import { addComposition, canGenerateCSS, flushDirectStyles, registerAtomicSlot } from "./getCSSStylesAtomic.mjs";
10
+ import { splitComponents, startsValueFunction } from "./borderComponents.mjs";
10
11
  import { getConfigRevisionState } from "./grammarConfig.mjs";
11
12
  import { mediaKeyMatch, mediaState } from "./mediaState.mjs";
12
13
  import { getStyleStaticConfig } from "./styleStaticConfig.mjs";
13
- import { styleToCSS } from "./styleToCSS.mjs";
14
- import { getVariantDefinition } from "./variantResolvers.mjs";
15
14
  import { warnOnce, warnRefusedValue } from "./warnOnce.mjs";
16
- import { getVariantExtras } from "./getVariantExtras.mjs";
17
- import { isObj } from "./isObj.mjs";
15
+ import { getDynamicEnv } from "./styledDynamic.mjs";
16
+ import { getRulesForIdentifier, insertStyleRules, shouldInsertStyleRules } from "./insertStyleRule.mjs";
18
17
  import { log } from "./log.mjs";
19
18
  import { normalizeColor } from "./normalizeColor.mjs";
20
- import { normalizeStyle } from "./normalizeStyle.mjs";
21
19
  import { normalizeValueWithProperty } from "./normalizeValueWithProperty.mjs";
22
- import { isRemValue, resolveRem } from "./resolveRem.mjs";
23
- import { expandSafeAreaValue, isSafeAreaKey } from "./resolveSafeArea.mjs";
24
- import { resolveSafeAreaVariable } from "./resolveSafeAreaVariable.mjs";
25
20
  import { resolveVariableValue } from "./resolveVariableValue.mjs";
26
21
  import { HOC_CLASSNAME_MARKER, skipProps } from "./skipProps.mjs";
27
22
  import { styleOriginalValues } from "./styleOriginalValues.mjs";
28
23
  import { STYLE_TOKEN_PROVENANCE_KEY, getStyleTokenProvenance, setStyleTokenProvenance } from "./styleProvenance.mjs";
29
24
  import { THEME_REF_PREFIX } from "./themeRef.mjs";
30
- import { getTokenCategoryForProperty } from "./tokenCategories.mjs";
31
25
  import { transformsToString } from "./transformsToString.mjs";
26
+ import { isStylePiece, isStylePieceCacheable, setStylePieceCompiler, setStylePieceResolver } from "../style.mjs";
32
27
 
33
28
  export * from "./tokenCategories.mjs"
34
29
 
35
- const TAMAGUI_CLASS_PROPS = "$$tamaguiClassProps";
36
30
  const shouldTrackStyleTokenProvenance = process.env.NODE_ENV === "development" && process.env.TAMAGUI_ENABLE_STYLE_TOKEN_PROVENANCE === "1";
37
- const conditionWidth = 4;
38
- const conditionValueOffset = 0;
39
- const conditionFlagsOffset = 1;
40
- const conditionPrecedenceOffset = 2;
41
- const conditionWrapperOffset = 3;
42
- const conditionActiveFlag = 1;
43
- const conditionEmitFlag = 2;
44
- const conditionResolvedFlag = 4;
45
- const conditionEnterFlag = 8;
46
- const conditionExitFlag = 16;
31
+ const conditionValue = 0;
32
+ const conditionPlatform = 1;
33
+ const conditionKey = 2;
34
+ const conditionSelector = 3;
35
+ const conditionTheme = 4;
36
+ const conditionWrappers = 5;
37
+ const conditionAtoms = 6;
38
+ const conditionRanks = 7;
39
+ const conditionResolvedFlag = 16;
47
40
  const conditionPlatformPseudoFlag = 32;
48
- const conditionInitialFlags = 7;
49
- const conditionTextWidth = 5;
50
- const conditionKeyOffset = 0;
51
- const conditionSelectorOffset = 1;
52
- const conditionThemeOffset = 2;
53
- const conditionUnsupportedStateOffset = 3;
54
- const conditionUnresolvedNameOffset = 4;
55
- let conditionNumbers = /* @__PURE__ */ new Float64Array(2048);
56
- const conditionTexts = [];
57
- const conditionWrappers = [];
58
- let conditionWrapperTop = 0;
59
- let conditionCursorTop = conditionWidth;
60
- function reserveConditionCursor(cursor) {
61
- const required = cursor + conditionWidth;
62
- if (required > conditionTexts.length) {
63
- const previous2 = conditionTexts.length;
64
- conditionTexts.length = required;
65
- conditionTexts.fill("", previous2);
66
- }
67
- if (required <= conditionNumbers.length) return;
68
- let length = conditionNumbers.length * 2;
69
- while (length < required) length *= 2;
70
- const previous = conditionNumbers;
71
- conditionNumbers = new Float64Array(length);
72
- conditionNumbers.set(previous);
73
- }
74
- function setConditionUnresolved(cursor, name = "") {
75
- conditionNumbers[cursor + conditionFlagsOffset] &= -5;
76
- if (name) {
77
- const text = cursor + conditionUnresolvedNameOffset;
78
- conditionTexts[text] ||= name;
79
- }
80
- }
81
- function appendConditionWrapper(cursor, wrapper) {
82
- conditionWrappers[conditionWrapperTop++] = wrapper;
83
- conditionNumbers[cursor + conditionWrapperOffset]++;
84
- }
85
- function copyConditionCursor(target, source) {
86
- for (let offset = 0; offset <= conditionPrecedenceOffset; offset++) conditionNumbers[target + offset] = conditionNumbers[source + offset];
87
- for (let offset = 0; offset < conditionTextWidth; offset++) conditionTexts[target + offset] = conditionTexts[source + offset] || "";
88
- const wrapper = conditionNumbers[source + conditionWrapperOffset];
89
- const wrapperStart = wrapper >> 3;
90
- const wrapperCount = wrapper & 7;
91
- for (let index = 0; index < wrapperCount; index++) conditionWrappers[conditionWrapperTop++] = conditionWrappers[wrapperStart + index];
92
- conditionNumbers[target + conditionWrapperOffset] += wrapperCount;
93
- }
94
- function resetConditionCursor(cursor, parent) {
95
- conditionNumbers[cursor + conditionValueOffset] = 0;
96
- conditionNumbers[cursor + conditionFlagsOffset] = conditionInitialFlags;
97
- conditionNumbers[cursor + conditionPrecedenceOffset] = 0;
98
- conditionNumbers[cursor + conditionWrapperOffset] = conditionWrapperTop << 3;
99
- conditionTexts.fill("", cursor, cursor + conditionTextWidth);
100
- if (parent) copyConditionCursor(cursor, parent);
101
- }
102
- function acquireConditionCursor(parent = 0) {
103
- const cursor = conditionCursorTop;
104
- conditionCursorTop += conditionWidth;
105
- reserveConditionCursor(cursor);
106
- resetConditionCursor(cursor, parent);
107
- return cursor;
41
+ function createCondition(parent) {
42
+ return parent ? [
43
+ parent[conditionValue] & 63,
44
+ parent[conditionPlatform],
45
+ "",
46
+ parent[conditionSelector],
47
+ parent[conditionTheme],
48
+ parent[conditionWrappers].slice(),
49
+ parent[conditionAtoms].slice(),
50
+ parent[conditionRanks].slice()
51
+ ] : [
52
+ 19,
53
+ 0,
54
+ "",
55
+ "",
56
+ "",
57
+ [],
58
+ [],
59
+ []
60
+ ];
108
61
  }
109
- function releaseConditionCursors(watermark) {
110
- if (watermark >= conditionCursorTop) return;
111
- conditionTexts.fill("", watermark, conditionCursorTop);
112
- conditionCursorTop = watermark;
62
+ function setConditionUnresolved(condition, name = "") {
63
+ condition[conditionValue] &= -17;
64
+ if (process.env.NODE_ENV !== "production") condition.problem ||= name;
113
65
  }
114
- function releaseConditionPayloads(wrapperBase) {
115
- conditionWrappers.fill("", wrapperBase, conditionWrapperTop);
116
- conditionWrapperTop = wrapperBase;
66
+ function appendConditionWrapper(condition, wrapper) {
67
+ const wrappers = condition[conditionWrappers];
68
+ if (!wrappers.includes(wrapper)) wrappers.push(wrapper);
117
69
  }
118
- function accumulateConditionAtom(state, cursor, kind, rank, name) {
119
- const keySlot = cursor + conditionKeyOffset;
120
- const key = conditionTexts[keySlot];
121
- if (!key) conditionTexts[keySlot] = name;
122
- else {
123
- let slotStart = 0;
124
- let inserted = false;
125
- while (slotStart <= key.length) {
126
- let slotEnd = key.indexOf(":", slotStart);
127
- if (slotEnd === -1) slotEnd = key.length;
128
- let order = 0;
129
- const compareLength = Math.min(name.length, slotEnd - slotStart);
130
- for (let offset = 0; offset < compareLength; offset++) {
131
- order = name.charCodeAt(offset) - key.charCodeAt(slotStart + offset);
132
- if (order) break;
133
- }
134
- order ||= name.length - (slotEnd - slotStart);
135
- if (!order) return;
136
- if (order < 0) {
137
- conditionTexts[keySlot] = `${key.slice(0, slotStart)}${name}:${key.slice(slotStart)}`;
138
- inserted = true;
139
- break;
140
- }
141
- if (slotEnd === key.length) break;
142
- slotStart = slotEnd + 1;
143
- }
144
- if (!inserted) conditionTexts[keySlot] = `${key}:${name}`;
70
+ function resolveConditionModifier(state, condition, authored) {
71
+ const modifier = getConfigRevisionState(state.conf).resolveCondition(authored);
72
+ if (!modifier) {
73
+ setConditionUnresolved(condition, authored);
74
+ return;
145
75
  }
146
- if (kind === modifierKindPlatform) {
147
- const precedence2 = conditionNumbers[cursor + conditionPrecedenceOffset];
148
- if (rank > precedence2 >>> 26) conditionNumbers[cursor + conditionPrecedenceOffset] = precedence2 & 67108863 | rank << 26;
149
- if (!platformMatches(name)) conditionNumbers[cursor + conditionFlagsOffset] &= -4;
76
+ const [name, kind, rank] = modifier;
77
+ const atoms = condition[conditionAtoms];
78
+ let atomIndex = 0;
79
+ while (atomIndex < atoms.length && atoms[atomIndex] < name) atomIndex++;
80
+ if (atoms[atomIndex] === name) return;
81
+ for (let index = atoms.length; index > atomIndex; index--) atoms[index] = atoms[index - 1];
82
+ atoms[atomIndex] = name;
83
+ if (kind === 3) {
84
+ condition[conditionPlatform] = Math.max(condition[conditionPlatform], rank);
85
+ if (!modifier[6]) condition[conditionValue] &= -4;
150
86
  return;
151
87
  }
152
- let precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
153
- const depth = Math.min((precedence >> 23 & 7) + 1, 7);
154
- const nextCategory = kind === modifierKindMedia ? 0 : kind === 6 ? 1 : kind === modifierKindTheme ? 2 : kind === 5 ? 3 : 4;
155
- let categoryRank = precedence >> 20 & 7;
156
- let withinRank = precedence & 1048575;
157
- if (nextCategory > categoryRank) {
158
- categoryRank = nextCategory;
159
- withinRank = rank;
160
- } else if (nextCategory === categoryRank && rank > withinRank) withinRank = rank;
161
- precedence = precedence & -67108864 | depth << 23 | categoryRank << 20 | withinRank;
162
- conditionNumbers[cursor + conditionPrecedenceOffset] = precedence;
88
+ const precedence = kind === 2 ? 1 + Math.min(rank, 63) : kind === 6 ? 65 + Math.min(rank, 63) : kind === 4 ? 129 : kind === 5 ? 161 + rank : 225 + rank;
89
+ const ranks = condition[conditionRanks];
90
+ let rankIndex = 0;
91
+ while (rankIndex < ranks.length && ranks[rankIndex] >= precedence) rankIndex++;
92
+ for (let index = ranks.length; index > rankIndex; index--) ranks[index] = ranks[index - 1];
93
+ ranks[rankIndex] = precedence;
163
94
  const buildCSS = canGenerateCSS && state.flatShouldDoClasses;
164
- if (kind === modifierKindMedia) {
165
- const query = getConfigRevisionState(state.conf).mediaQueries[name];
166
- if (!query) {
167
- setConditionUnresolved(cursor, name);
168
- return;
169
- }
170
- if (buildCSS) appendConditionWrapper(cursor, `@media ${query}`);
171
- if (!state.flatMediaState?.[name]) conditionNumbers[cursor + conditionFlagsOffset] &= -2;
95
+ if (kind === 2) {
96
+ const query = modifier[3];
97
+ if (!query) return setConditionUnresolved(condition, name);
98
+ if (buildCSS) appendConditionWrapper(condition, `@media ${query}`);
99
+ if (!state.flatMediaState?.[name]) condition[conditionValue] &= -2;
172
100
  (state.flatMediaKeys ||= /* @__PURE__ */ new Set()).add(name);
173
- } else if (kind === modifierKindTheme) {
174
- conditionTexts[cursor + conditionThemeOffset] = name;
175
- if (buildCSS) {
176
- const selector = cursor + conditionSelectorOffset;
177
- conditionTexts[selector] += `:where(.t_${name}, .t_${name} *)`;
178
- }
179
- if (state.flatThemeName !== name && state.flatThemeName?.startsWith(`${name}_`) !== true) conditionNumbers[cursor + conditionFlagsOffset] &= -2;
180
- } else if (kind === 5) {
181
- const slash = name.indexOf("/");
182
- const groupName = slash === -1 ? "true" : name.slice(slash + 1);
183
- const stateSelector = stateModifierSelectors[rank];
184
- const conditionStateName = canonicalStateModifierNames[rank];
101
+ return;
102
+ }
103
+ if (kind === 4) {
104
+ if (buildCSS) condition[conditionSelector] += `:where(.t_${name}, .t_${name} *)`;
105
+ if (state.flatThemeName !== name && state.flatThemeName?.startsWith(`${name}_`) !== true) condition[conditionValue] &= -2;
106
+ return;
107
+ }
108
+ if (kind === 6) {
109
+ const size = modifier[4];
110
+ const containerName = modifier[5];
111
+ const groupName = `@${containerName}`;
185
112
  if (buildCSS) {
186
- const selector = cursor + conditionSelectorOffset;
187
- conditionTexts[selector] += `:where(.t_group_${groupName}${stateSelector} *)`;
188
- if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
113
+ const query = modifier[3];
114
+ appendConditionWrapper(condition, containerName ? `@container ${containerName} ${query}` : `@container ${query}`);
189
115
  }
190
116
  const component = state.componentState.group?.[groupName];
191
117
  const context = state.flatGroupContext?.[groupName];
192
- if (!(component?.pseudo ?? context?.state.pseudo)?.[conditionStateName]) conditionNumbers[cursor + conditionFlagsOffset] &= -2;
118
+ if (process.env.NODE_ENV === "development" && containerName && !component && !context && state.flatGroupContext?.[containerName]) warnOnce(`group-container:${containerName}`, `@${size}/${containerName}: targets group="${containerName}", but groups no longer establish query containers. Add container="${containerName}" to that group.`);
119
+ if (!(component?.media?.[size] ?? (context?.state.layout && mediaKeyMatch(size, context.state.layout)))) condition[conditionValue] &= -2;
193
120
  (state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupName);
194
- } else if (kind === 6) {
195
- const slash = name.indexOf("/");
196
- const containerSize = name.slice(1, slash === -1 ? name.length : slash);
197
- const containerName = slash === -1 ? "" : name.slice(slash + 1);
198
- const containerQuery = getConfigRevisionState(state.conf).mediaQueries[containerSize];
199
- const groupKey = `@${containerName}`;
200
- if (buildCSS) appendConditionWrapper(cursor, containerName ? `@container ${containerName} ${containerQuery}` : `@container ${containerQuery}`);
201
- const component = state.componentState.group?.[groupKey];
202
- const context = state.flatGroupContext?.[groupKey];
203
- if (process.env.NODE_ENV === "development" && containerName && !component && !context && state.flatGroupContext?.[containerName]) warnOnce(`group-container:${containerName}`, `@${containerSize}/${containerName}: targets group="${containerName}", but groups no longer establish query containers. Add container="${containerName}" to that group.`);
204
- const match = component?.media?.[containerSize];
205
- if (!(match === void 0 ? context?.state.layout && mediaKeyMatch(containerSize, context.state.layout) : match)) conditionNumbers[cursor + conditionFlagsOffset] &= -2;
206
- (state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupKey);
207
- (state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(containerSize);
208
- } else {
209
- const stateSelector = stateModifierSelectors[rank];
210
- conditionNumbers[cursor + conditionFlagsOffset] += 64;
211
- if (rank === 6) conditionNumbers[cursor + conditionFlagsOffset] |= conditionEnterFlag;
212
- else if (rank === 7) conditionNumbers[cursor + conditionFlagsOffset] |= conditionExitFlag;
213
- else if (rank === 0 || rank === 2 || rank === 4) conditionNumbers[cursor + conditionFlagsOffset] |= conditionPlatformPseudoFlag;
214
- if (buildCSS) {
215
- const selector = cursor + conditionSelectorOffset;
216
- if (stateSelector[0] === ".") conditionTexts[selector] += `:is(${stateSelector}, ${stateSelector} *)`;
217
- else conditionTexts[selector] += stateSelector;
218
- if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
219
- }
220
- const component = state.componentState;
221
- if (!(rank === 0 ? !!component.hover : rank === 4 ? !!(component.press || component.pressIn) : rank === 2 ? !!component.focus : rank === 3 ? !!component.focusVisible : rank === 1 ? !!component.focusWithin : rank === 5 ? !!(component.disabled || state.props.disabled) : rank === 6 ? !!component.unmounted : rank === 7 ? !!state.styleProps.isExiting : false)) conditionNumbers[cursor + conditionFlagsOffset] &= -2;
222
- if (stateSelector[0] === ":") (state.flatStateKeys ||= /* @__PURE__ */ new Set()).add(name);
223
- }
224
- }
225
- function resolveConditionModifier(state, cursor, modifier) {
226
- const compiled = getConfigRevisionState(state.conf);
227
- let code = compiled.modifiers[modifier];
228
- let kind = code & 7;
229
- let rank = code >> 3;
230
- if (kind === modifierKindState) {
231
- accumulateConditionAtom(state, cursor, kind, rank, canonicalStateModifierNames[rank]);
121
+ (state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(size);
232
122
  return;
233
123
  }
234
- if (!kind && modifier.startsWith("group-")) {
235
- const slash = modifier.indexOf("/");
236
- const authoredState = modifier.slice(6, slash === -1 ? void 0 : slash);
237
- code = compiled.modifiers[authoredState];
238
- if ((code & 7) === modifierKindState) {
239
- rank = code >> 3;
240
- const groupName = slash === -1 ? "true" : modifier.slice(slash + 1);
241
- if (rank !== 6 && rank !== 7 && (slash === -1 || isModifierName(groupName, 0, groupName.length))) {
242
- const stateName = canonicalStateModifierNames[rank];
243
- accumulateConditionAtom(state, cursor, 5, rank, `group-${stateName}${slash === -1 ? "" : modifier.slice(slash)}`);
244
- return;
245
- }
246
- }
247
- } else if (!kind && modifier.charCodeAt(0) === 64) {
248
- const slash = modifier.indexOf("/");
249
- const containerSize = modifier.slice(1, slash === -1 ? void 0 : slash);
250
- const containerName = slash === -1 ? "" : modifier.slice(slash + 1);
251
- let containerQuery = "";
252
- if (isModifierName(containerSize, 0, containerSize.length) && (slash === -1 || isModifierName(containerName, 0, containerName.length)) && ((code = compiled.modifiers[containerSize]) & 7) === modifierKindMedia && (containerQuery = compiled.mediaQueries[containerSize]) && isContainerSizeQueryText(containerQuery)) {
253
- accumulateConditionAtom(state, cursor, 6, code >> 3, modifier);
254
- return;
255
- }
256
- } else if (kind) {
257
- accumulateConditionAtom(state, cursor, kind, rank, modifier);
258
- return;
124
+ const selector = modifier[3];
125
+ if (kind === 5) {
126
+ const groupName = modifier[4];
127
+ if (buildCSS) condition[conditionSelector] += `:where(.t_group_${groupName}${selector} *)`;
128
+ const component = state.componentState.group?.[groupName];
129
+ const context = state.flatGroupContext?.[groupName];
130
+ if (!(component?.pseudo ?? context?.state.pseudo)?.[modifier[5]]) condition[conditionValue] &= -2;
131
+ (state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupName);
132
+ } else {
133
+ if (rank === 0 || rank === 2 || rank === 4) condition[conditionValue] |= conditionPlatformPseudoFlag;
134
+ else if (rank === 6) condition[conditionValue] |= 4;
135
+ else if (rank === 7) condition[conditionValue] |= 8;
136
+ if (buildCSS) condition[conditionSelector] += `:where(${selector}${selector[0] === "." ? `, ${selector} *` : ""})`;
137
+ const component = state.componentState;
138
+ if (!(rank === 1 ? component.focusWithin : rank === 3 ? component.focusVisible : rank === 4 ? component.press || component.pressIn : rank === 5 ? component.disabled || state.props.disabled : rank === 6 ? component.unmounted : rank === 7 ? state.styleProps.isExiting : component[name])) condition[conditionValue] &= -2;
139
+ if (selector[0] === ":") (state.flatStateKeys ||= /* @__PURE__ */ new Set()).add(name);
259
140
  }
260
- setConditionUnresolved(cursor, modifier);
141
+ if (rank === 0 && buildCSS) appendConditionWrapper(condition, "@media (hover: hover)");
261
142
  }
262
- function resolveConditionText(state, cursor, text) {
143
+ function resolveConditionText(state, condition, text) {
263
144
  let start = 0;
264
145
  for (let index = 0; index <= text.length; index++) {
265
146
  if (index !== text.length && text.charCodeAt(index) !== 58) continue;
266
147
  if (index === start) {
267
- setConditionUnresolved(cursor);
148
+ setConditionUnresolved(condition);
268
149
  return;
269
150
  }
270
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) return;
271
- resolveConditionModifier(state, cursor, text.slice(start, index));
151
+ if (!(condition[conditionValue] & conditionResolvedFlag)) return;
152
+ resolveConditionModifier(state, condition, text.slice(start, index));
272
153
  start = index + 1;
273
154
  }
274
155
  }
275
- function commitConditionCursor(state, cursor) {
276
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
277
- conditionNumbers[cursor + conditionValueOffset] = 0;
156
+ function commitCondition(condition) {
157
+ if (!(condition[conditionValue] & conditionResolvedFlag)) {
158
+ condition[conditionValue] = 0;
278
159
  return 0;
279
160
  }
280
- const key = conditionTexts[cursor + conditionKeyOffset] || "";
281
- const precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
282
- const depth = precedence >> 23 & 7;
283
- if (depth > 5) throw new Error(`a flat value clause supports at most 5 non-platform conditions; received ${depth} in "${key}:"`);
284
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
285
- const condition = precedence * 256 + (flags >> 6) * 32 + 16 + (flags & conditionActiveFlag ? 1 : 0) + (flags & conditionEmitFlag ? 2 : 0) + (flags & conditionEnterFlag ? 4 : 0) + (flags & conditionExitFlag ? 8 : 0);
286
- conditionNumbers[cursor + conditionValueOffset] = condition;
287
- return condition;
288
- }
289
- function acquireConditionKeyCursor(state, key) {
290
- const cursor = acquireConditionCursor();
291
- if (key) {
292
- resolveConditionText(state, cursor, key);
293
- commitConditionCursor(state, cursor);
161
+ condition[conditionKey] = condition[conditionAtoms].join(":");
162
+ const ranks = condition[conditionRanks];
163
+ const depth = ranks.length;
164
+ if (depth > 5) {
165
+ if (process.env.NODE_ENV !== "production") throw new Error(`a flat value clause supports at most 5 non-platform conditions; received ${depth} in "${condition[conditionKey]}:"`);
166
+ return 0;
294
167
  }
295
- return cursor;
168
+ let precedence = condition[conditionPlatform] * 6 + depth;
169
+ for (let index = 0; index < 5; index++) precedence = precedence * 256 + (ranks[index] || 0);
170
+ const value = precedence * 256 + condition[conditionValue];
171
+ condition[conditionValue] = value;
172
+ return value;
296
173
  }
297
- function classifyConditionalObject(value, state, isChain, firstCursor) {
174
+ function conditionFromKey(state, key, parent) {
175
+ if (!key) return createCondition(parent);
176
+ if (!parent) {
177
+ const direct = state;
178
+ let cache = direct.flatConditions;
179
+ if (cache === void 0 || direct.flatConditionsClassed !== state.flatShouldDoClasses) {
180
+ cache = direct.flatConditions = /* @__PURE__ */ new Map();
181
+ direct.flatConditionsClassed = state.flatShouldDoClasses;
182
+ }
183
+ const known = cache.get(key);
184
+ if (known !== void 0) return known;
185
+ const resolved = createCondition(null);
186
+ resolveConditionText(state, resolved, key);
187
+ commitCondition(resolved);
188
+ cache.set(key, resolved);
189
+ return resolved;
190
+ }
191
+ const condition = createCondition(parent);
192
+ resolveConditionText(state, condition, key);
193
+ commitCondition(condition);
194
+ return condition;
195
+ }
196
+ function classifyConditionalObject(value, state, isChain, firstCondition) {
298
197
  if ("default" in value) return -1;
299
198
  for (const key in value) {
300
199
  if (!key.length) return 0;
301
200
  if (!state) return isChain?.(key) ? 1 : 0;
302
- const watermark = conditionCursorTop;
303
- const cursor = firstCursor || acquireConditionCursor();
304
- try {
305
- resolveConditionText(state, cursor, key);
306
- return commitConditionCursor(state, cursor);
307
- } finally {
308
- if (!firstCursor) releaseConditionCursors(watermark);
309
- }
201
+ const condition = firstCondition || createCondition();
202
+ resolveConditionText(state, condition, key);
203
+ return commitCondition(condition);
310
204
  }
311
205
  return 0;
312
206
  }
313
- const passStyleState = 0;
314
- const passClassName = 21;
315
- const passShouldDoClasses = 22;
316
- const passContainerValue = 23;
317
- const passContainerName = 24;
318
- const passContainerType = 25;
319
- const passFrontendGroup = 26;
320
- const passFrontendContainer = 27;
321
- const passFrontendContainerType = 28;
322
- const passHocMappedProperties = 29;
323
- const passHocMappedClasses = 30;
324
- const passParentCursor = 35;
325
- const passMapSourceKey = 36;
326
- const passMapFlags = 37;
207
+ const passClassName = 20;
208
+ const passShouldDoClasses = 21;
209
+ const passContainerValue = 22;
210
+ const passContainerName = 23;
211
+ const passContainerType = 24;
212
+ const passFrontendGroup = 25;
213
+ const passFrontendContainer = 26;
214
+ const passFrontendContainerType = 27;
215
+ const passSourceLayer = 28;
216
+ const passParentCursor = 29;
217
+ const passMapSourceKey = 30;
218
+ const passFlags = 13;
219
+ const sourceLayerBase = 0;
220
+ const sourceLayerVariant = 1;
221
+ const sourceLayerResolver = 2;
222
+ const sourceLayerProps = 3;
223
+ const sourceLayerStyle = 4;
327
224
  const passNoSkipFlag = 1;
328
225
  const passDisableShorthandsFlag = 2;
329
226
  const passNoExpandFlag = 4;
@@ -332,33 +229,8 @@ const passHocFlag = 16;
332
229
  const passTextFlag = 32;
333
230
  const passInputFlag = 64;
334
231
  const passAsChildStyleFlag = 128;
335
- function forEachPropInForwardOrder(pass) {
336
- const styleState = pass[passStyleState];
337
- const processedProps = styleState.props;
338
- const styleStaticConfig = styleState.flatStyleStaticConfig;
339
- const baseStyle = styleStaticConfig.baseStyle;
340
- const baseVariantProps = styleStaticConfig.baseVariantProps;
341
- const conditionWrapperBase = conditionWrapperTop;
342
- try {
343
- const appliesBaseStyle = baseStyle && !processedProps.asChild;
344
- if (appliesBaseStyle) for (const key in baseStyle) contributeProp(pass, key, baseVariantProps && Object.hasOwn(baseVariantProps, key) && Object.hasOwn(processedProps, key) ? processedProps[key] : baseStyle[key]);
345
- for (const key in processedProps) {
346
- if (appliesBaseStyle && baseVariantProps && Object.hasOwn(baseVariantProps, key)) continue;
347
- contributeProp(pass, key, processedProps[key]);
348
- }
349
- } catch (error) {
350
- releaseConditionPayloads(conditionWrapperBase);
351
- throw error;
352
- }
353
- }
354
- function isValidStyleKey(key, validStyles, accept) {
355
- return Boolean(key in validStyles || accept && key in accept);
356
- }
357
- function flushForwardStylesToClasses(pass) {
358
- const styleState = pass[passStyleState];
359
- if (!pass[passShouldDoClasses]) return;
360
- completeStreamingCSS(styleState);
361
- flushDirectStyles(styleState, true);
232
+ function isValidStyleKey(key, validStyles) {
233
+ return key in validStyles;
362
234
  }
363
235
  function effectiveLifecycleKeys(keys) {
364
236
  if (!keys) return;
@@ -366,312 +238,249 @@ function effectiveLifecycleKeys(keys) {
366
238
  for (const key of keys) out.add(key === "--t-x" || key === "--t-y" ? "translate" : key === "--t-scale-x" || key === "--t-scale-y" ? "scale" : key);
367
239
  return out;
368
240
  }
369
- function mapContributedProp(styleState, key, val, originalVal, condition) {
370
- const pass = styleState.flatPass;
371
- const keyInit = pass[passMapSourceKey];
372
- const disablePropMap = Boolean(pass[passMapFlags]);
373
- const [, conf, props, viewProps, , validStyles, accept, , variants, inlineProps, parentVariants, , styledContext, styledContextKeys, flags, debug] = pass;
241
+ function contributeProp(pass, keyOg, valOg, originalOg = valOg, disabled = false) {
242
+ const [styleState, conf, props, viewProps, , validStyles, neverSkipProps, variants, inlineProps, parentVariants, styleFrontend, styledContext, styledContextKeys, flags, debug, , defaultProps, driverAnimations, driverOutputStyle, elementType] = pass;
243
+ const noSkip = Boolean(flags & passNoSkipFlag);
244
+ const disableExpandShorthands = Boolean(flags & passDisableShorthandsFlag);
245
+ const noExpand = Boolean(flags & passNoExpandFlag);
246
+ const noMergeStyle = Boolean(flags & passNoMergeFlag);
374
247
  const isHOC = Boolean(flags & passHocFlag);
248
+ const isText = Boolean(flags & passTextFlag);
249
+ const isInput = Boolean(flags & passInputFlag);
250
+ const shorthands = conf.shorthands;
251
+ const shouldSkipDirectProps = !noSkip && !isHOC;
252
+ const shouldCheckSkipProps = !noSkip;
253
+ const asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
254
+ const isTextOrInput = isText || isInput;
375
255
  const hocParentVariants = isHOC ? parentVariants : void 0;
376
- const canResolveContextPrograms = !isHOC;
377
- const isStyledContextProp = styledContextKeys?.has(key) || styledContext && key in styledContext;
378
- if (key === "className") {
379
- if (typeof val === "string" && val) pass[passClassName] = `${pass[passClassName]} ${val}`.trim();
380
- return;
381
- }
382
- if (canResolveContextPrograms && disablePropMap && !isStyledContextProp) {
383
- if (key in stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
384
- if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
385
- return;
386
- }
387
- viewProps[key] = val;
388
- return;
389
- }
390
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
391
- console.groupCollapsed(" 💠 expanded", keyInit, "=>", key);
392
- log(val);
393
- console.groupEnd();
394
- }
395
- if (val == null) return;
396
- if (accept && key in accept) {
397
- viewProps[key] = val;
398
- return;
399
- }
400
- const isHostStyleKey = isValidStyleKey(key, validStyles, accept) || false;
401
- const isContextProgramKey = canResolveContextPrograms && Boolean(isStyledContextProp);
402
- if (condition !== void 0) {
403
- const conditionCursor = condition;
404
- if (isHostStyleKey || isContextProgramKey) contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey, conditionCursor);
405
- else if (isHOC) {
406
- const structured = mergeConditionTransport(styleState, viewProps[key], conditionCursor, val);
407
- if (key in viewProps) delete viewProps[key];
408
- viewProps[key] = structured;
409
- } else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is not a valid style on this component; the conditional variant value is dropped.`);
410
- return;
411
- }
412
- if (isHostStyleKey || isContextProgramKey) {
413
- contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey);
414
- return;
415
- }
416
- const isVariant = Boolean(variants && key in variants);
417
- if (inlineProps?.has(key)) viewProps[key] = props[key] ?? val;
418
- if (Boolean(hocParentVariants && hocParentVariants[keyInit])) {
419
- passDownProp(viewProps, key, val);
420
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
421
- console.groupCollapsed(` - passing down prop ${key}`);
422
- log({
423
- val,
424
- after: { ...viewProps[key] }
425
- });
426
- console.groupEnd();
427
- }
256
+ let keyInit = keyOg;
257
+ let valInit = valOg;
258
+ if (keyInit === "children") {
259
+ viewProps[keyInit] = valInit;
428
260
  return;
429
261
  }
430
- if (!isVariant) {
431
- if (isStyledContextProp) return;
432
- if (key in stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
433
- if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
434
- return;
435
- }
436
- viewProps[key] = val;
262
+ if (keyInit === "ref") return;
263
+ if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`before-prop-${keyInit}`;
264
+ if (process.env.NODE_ENV === "test" && keyInit === "jestAnimatedStyle") return;
265
+ if (!disableExpandShorthands) {
266
+ if (keyInit in shorthands) keyInit = shorthands[keyInit];
437
267
  }
438
- }
439
- function contributeProp(pass, keyOg, valOg, parentConditionKey) {
440
- const parentWatermark = conditionCursorTop;
441
- if (parentConditionKey) pass[passParentCursor] = acquireConditionKeyCursor(pass[passStyleState], parentConditionKey);
442
- try {
443
- const [styleState, conf, props, viewProps, staticConfig, validStyles, accept, neverSkipProps, variants, inlineProps, parentVariants, styleFrontend, styledContext, styledContextKeys, flags, debug, parentStaticConfig, defaultProps, driverAnimations, driverOutputStyle, elementType] = pass;
444
- const noSkip = Boolean(flags & passNoSkipFlag);
445
- const disableExpandShorthands = Boolean(flags & passDisableShorthandsFlag);
446
- const noExpand = Boolean(flags & passNoExpandFlag);
447
- const noMergeStyle = Boolean(flags & passNoMergeFlag);
448
- const isHOC = Boolean(flags & passHocFlag);
449
- const isText = Boolean(flags & passTextFlag);
450
- const isInput = Boolean(flags & passInputFlag);
451
- const shorthands = conf.shorthands;
452
- const shouldSkipDirectProps = !noSkip && !isHOC;
453
- const shouldCheckSkipProps = !noSkip;
454
- const asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
455
- const isTextOrInput = isText || isInput;
456
- const hocParentVariants = isHOC ? parentVariants : void 0;
457
- let keyInit = keyOg;
458
- let valInit = valOg;
459
- if (keyInit === "children") {
460
- viewProps[keyInit] = valInit;
268
+ if (keyInit === "className") {
269
+ if (pass[passParentCursor]) {
270
+ if (typeof valInit === "string") pass[passClassName] = `${pass[passClassName]} ${valInit}`.trim();
461
271
  return;
462
272
  }
463
- if (keyInit === "ref") return;
464
- if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`before-prop-${keyInit}`;
465
- if (process.env.NODE_ENV === "test" && keyInit === "jestAnimatedStyle") return;
466
- if (accept) {
467
- const accepted = accept[keyInit];
468
- if ((accepted === "style" || accepted === "textStyle") && valInit && typeof valInit === "object") {
469
- viewProps[keyInit] = resolveAcceptedStyle(styleState, valInit);
273
+ if (typeof valInit === "string" && valInit && true) {
274
+ if (noMergeStyle) {
275
+ viewProps.className = valInit;
470
276
  return;
471
277
  }
472
- }
473
- if (!disableExpandShorthands) {
474
- if (keyInit in shorthands) keyInit = shorthands[keyInit];
475
- }
476
- if (keyInit === "className") {
477
- if (typeof valInit === "string" && valInit && true) {
478
- if (noMergeStyle) {
479
- viewProps.className = valInit;
480
- return;
278
+ const resolveClassName = styleFrontend?.resolveClassName;
279
+ const sink = (entry) => {
280
+ const property = entry[0];
281
+ if (entry[2] !== void 0) {
282
+ if (isValidStyleKey(property, validStyles)) contributeValue(styleState, property, entry[1], void 0, false, entry[2]);
283
+ else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${property}" is not a valid style on this component; the frontend value is dropped.`);
284
+ } else {
285
+ if (property === "group") pass[passFrontendGroup] = entry[1];
286
+ else if (property === "container") pass[passFrontendContainer] = entry[1];
287
+ else if (property === "containerType") pass[passFrontendContainerType] = entry[1];
288
+ contributeProp(pass, property, entry[1]);
481
289
  }
482
- const hocClassNames = props[HOC_CLASSNAME_MARKER];
483
- if (hocClassNames && typeof hocClassNames === "object") {
484
- flushForwardStylesToClasses(pass);
485
- for (const property in hocClassNames) {
486
- const generatedClass = hocClassNames[property];
487
- if (typeof generatedClass !== "string") continue;
488
- clearDirectStyle(styleState, property);
489
- styleState.classNames[property] = generatedClass;
490
- (pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
491
- (pass[passHocMappedClasses] ||= /* @__PURE__ */ new Set()).add(generatedClass);
492
- }
290
+ };
291
+ let start = 0;
292
+ for (let index = 0; index <= valInit.length; index++) {
293
+ if (index !== valInit.length && valInit.charCodeAt(index) > 32) continue;
294
+ if (index === start) {
295
+ start = index + 1;
296
+ continue;
493
297
  }
494
- const getClassPlan = styleFrontend?.getClassPlan;
495
- let start = 0;
496
- for (let index = 0; index <= valInit.length; index++) {
497
- if (index !== valInit.length && valInit.charCodeAt(index) > 32) continue;
498
- if (index === start) {
499
- start = index + 1;
500
- continue;
501
- }
502
- const candidate = valInit.slice(start, index);
503
- if (pass[passHocMappedClasses]?.has(candidate)) {
504
- start = index + 1;
505
- continue;
506
- }
507
- const plan = getClassPlan ? getClassPlan(candidate, conf) : "raw";
508
- if (plan === null) {
509
- if (process.env.NODE_ENV === "development") warnOnce(`[tamagui] frontend candidate "${candidate}" is unavailable on this platform and was dropped.`);
510
- } else if (plan === "raw") {
511
- pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
512
- if (getClassPlan) {
513
- flushForwardStylesToClasses(pass);
514
- pass[passShouldDoClasses] = false;
515
- styleState.flatShouldDoClasses = false;
516
- }
517
- } else {
518
- const parentPlan = plan;
519
- if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
520
- pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
521
- flushForwardStylesToClasses(pass);
522
- pass[passShouldDoClasses] = false;
523
- styleState.flatShouldDoClasses = false;
524
- }
525
- const entries = Array.isArray(plan) ? plan : parentPlan.entries;
526
- for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
527
- const entry = entries[entryIndex];
528
- if (entry[2] !== void 0) {
529
- if (isValidStyleKey(entry[0], validStyles, accept)) contributeValue(styleState, entry[0], entry[1], mergeStyle, void 0, false, entry[2]);
530
- else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${entry[0]}" is not a valid style on this component; the frontend value is dropped.`);
531
- } else {
532
- if (entry[0] === "group") pass[passFrontendGroup] = entry[1];
533
- else if (entry[0] === "container") pass[passFrontendContainer] = entry[1];
534
- else if (entry[0] === "containerType") pass[passFrontendContainerType] = entry[1];
535
- contributeProp(pass, entry[0], entry[1]);
536
- }
298
+ const candidate = valInit.slice(start, index);
299
+ const preserveRaw = resolveClassName ? resolveClassName(candidate, conf, sink) : true;
300
+ if (preserveRaw === null) {
301
+ if (process.env.NODE_ENV === "development") warnOnce(`[tamagui] frontend candidate "${candidate}" is unavailable on this platform and was dropped.`);
302
+ } else if (preserveRaw) {
303
+ pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
304
+ if (resolveClassName) {
305
+ if (pass[passShouldDoClasses]) {
306
+ completeResolvedStyles(styleState);
307
+ flushDirectStyles(styleState, true);
537
308
  }
309
+ pass[passShouldDoClasses] = false;
310
+ styleState.flatShouldDoClasses = false;
538
311
  }
539
- start = index + 1;
540
- }
541
- if (props[HOC_CLASSNAME_MARKER] !== void 0) {
542
- flushForwardStylesToClasses(pass);
543
- pass[passShouldDoClasses] = false;
544
- styleState.flatShouldDoClasses = false;
545
312
  }
313
+ start = index + 1;
546
314
  }
547
- return;
548
315
  }
549
- if (keyInit === "style") {
550
- if (!valInit) return;
551
- if (noMergeStyle) {
552
- viewProps.style = valInit;
553
- return;
554
- }
555
- const isArray = Array.isArray(valInit);
556
- const length = isArray ? valInit.length : 1;
557
- for (let index = 0; index < length; index++) {
558
- const style = isArray ? valInit[index] : valInit;
559
- if (!style) continue;
560
- const hocClassNames = style[TAMAGUI_CLASS_PROPS];
561
- if (hocClassNames) {
562
- for (const property in hocClassNames) {
563
- clearDirectStyle(styleState, property);
564
- styleState.classNames[property] = hocClassNames[property];
565
- (pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
566
- }
567
- continue;
568
- }
569
- const normalized = normalizeStyle(style, false, true);
570
- const styleOriginals = shouldTrackStyleTokenProvenance ? styleOriginalValues.get(style) : void 0;
571
- for (const key in normalized) {
572
- if (normalized[key] == null) continue;
573
- if (pass[passHocMappedProperties]?.delete(key)) clearDirectStyle(styleState, key);
574
- if (key === "containerName") pass[passContainerName] = normalized[key];
575
- else if (key === "containerType") pass[passContainerType] = normalized[key];
576
- contributeValue(styleState, key, normalized[key], mergeStyle, styleOriginals?.[key]);
577
- }
316
+ return;
317
+ }
318
+ if (keyInit === HOC_CLASSNAME_MARKER) {
319
+ if (valInit && typeof valInit === "object") {
320
+ const direct = styleState;
321
+ const layers = direct.flatPropertyLayers ||= /* @__PURE__ */ new Map();
322
+ for (const property in valInit) {
323
+ clearDirectStyle(styleState, property);
324
+ styleState.classNames[property] = valInit[property];
325
+ layers.set(property, pass[passSourceLayer]);
578
326
  }
579
- return;
580
327
  }
581
- if (defaultProps) {
582
- const defaultVal = defaultProps[keyOg] ?? defaultProps[keyInit];
583
- if (defaultVal !== void 0 && valInit === defaultVal) return;
584
- }
585
- if (keyInit in skipProps && shouldSkipDirectProps && !neverSkipProps?.[keyInit]) {
586
- if (keyInit === "container") pass[passContainerValue] = valInit;
587
- if (keyInit === "transition" && typeof valInit === "string") {
588
- const animationConfig = driverAnimations?.[valInit];
589
- if (animationConfig && driverOutputStyle === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
590
- else if (animationConfig) return;
591
- } else return;
592
- }
593
- let isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles, accept);
594
- if (keyInit.startsWith("data-")) {
595
- viewProps[keyInit] = valInit;
328
+ return;
329
+ }
330
+ if (keyInit === "style") {
331
+ if (!valInit) return;
332
+ if (noMergeStyle) {
333
+ viewProps.style = valInit;
596
334
  return;
597
335
  }
598
- if (!noExpand) {
599
- if (keyInit === "disabled" && valInit === true) {
600
- viewProps["aria-disabled"] = true;
601
- if (isInput || elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") viewProps.disabled = true;
602
- if (!variants?.disabled) return;
603
- }
604
- if (keyInit === "testID") {
605
- viewProps["data-testid"] = valInit;
606
- return;
336
+ const layerBeforeStyle = pass[passSourceLayer];
337
+ pass[passSourceLayer] = sourceLayerStyle;
338
+ const isArray = Array.isArray(valInit);
339
+ const length = isArray ? valInit.length : 1;
340
+ for (let index = 0; index < length; index++) {
341
+ const style = isArray ? valInit[index] : valInit;
342
+ if (!style) continue;
343
+ if (isStylePiece(style)) {
344
+ if (styleState.flatShouldDoClasses && applyStylePieceClasses(styleState, style, sourceLayerStyle)) continue;
345
+ const resolvedPiece = resolveStylePiece(styleState, style);
346
+ const pieceOriginals = shouldTrackStyleTokenProvenance ? styleOriginalValues.get(style[stylePieceSymbol].styleObject) : void 0;
347
+ for (const key in resolvedPiece) {
348
+ if (resolvedPiece[key] == null) continue;
349
+ contributeValue(styleState, key, resolvedPiece[key], pieceOriginals?.[key]);
350
+ }
351
+ continue;
607
352
  }
608
- if (keyInit === "id") {
609
- viewProps.id = valInit;
610
- return;
353
+ const styleOriginals = shouldTrackStyleTokenProvenance ? styleOriginalValues.get(style) : void 0;
354
+ for (const key in style) {
355
+ if (style[key] == null) continue;
356
+ if (key === "containerName") pass[passContainerName] = style[key];
357
+ else if (key === "containerType") pass[passContainerType] = style[key];
358
+ contributeValue(styleState, key, style[key], styleOriginals?.[key]);
611
359
  }
612
360
  }
613
- if (isValidStyleKeyInit && valInit == null && keyOg in props) {
614
- clearDirectStyle(styleState, keyInit);
615
- if (styledContextKeys?.has(keyInit)) (styleState.overriddenContextProps ||= {})[keyInit] = valInit;
361
+ pass[passSourceLayer] = layerBeforeStyle;
362
+ return;
363
+ }
364
+ if (defaultProps) {
365
+ const defaultVal = defaultProps[keyOg] ?? defaultProps[keyInit];
366
+ if (defaultVal !== void 0 && valInit === defaultVal) return;
367
+ }
368
+ if (keyInit in skipProps && shouldSkipDirectProps && !neverSkipProps?.[keyInit]) {
369
+ if (keyInit === "container") pass[passContainerValue] = valInit;
370
+ if (keyInit === "transition" && typeof valInit === "string") {
371
+ const animationConfig = driverAnimations?.[valInit];
372
+ if (animationConfig && driverOutputStyle === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
373
+ else if (animationConfig) return;
374
+ } else return;
375
+ }
376
+ let isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles);
377
+ if (keyInit.startsWith("data-")) {
378
+ viewProps[keyInit] = valInit;
379
+ return;
380
+ }
381
+ if (!noExpand) {
382
+ if (keyInit === "disabled" && valInit === true) {
383
+ viewProps["aria-disabled"] = true;
384
+ if (isInput || elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") viewProps.disabled = true;
385
+ if (!variants?.disabled) return;
386
+ }
387
+ if (keyInit === "testID") {
388
+ viewProps["data-testid"] = valInit;
616
389
  return;
617
390
  }
618
- let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
619
- const isStyleLikeKey = isValidStyleKeyInit || isVariant;
620
- const isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
621
- if (isStyleProp && asChildExceptStyleLike) return;
622
- const shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || inlineProps?.has(keyInit);
623
- const parentVariant = parentVariants?.[keyInit];
624
- const isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in skipProps));
625
- const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
626
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
627
- console.groupCollapsed(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`);
628
- log({
629
- isVariant,
630
- valInit,
631
- shouldPassProp
632
- });
633
- if (isClient) log({
634
- variants,
635
- variant: variants?.[keyInit],
636
- isVariant,
637
- isHOCShouldPassThrough,
638
- parentStaticConfig
639
- });
391
+ if (keyInit === "id") {
392
+ viewProps.id = valInit;
393
+ return;
640
394
  }
641
- if (shouldPassThrough) {
642
- passDownProp(viewProps, keyInit, valInit);
395
+ }
396
+ if (isValidStyleKeyInit && valInit == null && keyOg in props) {
397
+ clearDirectStyle(styleState, keyInit);
398
+ if (styledContextKeys?.has(keyInit)) (styleState.overriddenContextProps ||= {})[keyInit] = valInit;
399
+ return;
400
+ }
401
+ let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
402
+ const isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
403
+ if (isStyleProp && asChildExceptStyleLike) return;
404
+ const shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || inlineProps?.has(keyInit);
405
+ const parentVariant = parentVariants?.[keyInit];
406
+ const isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in skipProps));
407
+ const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
408
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
409
+ console.groupCollapsed(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`);
410
+ log({
411
+ isVariant,
412
+ valInit,
413
+ shouldPassProp
414
+ });
415
+ if (isClient) log({
416
+ variants,
417
+ variant: variants?.[keyInit],
418
+ isVariant,
419
+ isHOCShouldPassThrough,
420
+ parentStaticConfig: pass[15]
421
+ });
422
+ }
423
+ if (shouldPassThrough) {
424
+ if (keyInit in viewProps) delete viewProps[keyInit];
425
+ viewProps[keyInit] = valInit;
426
+ if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
427
+ if (!isVariant) return;
428
+ }
429
+ if (shouldCheckSkipProps && !neverSkipProps?.[keyInit]) {
430
+ if (keyInit in skipProps && !(keyInit === "transition" && typeof valInit === "string" && !driverAnimations?.[valInit])) {
643
431
  if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
644
- if (!isVariant) return;
645
- }
646
- if (shouldCheckSkipProps && !neverSkipProps?.[keyInit]) {
647
- if (keyInit in skipProps && !(keyInit === "transition" && typeof valInit === "string" && !driverAnimations?.[valInit])) {
648
- if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
649
- return;
650
- }
651
- }
652
- if (isTextOrInput) {
653
- if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
654
- }
655
- const disablePropMap = !isStyleLikeKey;
656
- if (isValidStyleKeyInit && valInit != null && !(variants && keyInit in variants) && !(accept && keyInit in accept) && !(styledContextKeys?.has(keyInit) || styledContext && keyInit in styledContext)) {
657
- contributeValue(styleState, keyInit, valInit, mergeStyle);
658
432
  return;
659
433
  }
434
+ }
435
+ if (isTextOrInput) {
436
+ if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
437
+ }
438
+ if (isValidStyleKeyInit && valInit != null && !(variants && keyInit in variants) && !(styledContextKeys?.has(keyInit) || styledContext && keyInit in styledContext)) {
439
+ contributeValue(styleState, keyInit, valInit, originalOg);
440
+ return;
441
+ }
442
+ if (variants && keyInit in variants && !noExpand && !disabled) {
443
+ const previousLayer = pass[passSourceLayer];
444
+ pass[passSourceLayer] = previousLayer ? sourceLayerVariant : sourceLayerBase;
660
445
  pass[passMapSourceKey] = keyInit;
661
- pass[passMapFlags] = disablePropMap ? 1 : 0;
662
- contributeMappedValue(keyInit, valInit, styleState, disablePropMap);
663
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
664
- try {
665
- log(` \u2714\uFE0F expand complete`, keyInit);
666
- log("style", { ...styleState.style });
667
- log("viewProps", { ...viewProps });
668
- log("transforms", styleState.transformAccumulator);
669
- } catch {}
670
- console.groupEnd();
671
- }
672
- } finally {
673
- if (parentConditionKey) pass[passParentCursor] = null;
674
- releaseConditionCursors(parentWatermark);
446
+ const variantConfig = styleState.flatStyleStaticConfig;
447
+ variantConfig.variantStyleResolver?.(styleState, variantConfig.variants, keyInit, valInit, keyInit, pass[passParentCursor]);
448
+ pass[passSourceLayer] = previousLayer;
449
+ return;
450
+ }
451
+ const isStyledContextProp = !isHOC && (styledContextKeys?.has(keyInit) || styledContext && keyInit in styledContext);
452
+ if (isStyledContextProp) {
453
+ (styleState.overriddenContextProps ||= {})[keyInit] = originalOg;
454
+ (styleState.originalContextPropValues ||= {})[keyInit] = originalOg;
455
+ }
456
+ const isHostStyleKey = isValidStyleKeyInit || false;
457
+ if (isHostStyleKey || isStyledContextProp) {
458
+ contributeValue(styleState, keyInit, valInit, originalOg, !isHostStyleKey);
459
+ return;
460
+ }
461
+ const condition = pass[passParentCursor];
462
+ if (condition) {
463
+ if (isHOC) {
464
+ const previous = viewProps[keyInit];
465
+ const transport = previous && typeof previous === "object" && !Array.isArray(previous) && "default" in previous ? previous : { default: previous };
466
+ transport[condition[conditionKey]] = valInit;
467
+ viewProps[keyInit] = transport;
468
+ } else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${keyInit}" is not a valid style on this component; the conditional variant value is dropped.`);
469
+ return;
470
+ }
471
+ if (keyInit in stylePropsAll) {
472
+ if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${keyInit}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
473
+ return;
474
+ }
475
+ viewProps[keyInit] = valInit;
476
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
477
+ try {
478
+ log(` \u2714\uFE0F expand complete`, keyInit);
479
+ log("style", { ...styleState.style });
480
+ log("viewProps", { ...viewProps });
481
+ log("transforms", styleState.transformAccumulator);
482
+ } catch {}
483
+ console.groupEnd();
675
484
  }
676
485
  }
677
486
  const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver, styleStaticConfig) => {
@@ -697,7 +506,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
697
506
  const staticPassthroughClassName = styleStaticConfig.passthroughClassName || "";
698
507
  let className = staticPassthroughClassName;
699
508
  if (staticPassthroughClassName) shouldDoClasses = false;
700
- const validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
509
+ const validStyles$1 = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStyles);
701
510
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-setup`;
702
511
  const styleState = {
703
512
  classNames,
@@ -719,7 +528,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
719
528
  animationDriver: resolvedDriver
720
529
  };
721
530
  styleState.flatStyleStaticConfig = styleStaticConfig;
722
- if (canGenerateCSS && shouldDoClasses && styleProps.canPlatformPseudo) styleState.flatDeferCSS = true;
723
531
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`style-state`;
724
532
  if (process.env.NODE_ENV === "development" && debug === "verbose" && isClient) {
725
533
  if (isDevTools) {
@@ -737,7 +545,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
737
545
  }
738
546
  }
739
547
  const { asChild } = props;
740
- const { accept, neverSkipProps } = staticConfig;
548
+ const { neverSkipProps } = staticConfig;
741
549
  const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext } = styleProps;
742
550
  const styledContextKeys = styleStaticConfig.styledContextKeys;
743
551
  const styleFrontend = staticConfig.styleFrontend;
@@ -753,8 +561,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
753
561
  let containerType;
754
562
  containerName = processedProps.containerName;
755
563
  containerType = processedProps.containerType;
756
- let hocMappedClassProperties;
757
- let hocMappedClasses;
758
564
  const pass = [
759
565
  styleState,
760
566
  conf,
@@ -762,7 +568,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
762
568
  viewProps,
763
569
  staticConfig,
764
570
  validStyles$1,
765
- accept,
766
571
  neverSkipProps,
767
572
  variants,
768
573
  inlineProps,
@@ -784,48 +589,101 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
784
589
  containerType,
785
590
  frontendGroup,
786
591
  frontendContainer,
787
- frontendContainerType,
788
- hocMappedClassProperties,
789
- hocMappedClasses
592
+ frontendContainerType
790
593
  ];
791
594
  styleState.flatPass = pass;
792
595
  let conditionalStates = null;
793
596
  let usesSafeArea = false;
794
- const conditionWrapperBase = conditionWrapperTop;
795
- try {
796
- forEachPropInForwardOrder(pass);
797
- [, , , , , , , , , , , , , , , , , , , , , className, shouldDoClasses, containerValue, containerName, containerType, frontendGroup, frontendContainer, frontendContainerType, hocMappedClassProperties, hocMappedClasses] = pass;
798
- if (containerValue) {
799
- containerName ??= typeof containerValue === "string" ? containerValue : void 0;
800
- containerType ??= "inline-size";
801
- contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType, mergeStyle);
802
- }
803
- if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
804
- conditionalStates = styleState.flatStateKeys || null;
805
- usesSafeArea = !!styleState.flatUsesSafeArea;
806
- hasMedia = styleState.flatMediaKeys?.size ? styleState.flatMediaKeys : false;
807
- pseudoGroups = styleState.flatGroupKeys?.size ? styleState.flatGroupKeys : void 0;
808
- mediaGroups = styleState.flatGroupMedia?.size ? styleState.flatGroupMedia : void 0;
809
- if (styleProps.canPlatformPseudo && styleState.flatHasPlatformPseudo) {
810
- shouldDoClasses = false;
811
- styleState.flatShouldDoClasses = false;
812
- if (styleState.transformAccumulator) {
813
- mergeStyle(styleState, "transform", finalizeTransformAccumulator(styleState.transformAccumulator), true);
814
- styleState.transformAccumulator = void 0;
597
+ const baseStyle = styleStaticConfig.baseStyle;
598
+ const baseVariantProps = styleStaticConfig.baseVariantProps;
599
+ const appliesBaseStyle = baseStyle && !processedProps.asChild;
600
+ pass[passSourceLayer] = sourceLayerBase;
601
+ let appliedBaseStylePieces;
602
+ if (appliesBaseStyle && baseVariantProps) {
603
+ let callerKeys;
604
+ for (const key in baseVariantProps) if (Object.hasOwn(processedProps, key) && processedProps[key] !== baseVariantProps[key]) (callerKeys ||= /* @__PURE__ */ new Set()).add(key);
605
+ styleState.flatCallerVariantKeys = callerKeys;
606
+ }
607
+ if (appliesBaseStyle) for (const key in baseStyle) {
608
+ const baseValue = baseVariantProps && Object.hasOwn(baseVariantProps, key) && Object.hasOwn(processedProps, key) ? processedProps[key] : baseStyle[key];
609
+ const expandedKey = shorthands[key] || key;
610
+ if ((isText || isInput) && baseValue && expandedKey === "fontFamily" && baseValue in conf.fontsParsed) styleState.fontFamily = baseValue;
611
+ const piece = styleStaticConfig.baseStylePieces?.[key];
612
+ if (piece && styleState.flatShouldDoClasses) {
613
+ if (!appliedBaseStylePieces?.has(piece)) {
614
+ if (applyStylePieceClasses(styleState, piece, sourceLayerBase)) (appliedBaseStylePieces ||= /* @__PURE__ */ new Set()).add(piece);
615
+ }
616
+ if (appliedBaseStylePieces?.has(piece)) continue;
617
+ }
618
+ contributeProp(pass, key, baseValue);
619
+ }
620
+ pass[passSourceLayer] = sourceLayerProps;
621
+ for (const key in processedProps) {
622
+ if (appliesBaseStyle && baseVariantProps && Object.hasOwn(baseVariantProps, key)) continue;
623
+ contributeProp(pass, key, processedProps[key]);
624
+ }
625
+ const resolvers = staticConfig.resolvers;
626
+ if (resolvers && !noExpand) {
627
+ pass[passSourceLayer] = sourceLayerResolver;
628
+ const flagsBefore = pass[passFlags];
629
+ pass[passFlags] = flagsBefore | passNoExpandFlag;
630
+ const env = getDynamicEnv(styleState);
631
+ for (let index = 0; index < resolvers.length; index++) {
632
+ const resolved = resolvers[index](processedProps, env);
633
+ if (resolved) for (const key in resolved) {
634
+ if (resolved[key] == null) continue;
635
+ contributeProp(pass, key, resolved[key]);
815
636
  }
816
- convertDeferredInline(styleState, mergeStyle);
817
637
  }
818
- completeStreaming(styleState, mergeStyle);
819
- } finally {
820
- releaseConditionPayloads(conditionWrapperBase);
638
+ pass[passFlags] = flagsBefore;
639
+ }
640
+ className = pass[passClassName];
641
+ shouldDoClasses = pass[passShouldDoClasses];
642
+ containerValue = pass[passContainerValue];
643
+ containerName = pass[passContainerName];
644
+ containerType = pass[passContainerType];
645
+ frontendGroup = pass[passFrontendGroup];
646
+ frontendContainer = pass[passFrontendContainer];
647
+ frontendContainerType = pass[passFrontendContainerType];
648
+ if (containerValue) {
649
+ containerName ??= typeof containerValue === "string" ? containerValue : void 0;
650
+ containerType ??= "inline-size";
651
+ contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType);
652
+ }
653
+ if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
654
+ conditionalStates = styleState.flatStateKeys || null;
655
+ usesSafeArea = !!styleState.flatUsesSafeArea;
656
+ hasMedia = styleState.flatMediaKeys?.size ? styleState.flatMediaKeys : false;
657
+ pseudoGroups = styleState.flatGroupKeys?.size ? styleState.flatGroupKeys : void 0;
658
+ mediaGroups = styleState.flatGroupMedia?.size ? styleState.flatGroupMedia : void 0;
659
+ if (styleProps.canPlatformPseudo && styleState.flatHasPlatformPseudo) {
660
+ shouldDoClasses = false;
661
+ styleState.flatShouldDoClasses = false;
662
+ if (styleState.transformAccumulator) {
663
+ mergeStyle(styleState, "transform", finalizeTransformAccumulator(styleState.transformAccumulator), true);
664
+ styleState.transformAccumulator = void 0;
665
+ }
666
+ }
667
+ if (styleProps.stylePieceEntries) {
668
+ const slots = styleState.flatSlots;
669
+ if (slots) for (const [slot, entries] of slots) styleProps.stylePieceEntries[slot] = entries;
670
+ }
671
+ completeResolvedStyles(styleState);
672
+ if (styleProps.isStatic) for (const property in classNames) {
673
+ const identifier = classNames[property];
674
+ if (rulesToInsert[identifier]) continue;
675
+ const rules = getRulesForIdentifier(identifier);
676
+ if (rules) rulesToInsert[identifier] = [
677
+ property,
678
+ "",
679
+ identifier,
680
+ void 0,
681
+ rules
682
+ ];
821
683
  }
822
684
  const effectiveTransition = styleState.style?.transition;
823
685
  if (effectiveTransition != null && styleState.style && driverOutputStyle !== "css") delete styleState.style.transition;
824
686
  if (!(noNormalize === false)) {
825
- if (styleState.style) {
826
- fixStyles(styleState.style);
827
- if (!noExpand && !noMergeStyle) styleToCSS(styleState.style);
828
- }
829
687
  if (styleState.transformAccumulator && !styleState.flatShouldDoClasses) {
830
688
  styleState.style ||= {};
831
689
  styleState.style.transform = finalizeTransformAccumulator(styleState.transformAccumulator);
@@ -872,7 +730,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
872
730
  if (effectiveTransition != null) result.effectiveTransition = effectiveTransition;
873
731
  if (conditionalStates) result.programStates = conditionalStates;
874
732
  if (usesSafeArea) result.usesSafeArea = true;
875
- if (getDirectDynamicThemeAccess(styleState)) result.dynamicThemeAccess = true;
733
+ if (styleState.flatDynamicThemeAccess) result.dynamicThemeAccess = true;
876
734
  if (styleState.flatEnterKeys || styleState.flatExitKeys) result.programLifecycleStyleKeys = {
877
735
  enter: effectiveLifecycleKeys(styleState.flatEnterKeys),
878
736
  exit: effectiveLifecycleKeys(styleState.flatExitKeys)
@@ -895,27 +753,13 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
895
753
  let hasPropertyClassNames = false;
896
754
  if (classNames) for (const key in classNames) {
897
755
  hasPropertyClassNames = true;
898
- finalClassName += ` ${classNames[key]}`;
756
+ if (!isHOC) finalClassName += ` ${classNames[key]}`;
899
757
  }
900
758
  if (groupClassName) finalClassName += ` ${groupClassName}`;
901
759
  if (className) finalClassName += ` ${className}`;
902
- if (isAnimated && driverInputStyle === "css") {
903
- viewProps.className = finalClassName;
904
- if (style) viewProps.style = style;
905
- } else {
906
- if (finalClassName) {
907
- if (isHOC) viewProps[HOC_CLASSNAME_MARKER] = classNames;
908
- viewProps.className = finalClassName;
909
- }
910
- if (isHOC && hasPropertyClassNames) {
911
- const classStyle = {};
912
- Object.defineProperty(classStyle, TAMAGUI_CLASS_PROPS, {
913
- value: classNames,
914
- enumerable: false
915
- });
916
- viewProps.style = style ? [classStyle, style] : classStyle;
917
- } else if (style) viewProps.style = style;
918
- }
760
+ if (isHOC && hasPropertyClassNames) viewProps[HOC_CLASSNAME_MARKER] = classNames;
761
+ if (finalClassName) viewProps.className = finalClassName;
762
+ if (style) viewProps.style = style;
919
763
  }
920
764
  }
921
765
  }
@@ -941,6 +785,158 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
941
785
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-done`;
942
786
  return result;
943
787
  };
788
+ const stylePieceStaticConfig = {
789
+ acceptsClassName: true,
790
+ isText: true,
791
+ validStyles: stylePropsAll
792
+ };
793
+ const compiledStylePieces = /* @__PURE__ */ new WeakMap();
794
+ const compileStylePieceRuntime = (piece, layer) => {
795
+ const conf = getConfigMaybe();
796
+ if (!conf) return;
797
+ const themeName = Object.keys(conf.themes)[0] || "";
798
+ const theme = conf.themes[themeName] || {};
799
+ const definition = piece[stylePieceSymbol].styleObject;
800
+ const isBase = layer === "base";
801
+ const slots = {};
802
+ const split = getSplitStyles(isBase ? {} : { style: definition }, isBase ? {
803
+ ...stylePieceStaticConfig,
804
+ baseStyle: definition,
805
+ disableBaseStylePiece: true
806
+ } : stylePieceStaticConfig, theme, themeName, defaultComponentStateMounted, {
807
+ isAnimated: false,
808
+ resolveValues: "variable",
809
+ stylePieceEntries: slots
810
+ });
811
+ if (!split) return;
812
+ const directClassNames = {};
813
+ for (const key in split.classNames) if (!(key in slots)) directClassNames[key] = split.classNames[key];
814
+ compiledStylePieces.set(piece, {
815
+ slots,
816
+ directClassNames,
817
+ programStates: split.programStates,
818
+ mediaKeys: split.hasMedia instanceof Set ? split.hasMedia : void 0,
819
+ pseudoGroups: split.pseudoGroups,
820
+ mediaGroups: split.mediaGroups,
821
+ dynamicThemeAccess: split.dynamicThemeAccess
822
+ });
823
+ const byKey = piece[stylePieceSymbol].byKey;
824
+ let className = "";
825
+ for (const key in split.classNames) {
826
+ const identifier = split.classNames[key];
827
+ byKey[key] = identifier;
828
+ className = className ? `${className} ${identifier}` : identifier;
829
+ }
830
+ piece.className = className;
831
+ if (isClient) insertStyleRules(split.rulesToInsert);
832
+ };
833
+ setStylePieceCompiler(compileStylePieceRuntime);
834
+ setStylePieceResolver((piece, theme, themeName) => {
835
+ return getSplitStyles({ style: piece }, stylePieceStaticConfig, theme, themeName, defaultComponentStateMounted, {
836
+ isAnimated: false,
837
+ resolveValues: "value"
838
+ })?.style || {};
839
+ });
840
+ const resolvedStylePieceCache = /* @__PURE__ */ new WeakMap();
841
+ function resolveStylePiece(styleState, piece) {
842
+ const definition = piece[stylePieceSymbol].styleObject;
843
+ if (!isStylePieceCacheable(piece)) return resolveStyleObject(styleState, definition);
844
+ let themeCache = resolvedStylePieceCache.get(piece);
845
+ if (!themeCache) {
846
+ themeCache = /* @__PURE__ */ new WeakMap();
847
+ resolvedStylePieceCache.set(piece, themeCache);
848
+ }
849
+ const theme = styleState.theme;
850
+ const cached = themeCache.get(theme);
851
+ if (cached) return cached;
852
+ const resolved = resolveStyleObject(styleState, definition);
853
+ themeCache.set(theme, resolved);
854
+ return resolved;
855
+ }
856
+ function applyStylePieceClasses(styleState, piece, sourceLayer) {
857
+ let compiled = compiledStylePieces.get(piece);
858
+ if (!compiled && getConfigMaybe()) {
859
+ compileStylePieceRuntime(piece, "style");
860
+ compiled = compiledStylePieces.get(piece);
861
+ }
862
+ if (compiled) {
863
+ const direct2 = styleState;
864
+ const slots = direct2.flatSlots ||= /* @__PURE__ */ new Map();
865
+ for (const slot in compiled.slots) for (const entry of compiled.slots[slot]) {
866
+ const property = entry[0];
867
+ if (!ownsSourceLayer(styleState, property, !!entry[2])) continue;
868
+ writeCapturedStyleRecord(slots, slot, entry, sourceLayer);
869
+ }
870
+ if (compiled.programStates) {
871
+ const target = styleState.flatStateKeys ||= /* @__PURE__ */ new Set();
872
+ for (const key of compiled.programStates) target.add(key);
873
+ }
874
+ if (compiled.mediaKeys) {
875
+ const target = styleState.flatMediaKeys ||= /* @__PURE__ */ new Set();
876
+ for (const key of compiled.mediaKeys) target.add(key);
877
+ }
878
+ if (compiled.pseudoGroups) {
879
+ const target = styleState.flatGroupKeys ||= /* @__PURE__ */ new Set();
880
+ for (const key of compiled.pseudoGroups) target.add(key);
881
+ }
882
+ if (compiled.mediaGroups) {
883
+ const target = styleState.flatGroupMedia ||= /* @__PURE__ */ new Set();
884
+ for (const key of compiled.mediaGroups) target.add(key);
885
+ }
886
+ if (compiled.dynamicThemeAccess) direct2.flatDynamicThemeAccess = true;
887
+ for (const property in compiled.directClassNames) styleState.classNames[property] = compiled.directClassNames[property];
888
+ return true;
889
+ }
890
+ const byKey = piece[stylePieceSymbol].byKey;
891
+ const direct = styleState;
892
+ const layers = direct.flatPropertyLayers ||= /* @__PURE__ */ new Map();
893
+ let applied = false;
894
+ for (const property in byKey) {
895
+ const previousLayer = layers.get(property);
896
+ if (previousLayer !== void 0 && previousLayer > sourceLayer) continue;
897
+ clearDirectStyle(styleState, property);
898
+ styleState.classNames[property] = byKey[property];
899
+ layers.set(property, sourceLayer);
900
+ const identifier = byKey[property];
901
+ const fallbackRules = getRulesForIdentifier(identifier);
902
+ const shouldInsert = styleState.styleProps.isStatic || shouldInsertStyleRules(identifier);
903
+ if (fallbackRules && shouldInsert) styleState.flatRulesToInsert[identifier] = [
904
+ property,
905
+ "",
906
+ identifier,
907
+ void 0,
908
+ fallbackRules
909
+ ];
910
+ applied = true;
911
+ }
912
+ return applied;
913
+ }
914
+ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
915
+ let list = slots.get(slot);
916
+ if (!list) slots.set(slot, list = []);
917
+ const flags = source[7] & 31;
918
+ const identity = source[3];
919
+ const condition = source[2];
920
+ for (let index = 0; index < list.length; index++) {
921
+ const entry = list[index];
922
+ const entryFlags = entry[7] & 31;
923
+ if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
924
+ if (entry[0] !== source[0]) continue;
925
+ if (flags & recordDefault) {
926
+ if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
927
+ } else if (entryFlags & recordDefault && (!condition || entry[3] === identity)) {
928
+ list.splice(index--, 1);
929
+ continue;
930
+ }
931
+ if (entry[3] === identity) {
932
+ list.splice(index, 1);
933
+ break;
934
+ }
935
+ }
936
+ const next = [...source];
937
+ next[7] = flags | sourceLayer << 5;
938
+ list.push(next);
939
+ }
944
940
  function mergeStyle(styleState, key, val, disableNormalize = false, originalVal) {
945
941
  const { viewProps, styleProps, staticConfig } = styleState;
946
942
  if (styleState.flatStyleStaticConfig.styledContextKeys?.has(key)) {
@@ -953,12 +949,9 @@ function mergeStyle(styleState, key, val, disableNormalize = false, originalVal)
953
949
  addTransformValue(styleState.transformAccumulator, key, val);
954
950
  } else {
955
951
  const out = !disableNormalize && !styleProps.noNormalize ? normalizeValueWithProperty(val, key) : val;
956
- if (staticConfig.accept && key in staticConfig.accept) viewProps[key] = out;
957
- else {
958
- styleState.style ||= {};
959
- styleState.style[key] = out;
960
- if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
961
- }
952
+ styleState.style ||= {};
953
+ styleState.style[key] = out;
954
+ if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
962
955
  }
963
956
  }
964
957
  function recordStyleTokenProvenance(styleState, key, originalVal) {
@@ -971,7 +964,7 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
971
964
  if (tokenName !== "" && (tokenName in styleState.theme || tokenName in (styleState.conf.themes?.[styleState.flatThemeName || ""] || {}) || Object.values(styleState.conf.tokensParsed).some((category) => tokenName in category))) (styleState.tokenProvenance ||= {})[key] = originalVal;
972
965
  else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
973
966
  }
974
- const resolveAcceptedStyle = (styleState, styleIn) => {
967
+ const resolveStyleObject = (styleState, styleIn) => {
975
968
  const { conf, styleProps } = styleState;
976
969
  const styleOut = {};
977
970
  let originalValues;
@@ -984,12 +977,9 @@ const resolveAcceptedStyle = (styleState, styleIn) => {
984
977
  style: styleOut,
985
978
  transformAccumulator: void 0
986
979
  };
987
- childState.flatUsed = void 0;
988
- childState.flatTransitions = void 0;
989
980
  childState.flatAtomics = void 0;
990
- childState.flatSingleEntries = void 0;
991
981
  childState.flatSlots = void 0;
992
- childState.flatBorderDefaultRequests = void 0;
982
+ childState.flatPropertyLayers = void 0;
993
983
  const mergeAccepted = (_state, key, value, disableNormalize, originalValue) => {
994
984
  styleOut[key] = disableNormalize || styleProps.noNormalize ? value : normalizeValueWithProperty(value, key);
995
985
  const trackedOriginal = styleInOriginalValues?.[key] ?? originalValue;
@@ -999,87 +989,76 @@ const resolveAcceptedStyle = (styleState, styleIn) => {
999
989
  const value = styleIn[key];
1000
990
  key = conf.shorthands[key] || key;
1001
991
  if (key in skipProps || value == null) continue;
1002
- contributeValue(childState, key, value, mergeAccepted);
992
+ contributeValue(childState, key, value);
1003
993
  }
1004
- completeStreaming(childState, mergeAccepted);
994
+ completeResolvedStyles(childState, mergeAccepted);
1005
995
  if (childState.transformAccumulator) styleOut.transform = finalizeTransformAccumulator(childState.transformAccumulator);
1006
- if (!styleProps.noNormalize) fixStyles(styleOut);
1007
996
  if (originalValues) styleOriginalValues.set(styleOut, originalValues);
1008
997
  return styleOut;
1009
998
  };
1010
- function passDownProp(viewProps, key, val) {
1011
- if (key in viewProps) delete viewProps[key];
1012
- viewProps[key] = val;
1013
- }
1014
999
  let frameSequence = 0;
1015
- function streamWriteCSS(state, property, value, cursor, original, conditionOverride = -1) {
1000
+ const recordInline = 1;
1001
+ const recordNormalize = 2;
1002
+ const recordRetract = 4;
1003
+ const recordDefault = 8;
1004
+ const recordCSS = 16;
1005
+ const webStyleProperties = /* @__PURE__ */ new Map();
1006
+ function webStyleProperty(property) {
1007
+ let web = webStyleProperties.get(property);
1008
+ if (web === void 0) {
1009
+ web = property === "writingDirection" ? "direction" : property.endsWith("Horizontal") ? `${property.slice(0, -10)}Inline` : property.endsWith("Vertical") ? `${property.slice(0, -8)}Block` : property;
1010
+ webStyleProperties.set(property, web);
1011
+ }
1012
+ return web;
1013
+ }
1014
+ const styleSlots = /* @__PURE__ */ new Map();
1015
+ function styleSlot(property) {
1016
+ let slot = styleSlots.get(property);
1017
+ if (slot === void 0) styleSlots.set(property, slot = classifyStyleSlot(property));
1018
+ return slot;
1019
+ }
1020
+ function classifyStyleSlot(property) {
1021
+ return property.startsWith("border") ? property.includes("Radius") ? "borderRadius" : "border" : property.startsWith("margin") ? "margin" : property.startsWith("padding") ? "padding" : property.startsWith("background") ? "background" : property.startsWith("textDecoration") ? "textDecoration" : property.includes("flex") ? "flex" : property.startsWith("transition") ? "transition" : property.startsWith("overflow") ? "overflow" : property === "top" || property === "right" || property === "bottom" || property === "left" || property.startsWith("inset") ? "inset" : property;
1022
+ }
1023
+ function writeStyleRecord(state, property, value, cursor, original, flags, conditionOverride = -1) {
1024
+ const condition = conditionOverride !== -1 ? conditionOverride : cursor ? cursor[conditionValue] : 0;
1025
+ const identity = cursor ? cursor[conditionKey] : "";
1016
1026
  const direct = state;
1017
- const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1018
- const identity = cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "";
1019
- if (property.charCodeAt(0) === 116 && property.startsWith("transition")) {
1020
- const transitions = direct.flatTransitions ||= [];
1021
- for (let index = 0; index < transitions.length; index++) if (transitions[index][0] === property && transitions[index][3] === identity) {
1022
- transitions[index][1] = value;
1023
- transitions[index][2] = condition;
1024
- return;
1027
+ const slots = direct.flatSlots ||= /* @__PURE__ */ new Map();
1028
+ const slot = canGenerateCSS && (state.flatShouldDoClasses || flags & recordCSS) ? styleSlot(property) : property.startsWith("transition") ? "transition" : property;
1029
+ let list = slots.get(slot);
1030
+ if (!list) slots.set(slot, list = []);
1031
+ for (let index = 0; index < list.length; index++) {
1032
+ const entry = list[index];
1033
+ const entryFlags = entry[7];
1034
+ if ((entryFlags & 17) !== (flags & 17)) continue;
1035
+ if (entry[0] !== property) continue;
1036
+ if (flags & recordDefault) {
1037
+ if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
1038
+ } else if (entryFlags & recordDefault && (!condition || entry[3] === identity)) {
1039
+ list.splice(index--, 1);
1040
+ continue;
1025
1041
  }
1026
- transitions.push([
1027
- property,
1028
- value,
1029
- condition,
1030
- identity,
1031
- cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "",
1032
- cursor ? conditionWrappers : void 0,
1033
- cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0,
1034
- cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0
1035
- ]);
1036
- return;
1037
- }
1038
- streamAtomic(state, property, value, condition, identity, cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0, false, original);
1039
- }
1040
- function streamWriteInline(state, property, value, cursor, merge, original, normalize = false, conditionOverride = -1) {
1041
- const direct = state;
1042
- const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1043
- const importance = condition ? Math.floor(condition / 256) + 1 : 0;
1044
- const used = direct.flatUsed ||= {};
1045
- const previous = used[property];
1046
- if (previous !== void 0 && previous > importance) return;
1047
- used[property] = importance;
1048
- merge(state, property, value, !normalize, original);
1049
- }
1050
- function streamRetractInline(state, property, cursor) {
1051
- const direct = state;
1052
- const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1053
- const importance = condition ? Math.floor(condition / 256) + 1 : 0;
1054
- const used = direct.flatUsed ||= {};
1055
- const previous = used[property];
1056
- if (previous !== void 0 && previous > importance) return;
1057
- used[property] = importance;
1058
- if (state.style) delete state.style[property];
1059
- }
1060
- function convertDeferredInline(state, merge) {
1061
- const direct = state;
1062
- const consume = (entries) => {
1063
- for (let index = 0; index < entries.length; index++) {
1064
- const entry = entries[index];
1065
- const condition = entry[2];
1066
- if (condition && !(condition & 1)) continue;
1067
- streamWriteInline(state, entry[0], entry[1], null, merge, entry[8] !== void 0 ? entry[8] : entry[1], false, condition);
1042
+ if (entry[3] === identity) {
1043
+ list.splice(index, 1);
1044
+ break;
1068
1045
  }
1069
- };
1070
- const slots = direct.flatSlots;
1071
- if (slots) {
1072
- direct.flatSlots = void 0;
1073
- for (const property in slots) consume(slots[property]);
1074
- }
1075
- const transitions = direct.flatTransitions;
1076
- if (transitions) {
1077
- direct.flatTransitions = void 0;
1078
- consume(transitions);
1079
1046
  }
1080
- direct.flatBorderDefaultRequests = void 0;
1047
+ list.push([
1048
+ property,
1049
+ value,
1050
+ condition,
1051
+ identity,
1052
+ cursor ? cursor[conditionSelector] : "",
1053
+ cursor ? cursor[conditionWrappers] : void 0,
1054
+ original,
1055
+ flags | (state.flatPass?.[passSourceLayer] || 0) << 5
1056
+ ]);
1057
+ }
1058
+ function streamWriteInline(state, property, value, cursor, original, normalize = property === "lineHeight", conditionOverride = -1, force = false) {
1059
+ writeStyleRecord(state, property, value, cursor, original, (normalize ? recordNormalize : 0) | (force ? recordInline : 0), conditionOverride);
1081
1060
  }
1082
- function completeStreaming(state, merge) {
1061
+ function completeResolvedStyles(state, merge = mergeStyle) {
1083
1062
  const direct = state;
1084
1063
  const shadow = direct.flatWebShadow;
1085
1064
  if (shadow && (direct.flatBoxShadowSequence || 0) <= shadow[4]) {
@@ -1090,264 +1069,83 @@ function completeStreaming(state, merge) {
1090
1069
  const color = normalizeColor(shadow[0], shadow[2] ?? 1);
1091
1070
  if (color) {
1092
1071
  const next = `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow[3])} ${color}`;
1093
- emitProperty(state, "boxShadow", direct.flatBoxShadow ? `${direct.flatBoxShadow}, ${next}` : next, null, merge, shadow[5], shadow[6]);
1072
+ emitProperty(state, "boxShadow", direct.flatBoxShadow ? `${direct.flatBoxShadow}, ${next}` : next, null, shadow[5], shadow[6]);
1094
1073
  }
1074
+ direct.flatWebShadow = void 0;
1095
1075
  }
1096
- completeStreamingCSS(state);
1076
+ if (state.flatShouldDoClasses && state.transformAccumulator) {
1077
+ const transform = finalizeTransformAccumulator(state.transformAccumulator);
1078
+ state.transformAccumulator = void 0;
1079
+ writeStyleRecord(state, "transform", Array.isArray(transform) ? transformsToString(transform) : transform, null, transform, 0);
1080
+ }
1081
+ const slots = direct.flatSlots;
1082
+ if (!slots) return;
1083
+ for (const [property, entries] of slots) {
1084
+ let cssEntries;
1085
+ let inlineWinner;
1086
+ let importance = -1;
1087
+ for (let index = 0; index < entries.length; index++) {
1088
+ const entry = entries[index];
1089
+ const flags = entry[7];
1090
+ if (flags & recordCSS || state.flatShouldDoClasses && !(flags & recordInline)) {
1091
+ cssEntries ||= [];
1092
+ const precedence = entry[2] ? Math.floor(entry[2] / 256) : -1;
1093
+ const layer = flags >> 5;
1094
+ let index2 = cssEntries.length;
1095
+ while (index2 > 0) {
1096
+ const before = cssEntries[index2 - 1];
1097
+ const beforeLayer = before[7] >> 5;
1098
+ if (beforeLayer < layer || beforeLayer === layer && (before[2] ? Math.floor(before[2] / 256) : -1) <= precedence) break;
1099
+ index2--;
1100
+ }
1101
+ if (index2 === cssEntries.length) cssEntries.push(entry);
1102
+ else cssEntries.splice(index2, 0, entry);
1103
+ } else if (!entry[2] || entry[2] & 1) {
1104
+ const next = entry[2] ? Math.floor(entry[2] / 256) : 0;
1105
+ if (next >= importance) {
1106
+ importance = next;
1107
+ inlineWinner = entry;
1108
+ }
1109
+ }
1110
+ }
1111
+ if (cssEntries) registerAtomicSlot(direct, property, cssEntries);
1112
+ if (inlineWinner) if (inlineWinner[7] & recordRetract) {
1113
+ if (state.style) delete state.style[inlineWinner[0]];
1114
+ } else merge(state, inlineWinner[0], inlineWinner[1], !(inlineWinner[7] & recordNormalize), inlineWinner[6] !== void 0 ? inlineWinner[6] : inlineWinner[1]);
1115
+ }
1116
+ direct.flatSlots = void 0;
1097
1117
  }
1098
- function emitAtParentCondition(state, property, value, merge, originalValue, contextOnly) {
1099
- emitValue(state, property, value, state.flatPass?.[passParentCursor] || null, merge, originalValue, contextOnly);
1118
+ function emitAtParentCondition(state, property, value, originalValue, contextOnly) {
1119
+ const cursor = state.flatPass?.[passParentCursor];
1120
+ if (cursor) emitUnderCondition(state, property, value, cursor, originalValue, contextOnly, 0, value);
1121
+ else emitValue(state, property, value, null, originalValue, contextOnly);
1100
1122
  }
1101
- function emitUnderCondition(state, property, value, cursor, merge, originalValue, contextOnly, warnMode, warnSource) {
1102
- const condition = conditionNumbers[cursor + conditionValueOffset];
1103
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
1104
- if (warnMode && process.env.NODE_ENV === "development") warnRefusedValue(property, warnSource, `unknown modifier "${conditionTexts[cursor + conditionUnresolvedNameOffset] || ""}"`);
1123
+ function emitUnderCondition(state, property, value, cursor, originalValue, contextOnly, warnMode, warnSource) {
1124
+ const condition = cursor[conditionValue];
1125
+ if (!(condition & conditionResolvedFlag)) {
1126
+ if (warnMode && process.env.NODE_ENV !== "production") warnRefusedValue(property, warnSource, `unknown modifier "${cursor.problem}"`);
1105
1127
  return 0;
1106
1128
  }
1107
- const unsupportedState = conditionTexts[cursor + conditionUnsupportedStateOffset] || "";
1108
- if (warnMode && unsupportedState && process.env.NODE_ENV === "development") warnOnce(`${property}: "${unsupportedState}:" has no native component-state source; dropping the clause`);
1109
- if (merge && property && condition & 2 && (condition & 1 || canGenerateCSS && state.flatShouldDoClasses || warnMode === 1 && false)) {
1110
- emitValue(state, property, value, cursor, merge, warnMode === 2 ? originalValue : originalValue ?? value, contextOnly);
1111
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
1112
- if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
1113
- if (flags & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
1114
- } else if (merge && property && condition & 2) {
1115
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
1116
- if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
1117
- if (flags & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
1129
+ emitValue(state, property, value, cursor, warnMode === 2 ? originalValue : originalValue ?? value, contextOnly);
1130
+ if (condition & 2) {
1131
+ if (condition & 4) state.flatHasEnterStyle = true;
1132
+ if (condition & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
1118
1133
  }
1119
1134
  return condition;
1120
1135
  }
1121
- const directStyleHandler = {
1122
- segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid, chainCount, _result, failure, failureIndex, property, merge, originalValue, contextOnly) {
1123
- if (isBase) {
1124
- if (start === end) return;
1125
- if (!valid) {
1126
- if (failure === "invalid-character" || failure === "stray-comment-close") return 16;
1127
- if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : "an unterminated \"(\"");
1128
- return;
1129
- }
1130
- const value = source.slice(start, end);
1131
- emitAtParentCondition(state, property, value, merge, value, contextOnly);
1132
- return 5;
1133
- }
1134
- if (!chainValid) {
1135
- if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
1136
- return;
1137
- }
1138
- if (start === end) {
1139
- if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, "a conditional clause has no value");
1140
- return;
1141
- }
1142
- if (property === "aspectRatio" && chainCount === 1) {
1143
- const left = Number(source.slice(chainStart, chainEnd));
1144
- const right = Number(source.slice(start, end));
1145
- if (chainStart < chainEnd && Number.isFinite(left) && left > 0 && Number.isFinite(right) && right > 0) return 12;
1146
- }
1147
- const cursor = state.flatScanCursor;
1148
- const condition = valid ? emitUnderCondition(state, property, source.slice(start, end), cursor, merge, void 0, contextOnly, 1, source) : conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0;
1149
- if (!condition) return;
1150
- if (!valid) {
1151
- if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
1152
- return;
1153
- }
1154
- return 4 | (condition & 12 ? 2 : 0);
1155
- },
1156
- modifier(state, start, end, valid, first, source) {
1157
- const directState = state;
1158
- let cursor = directState.flatScanCursor;
1159
- if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor(directState.flatPass?.[passParentCursor] || null);
1160
- else if (first) resetConditionCursor(cursor, directState.flatPass?.[passParentCursor] || null);
1161
- if (!valid) {
1162
- setConditionUnresolved(cursor);
1163
- return;
1164
- }
1165
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
1166
- },
1167
- chain(state, _start, _end, valid) {
1168
- const cursor = state.flatScanCursor;
1169
- if (cursor) {
1170
- if (!valid) setConditionUnresolved(cursor);
1171
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
1172
- }
1173
- return true;
1174
- },
1175
- end(state, source, result, lastPayloadStart, chainCount, property, merge, originalValue, contextOnly, failure, failureIndex) {
1176
- let hasBase = !!(result & 1);
1177
- if (result & 16) {
1178
- if (chainCount === 0) {
1179
- emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
1180
- hasBase = true;
1181
- } else if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
1182
- }
1183
- if (result & 8 && chainCount === 1) {
1184
- emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
1185
- hasBase = true;
1186
- }
1187
- if (process.env.NODE_ENV === "development" && !hasBase && result & 4 && property in propToTokenCategoryCode && splitComponents(source.slice(lastPayloadStart)).length > 1) warnOnce(`${property}="${source}" has multiple values after its first conditional. Write the base value before the first conditional.`);
1188
- if ((!canGenerateCSS || !state.flatShouldDoClasses) && result & 2 && !hasBase) {
1189
- const value = implicitLifecycleBase(property);
1190
- if (value !== null) emitAtParentCondition(state, property, value, merge, value, contextOnly);
1191
- }
1192
- }
1193
- };
1194
- function implicitLifecycleBase(property) {
1195
- return property === "opacity" || property === "scale" || property === "scaleX" || property === "scaleY" ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
1196
- }
1197
- const legacyTransformParts = /* @__PURE__ */ new Set([
1198
- "matrix",
1199
- "perspective",
1200
- "rotateX",
1201
- "rotateY",
1202
- "rotateZ",
1203
- "scaleZ",
1204
- "skewX",
1205
- "skewY"
1206
- ]);
1207
- const webShadowParts = {
1208
- shadowColor: 1,
1209
- shadowOffset: 2,
1210
- shadowOpacity: 3,
1211
- shadowRadius: 4
1212
- };
1213
- const webTextShadowParts = /* @__PURE__ */ new Set([
1214
- "textShadowColor",
1215
- "textShadowOffset",
1216
- "textShadowRadius"
1217
- ]);
1218
- const lineStyles = /* @__PURE__ */ new Set([
1219
- "none",
1220
- "hidden",
1221
- "dotted",
1222
- "dashed",
1223
- "solid",
1224
- "double",
1225
- "groove",
1226
- "ridge",
1227
- "inset",
1228
- "outset"
1229
- ]);
1230
- const borderTargets = {
1231
- border: {
1232
- width: [
1233
- "borderTopWidth",
1234
- "borderRightWidth",
1235
- "borderBottomWidth",
1236
- "borderLeftWidth"
1237
- ],
1238
- style: [
1239
- "borderTopStyle",
1240
- "borderRightStyle",
1241
- "borderBottomStyle",
1242
- "borderLeftStyle"
1243
- ],
1244
- color: [
1245
- "borderTopColor",
1246
- "borderRightColor",
1247
- "borderBottomColor",
1248
- "borderLeftColor"
1249
- ]
1250
- },
1251
- borderTop: {
1252
- width: ["borderTopWidth"],
1253
- style: ["borderTopStyle"],
1254
- color: ["borderTopColor"]
1255
- },
1256
- borderRight: {
1257
- width: ["borderRightWidth"],
1258
- style: ["borderRightStyle"],
1259
- color: ["borderRightColor"]
1260
- },
1261
- borderBottom: {
1262
- width: ["borderBottomWidth"],
1263
- style: ["borderBottomStyle"],
1264
- color: ["borderBottomColor"]
1265
- },
1266
- borderLeft: {
1267
- width: ["borderLeftWidth"],
1268
- style: ["borderLeftStyle"],
1269
- color: ["borderLeftColor"]
1270
- },
1271
- outline: {
1272
- width: ["outlineWidth"],
1273
- style: ["outlineStyle"],
1274
- color: ["outlineColor"]
1275
- },
1276
- borderBlock: {
1277
- width: ["borderBlockStartWidth", "borderBlockEndWidth"],
1278
- style: ["borderBlockStartStyle", "borderBlockEndStyle"],
1279
- color: ["borderBlockStartColor", "borderBlockEndColor"]
1280
- },
1281
- borderInline: {
1282
- width: ["borderInlineStartWidth", "borderInlineEndWidth"],
1283
- style: ["borderInlineStartStyle", "borderInlineEndStyle"],
1284
- color: ["borderInlineStartColor", "borderInlineEndColor"]
1285
- }
1136
+ const formatScanFailure = (failure, source, failureIndex) => failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"";
1137
+ const warnScanFailure = (property, source, failure, failureIndex) => {
1138
+ if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, formatScanFailure(failure, source, failureIndex));
1286
1139
  };
1287
- const tokenLookup = {
1288
- value: void 0,
1289
- fromTheme: false,
1290
- themeKey: ""
1291
- };
1292
- function fillTokenLookup(value, fromTheme, themeKey) {
1293
- tokenLookup.value = value;
1294
- tokenLookup.fromTheme = fromTheme;
1295
- tokenLookup.themeKey = themeKey;
1296
- return tokenLookup;
1297
- }
1298
- function tokenVariable(state, property, name) {
1299
- let lookupName = name.charCodeAt(0) === 36 ? name.slice(1) : name;
1300
- if (property === "fontFamily") {
1301
- const family = state.conf.fontsParsed[lookupName]?.family;
1302
- return family ? fillTokenLookup(family, false, lookupName) : void 0;
1303
- }
1304
- const fontKey = property === "fontSize" ? "size" : property === "fontWeight" ? "weight" : property === "lineHeight" || property === "letterSpacing" ? property : void 0;
1305
- if (fontKey) {
1306
- const value = (state.conf.fontsParsed[state.fontFamily || state.conf.defaultFontToken] || state.conf.fontsParsed[state.conf.defaultFontToken])?.[fontKey]?.[lookupName];
1307
- return value ? fillTokenLookup(value, false, lookupName) : void 0;
1308
- }
1309
- const category = getTokenCategoryForProperty(property);
1310
- const dot = lookupName.indexOf(".");
1311
- if (dot !== -1) {
1312
- const prefix = lookupName.slice(0, dot);
1313
- if (!category || prefix === category || prefix === "color") lookupName = lookupName.slice(dot + 1);
1314
- }
1315
- if (category) {
1316
- const own = state.conf.tokensParsed[category]?.[lookupName];
1317
- if (own) return fillTokenLookup(own, false, lookupName);
1318
- } else {
1319
- const first = lookupName.charCodeAt(0);
1320
- if (first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46) return;
1321
- }
1322
- const theme = state.theme?.[lookupName] || state.conf.themes?.[state.flatThemeName || ""]?.[lookupName];
1323
- if (theme) return fillTokenLookup(theme, true, lookupName);
1324
- if (category) return;
1325
- const token = state.conf.tokensParsed.space?.[lookupName] || state.conf.tokensParsed.color?.[lookupName];
1326
- return token ? fillTokenLookup(token, false, lookupName) : void 0;
1327
- }
1328
- let literalMissConf = null;
1329
- let literalMissRevision = -1;
1330
- let literalMisses = /* @__PURE__ */ new WeakMap();
1331
- const literalMissRootTheme = {};
1332
- function isFontKeyedProperty(property) {
1333
- return property === "fontFamily" || property === "fontSize" || property === "fontWeight" || property === "lineHeight" || property === "letterSpacing";
1334
- }
1335
- function literalMissSet(state) {
1336
- const revision = getConfigRevisionState(state.conf).revision;
1337
- if (state.conf !== literalMissConf || revision !== literalMissRevision) {
1338
- literalMissConf = state.conf;
1339
- literalMissRevision = revision;
1340
- literalMisses = /* @__PURE__ */ new WeakMap();
1341
- }
1342
- const themeKey = state.theme && typeof state.theme === "object" ? state.theme : literalMissRootTheme;
1343
- let set = literalMisses.get(themeKey);
1344
- if (!set) {
1345
- set = /* @__PURE__ */ new Set();
1346
- literalMisses.set(themeKey, set);
1347
- }
1348
- return set;
1349
- }
1350
- function configuredValue(state, property, raw) {
1140
+ let valueCacheConf;
1141
+ let valueCacheRevision = -1;
1142
+ let valueCaches = /* @__PURE__ */ new WeakMap();
1143
+ let valueCacheEntries = 0;
1144
+ const valueCacheRoot = {};
1145
+ const parsedSlices = /* @__PURE__ */ new WeakMap();
1146
+ const fontProperties = /* @__PURE__ */ new Map();
1147
+ function configuredValue(state, property, raw, embedded = false) {
1148
+ const grammar = getConfigRevisionState(state.conf);
1351
1149
  let name = raw;
1352
1150
  let opacity;
1353
1151
  const slash = raw.lastIndexOf("/");
@@ -1358,145 +1156,112 @@ function configuredValue(state, property, raw) {
1358
1156
  opacity = amount;
1359
1157
  }
1360
1158
  }
1361
- const safeArea = resolveSafeAreaVariable(name);
1159
+ const safeArea = grammar.safeAreaVariable(name);
1362
1160
  if (safeArea !== void 0) {
1363
1161
  state.flatUsesSafeArea = true;
1364
1162
  return safeArea;
1365
1163
  }
1366
- const cacheable = !isFontKeyedProperty(property);
1367
- let misses;
1368
- let missKey = "";
1369
- if (cacheable) {
1370
- misses = literalMissSet(state);
1371
- missKey = `${state.flatThemeName || ""}${property}${name}`;
1372
- if (misses.has(missKey)) return raw;
1164
+ let fontProperty = fontProperties.get(property);
1165
+ if (fontProperty === void 0) {
1166
+ fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
1167
+ fontProperties.set(property, fontProperty);
1373
1168
  }
1374
- if (process.env.NODE_ENV === "development") {
1375
- const category = getTokenCategoryForProperty(property);
1376
- if (category && category !== "color" && state.conf.tokensParsed.color?.[name]) warnOnce(`"${name}" contributes to "color", not "${property}"`);
1377
- }
1378
- const lookup = tokenVariable(state, property, name);
1379
- if (!lookup || !isVariable(lookup.value)) {
1380
- if (misses) misses.add(missKey);
1381
- return raw;
1169
+ const revision = grammar.revision;
1170
+ if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
1171
+ valueCacheConf = state.conf;
1172
+ valueCacheRevision = revision;
1173
+ valueCaches = /* @__PURE__ */ new WeakMap();
1174
+ valueCacheEntries = 0;
1175
+ state.flatValueScope = void 0;
1382
1176
  }
1383
1177
  const resolveValues = !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues;
1384
- if (resolveValues === "except-theme" && lookup.fromTheme) return `${THEME_REF_PREFIX}${lookup.themeKey}${opacity !== void 0 ? `/${opacity}` : ""}`;
1385
- let value = resolveVariableValue(property, lookup.value, resolveValues);
1386
- if (opacity !== void 0) value = `color-mix(in srgb, ${value} ${opacity}%, transparent)`;
1387
- return value;
1388
- }
1389
- function resolveEmbeddedTokens(state, property, raw) {
1390
- let copyFrom = 0;
1391
- let out = "";
1392
- let quote = 0;
1393
- for (let index = 0; index < raw.length; index++) {
1394
- const code = raw.charCodeAt(index);
1395
- if (quote) {
1396
- if (code === 92) index++;
1397
- else if (code === quote) quote = 0;
1398
- continue;
1399
- }
1400
- if (code === 34 || code === 39) {
1401
- quote = code;
1402
- continue;
1403
- }
1404
- if (!(code === 36 || code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122)) continue;
1405
- let end = index + 1;
1406
- while (end < raw.length) {
1407
- const next = raw.charCodeAt(end);
1408
- if (next === 36 || next === 45 || next === 46 || next === 95 || next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122) end++;
1409
- else break;
1410
- }
1411
- if (raw.charCodeAt(end) === 47) {
1412
- let suffix = end + 1;
1413
- while (suffix < raw.length) {
1414
- const next = raw.charCodeAt(suffix);
1415
- if (next < 48 || next > 57) break;
1416
- suffix++;
1417
- }
1418
- if (suffix > end + 1) end = suffix;
1419
- }
1420
- const before = raw.charCodeAt(index - 1);
1421
- if (code !== 36 && (before >= 48 && before <= 57 || before === 35 || before === 45 && raw.charCodeAt(index - 2) === 45 || raw.charCodeAt(end) === 40)) {
1422
- index = end - 1;
1423
- continue;
1424
- }
1425
- const word = raw.slice(index, end);
1426
- const value = configuredValue(state, property, word);
1427
- if (value !== word) {
1428
- out += raw.slice(copyFrom, index);
1429
- out += String(value);
1430
- copyFrom = end;
1431
- }
1432
- index = end - 1;
1178
+ const direct = state;
1179
+ let scope = direct.flatValueScope;
1180
+ if (scope === void 0 || direct.flatValueScopeKind !== resolveValues) {
1181
+ const themeObject = state.theme && typeof state.theme === "object" ? state.theme : valueCacheRoot;
1182
+ let byScope = valueCaches.get(themeObject);
1183
+ if (!byScope) valueCaches.set(themeObject, byScope = /* @__PURE__ */ new Map());
1184
+ const scopeKey = `${state.flatThemeName || ""}${resolveValues}`;
1185
+ scope = byScope.get(scopeKey);
1186
+ if (!scope) byScope.set(scopeKey, scope = /* @__PURE__ */ new Map());
1187
+ direct.flatValueScope = scope;
1188
+ direct.flatValueScopeKind = resolveValues;
1189
+ }
1190
+ let maps = scope.get(property);
1191
+ if (maps === void 0) scope.set(property, maps = { direct: /* @__PURE__ */ new Map() });
1192
+ const byRaw = embedded ? maps.embedded ||= /* @__PURE__ */ new Map() : maps.direct;
1193
+ if (!fontProperty) {
1194
+ const known = byRaw.get(raw);
1195
+ if (known !== void 0 || byRaw.has(raw)) return known;
1433
1196
  }
1434
- return copyFrom ? out + raw.slice(copyFrom) : raw;
1435
- }
1436
- function normalizeTransitionNames(state, raw) {
1437
- let quote = 0;
1438
- let depth = 0;
1439
- let copyFrom = 0;
1440
- let out = "";
1441
- for (let index = 0; index < raw.length; index++) {
1442
- const code = raw.charCodeAt(index);
1443
- if (quote) {
1444
- if (code === 92) index++;
1445
- else if (code === quote) quote = 0;
1446
- continue;
1447
- }
1448
- if (code === 34 || code === 39) {
1449
- quote = code;
1450
- continue;
1451
- }
1452
- if (code === 40) {
1453
- depth++;
1454
- continue;
1455
- }
1456
- if (code === 41) {
1457
- depth--;
1458
- continue;
1459
- }
1460
- if (depth || !(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 95) || index > 1 && raw.charCodeAt(index - 1) === 45 && raw.charCodeAt(index - 2) === 45) continue;
1461
- let end = index + 1;
1462
- while (end < raw.length) {
1463
- const next = raw.charCodeAt(end);
1464
- if (next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 45 || next === 95) end++;
1465
- else break;
1466
- }
1467
- if (raw.charCodeAt(end) !== 40) {
1468
- const authored = raw.slice(index, end);
1469
- let property = state.conf.shorthands[authored] || authored;
1470
- if (property === "x" || property === "y") property = "translate";
1471
- else if (property === "scaleX" || property === "scaleY") property = "scale";
1472
- else if (legacyTransformParts.has(property)) property = "transform";
1473
- let hasUpper = false;
1474
- for (let offset = 0; offset < property.length; offset++) {
1475
- const letter = property.charCodeAt(offset);
1476
- if (letter >= 65 && letter <= 90) {
1477
- hasUpper = true;
1478
- break;
1479
- }
1197
+ let lookupName = name.charCodeAt(0) === 36 ? name.slice(1) : name;
1198
+ let value;
1199
+ let fromTheme = false;
1200
+ if (property === "fontFamily") value = state.conf.fontsParsed[lookupName]?.family;
1201
+ else {
1202
+ const fontKey = property === "fontSize" ? "size" : property === "fontWeight" ? "weight" : property === "lineHeight" || property === "letterSpacing" ? property : "";
1203
+ if (fontKey) value = (state.conf.fontsParsed[state.fontFamily || state.conf.defaultFontToken] || state.conf.fontsParsed[state.conf.defaultFontToken])?.[fontKey]?.[lookupName];
1204
+ else {
1205
+ const category = grammar.tokenCategory(property);
1206
+ const dot = lookupName.indexOf(".");
1207
+ if (dot !== -1) {
1208
+ const prefix = lookupName.slice(0, dot);
1209
+ if (!category || prefix === category || prefix === "color") lookupName = lookupName.slice(dot + 1);
1480
1210
  }
1481
- if (property !== authored || hasUpper) {
1482
- out += raw.slice(copyFrom, index);
1483
- for (let offset = 0; offset < property.length; offset++) {
1484
- const letter = property.charCodeAt(offset);
1485
- out += letter >= 65 && letter <= 90 ? `-${String.fromCharCode(letter + 32)}` : property[offset];
1211
+ value = category ? state.conf.tokensParsed[category]?.[lookupName] : void 0;
1212
+ if (!value) {
1213
+ const first = lookupName.charCodeAt(0);
1214
+ if (category || !(first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46)) {
1215
+ value = state.theme?.[lookupName] || state.conf.themes?.[state.flatThemeName || ""]?.[lookupName];
1216
+ fromTheme = !!value;
1217
+ if (!value && !category) value = state.conf.tokensParsed.space?.[lookupName] || state.conf.tokensParsed.color?.[lookupName];
1486
1218
  }
1487
- copyFrom = end;
1488
1219
  }
1489
1220
  }
1490
- index = end - 1;
1491
1221
  }
1492
- return copyFrom ? out + raw.slice(copyFrom) : raw;
1222
+ if (process.env.NODE_ENV === "development") {
1223
+ const category = grammar.tokenCategory(property);
1224
+ if (category && category !== "color" && state.conf.tokensParsed.color?.[name]) warnOnce(`"${name}" contributes to "color", not "${property}"`);
1225
+ }
1226
+ let out = raw;
1227
+ if (isVariable(value)) {
1228
+ out = resolveValues === "except-theme" && fromTheme ? `${THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : resolveVariableValue(property, value, resolveValues);
1229
+ if (opacity !== void 0) out = `color-mix(in srgb, ${out} ${opacity}%, transparent)`;
1230
+ }
1231
+ if (embedded && out === raw) {
1232
+ const usedSafeArea = state.flatUsesSafeArea;
1233
+ out = grammar.embeddedTokens(raw, (word) => configuredValue(state, property, word));
1234
+ if (!usedSafeArea && state.flatUsesSafeArea) return out;
1235
+ }
1236
+ if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
1237
+ valueCaches = /* @__PURE__ */ new WeakMap();
1238
+ valueCacheEntries = 0;
1239
+ } else {
1240
+ valueCacheEntries++;
1241
+ byRaw.set(raw, out);
1242
+ }
1243
+ return out;
1493
1244
  }
1494
- function getDirectDynamicThemeAccess(state) {
1495
- return state.flatDynamicThemeAccess;
1245
+ function ownsSourceLayer(state, property, conditional = false) {
1246
+ const direct = state;
1247
+ const layer = direct.flatPass?.[passSourceLayer] || 0;
1248
+ const layers = direct.flatPropertyLayers ||= /* @__PURE__ */ new Map();
1249
+ const previous = layers.get(property);
1250
+ if (previous !== void 0) {
1251
+ if (previous > layer) return false;
1252
+ if (previous < layer) {
1253
+ if (conditional) return true;
1254
+ clearDirectStyle(state, property);
1255
+ }
1256
+ } else if (conditional) return true;
1257
+ layers.set(property, layer);
1258
+ return true;
1496
1259
  }
1497
- function emitProperty(state, property, value, cursor, merge, originalValue, contextOnly) {
1260
+ function emitProperty(state, property, value, cursor, originalValue, contextOnly) {
1261
+ if (!ownsSourceLayer(state, property, cursor !== null)) return;
1498
1262
  const direct = state;
1499
- const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1263
+ const condition = cursor ? cursor[conditionValue] : 0;
1264
+ if (condition && (!(condition & 2) || !(condition & 1) && !(canGenerateCSS && state.flatShouldDoClasses) && true)) return;
1500
1265
  if (value === false && !condition) {
1501
1266
  clearDirectStyle(state, property);
1502
1267
  if (direct.flatStyleStaticConfig?.styledContextKeys?.has(property)) (state.overriddenContextProps ||= {})[property] = false;
@@ -1504,7 +1269,7 @@ function emitProperty(state, property, value, cursor, merge, originalValue, cont
1504
1269
  }
1505
1270
  if (condition & 4) (state.flatEnterKeys ||= /* @__PURE__ */ new Set()).add(property);
1506
1271
  if (condition & 8) (state.flatExitKeys ||= /* @__PURE__ */ new Set()).add(property);
1507
- cursor && conditionTexts[cursor + conditionThemeOffset];
1272
+ cursor && cursor[conditionTheme];
1508
1273
  if (contextOnly) {
1509
1274
  if (!condition || condition & 1) (state.overriddenContextProps ||= {})[property] = originalValue;
1510
1275
  return;
@@ -1517,34 +1282,10 @@ function emitProperty(state, property, value, cursor, merge, originalValue, cont
1517
1282
  }
1518
1283
  const shouldPromoteAnimatedStyle = canGenerateCSS && !condition && !state.flatShouldDoClasses && !state.styleProps.noMergeStyle && state.styleProps.isAnimated && state.animationDriver?.inputStyle === "css" && property in nonAnimatableStyleProps;
1519
1284
  if (canGenerateCSS && (state.flatShouldDoClasses || shouldPromoteAnimatedStyle)) {
1520
- if (!condition && state.style && !(direct.flatUsed && direct.flatUsed[property])) delete state.style[property];
1521
- streamWriteCSS(state, property, value, cursor, originalValue);
1285
+ writeStyleRecord(state, property, value, cursor, originalValue, shouldPromoteAnimatedStyle ? recordCSS : 0);
1522
1286
  return;
1523
1287
  }
1524
- if (condition && !(condition & 1)) return;
1525
- streamWriteInline(state, property, value, cursor, merge, originalValue);
1526
- }
1527
- function splitComponents(value) {
1528
- const parts = [];
1529
- let start = 0;
1530
- let quote = 0;
1531
- let depth = 0;
1532
- for (let index = 0; index <= value.length; index++) {
1533
- const code = index === value.length ? 32 : value.charCodeAt(index);
1534
- if (quote) {
1535
- if (code === 92) index++;
1536
- else if (code === quote) quote = 0;
1537
- continue;
1538
- }
1539
- if (code === 34 || code === 39) quote = code;
1540
- else if (code === 40) depth++;
1541
- else if (code === 41) depth--;
1542
- else if (!depth && code <= 32) {
1543
- if (index > start) parts.push(value.slice(start, index));
1544
- start = index + 1;
1545
- }
1546
- }
1547
- return parts;
1288
+ streamWriteInline(state, property, value, cursor, originalValue);
1548
1289
  }
1549
1290
  function numericUnitValue(value, first, second) {
1550
1291
  const unitLength = value.endsWith(first) || second !== void 0 && value.endsWith(second) ? first.length : 0;
@@ -1552,126 +1293,19 @@ function numericUnitValue(value, first, second) {
1552
1293
  const numeric = Number(value.slice(0, value.length - unitLength));
1553
1294
  return Number.isFinite(numeric) ? numeric : NaN;
1554
1295
  }
1555
- function isNumericCSSComponent(value) {
1556
- let index = 0;
1557
- if (value.charCodeAt(index) === 43 || value.charCodeAt(index) === 45) index++;
1558
- let digits = 0;
1559
- let dot = false;
1560
- for (; index < value.length; index++) {
1561
- const code = value.charCodeAt(index);
1562
- if (code >= 48 && code <= 57) {
1563
- digits++;
1564
- continue;
1565
- }
1566
- if (code === 46 && !dot) {
1567
- dot = true;
1568
- continue;
1569
- }
1570
- break;
1571
- }
1572
- if (!digits) return false;
1573
- for (; index < value.length; index++) {
1574
- const code = value.charCodeAt(index);
1575
- if (code !== 37 && (code < 97 || code > 122)) return false;
1576
- }
1577
- return true;
1578
- }
1579
- function startsValueFunction(value) {
1580
- let index = 0;
1581
- while (index < value.length) {
1582
- const code = value.charCodeAt(index);
1583
- if (code === 45 || code >= 97 && code <= 122) {
1584
- index++;
1585
- continue;
1586
- }
1587
- break;
1588
- }
1589
- return index > 0 && value.charCodeAt(index) === 40;
1590
- }
1591
- function emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly) {
1592
- let width;
1593
- let style;
1594
- let color;
1595
- for (const part of splitComponents(raw)) if (lineStyles.has(part) || property === "outline" && part === "auto") style = part;
1596
- else if (part === "thin" || part === "medium" || part === "thick" || isNumericCSSComponent(part) || startsValueFunction(part)) width = part;
1597
- else color = part;
1598
- if (style === "none" && width === void 0) width = "0";
1599
- const targets = borderTargets[property];
1600
- if (width !== void 0) for (const target of targets.width) emitResolved(state, target, width, cursor, merge, originalValue, contextOnly);
1601
- if (style !== void 0) {
1602
- const styleTargets = targets.style;
1603
- for (const target of styleTargets) emitProperty(state, target, style, cursor, merge, originalValue, contextOnly);
1604
- }
1605
- if (color !== void 0) for (const target of targets.color) emitResolved(state, target, color, cursor, merge, originalValue, contextOnly);
1606
- }
1607
- function emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly) {
1608
- for (const part of splitComponents(raw)) emitResolved(state, part === "solid" || part === "double" || part === "dotted" || part === "dashed" || part === "wavy" ? "textDecorationStyle" : part === "underline" || part === "overline" || part === "line-through" || part === "none" ? "textDecorationLine" : "textDecorationColor", part, cursor, merge, originalValue, contextOnly);
1609
- }
1610
- function emitTransform(state, property, value, cursor, merge, originalValue, contextOnly) {
1611
- if (!canGenerateCSS || !state.flatShouldDoClasses) {
1612
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
1613
- return;
1614
- }
1615
- const targets = property === "scale" ? ["--t-scale-x", "--t-scale-y"] : [property === "x" ? "--t-x" : property === "y" ? "--t-y" : property === "scaleX" ? "--t-scale-x" : property === "scaleY" ? "--t-scale-y" : "rotate"];
1616
- for (const target of targets) {
1617
- let targetValue = value;
1618
- if (typeof targetValue === "number") {
1619
- if (target === "--t-x" || target === "--t-y") targetValue = `${targetValue}px`;
1620
- else if (target === "rotate") targetValue = `${targetValue}deg`;
1621
- }
1622
- emitProperty(state, target, targetValue, cursor, merge, originalValue, contextOnly);
1623
- if (target === "--t-x" || target === "--t-y") addComposition(state, "translate");
1624
- else if (target.startsWith("--t-scale")) addComposition(state, "scale");
1625
- }
1626
- }
1627
- function emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly) {
1628
- let value = configuredValue(state, property, raw);
1629
- if (value === raw) value = resolveEmbeddedTokens(state, property, raw);
1296
+ function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
1297
+ let value = configuredValue(state, property, raw, true);
1630
1298
  if (!state.flatShouldDoClasses && typeof value === "string") {
1631
1299
  const unitValue = numericUnitValue(value, "px", "dp");
1632
1300
  if (Number.isFinite(unitValue)) value = unitValue;
1633
1301
  else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
1634
1302
  }
1635
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
1303
+ emitProperty(state, property, value, cursor, originalValue, contextOnly);
1636
1304
  }
1637
- const emitKindTransition = 1;
1638
- const emitKindTransformPart = 2;
1639
- const emitKindWebShadow = 3;
1640
- const emitKindWebTextShadow = 4;
1641
- const emitKindTransform = 5;
1642
- const emitKindBorder = 6;
1643
- const emitKindTextDecoration = 7;
1644
- const emitKindBackground = 8;
1645
- const emitKindAxis = 9;
1646
- const emitKindBorderRadius = 10;
1647
- const emitKindBorderWidth = 11;
1648
- const emitValueKinds = {
1649
- transition: emitKindTransition,
1650
- transitionProperty: emitKindTransition,
1651
- transform: emitKindTransform,
1652
- textDecoration: emitKindTextDecoration,
1653
- background: emitKindBackground,
1654
- x: emitKindAxis,
1655
- y: emitKindAxis,
1656
- scale: emitKindAxis,
1657
- scaleX: emitKindAxis,
1658
- scaleY: emitKindAxis,
1659
- rotate: emitKindAxis,
1660
- borderRadius: emitKindBorderRadius,
1661
- borderWidth: emitKindBorderWidth,
1662
- borderTopWidth: emitKindBorderWidth,
1663
- borderRightWidth: emitKindBorderWidth,
1664
- borderBottomWidth: emitKindBorderWidth,
1665
- borderLeftWidth: emitKindBorderWidth
1666
- };
1667
- for (const part of legacyTransformParts) emitValueKinds[part] = emitKindTransformPart;
1668
- for (const part in webShadowParts) emitValueKinds[part] = emitKindWebShadow;
1669
- for (const part of webTextShadowParts) emitValueKinds[part] = emitKindWebTextShadow;
1670
- for (const target in borderTargets) emitValueKinds[target] = emitKindBorder;
1671
1305
  function shadowUnit(part) {
1672
1306
  return typeof part === "number" ? `${part}px` : part || "0px";
1673
1307
  }
1674
- function emitWebTextShadow(state, property, value, merge, originalValue, contextOnly) {
1308
+ function emitWebTextShadow(state, property, value, originalValue, contextOnly) {
1675
1309
  const shadow = state.flatTextShadow ||= {};
1676
1310
  shadow[property] = value;
1677
1311
  const offset = shadow.textShadowOffset || {
@@ -1679,100 +1313,97 @@ function emitWebTextShadow(state, property, value, merge, originalValue, context
1679
1313
  height: 0
1680
1314
  };
1681
1315
  if (!shadow.textShadowColor) return;
1682
- emitProperty(state, "textShadow", `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow.textShadowRadius)} ${shadow.textShadowColor}`, null, merge, originalValue, contextOnly);
1316
+ emitProperty(state, "textShadow", `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow.textShadowRadius)} ${shadow.textShadowColor}`, null, originalValue, contextOnly);
1683
1317
  }
1684
- function emitValue(state, property, raw, cursor, merge, originalValue, contextOnly) {
1685
- const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1318
+ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
1319
+ const condition = cursor ? cursor[conditionValue] : 0;
1320
+ const grammar = getConfigRevisionState(state.conf);
1321
+ property = webStyleProperty(property);
1322
+ if (property === "backdropFilter") emitValue(state, "WebkitBackdropFilter", raw, cursor, originalValue, contextOnly);
1686
1323
  if (isVariable(raw)) raw = resolveVariableValue(property, raw, !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues);
1687
- const emitKind = emitValueKinds[property];
1688
- if (emitKind !== void 0) switch (emitKind) {
1689
- case emitKindTransition:
1690
- if (typeof raw === "string") raw = normalizeTransitionNames(state, raw);
1691
- break;
1692
- case emitKindBorderWidth:
1693
- requestBorderStyleDefault(state, property, condition, cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "", cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0);
1694
- break;
1695
- case emitKindTransformPart: {
1696
- const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1697
- if (canGenerateCSS && state.flatShouldDoClasses && !condition) {
1698
- state.transformAccumulator ||= createTransformAccumulator();
1699
- addTransformValue(state.transformAccumulator, property, value2);
1700
- } else if (condition && canGenerateCSS && state.flatShouldDoClasses) emitProperty(state, "transform", `${property}(${value2})`, cursor, merge, originalValue, contextOnly);
1701
- else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
1324
+ if (typeof raw === "string" && (property === "transition" || property === "transitionProperty")) raw = grammar.normalizeTransition(raw);
1325
+ if ((property === "borderWidth" || property === "borderTopWidth" || property === "borderRightWidth" || property === "borderBottomWidth" || property === "borderLeftWidth") && state.styleProps.noNormalize !== false) writeStyleRecord(state, property.slice(0, -5) + "Style", "solid", cursor, originalValue, recordDefault);
1326
+ const propertyKind = grammar.propertyKind(property);
1327
+ if (propertyKind >= 7 && typeof raw === "string") {
1328
+ const composite = grammar.compositeValue(property, raw, state, configuredValue);
1329
+ if (composite !== void 0) {
1330
+ emitProperty(state, property, composite, cursor, originalValue, contextOnly);
1702
1331
  return;
1703
1332
  }
1704
- case emitKindWebShadow: {
1333
+ }
1334
+ if (propertyKind === 5) {
1335
+ const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1336
+ if (canGenerateCSS && state.flatShouldDoClasses && !condition) {
1337
+ state.transformAccumulator ||= createTransformAccumulator();
1338
+ addTransformValue(state.transformAccumulator, property, value2);
1339
+ } else if (condition && canGenerateCSS && state.flatShouldDoClasses) emitProperty(state, "transform", `${property}(${value2})`, cursor, originalValue, contextOnly);
1340
+ else streamWriteInline(state, property, value2, cursor, originalValue, true);
1341
+ return;
1342
+ }
1343
+ {
1344
+ const webShadowPart = propertyKind < 5 ? propertyKind : 0;
1345
+ if (webShadowPart || propertyKind === 6) {
1705
1346
  const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1706
- if (canGenerateCSS && state.flatShouldDoClasses) {
1347
+ if (state.styleProps.noNormalize !== false) if (webShadowPart) {
1707
1348
  const shadow = state.flatWebShadow ||= [];
1708
- shadow[webShadowParts[property] - 1] = value2;
1349
+ shadow[webShadowPart - 1] = value2;
1709
1350
  shadow[4] = ++frameSequence;
1710
1351
  shadow[5] = originalValue;
1711
1352
  shadow[6] = contextOnly;
1712
- } else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
1353
+ } else emitWebTextShadow(state, property, value2, originalValue, contextOnly);
1354
+ else streamWriteInline(state, property, value2, cursor, originalValue, true, -1, true);
1713
1355
  return;
1714
1356
  }
1715
- case emitKindWebTextShadow: {
1716
- const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1717
- if (canGenerateCSS && state.flatShouldDoClasses) emitWebTextShadow(state, property, value2, merge, originalValue, contextOnly);
1718
- else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
1357
+ }
1358
+ if (property === "transform") {
1359
+ if (canGenerateCSS && state.flatShouldDoClasses && Array.isArray(raw)) raw = transformsToString(raw);
1360
+ }
1361
+ if (typeof raw === "string" && property === "background") {
1362
+ const parts = splitComponents(raw);
1363
+ if (parts.length === 1 && !startsValueFunction(parts[0])) {
1364
+ emitResolved(state, "backgroundColor", parts[0], cursor, originalValue, contextOnly);
1719
1365
  return;
1720
1366
  }
1721
- case emitKindTransform:
1722
- if (canGenerateCSS && state.flatShouldDoClasses && Array.isArray(raw)) raw = transformsToString(raw);
1723
- break;
1724
- case emitKindBorder:
1725
- if (typeof raw === "string") {
1726
- emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly);
1727
- return;
1728
- }
1729
- break;
1730
- case emitKindTextDecoration:
1731
- if (typeof raw === "string") {
1732
- emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly);
1733
- return;
1734
- }
1735
- break;
1736
- case emitKindBackground:
1737
- if (typeof raw === "string") {
1738
- const parts = splitComponents(raw);
1739
- if (parts.length === 1 && !startsValueFunction(parts[0])) {
1740
- emitResolved(state, "backgroundColor", parts[0], cursor, merge, originalValue, contextOnly);
1741
- return;
1742
- }
1743
- }
1744
- break;
1745
- case emitKindAxis: {
1746
- let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1747
- if (!state.flatShouldDoClasses && typeof value2 === "string" && !value2.startsWith(THEME_REF_PREFIX)) {
1748
- if (property === "rotate" && !Number.isFinite(numericUnitValue(value2, "deg", "rad"))) {
1749
- if (process.env.NODE_ENV === "development") warnOnce(`native transform "${property}" cannot represent "${value2}"; dropping it`);
1750
- if (condition & 1) {
1751
- removeTransformValue(state.transformAccumulator, property);
1752
- streamRetractInline(state, property, cursor);
1753
- }
1754
- return;
1367
+ }
1368
+ if (property === "x" || property === "y" || property === "scale" || property === "scaleX" || property === "scaleY" || property === "rotate") {
1369
+ let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
1370
+ if (!state.flatShouldDoClasses && typeof value2 === "string" && !value2.startsWith(THEME_REF_PREFIX)) {
1371
+ if (property === "rotate" && !Number.isFinite(numericUnitValue(value2, "deg", "rad"))) {
1372
+ if (process.env.NODE_ENV === "development") warnOnce(`native transform "${property}" cannot represent "${value2}"; dropping it`);
1373
+ if (condition & 1) {
1374
+ removeTransformValue(state.transformAccumulator, property);
1375
+ writeStyleRecord(state, property, void 0, cursor, void 0, recordRetract);
1755
1376
  }
1756
- const unitValue = numericUnitValue(value2, "px", "dp");
1757
- if (Number.isFinite(unitValue)) value2 = unitValue;
1758
- else if (Number.isFinite(Number(value2))) value2 = Number(value2);
1377
+ return;
1759
1378
  }
1760
- emitTransform(state, property, value2, cursor, merge, originalValue, contextOnly);
1379
+ const unitValue = numericUnitValue(value2, "px", "dp");
1380
+ if (Number.isFinite(unitValue)) value2 = unitValue;
1381
+ else if (Number.isFinite(Number(value2))) value2 = Number(value2);
1382
+ }
1383
+ if (!canGenerateCSS || !state.flatShouldDoClasses) {
1384
+ emitProperty(state, property, value2, cursor, originalValue, contextOnly);
1761
1385
  return;
1762
1386
  }
1763
- case emitKindBorderRadius:
1764
- if (!state.flatShouldDoClasses && !condition) {
1765
- if (typeof raw === "string") emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly);
1766
- else emitProperty(state, property, raw, cursor, merge, originalValue, contextOnly);
1767
- return;
1387
+ const targets = property === "scale" ? ["--t-scale-x", "--t-scale-y"] : [property === "x" ? "--t-x" : property === "y" ? "--t-y" : property === "scaleX" ? "--t-scale-x" : property === "scaleY" ? "--t-scale-y" : "rotate"];
1388
+ for (const target of targets) {
1389
+ let targetValue = value2;
1390
+ if (typeof targetValue === "number") {
1391
+ if (target === "--t-x" || target === "--t-y") targetValue = `${targetValue}px`;
1392
+ else if (target === "rotate") targetValue = `${targetValue}deg`;
1768
1393
  }
1769
- break;
1394
+ emitProperty(state, target, targetValue, cursor, originalValue, contextOnly);
1395
+ if (target === "--t-x" || target === "--t-y") addComposition(state, "translate");
1396
+ else if (target.startsWith("--t-scale")) addComposition(state, "scale");
1397
+ }
1398
+ return;
1770
1399
  }
1771
- let value = raw;
1772
- if (typeof raw === "string") {
1773
- value = configuredValue(state, property, raw);
1774
- if (value === raw) value = resolveEmbeddedTokens(state, property, raw);
1400
+ if (property === "borderRadius" && !state.flatShouldDoClasses && !condition) {
1401
+ if (typeof raw === "string") emitResolved(state, property, raw, cursor, originalValue, contextOnly);
1402
+ else emitProperty(state, property, raw, cursor, originalValue, contextOnly);
1403
+ return;
1775
1404
  }
1405
+ let value = raw;
1406
+ if (typeof raw === "string") value = configuredValue(state, property, raw, true);
1776
1407
  if (!state.flatShouldDoClasses && typeof value === "string") {
1777
1408
  const unitValue = numericUnitValue(value, "px", "dp");
1778
1409
  if (Number.isFinite(unitValue)) value = unitValue;
@@ -1782,448 +1413,146 @@ function emitValue(state, property, raw, cursor, merge, originalValue, contextOn
1782
1413
  state.flatBoxShadow = value;
1783
1414
  state.flatBoxShadowSequence = frameSequence + 1;
1784
1415
  }
1785
- const expanded = state.styleProps.noExpand ? null : expandStyle(property, value, state.conf.settings.styleCompat || "web");
1786
- if (!expanded) {
1787
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
1788
- return;
1789
- }
1790
- if (typeof raw === "string" && expanded.length > 1) {
1791
- const parts = splitComponents(raw);
1792
- if (parts.length > 0 && parts.length <= (expanded.length === 4 ? 4 : 2)) {
1793
- for (let index = 0; index < expanded.length; index++) {
1794
- const partIndex = index === 0 || parts.length === 1 ? 0 : index === 1 || index === 3 && parts.length < 4 ? 1 : index === 2 && parts.length < 3 ? 0 : index;
1795
- emitResolved(state, expanded[index][0], parts[partIndex], cursor, merge, originalValue, contextOnly);
1796
- }
1797
- return;
1798
- }
1799
- }
1800
- for (let index = 0; index < expanded.length; index++) emitProperty(state, expanded[index][0], expanded[index][1], cursor, merge, originalValue, contextOnly);
1801
- }
1802
- function contributeStyleString(state, property, source, merge, originalValue, contextOnly = false) {
1803
- const directState = state;
1804
- const watermark = conditionCursorTop;
1805
- const previousCursor = directState.flatScanCursor;
1806
- const previousExpectMulti = directState.flatExpectMulti;
1807
- directState.flatScanCursor = null;
1808
- directState.flatExpectMulti = source.indexOf(":") !== -1;
1809
- try {
1810
- scanFlatValue(source, directStyleHandler, state, property, merge, originalValue, contextOnly);
1811
- } finally {
1812
- directState.flatScanCursor = previousCursor;
1813
- directState.flatExpectMulti = previousExpectMulti;
1814
- releaseConditionCursors(watermark);
1416
+ if (!state.styleProps.noExpand && property === "flex" && typeof value === "number") {
1417
+ const compat = state.conf.settings.styleCompat;
1418
+ value = value === -1 ? "0 auto" : compat === "legacy" ? `${value} auto` : compat && compat !== "web" ? value > 0 ? `${value} 0 0` : `0 ${-value} auto` : value < 0 ? value : `${value} 0px`;
1815
1419
  }
1816
- return true;
1420
+ emitProperty(state, property, value, cursor, originalValue, contextOnly);
1817
1421
  }
1818
- function contributeStyleObject(state, property, value, merge, contextOnly) {
1819
- const outerState = state;
1820
- const previousExpectMulti = outerState.flatExpectMulti;
1821
- outerState.flatExpectMulti = true;
1822
- try {
1823
- return contributeStyleObjectInner(state, property, value, merge, contextOnly);
1824
- } finally {
1825
- outerState.flatExpectMulti = previousExpectMulti;
1826
- }
1827
- }
1828
- function contributeStyleObjectInner(state, property, value, merge, contextOnly) {
1829
- const parent = state.flatPass?.[passParentCursor] || null;
1830
- const hasDefault = "default" in value;
1422
+ function walkConditionalValue(state, property, value, parent, sink, warnMode = 0) {
1423
+ const parentCondition = parent || null;
1831
1424
  let hasBase = false;
1832
- const base = hasDefault ? value.default : void 0;
1833
- if (base != null) {
1834
- emitAtParentCondition(state, property, base, merge, base, contextOnly);
1835
- hasBase = true;
1836
- }
1837
1425
  let conditions = 0;
1838
- let firstCondition = !hasDefault;
1839
- for (const key in value) {
1840
- if (key === "default") continue;
1841
- const payload = value[key];
1842
- const watermark = conditionCursorTop;
1843
- const cursor = acquireConditionCursor(parent);
1844
- resolveConditionText(state, cursor, key);
1845
- const condition = commitConditionCursor(state, cursor);
1846
- if (firstCondition) {
1847
- firstCondition = false;
1848
- if (!condition) {
1849
- releaseConditionCursors(watermark);
1850
- return false;
1426
+ let lastPayload = "";
1427
+ if (typeof value === "string") {
1428
+ const parsed = getConfigRevisionState(state.conf).parseFlatValue(value);
1429
+ const [segments, failure, failureIndex] = parsed;
1430
+ let slices = parsedSlices.get(parsed);
1431
+ if (slices === void 0) parsedSlices.set(parsed, slices = []);
1432
+ const chainCount = segments.length / 5 - 1;
1433
+ if (property === "aspectRatio" && chainCount === 1) {
1434
+ const left = Number(value.slice(segments[7], segments[8]));
1435
+ const right = Number(value.slice(segments[5], segments[6]));
1436
+ if (left > 0 && right > 0 && Number.isFinite(left) && Number.isFinite(right)) return false;
1437
+ }
1438
+ for (let index = 0; index < segments.length; index += 5) {
1439
+ const start = segments[index];
1440
+ const end = segments[index + 1];
1441
+ const flags = segments[index + 4];
1442
+ if (!(flags & 1)) continue;
1443
+ if (start === end) continue;
1444
+ if (flags & 2) {
1445
+ const payload = slices[index] ??= value.slice(start, end);
1446
+ sink(payload, parentCondition, payload);
1447
+ hasBase = true;
1448
+ } else if (process.env.NODE_ENV !== "production" && warnMode && !chainCount && (failure === "invalid-character" || failure === "stray-comment-close")) {
1449
+ sink(value, parentCondition, value);
1450
+ hasBase = true;
1451
+ } else if (warnMode) warnScanFailure(property, value, failure, failureIndex);
1452
+ }
1453
+ let lastPayloadStart = 0;
1454
+ for (let index = 0; index < segments.length; index += 5) {
1455
+ const start = segments[index];
1456
+ const end = segments[index + 1];
1457
+ const flags = segments[index + 4];
1458
+ if (flags & 1) continue;
1459
+ if (!(flags & 4) || !(flags & 2)) {
1460
+ if (warnMode) warnScanFailure(property, value, failure, failureIndex);
1461
+ continue;
1462
+ }
1463
+ lastPayloadStart = start;
1464
+ if (start === end) {
1465
+ if (warnMode && process.env.NODE_ENV === "development") warnRefusedValue(property, value, "a conditional clause has no value");
1466
+ continue;
1851
1467
  }
1468
+ const cursor = conditionFromKey(state, slices[index + 2] ??= value.slice(segments[index + 2], segments[index + 3]), parentCondition);
1469
+ conditions |= cursor[conditionValue];
1470
+ if (cursor[conditionValue] & conditionResolvedFlag || warnMode) sink(slices[index] ??= value.slice(start, end), cursor, value);
1471
+ }
1472
+ if (process.env.NODE_ENV !== "production") lastPayload = value.slice(lastPayloadStart);
1473
+ } else {
1474
+ if (!value || typeof value !== "object" || Array.isArray(value) || isVariable(value) || !classifyConditionalObject(value, state)) return false;
1475
+ if (value.default != null) {
1476
+ sink(value.default, parentCondition, value.default);
1477
+ hasBase = true;
1478
+ }
1479
+ for (const key in value) {
1480
+ if (key === "default" || value[key] == null) continue;
1481
+ const cursor = conditionFromKey(state, key, parentCondition);
1482
+ conditions |= cursor[conditionValue];
1483
+ if (cursor[conditionValue] & conditionResolvedFlag || warnMode) sink(value[key], cursor, value[key]);
1852
1484
  }
1853
- if (payload != null) conditions |= emitUnderCondition(state, property, payload, cursor, merge, payload, contextOnly, 1, payload);
1854
- releaseConditionCursors(watermark);
1855
1485
  }
1856
- if (!hasDefault && firstCondition) return false;
1857
- if ((!canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
1858
- const resting = implicitLifecycleBase(property);
1859
- if (resting !== null) emitAtParentCondition(state, property, resting, merge, resting, contextOnly);
1486
+ if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && getConfigRevisionState(state.conf).tokenCategory(property) && splitComponents(lastPayload).length > 1) warnOnce(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
1487
+ if (warnMode === 1 && (!canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
1488
+ const resting = property === "opacity" || property.startsWith("scale") ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
1489
+ if (resting !== null && !state.flatPropertyLayers?.has(property)) sink(resting, parentCondition, resting);
1860
1490
  }
1861
1491
  return true;
1862
1492
  }
1863
- function contributeValue(state, property, value, merge, originalValue, contextOnly = false, condition) {
1864
- if (isConditionTransport(value)) {
1865
- if (value[transportHasBase]) {
1866
- const base = value[transportBase];
1867
- contributeValue(state, property, base, merge, base, contextOnly);
1868
- }
1869
- for (let offset = transportEntries; offset < value.length;) {
1870
- const entryValue = value[offset];
1871
- const watermark = conditionCursorTop;
1872
- try {
1873
- emitUnderCondition(state, property, entryValue, acquireTransportCursor(state, value, offset, state.flatPass?.[passParentCursor] || null), merge, entryValue, contextOnly, 2, entryValue);
1874
- } finally {
1875
- releaseConditionCursors(watermark);
1876
- }
1877
- offset += transportEntryWidth;
1878
- }
1879
- return true;
1880
- }
1493
+ function contributeValue(state, property, value, originalValue, contextOnly = false, condition) {
1881
1494
  if (condition !== void 0) {
1882
- const parent = state.flatPass?.[passParentCursor] || null;
1883
- const watermark = conditionCursorTop;
1884
- try {
1885
- let effective;
1886
- if (typeof condition === "string") {
1887
- effective = acquireConditionCursor(parent);
1888
- resolveConditionText(state, effective, condition);
1889
- commitConditionCursor(state, effective);
1890
- } else if (parent) {
1891
- effective = acquireConditionCursor(parent);
1892
- const conditionKey = conditionTexts[condition + conditionKeyOffset] || "";
1893
- if (conditionKey) resolveConditionText(state, effective, conditionKey);
1894
- if (!(conditionNumbers[condition + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(effective);
1895
- commitConditionCursor(state, effective);
1896
- } else effective = condition;
1897
- const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !isVariable(value);
1898
- const objectHasDefault = isObjectValue && "default" in value;
1899
- const firstChild = isObjectValue && !objectHasDefault ? acquireConditionCursor(effective) : null;
1900
- if (isObjectValue && classifyConditionalObject(value, state, void 0, firstChild || void 0)) {
1901
- let useFirstChild = firstChild !== null;
1902
- for (const key in value) {
1903
- const payload = value[key];
1904
- if (payload == null) continue;
1905
- if (key === "default") emitUnderCondition(state, property, payload, effective, merge, payload, contextOnly, 2, payload);
1906
- else {
1907
- const keyWatermark = conditionCursorTop;
1908
- const child = useFirstChild ? firstChild : acquireConditionCursor(effective);
1909
- if (useFirstChild) useFirstChild = false;
1910
- else {
1911
- resolveConditionText(state, child, key);
1912
- commitConditionCursor(state, child);
1913
- }
1914
- emitUnderCondition(state, property, payload, child, merge, payload, contextOnly, 2, payload);
1915
- if (child !== firstChild) releaseConditionCursors(keyWatermark);
1916
- }
1917
- }
1918
- return true;
1919
- }
1920
- emitUnderCondition(state, property, value, effective, merge, originalValue, contextOnly, 2, value);
1921
- return true;
1922
- } finally {
1923
- releaseConditionCursors(watermark);
1924
- }
1495
+ const parent2 = state.flatPass?.[passParentCursor] || null;
1496
+ let effective;
1497
+ if (typeof condition === "string") effective = conditionFromKey(state, condition, parent2);
1498
+ else if (parent2) {
1499
+ effective = conditionFromKey(state, condition[conditionKey], parent2);
1500
+ if (!(condition[conditionValue] & conditionResolvedFlag)) setConditionUnresolved(effective);
1501
+ commitCondition(effective);
1502
+ } else effective = condition;
1503
+ if (typeof value !== "string" && walkConditionalValue(state, property, value, effective, (payload, cursor, source) => emitUnderCondition(state, property, payload, cursor, payload, contextOnly, 2, source), 2)) return true;
1504
+ emitUnderCondition(state, property, value, effective, originalValue, contextOnly, 2, value);
1505
+ return true;
1925
1506
  }
1926
- if ((webShadowParts[property] || legacyTransformParts.has(property)) && (typeof value === "string" && value.indexOf(":") !== -1 || value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && classifyConditionalObject(value, state))) {
1507
+ const compositeKind = getConfigRevisionState(state.conf).propertyKind(property);
1508
+ if (compositeKind > 0 && compositeKind < 6 && (typeof value === "string" && value.indexOf(":") !== -1 || value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && classifyConditionalObject(value, state))) {
1927
1509
  if (process.env.NODE_ENV === "development") warnOnce(`conditional "${property}" needs its composite property; dropping it`);
1928
1510
  return true;
1929
1511
  }
1930
- if (value === "safe" && isSafeAreaKey(property)) {
1931
- const expanded = expandSafeAreaValue(property);
1512
+ if (value === "safe") {
1513
+ const expanded = getConfigRevisionState(state.conf).expandSafeArea(property);
1932
1514
  if (expanded) {
1933
1515
  state.flatUsesSafeArea = true;
1934
- for (const [key, resolved] of expanded) emitAtParentCondition(state, key, resolved, merge, originalValue ?? value, contextOnly);
1516
+ for (const [key, resolved] of expanded) emitAtParentCondition(state, key, resolved, originalValue ?? value, contextOnly);
1935
1517
  return true;
1936
1518
  }
1937
1519
  }
1938
- if (typeof value === "string") return contributeStyleString(state, property, value, merge, originalValue, contextOnly);
1939
- if (value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && contributeStyleObject(state, property, value, merge, contextOnly)) return true;
1520
+ if (walkConditionalValue(state, property, value, state.flatPass?.[passParentCursor] || null, (payload, cursor, source) => cursor ? emitUnderCondition(state, property, payload, cursor, void 0, contextOnly, 1, source) : emitValue(state, property, payload, null, payload, contextOnly), 1)) return true;
1940
1521
  if (value != null) {
1941
- emitAtParentCondition(state, property, value, merge, originalValue ?? value, contextOnly);
1522
+ emitAtParentCondition(state, property, value, originalValue ?? value, contextOnly);
1942
1523
  return true;
1943
1524
  }
1944
1525
  return false;
1945
1526
  }
1946
1527
  function clearDirectStyle(state, property) {
1947
1528
  const direct = state;
1948
- const atomicKey = property.startsWith("transition") ? "transition" : webShadowParts[property] ? "boxShadow" : webTextShadowParts.has(property) ? "textShadow" : legacyTransformParts.has(property) ? "transform" : property;
1949
- clearFrameAtomic(state, atomicKey);
1950
- const used = direct.flatUsed;
1951
- if (used) delete used[atomicKey];
1952
- if (atomicKey === "transform") state.transformAccumulator = void 0;
1953
- if (state.style) delete state.style[atomicKey];
1954
- delete state.classNames[atomicKey];
1955
- }
1956
- const conditionTransportTag = /* @__PURE__ */ Symbol();
1957
- const transportHasBase = 1;
1958
- const transportBase = 2;
1959
- const transportEntries = 3;
1960
- const transportEntryWidth = 2;
1961
- function isConditionTransport(value) {
1962
- return Array.isArray(value) && value[0] === conditionTransportTag;
1963
- }
1964
- function appendConditionEntry(transport, cursor, value) {
1965
- transport.push(value, conditionTexts[cursor + conditionKeyOffset] || "");
1966
- }
1967
- function acquireTransportCursor(state, transport, offset, parent) {
1968
- const cursor = acquireConditionCursor(parent);
1969
- const key = transport[offset + 1];
1970
- if (key) resolveConditionText(state, cursor, key);
1971
- commitConditionCursor(state, cursor);
1972
- return cursor;
1973
- }
1974
- function mergeConditionTransport(state, prev, cursor, value) {
1975
- let transport;
1976
- if (isConditionTransport(prev)) transport = prev;
1977
- else {
1978
- transport = [
1979
- conditionTransportTag,
1980
- false,
1981
- void 0
1982
- ];
1983
- if (prev != null) {
1984
- const isObjectValue = typeof prev === "object" && !Array.isArray(prev) && !isVariable(prev);
1985
- const objectHasDefault = isObjectValue && "default" in prev;
1986
- const authoredWatermark = conditionCursorTop;
1987
- try {
1988
- const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
1989
- if (isObjectValue && classifyConditionalObject(prev, state, void 0, firstCursor || void 0)) {
1990
- let useFirstCursor = firstCursor !== null;
1991
- for (const key in prev) {
1992
- const payload = prev[key];
1993
- if (payload == null) continue;
1994
- if (key === "default") {
1995
- transport[transportHasBase] = true;
1996
- transport[transportBase] = payload;
1997
- continue;
1998
- }
1999
- const watermark = conditionCursorTop;
2000
- const keyCursor = useFirstCursor ? firstCursor : acquireConditionCursor();
2001
- if (useFirstCursor) useFirstCursor = false;
2002
- else {
2003
- resolveConditionText(state, keyCursor, key);
2004
- commitConditionCursor(state, keyCursor);
2005
- }
2006
- appendConditionEntry(transport, keyCursor, payload);
2007
- if (keyCursor !== firstCursor) releaseConditionCursors(watermark);
2008
- }
2009
- } else {
2010
- transport[transportHasBase] = true;
2011
- transport[transportBase] = prev;
2012
- }
2013
- } finally {
2014
- releaseConditionCursors(authoredWatermark);
1529
+ property = webStyleProperty(property);
1530
+ const propertyKind = getConfigRevisionState(state.conf).propertyKind(property);
1531
+ const atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
1532
+ const slot = styleSlot(atomicKey);
1533
+ direct.flatAtomics?.delete(slot);
1534
+ if (direct.flatSlots) {
1535
+ if (slot !== atomicKey) {
1536
+ const entries = direct.flatSlots.get(slot);
1537
+ if (entries) {
1538
+ for (let index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
2015
1539
  }
2016
1540
  }
1541
+ direct.flatSlots.delete(atomicKey);
2017
1542
  }
2018
- const cursorKey = conditionTexts[cursor + conditionKeyOffset] || "";
2019
- for (let offset = transportEntries; offset < transport.length; offset += transportEntryWidth) if (transport[offset + 1] === cursorKey) {
2020
- transport.splice(offset, transportEntryWidth);
2021
- break;
2022
- }
2023
- appendConditionEntry(transport, cursor, value);
2024
- return transport;
2025
- }
2026
- const variantValueHandler = {
2027
- segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
2028
- const state = ctx[0];
2029
- if (start === end) return;
2030
- if (isBase) {
2031
- if (!valid) return;
2032
- emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], null);
2033
- return;
2034
- }
2035
- if (!valid || !chainValid) return;
2036
- const cursor = state.flatScanCursor;
2037
- if (!(cursor && conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0)) return;
2038
- emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], cursor);
2039
- },
2040
- modifier(ctx, start, end, valid, first, source) {
2041
- const directState = ctx[0];
2042
- let cursor = directState.flatScanCursor;
2043
- if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor();
2044
- else if (first) resetConditionCursor(cursor, 0);
2045
- if (!valid) {
2046
- setConditionUnresolved(cursor);
2047
- return;
2048
- }
2049
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(ctx[0], cursor, source.slice(start, end));
2050
- },
2051
- chain(ctx, _start, _end, valid) {
2052
- const cursor = ctx[0].flatScanCursor;
2053
- if (cursor) {
2054
- if (!valid) setConditionUnresolved(cursor);
2055
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(ctx[0], cursor);
2056
- }
2057
- return true;
2058
- }
2059
- };
2060
- function emitMappedValue(styleState, key, value, originalValue, nestedCondition, parentCondition, fallbackOriginal) {
2061
- const nested = nestedCondition;
2062
- const parent = parentCondition;
2063
- let resolvedCondition = nested ?? parent;
2064
- const watermark = conditionCursorTop;
2065
- if (nested && parent) {
2066
- const composed = acquireConditionCursor(parent);
2067
- const nestedKey = conditionTexts[nested + conditionKeyOffset] || "";
2068
- if (nestedKey) resolveConditionText(styleState, composed, nestedKey);
2069
- if (!(conditionNumbers[nested + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(composed);
2070
- commitConditionCursor(styleState, composed);
2071
- resolvedCondition = composed;
2072
- }
2073
- const conf = styleState.conf;
2074
- if (key === "fontFamily" || key === conf.inverseShorthands.fontFamily) styleState.fontFamily = getFontFamilyFromNameOrVariable(value, conf);
2075
- mapContributedProp(styleState, key, value, originalValue ?? fallbackOriginal, resolvedCondition);
2076
- releaseConditionCursors(watermark);
2077
- }
2078
- const contributeMappedValue = (key, value, styleState, disabled, parentCondition, fallbackOriginal) => {
2079
- if (disabled) return emitMappedValue(styleState, key, value, void 0, void 0, parentCondition, fallbackOriginal);
2080
- const { conf, styleProps } = styleState;
2081
- const variants = styleState.flatStyleStaticConfig.variants;
2082
- const { disableExpandShorthands, noExpand, resolveValues } = styleProps;
2083
- const shorthands = conf.shorthands;
2084
- if (!noExpand) {
2085
- if (variants && key in variants) {
2086
- resolveVariants(key, value, styleProps, styleState, key);
2087
- return;
2088
- }
2089
- }
2090
- if (!disableExpandShorthands) {
2091
- if (key in shorthands) key = shorthands[key];
2092
- }
2093
- const originalValue = value;
2094
- if (value === "safe" && isSafeAreaKey(key)) {
2095
- const expanded = expandSafeAreaValue(key);
2096
- if (expanded) {
2097
- for (let i = 0; i < expanded.length; i++) {
2098
- const [nkey, nvalue] = expanded[i];
2099
- emitMappedValue(styleState, nkey, nvalue, originalValue, void 0, parentCondition, fallbackOriginal);
2100
- }
2101
- return;
2102
- }
2103
- }
2104
- if (value != null) {
2105
- if (typeof value === "string") value = isRemValue(value) ? resolveRem(value) : value;
2106
- else if (isVariable(value)) value = resolveVariableValue(key, value, resolveValues);
2107
- else if (isRemValue(value)) value = resolveRem(value);
2108
- }
2109
- if (value != null) {
2110
- if (key === "fontFamily" && typeof originalValue === "string") {
2111
- if (originalValue in conf.fontsParsed) styleState.fontFamily = originalValue;
2112
- }
2113
- const expanded = noExpand || typeof value === "string" ? null : expandStyle(key, value, conf.settings.styleCompat || "web");
2114
- if (expanded) {
2115
- const max = expanded.length;
2116
- for (let i = 0; i < max; i++) {
2117
- const [nkey, nvalue, noriginalValue] = expanded[i];
2118
- emitMappedValue(styleState, nkey, nvalue, noriginalValue ?? originalValue, void 0, parentCondition, fallbackOriginal);
2119
- }
2120
- } else emitMappedValue(styleState, key, value, originalValue, void 0, parentCondition, fallbackOriginal);
2121
- }
2122
- };
2123
- function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
2124
- const variantDefinition = styleState.flatStyleStaticConfig.variants?.[key];
2125
- if (isConditionTransport(value)) {
2126
- if (value[transportHasBase]) emitResolvedVariant(key, value[transportBase], styleState, parentVariantKey, null);
2127
- for (let offset = transportEntries; offset < value.length;) {
2128
- const entryValue = value[offset];
2129
- const watermark = conditionCursorTop;
2130
- try {
2131
- emitResolvedVariant(key, entryValue, styleState, parentVariantKey, acquireTransportCursor(styleState, value, offset, null));
2132
- } finally {
2133
- releaseConditionCursors(watermark);
2134
- }
2135
- offset += transportEntryWidth;
2136
- }
2137
- return;
2138
- }
2139
- if (typeof value === "string" && !(variantDefinition && typeof variantDefinition === "object" && value in variantDefinition)) {
2140
- const directState = styleState;
2141
- const watermark = conditionCursorTop;
2142
- const previousCursor = directState.flatScanCursor;
2143
- directState.flatScanCursor = null;
2144
- try {
2145
- scanFlatValue(value, variantValueHandler, [
2146
- styleState,
2147
- key,
2148
- parentVariantKey
2149
- ]);
2150
- } finally {
2151
- directState.flatScanCursor = previousCursor;
2152
- releaseConditionCursors(watermark);
2153
- }
2154
- return;
2155
- }
2156
- const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !isVariable(value);
2157
- const objectHasDefault = isObjectValue && "default" in value;
2158
- const objectWatermark = conditionCursorTop;
2159
- try {
2160
- const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
2161
- if (isObjectValue && classifyConditionalObject(value, styleState, void 0, firstCursor || void 0)) {
2162
- let useFirstCursor = firstCursor !== null;
2163
- for (const objKey in value) {
2164
- const payload = value[objKey];
2165
- if (payload == null) continue;
2166
- if (objKey === "default") {
2167
- emitResolvedVariant(key, payload, styleState, parentVariantKey, null);
2168
- continue;
2169
- }
2170
- const watermark = conditionCursorTop;
2171
- const cursor = useFirstCursor ? firstCursor : acquireConditionCursor();
2172
- conditionNumbers[cursor + conditionValueOffset];
2173
- if (useFirstCursor) useFirstCursor = false;
2174
- else {
2175
- resolveConditionText(styleState, cursor, objKey);
2176
- commitConditionCursor(styleState, cursor);
2177
- }
2178
- emitResolvedVariant(key, payload, styleState, parentVariantKey, cursor);
2179
- if (cursor !== firstCursor) releaseConditionCursors(watermark);
2180
- }
2181
- return;
2182
- }
2183
- } finally {
2184
- releaseConditionCursors(objectWatermark);
2185
- }
2186
- emitResolvedVariant(key, value, styleState, parentVariantKey, null);
1543
+ if (atomicKey === "transform") state.transformAccumulator = void 0;
1544
+ if (state.style) delete state.style[atomicKey];
1545
+ delete state.classNames[atomicKey];
1546
+ delete state.classNames[slot];
2187
1547
  }
2188
- function emitResolvedVariant(key, value, styleState, parentVariantKey, conditionCursor) {
2189
- const { conf, debug } = styleState;
2190
- const styleProps = styleState.styleProps;
2191
- const variants = styleState.flatStyleStaticConfig.variants;
2192
- if (!variants) return;
2193
- const variant = variants[key];
2194
- let variantValue = getVariantDefinition(variant, value, conf, styleState);
2195
- if (!variantValue) return;
2196
- if (typeof variantValue === "function") {
2197
- const fn = variantValue;
2198
- const extras = getVariantExtras(styleState);
2199
- variantValue = fn(value, extras);
2200
- if (process.env.NODE_ENV === "development" && debug === "verbose" && true) {
2201
- console.groupCollapsed(" expanded functional variant", key);
2202
- console.info({
2203
- fn,
2204
- variantValue,
2205
- extras
2206
- });
2207
- console.groupEnd();
2208
- }
2209
- }
2210
- if (!isObj(variantValue)) return;
2211
- if (process.env.NODE_ENV === "development" && debug === "verbose") console.info(` expanding styles from `, variantValue);
2212
- const { noSkip } = styleProps;
2213
- const originals = styleOriginalValues.get(variantValue);
2214
- for (const outputKey in variantValue) {
2215
- if (!noSkip && outputKey in skipProps) continue;
2216
- const rawOutputValue = variantValue[outputKey];
2217
- const outputValue = styleProps.noNormalize ? rawOutputValue : normalizeValueWithProperty(rawOutputValue, conf.shorthands[outputKey] || outputKey);
2218
- const originalValue = originals?.[outputKey] ?? rawOutputValue;
2219
- if (styleState.flatStyleStaticConfig.styledContextKeys?.has(outputKey)) {
2220
- styleState.overriddenContextProps ||= {};
2221
- styleState.overriddenContextProps[outputKey] = originalValue;
2222
- styleState.originalContextPropValues ||= {};
2223
- styleState.originalContextPropValues[outputKey] = originalValue;
2224
- }
2225
- contributeMappedValue(outputKey, outputValue, styleState, parentVariantKey === key && outputKey === key, conditionCursor || void 0, originalValue);
2226
- }
1548
+ function emitVariantStyle(state, key, value, original, condition, disabled) {
1549
+ const pass = state.flatPass;
1550
+ if (key !== pass[passMapSourceKey] && state.flatCallerVariantKeys?.has(key)) return;
1551
+ if (state.flatStyleStaticConfig.styledContextKeys?.has(key)) (state.overriddenContextProps ||= {})[key] = (state.originalContextPropValues ||= {})[key] = original;
1552
+ const parent = pass[passParentCursor];
1553
+ pass[passParentCursor] = condition;
1554
+ contributeProp(pass, key, value, original, disabled);
1555
+ pass[passParentCursor] = parent;
2227
1556
  }
2228
1557
  function getFontFamilyFromNameOrVariable(input, conf) {
2229
1558
  if (isVariable(input)) {
@@ -2240,5 +1569,5 @@ function getFontFamilyFromNameOrVariable(input, conf) {
2240
1569
  }
2241
1570
  const variableToFontNameCache = /* @__PURE__ */ new WeakMap();
2242
1571
 
2243
- export { STYLE_TOKEN_PROVENANCE_KEY, clearDirectStyle, contributeStyleString, directStyleSignature, flushDirectStyles2 as flushDirectStyles, getDirectDynamicThemeAccess, getFontFamilyFromNameOrVariable, getSplitStyles, getStyleStaticConfig, getStyleTokenProvenance, isValidStyleKey, styleOriginalValues };
1572
+ export { STYLE_TOKEN_PROVENANCE_KEY, emitVariantStyle, getFontFamilyFromNameOrVariable, getSplitStyles, getStyleStaticConfig, getStyleTokenProvenance, isValidStyleKey, styleOriginalValues, walkConditionalValue };
2244
1573
  //# sourceMappingURL=getSplitStyles.mjs.map