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