@tamagui/web 3.0.0-beta.807.1 → 3.0.0-beta.881.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 (587) hide show
  1. package/dist/cjs/config.cjs +1 -1
  2. package/dist/cjs/config.native.cjs +1 -1
  3. package/dist/cjs/config.native.js +1 -1
  4. package/dist/cjs/config.native.js.map +1 -1
  5. package/dist/cjs/createComponent.cjs +40 -19
  6. package/dist/cjs/createComponent.native.cjs +42 -21
  7. package/dist/cjs/createComponent.native.js +42 -21
  8. package/dist/cjs/createComponent.native.js.map +1 -1
  9. package/dist/cjs/createStyledHOC.cjs +54 -4
  10. package/dist/cjs/createStyledHOC.native.cjs +55 -4
  11. package/dist/cjs/createStyledHOC.native.js +55 -4
  12. package/dist/cjs/createStyledHOC.native.js.map +1 -1
  13. package/dist/cjs/createTokens.cjs +1 -1
  14. package/dist/cjs/createTokens.native.cjs +1 -1
  15. package/dist/cjs/createTokens.native.js +1 -1
  16. package/dist/cjs/createTokens.native.js.map +1 -1
  17. package/dist/cjs/createVariable.cjs +0 -10
  18. package/dist/cjs/createVariable.native.cjs +0 -10
  19. package/dist/cjs/createVariable.native.js +0 -10
  20. package/dist/cjs/createVariable.native.js.map +1 -1
  21. package/dist/cjs/dom/html.cjs +147 -99
  22. package/dist/cjs/dom/htmlRuntime.native.cjs +6 -2
  23. package/dist/cjs/dom/htmlRuntime.native.js +6 -2
  24. package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
  25. package/dist/cjs/dom/primitives.native.cjs +16 -13
  26. package/dist/cjs/dom/primitives.native.js +16 -13
  27. package/dist/cjs/dom/primitives.native.js.map +1 -1
  28. package/dist/cjs/helpers/borderComponents.cjs +62 -0
  29. package/dist/cjs/helpers/borderComponents.native.cjs +82 -0
  30. package/dist/cjs/helpers/borderComponents.native.js +84 -0
  31. package/dist/cjs/helpers/borderComponents.native.js.map +1 -0
  32. package/dist/cjs/helpers/componentDisplayName.cjs +1 -11
  33. package/dist/cjs/helpers/componentDisplayName.native.cjs +1 -11
  34. package/dist/cjs/helpers/componentDisplayName.native.js +1 -11
  35. package/dist/cjs/helpers/componentDisplayName.native.js.map +1 -1
  36. package/dist/cjs/helpers/createDesignSystem.cjs +0 -2
  37. package/dist/cjs/helpers/createStyledContext.cjs +10 -18
  38. package/dist/cjs/helpers/createStyledContext.native.cjs +14 -18
  39. package/dist/cjs/helpers/createStyledContext.native.js +14 -18
  40. package/dist/cjs/helpers/createStyledContext.native.js.map +1 -1
  41. package/dist/cjs/helpers/formatDiagnostic.cjs +8 -10
  42. package/dist/cjs/helpers/formatDiagnostic.native.cjs +8 -10
  43. package/dist/cjs/helpers/formatDiagnostic.native.js +8 -10
  44. package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
  45. package/dist/cjs/helpers/getCSSStylesAtomic.cjs +133 -114
  46. package/dist/cjs/helpers/getCSSStylesAtomic.native.cjs +11 -3
  47. package/dist/cjs/helpers/getCSSStylesAtomic.native.js +11 -3
  48. package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -1
  49. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.cjs +13 -1
  50. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.cjs +15 -1
  51. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +15 -1
  52. package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
  53. package/dist/cjs/helpers/getDynamicVal.cjs +5 -1
  54. package/dist/cjs/helpers/getDynamicVal.native.cjs +5 -1
  55. package/dist/cjs/helpers/getDynamicVal.native.js +5 -1
  56. package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -1
  57. package/dist/cjs/helpers/getSplitStyles.cjs +1063 -2168
  58. package/dist/cjs/helpers/getSplitStyles.native.cjs +1115 -2515
  59. package/dist/cjs/helpers/getSplitStyles.native.js +1115 -2515
  60. package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
  61. package/dist/cjs/helpers/grammarConfig.cjs +163 -1
  62. package/dist/cjs/helpers/grammarConfig.native.cjs +186 -1
  63. package/dist/cjs/helpers/grammarConfig.native.js +186 -1
  64. package/dist/cjs/helpers/grammarConfig.native.js.map +1 -1
  65. package/dist/cjs/helpers/insertStyleRule.cjs +5 -1
  66. package/dist/cjs/helpers/insertStyleRule.native.cjs +7 -1
  67. package/dist/cjs/helpers/insertStyleRule.native.js +7 -1
  68. package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
  69. package/dist/cjs/helpers/log.cjs +9 -8
  70. package/dist/cjs/helpers/log.native.cjs +9 -8
  71. package/dist/cjs/helpers/log.native.js +9 -8
  72. package/dist/cjs/helpers/log.native.js.map +1 -1
  73. package/dist/cjs/helpers/mergeVariants.cjs +44 -13
  74. package/dist/cjs/helpers/mergeVariants.native.cjs +79 -14
  75. package/dist/cjs/helpers/mergeVariants.native.js +79 -14
  76. package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
  77. package/dist/cjs/helpers/nativeOnlyProps.cjs +0 -1
  78. package/dist/cjs/helpers/nativeOnlyProps.native.cjs +0 -1
  79. package/dist/cjs/helpers/nativeOnlyProps.native.js +0 -1
  80. package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -1
  81. package/dist/cjs/helpers/nativeStyleEngine.cjs +34 -14
  82. package/dist/cjs/helpers/nativeStyleEngine.native.cjs +36 -14
  83. package/dist/cjs/helpers/nativeStyleEngine.native.js +36 -14
  84. package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
  85. package/dist/cjs/helpers/normalizeValueWithProperty.cjs +7 -8
  86. package/dist/cjs/helpers/normalizeValueWithProperty.native.cjs +9 -8
  87. package/dist/cjs/helpers/normalizeValueWithProperty.native.js +9 -8
  88. package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
  89. package/dist/cjs/helpers/parseBorderShorthand.native.cjs +25 -56
  90. package/dist/cjs/helpers/parseBorderShorthand.native.js +25 -56
  91. package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -1
  92. package/dist/cjs/helpers/parseOutlineShorthand.native.cjs +9 -49
  93. package/dist/cjs/helpers/parseOutlineShorthand.native.js +9 -49
  94. package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -1
  95. package/dist/cjs/helpers/resolveSafeArea.cjs +35 -100
  96. package/dist/cjs/helpers/resolveVariantStyle.cjs +57 -0
  97. package/dist/cjs/helpers/resolveVariantStyle.native.cjs +67 -0
  98. package/dist/cjs/helpers/resolveVariantStyle.native.js +69 -0
  99. package/dist/cjs/helpers/resolveVariantStyle.native.js.map +1 -0
  100. package/dist/cjs/helpers/splitStyleProps.cjs +46 -0
  101. package/dist/cjs/helpers/splitStyleProps.native.cjs +49 -0
  102. package/dist/cjs/helpers/splitStyleProps.native.js +51 -0
  103. package/dist/cjs/helpers/splitStyleProps.native.js.map +1 -0
  104. package/dist/cjs/helpers/{getDefaultProps.native.cjs → styleStaticConfig.cjs} +7 -8
  105. package/dist/cjs/helpers/{getDefaultProps.native.js → styleStaticConfig.native.cjs} +7 -8
  106. package/dist/cjs/helpers/styleStaticConfig.native.js +31 -0
  107. package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -0
  108. package/dist/cjs/helpers/styleStaticConfigCore.cjs +107 -0
  109. package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +127 -0
  110. package/dist/cjs/helpers/styleStaticConfigCore.native.js +129 -0
  111. package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -0
  112. package/dist/cjs/helpers/styledDynamic.cjs +160 -0
  113. package/dist/cjs/helpers/styledDynamic.native.cjs +195 -0
  114. package/dist/cjs/helpers/styledDynamic.native.js +197 -0
  115. package/dist/cjs/helpers/styledDynamic.native.js.map +1 -0
  116. package/dist/cjs/helpers/tokenCategories.cjs +12 -74
  117. package/dist/cjs/helpers/tokenCategories.native.cjs +12 -76
  118. package/dist/cjs/helpers/tokenCategories.native.js +12 -76
  119. package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
  120. package/dist/cjs/helpers/variableValue.cjs +17 -12
  121. package/dist/cjs/helpers/variableValue.native.cjs +46 -23
  122. package/dist/cjs/helpers/variableValue.native.js +46 -23
  123. package/dist/cjs/helpers/variableValue.native.js.map +1 -1
  124. package/dist/cjs/helpers/warnOnce.cjs +5 -4
  125. package/dist/cjs/helpers/warnOnce.native.cjs +6 -4
  126. package/dist/cjs/helpers/warnOnce.native.js +6 -4
  127. package/dist/cjs/helpers/warnOnce.native.js.map +1 -1
  128. package/dist/cjs/hooks/useAnimationDriver.cjs +2 -2
  129. package/dist/cjs/hooks/useAnimationDriver.native.cjs +2 -2
  130. package/dist/cjs/hooks/useAnimationDriver.native.js +2 -2
  131. package/dist/cjs/hooks/useAnimationDriver.native.js.map +1 -1
  132. package/dist/cjs/hooks/useComponentState.cjs +41 -82
  133. package/dist/cjs/hooks/useComponentState.native.cjs +45 -84
  134. package/dist/cjs/hooks/useComponentState.native.js +45 -84
  135. package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
  136. package/dist/cjs/hooks/useMedia.cjs +2 -2
  137. package/dist/cjs/hooks/useMedia.native.cjs +2 -2
  138. package/dist/cjs/hooks/useMedia.native.js +2 -2
  139. package/dist/cjs/hooks/useMedia.native.js.map +1 -1
  140. package/dist/cjs/hooks/useSplitStyles.cjs +2 -2
  141. package/dist/cjs/hooks/useSplitStyles.native.cjs +2 -2
  142. package/dist/cjs/hooks/useSplitStyles.native.js +2 -2
  143. package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -1
  144. package/dist/cjs/{helpers/getDefaultProps.cjs → hooks/useStyle.cjs} +10 -4
  145. package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.native.cjs} +16 -6
  146. package/dist/cjs/hooks/useStyle.native.js +34 -0
  147. package/dist/cjs/hooks/useStyle.native.js.map +1 -0
  148. package/dist/cjs/hooks/useThemeState.cjs +25 -90
  149. package/dist/cjs/hooks/useThemeState.native.cjs +34 -94
  150. package/dist/cjs/hooks/useThemeState.native.js +34 -94
  151. package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
  152. package/dist/cjs/index.cjs +9 -12
  153. package/dist/cjs/index.native.cjs +9 -12
  154. package/dist/cjs/index.native.js +9 -12
  155. package/dist/cjs/index.native.js.map +1 -1
  156. package/dist/cjs/internal-runtime.cjs +8 -7
  157. package/dist/cjs/internal-runtime.native.cjs +8 -7
  158. package/dist/cjs/internal-runtime.native.js +8 -7
  159. package/dist/cjs/internal-runtime.native.js.map +1 -1
  160. package/dist/cjs/static-resolve.cjs +8 -7
  161. package/dist/cjs/static-resolve.native.cjs +8 -7
  162. package/dist/cjs/static-resolve.native.js +8 -7
  163. package/dist/cjs/static-resolve.native.js.map +1 -1
  164. package/dist/cjs/style.cjs +91 -0
  165. package/dist/cjs/style.native.cjs +98 -0
  166. package/dist/cjs/style.native.js +100 -0
  167. package/dist/cjs/style.native.js.map +1 -0
  168. package/dist/cjs/styled.cjs +15 -62
  169. package/dist/cjs/styled.native.cjs +15 -64
  170. package/dist/cjs/styled.native.js +15 -64
  171. package/dist/cjs/styled.native.js.map +1 -1
  172. package/dist/cjs/types.cjs +4 -22
  173. package/dist/cjs/types.native.cjs +4 -22
  174. package/dist/cjs/types.native.js +4 -22
  175. package/dist/cjs/types.native.js.map +1 -1
  176. package/dist/cjs/views/TamaguiProvider.cjs +1 -2
  177. package/dist/cjs/views/TamaguiProvider.native.cjs +1 -2
  178. package/dist/cjs/views/TamaguiProvider.native.js +1 -2
  179. package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
  180. package/dist/cjs/views/Text.cjs +21 -14
  181. package/dist/cjs/views/Text.native.cjs +5 -2
  182. package/dist/cjs/views/Text.native.js +5 -2
  183. package/dist/cjs/views/Text.native.js.map +1 -1
  184. package/dist/cjs/views/Theme.cjs +2 -2
  185. package/dist/cjs/views/Theme.native.cjs +2 -2
  186. package/dist/cjs/views/Theme.native.js +2 -2
  187. package/dist/cjs/views/Theme.native.js.map +1 -1
  188. package/dist/cjs/views/ThemeDebug.cjs +1 -4
  189. package/dist/cjs/views/View.cjs +4 -2
  190. package/dist/cjs/views/View.native.cjs +4 -2
  191. package/dist/cjs/views/View.native.js +4 -2
  192. package/dist/cjs/views/View.native.js.map +1 -1
  193. package/dist/esm/config.mjs +1 -1
  194. package/dist/esm/config.mjs.map +1 -1
  195. package/dist/esm/config.native.js +1 -1
  196. package/dist/esm/config.native.js.map +1 -1
  197. package/dist/esm/createComponent.mjs +41 -20
  198. package/dist/esm/createComponent.mjs.map +1 -1
  199. package/dist/esm/createComponent.native.js +43 -22
  200. package/dist/esm/createComponent.native.js.map +1 -1
  201. package/dist/esm/createStyledHOC.mjs +55 -5
  202. package/dist/esm/createStyledHOC.mjs.map +1 -1
  203. package/dist/esm/createStyledHOC.native.js +56 -5
  204. package/dist/esm/createStyledHOC.native.js.map +1 -1
  205. package/dist/esm/createTokens.mjs +1 -1
  206. package/dist/esm/createTokens.mjs.map +1 -1
  207. package/dist/esm/createTokens.native.js +1 -1
  208. package/dist/esm/createTokens.native.js.map +1 -1
  209. package/dist/esm/createVariable.mjs +1 -9
  210. package/dist/esm/createVariable.mjs.map +1 -1
  211. package/dist/esm/createVariable.native.js +1 -9
  212. package/dist/esm/createVariable.native.js.map +1 -1
  213. package/dist/esm/dom/html.mjs +147 -99
  214. package/dist/esm/dom/html.mjs.map +1 -1
  215. package/dist/esm/dom/htmlRuntime.native.js +7 -3
  216. package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
  217. package/dist/esm/dom/primitives.native.js +16 -13
  218. package/dist/esm/dom/primitives.native.js.map +1 -1
  219. package/dist/esm/helpers/borderComponents.mjs +37 -0
  220. package/dist/esm/helpers/borderComponents.mjs.map +1 -0
  221. package/dist/esm/helpers/borderComponents.native.js +55 -0
  222. package/dist/esm/helpers/borderComponents.native.js.map +1 -0
  223. package/dist/esm/helpers/componentDisplayName.mjs +1 -8
  224. package/dist/esm/helpers/componentDisplayName.mjs.map +1 -1
  225. package/dist/esm/helpers/componentDisplayName.native.js +1 -8
  226. package/dist/esm/helpers/componentDisplayName.native.js.map +1 -1
  227. package/dist/esm/helpers/createDesignSystem.mjs +0 -2
  228. package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
  229. package/dist/esm/helpers/createStyledContext.mjs +10 -18
  230. package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
  231. package/dist/esm/helpers/createStyledContext.native.js +14 -18
  232. package/dist/esm/helpers/createStyledContext.native.js.map +1 -1
  233. package/dist/esm/helpers/formatDiagnostic.mjs +8 -10
  234. package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
  235. package/dist/esm/helpers/formatDiagnostic.native.js +8 -10
  236. package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
  237. package/dist/esm/helpers/getCSSStylesAtomic.mjs +131 -114
  238. package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
  239. package/dist/esm/helpers/getCSSStylesAtomic.native.js +7 -4
  240. package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -1
  241. package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +8 -1
  242. package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -1
  243. package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +10 -1
  244. package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
  245. package/dist/esm/helpers/getDynamicVal.mjs +5 -1
  246. package/dist/esm/helpers/getDynamicVal.mjs.map +1 -1
  247. package/dist/esm/helpers/getDynamicVal.native.js +5 -1
  248. package/dist/esm/helpers/getDynamicVal.native.js.map +1 -1
  249. package/dist/esm/helpers/getSplitStyles.mjs +1052 -2151
  250. package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
  251. package/dist/esm/helpers/getSplitStyles.native.js +1090 -2481
  252. package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
  253. package/dist/esm/helpers/grammarConfig.mjs +164 -2
  254. package/dist/esm/helpers/grammarConfig.mjs.map +1 -1
  255. package/dist/esm/helpers/grammarConfig.native.js +187 -2
  256. package/dist/esm/helpers/grammarConfig.native.js.map +1 -1
  257. package/dist/esm/helpers/insertStyleRule.mjs +5 -2
  258. package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
  259. package/dist/esm/helpers/insertStyleRule.native.js +7 -2
  260. package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
  261. package/dist/esm/helpers/log.mjs +9 -8
  262. package/dist/esm/helpers/log.mjs.map +1 -1
  263. package/dist/esm/helpers/log.native.js +9 -8
  264. package/dist/esm/helpers/log.native.js.map +1 -1
  265. package/dist/esm/helpers/mergeVariants.mjs +44 -13
  266. package/dist/esm/helpers/mergeVariants.mjs.map +1 -1
  267. package/dist/esm/helpers/mergeVariants.native.js +79 -14
  268. package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
  269. package/dist/esm/helpers/nativeOnlyProps.mjs +0 -1
  270. package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -1
  271. package/dist/esm/helpers/nativeOnlyProps.native.js +0 -1
  272. package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -1
  273. package/dist/esm/helpers/nativeStyleEngine.mjs +34 -15
  274. package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
  275. package/dist/esm/helpers/nativeStyleEngine.native.js +36 -15
  276. package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
  277. package/dist/esm/helpers/normalizeValueWithProperty.mjs +7 -8
  278. package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
  279. package/dist/esm/helpers/normalizeValueWithProperty.native.js +9 -8
  280. package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
  281. package/dist/esm/helpers/parseBorderShorthand.native.js +23 -56
  282. package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -1
  283. package/dist/esm/helpers/parseOutlineShorthand.native.js +10 -49
  284. package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -1
  285. package/dist/esm/helpers/resolveSafeArea.mjs +35 -97
  286. package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -1
  287. package/dist/esm/helpers/resolveVariantStyle.mjs +38 -0
  288. package/dist/esm/helpers/resolveVariantStyle.mjs.map +1 -0
  289. package/dist/esm/helpers/resolveVariantStyle.native.js +46 -0
  290. package/dist/esm/helpers/resolveVariantStyle.native.js.map +1 -0
  291. package/dist/esm/helpers/splitStyleProps.mjs +27 -0
  292. package/dist/esm/helpers/splitStyleProps.mjs.map +1 -0
  293. package/dist/esm/helpers/splitStyleProps.native.js +28 -0
  294. package/dist/esm/helpers/splitStyleProps.native.js.map +1 -0
  295. package/dist/esm/helpers/styleStaticConfig.mjs +8 -0
  296. package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -0
  297. package/dist/esm/helpers/styleStaticConfig.native.js +8 -0
  298. package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -0
  299. package/dist/esm/helpers/styleStaticConfigCore.mjs +88 -0
  300. package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -0
  301. package/dist/esm/helpers/styleStaticConfigCore.native.js +106 -0
  302. package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -0
  303. package/dist/esm/helpers/styledDynamic.mjs +136 -0
  304. package/dist/esm/helpers/styledDynamic.mjs.map +1 -0
  305. package/dist/esm/helpers/styledDynamic.native.js +169 -0
  306. package/dist/esm/helpers/styledDynamic.native.js.map +1 -0
  307. package/dist/esm/helpers/tokenCategories.mjs +12 -72
  308. package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
  309. package/dist/esm/helpers/tokenCategories.native.js +12 -74
  310. package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
  311. package/dist/esm/helpers/variableValue.mjs +17 -12
  312. package/dist/esm/helpers/variableValue.mjs.map +1 -1
  313. package/dist/esm/helpers/variableValue.native.js +46 -23
  314. package/dist/esm/helpers/variableValue.native.js.map +1 -1
  315. package/dist/esm/helpers/warnOnce.mjs +5 -4
  316. package/dist/esm/helpers/warnOnce.mjs.map +1 -1
  317. package/dist/esm/helpers/warnOnce.native.js +6 -4
  318. package/dist/esm/helpers/warnOnce.native.js.map +1 -1
  319. package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
  320. package/dist/esm/hooks/useAnimationDriver.mjs.map +1 -1
  321. package/dist/esm/hooks/useAnimationDriver.native.js +2 -2
  322. package/dist/esm/hooks/useAnimationDriver.native.js.map +1 -1
  323. package/dist/esm/hooks/useComponentState.mjs +41 -82
  324. package/dist/esm/hooks/useComponentState.mjs.map +1 -1
  325. package/dist/esm/hooks/useComponentState.native.js +45 -84
  326. package/dist/esm/hooks/useComponentState.native.js.map +1 -1
  327. package/dist/esm/hooks/useMedia.mjs +2 -2
  328. package/dist/esm/hooks/useMedia.mjs.map +1 -1
  329. package/dist/esm/hooks/useMedia.native.js +2 -2
  330. package/dist/esm/hooks/useMedia.native.js.map +1 -1
  331. package/dist/esm/hooks/useSplitStyles.mjs +2 -2
  332. package/dist/esm/hooks/useSplitStyles.mjs.map +1 -1
  333. package/dist/esm/hooks/useSplitStyles.native.js +2 -2
  334. package/dist/esm/hooks/useSplitStyles.native.js.map +1 -1
  335. package/dist/esm/hooks/useStyle.mjs +11 -0
  336. package/dist/esm/hooks/useStyle.mjs.map +1 -0
  337. package/dist/esm/hooks/useStyle.native.js +11 -0
  338. package/dist/esm/hooks/useStyle.native.js.map +1 -0
  339. package/dist/esm/hooks/useThemeState.mjs +25 -90
  340. package/dist/esm/hooks/useThemeState.mjs.map +1 -1
  341. package/dist/esm/hooks/useThemeState.native.js +34 -94
  342. package/dist/esm/hooks/useThemeState.native.js.map +1 -1
  343. package/dist/esm/index.js +8 -8
  344. package/dist/esm/index.mjs +8 -8
  345. package/dist/esm/index.native.js +8 -8
  346. package/dist/esm/internal-runtime.mjs +8 -7
  347. package/dist/esm/internal-runtime.mjs.map +1 -1
  348. package/dist/esm/internal-runtime.native.js +8 -7
  349. package/dist/esm/internal-runtime.native.js.map +1 -1
  350. package/dist/esm/static-resolve.mjs +11 -9
  351. package/dist/esm/static-resolve.mjs.map +1 -1
  352. package/dist/esm/static-resolve.native.js +11 -9
  353. package/dist/esm/static-resolve.native.js.map +1 -1
  354. package/dist/esm/style.mjs +58 -0
  355. package/dist/esm/style.mjs.map +1 -0
  356. package/dist/esm/style.native.js +63 -0
  357. package/dist/esm/style.native.js.map +1 -0
  358. package/dist/esm/styled.mjs +17 -62
  359. package/dist/esm/styled.mjs.map +1 -1
  360. package/dist/esm/styled.native.js +17 -64
  361. package/dist/esm/styled.native.js.map +1 -1
  362. package/dist/esm/types.mjs +3 -21
  363. package/dist/esm/types.mjs.map +1 -1
  364. package/dist/esm/types.native.js +3 -21
  365. package/dist/esm/types.native.js.map +1 -1
  366. package/dist/esm/views/TamaguiProvider.mjs +1 -2
  367. package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
  368. package/dist/esm/views/TamaguiProvider.native.js +1 -2
  369. package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
  370. package/dist/esm/views/Text.mjs +21 -14
  371. package/dist/esm/views/Text.mjs.map +1 -1
  372. package/dist/esm/views/Text.native.js +4 -2
  373. package/dist/esm/views/Text.native.js.map +1 -1
  374. package/dist/esm/views/Theme.mjs +2 -2
  375. package/dist/esm/views/Theme.mjs.map +1 -1
  376. package/dist/esm/views/Theme.native.js +2 -2
  377. package/dist/esm/views/Theme.native.js.map +1 -1
  378. package/dist/esm/views/ThemeDebug.mjs +1 -4
  379. package/dist/esm/views/ThemeDebug.mjs.map +1 -1
  380. package/dist/esm/views/View.mjs +4 -2
  381. package/dist/esm/views/View.mjs.map +1 -1
  382. package/dist/esm/views/View.native.js +4 -2
  383. package/dist/esm/views/View.native.js.map +1 -1
  384. package/package.json +15 -15
  385. package/src/config.ts +1 -1
  386. package/src/createComponent.tsx +62 -31
  387. package/src/createStyledHOC.tsx +56 -9
  388. package/src/createTokens.ts +1 -1
  389. package/src/createVariable.ts +0 -10
  390. package/src/dom/html.tsx +778 -877
  391. package/src/dom/htmlRuntime.native.tsx +7 -3
  392. package/src/dom/primitives.native.tsx +30 -39
  393. package/src/helpers/borderComponents.ts +62 -0
  394. package/src/helpers/componentDisplayName.ts +0 -11
  395. package/src/helpers/createDesignSystem.ts +0 -2
  396. package/src/helpers/createStyledContext.tsx +15 -53
  397. package/src/helpers/formatDiagnostic.ts +11 -13
  398. package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
  399. package/src/helpers/getCSSStylesAtomic.ts +197 -206
  400. package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
  401. package/src/helpers/getDynamicVal.ts +4 -0
  402. package/src/helpers/getSplitStyles.tsx +2058 -4052
  403. package/src/helpers/grammarConfig.ts +218 -1
  404. package/src/helpers/insertStyleRule.tsx +4 -2
  405. package/src/helpers/log.ts +12 -11
  406. package/src/helpers/mergeVariants.ts +55 -18
  407. package/src/helpers/nativeOnlyProps.ts +0 -1
  408. package/src/helpers/nativeStyleEngine.ts +55 -14
  409. package/src/helpers/normalizeValueWithProperty.ts +10 -12
  410. package/src/helpers/parseBorderShorthand.native.ts +23 -45
  411. package/src/helpers/parseOutlineShorthand.native.ts +9 -40
  412. package/src/helpers/resolveSafeArea.ts +34 -101
  413. package/src/helpers/resolveVariantStyle.ts +77 -0
  414. package/src/helpers/splitStyleProps.ts +166 -0
  415. package/src/helpers/styleFrontend.ts +16 -9
  416. package/src/helpers/styleStaticConfig.ts +21 -0
  417. package/src/helpers/styleStaticConfigCore.ts +110 -0
  418. package/src/helpers/styledDynamic.ts +191 -0
  419. package/src/helpers/tokenCategories.ts +32 -88
  420. package/src/helpers/variableValue.ts +20 -15
  421. package/src/helpers/warnOnce.ts +5 -4
  422. package/src/hooks/useAnimationDriver.ts +6 -2
  423. package/src/hooks/useComponentState.ts +55 -183
  424. package/src/hooks/useMedia.tsx +10 -8
  425. package/src/hooks/useSplitStyles.tsx +17 -2
  426. package/src/hooks/useStyle.ts +10 -0
  427. package/src/hooks/useTheme.tsx +1 -1
  428. package/src/hooks/useThemeState.ts +51 -264
  429. package/src/index.ts +14 -10
  430. package/src/internal-runtime.ts +10 -9
  431. package/src/internalRuntimeTypes.ts +1 -0
  432. package/src/static-resolve.ts +25 -18
  433. package/src/style.ts +97 -0
  434. package/src/styled.tsx +46 -332
  435. package/src/types.tsx +107 -192
  436. package/src/views/TamaguiProvider.tsx +0 -2
  437. package/src/views/Text.tsx +26 -21
  438. package/src/views/Theme.tsx +10 -8
  439. package/src/views/ThemeDebug.tsx +0 -1
  440. package/src/views/View.tsx +6 -7
  441. package/types/createComponent.d.ts.map +1 -1
  442. package/types/createStyledHOC.d.ts.map +1 -1
  443. package/types/createVariable.d.ts +0 -2
  444. package/types/createVariable.d.ts.map +1 -1
  445. package/types/dom/html.d.ts.map +1 -1
  446. package/types/dom/htmlRuntime.native.d.ts.map +1 -1
  447. package/types/dom/primitives.native.d.ts.map +1 -1
  448. package/types/helpers/borderComponents.d.ts +10 -0
  449. package/types/helpers/borderComponents.d.ts.map +1 -0
  450. package/types/helpers/componentDisplayName.d.ts +0 -3
  451. package/types/helpers/componentDisplayName.d.ts.map +1 -1
  452. package/types/helpers/createDesignSystem.d.ts.map +1 -1
  453. package/types/helpers/createStyledContext.d.ts.map +1 -1
  454. package/types/helpers/formatDiagnostic.d.ts.map +1 -1
  455. package/types/helpers/getCSSStylesAtomic.d.ts +25 -22
  456. package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
  457. package/types/helpers/getCSSStylesAtomic.native.d.ts +5 -0
  458. package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -1
  459. package/types/helpers/getCSSStylesAtomicCompiled.d.ts +6 -1
  460. package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -1
  461. package/types/helpers/getDynamicVal.d.ts.map +1 -1
  462. package/types/helpers/getSplitStyles.d.ts +9 -11
  463. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  464. package/types/helpers/grammarConfig.d.ts +25 -2
  465. package/types/helpers/grammarConfig.d.ts.map +1 -1
  466. package/types/helpers/insertStyleRule.d.ts +1 -0
  467. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  468. package/types/helpers/log.d.ts.map +1 -1
  469. package/types/helpers/mergeVariants.d.ts.map +1 -1
  470. package/types/helpers/nativeOnlyProps.d.ts +0 -1
  471. package/types/helpers/nativeOnlyProps.d.ts.map +1 -1
  472. package/types/helpers/nativeStyleEngine.d.ts +6 -0
  473. package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
  474. package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
  475. package/types/helpers/parseBorderShorthand.native.d.ts +1 -0
  476. package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -1
  477. package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -1
  478. package/types/helpers/resolveSafeArea.d.ts +0 -1
  479. package/types/helpers/resolveSafeArea.d.ts.map +1 -1
  480. package/types/helpers/resolveVariantStyle.d.ts +3 -0
  481. package/types/helpers/resolveVariantStyle.d.ts.map +1 -0
  482. package/types/helpers/splitStyleProps.d.ts +44 -0
  483. package/types/helpers/splitStyleProps.d.ts.map +1 -0
  484. package/types/helpers/styleFrontend.d.ts +7 -9
  485. package/types/helpers/styleFrontend.d.ts.map +1 -1
  486. package/types/helpers/styleStaticConfig.d.ts +14 -0
  487. package/types/helpers/styleStaticConfig.d.ts.map +1 -0
  488. package/types/helpers/styleStaticConfigCore.d.ts +4 -0
  489. package/types/helpers/styleStaticConfigCore.d.ts.map +1 -0
  490. package/types/helpers/styledDynamic.d.ts +18 -0
  491. package/types/helpers/styledDynamic.d.ts.map +1 -0
  492. package/types/helpers/tokenCategories.d.ts +0 -1
  493. package/types/helpers/tokenCategories.d.ts.map +1 -1
  494. package/types/helpers/variableValue.d.ts.map +1 -1
  495. package/types/helpers/warnOnce.d.ts.map +1 -1
  496. package/types/helpers/webPropsToSkip.native.d.ts +68 -68
  497. package/types/hooks/useAnimationDriver.d.ts.map +1 -1
  498. package/types/hooks/useComponentState.d.ts.map +1 -1
  499. package/types/hooks/useMedia.d.ts.map +1 -1
  500. package/types/hooks/useSplitStyles.d.ts.map +1 -1
  501. package/types/hooks/useStyle.d.ts +4 -0
  502. package/types/hooks/useStyle.d.ts.map +1 -0
  503. package/types/hooks/useThemeState.d.ts +1 -11
  504. package/types/hooks/useThemeState.d.ts.map +1 -1
  505. package/types/index.d.ts +8 -8
  506. package/types/index.d.ts.map +1 -1
  507. package/types/internal-runtime.d.ts.map +1 -1
  508. package/types/internalRuntimeTypes.d.ts +1 -1
  509. package/types/internalRuntimeTypes.d.ts.map +1 -1
  510. package/types/static-resolve.d.ts +2 -2
  511. package/types/static-resolve.d.ts.map +1 -1
  512. package/types/style.d.ts +18 -0
  513. package/types/style.d.ts.map +1 -0
  514. package/types/styled.d.ts +12 -48
  515. package/types/styled.d.ts.map +1 -1
  516. package/types/types.d.ts +75 -60
  517. package/types/types.d.ts.map +1 -1
  518. package/types/views/TamaguiProvider.d.ts +1 -1
  519. package/types/views/TamaguiProvider.d.ts.map +1 -1
  520. package/types/views/Text.d.ts.map +1 -1
  521. package/types/views/Theme.d.ts.map +1 -1
  522. package/types/views/ThemeDebug.d.ts.map +1 -1
  523. package/types/views/View.d.ts.map +1 -1
  524. package/dist/cjs/helpers/directStyleCSS.cjs +0 -348
  525. package/dist/cjs/helpers/directStyleCSS.native.cjs +0 -20
  526. package/dist/cjs/helpers/directStyleCSS.native.js.map +0 -1
  527. package/dist/cjs/helpers/directStyleCSSCompiled.cjs +0 -40
  528. package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +0 -46
  529. package/dist/cjs/helpers/directStyleCSSCompiled.native.js +0 -48
  530. package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +0 -1
  531. package/dist/cjs/helpers/getDefaultProps.native.js.map +0 -1
  532. package/dist/cjs/helpers/getVariantExtras.cjs +0 -91
  533. package/dist/cjs/helpers/getVariantExtras.native.cjs +0 -94
  534. package/dist/cjs/helpers/getVariantExtras.native.js +0 -96
  535. package/dist/cjs/helpers/getVariantExtras.native.js.map +0 -1
  536. package/dist/cjs/helpers/themeable.cjs +0 -92
  537. package/dist/cjs/helpers/themeable.native.cjs +0 -95
  538. package/dist/cjs/helpers/themeable.native.js +0 -97
  539. package/dist/cjs/helpers/themeable.native.js.map +0 -1
  540. package/dist/cjs/hooks/useProps.cjs +0 -129
  541. package/dist/cjs/hooks/useProps.native.cjs +0 -135
  542. package/dist/cjs/hooks/useProps.native.js +0 -137
  543. package/dist/cjs/hooks/useProps.native.js.map +0 -1
  544. package/dist/esm/helpers/directStyleCSS.mjs +0 -320
  545. package/dist/esm/helpers/directStyleCSS.mjs.map +0 -1
  546. package/dist/esm/helpers/directStyleCSS.native.js +0 -1
  547. package/dist/esm/helpers/directStyleCSSCompiled.mjs +0 -11
  548. package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +0 -1
  549. package/dist/esm/helpers/directStyleCSSCompiled.native.js +0 -15
  550. package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +0 -1
  551. package/dist/esm/helpers/getDefaultProps.mjs +0 -4
  552. package/dist/esm/helpers/getDefaultProps.mjs.map +0 -1
  553. package/dist/esm/helpers/getDefaultProps.native.js +0 -6
  554. package/dist/esm/helpers/getDefaultProps.native.js.map +0 -1
  555. package/dist/esm/helpers/getVariantExtras.mjs +0 -69
  556. package/dist/esm/helpers/getVariantExtras.mjs.map +0 -1
  557. package/dist/esm/helpers/getVariantExtras.native.js +0 -70
  558. package/dist/esm/helpers/getVariantExtras.native.js.map +0 -1
  559. package/dist/esm/helpers/themeable.mjs +0 -67
  560. package/dist/esm/helpers/themeable.mjs.map +0 -1
  561. package/dist/esm/helpers/themeable.native.js +0 -68
  562. package/dist/esm/helpers/themeable.native.js.map +0 -1
  563. package/dist/esm/hooks/useProps.mjs +0 -100
  564. package/dist/esm/hooks/useProps.mjs.map +0 -1
  565. package/dist/esm/hooks/useProps.native.js +0 -104
  566. package/dist/esm/hooks/useProps.native.js.map +0 -1
  567. package/src/helpers/directStyleCSS.native.ts +0 -1
  568. package/src/helpers/directStyleCSS.ts +0 -534
  569. package/src/helpers/directStyleCSSCompiled.ts +0 -32
  570. package/src/helpers/getDefaultProps.ts +0 -3
  571. package/src/helpers/getVariantExtras.tsx +0 -95
  572. package/src/helpers/themeable.tsx +0 -96
  573. package/src/hooks/useProps.tsx +0 -186
  574. package/types/helpers/directStyleCSS.d.ts +0 -28
  575. package/types/helpers/directStyleCSS.d.ts.map +0 -1
  576. package/types/helpers/directStyleCSS.native.d.ts +0 -2
  577. package/types/helpers/directStyleCSS.native.d.ts.map +0 -1
  578. package/types/helpers/directStyleCSSCompiled.d.ts +0 -10
  579. package/types/helpers/directStyleCSSCompiled.d.ts.map +0 -1
  580. package/types/helpers/getDefaultProps.d.ts +0 -3
  581. package/types/helpers/getDefaultProps.d.ts.map +0 -1
  582. package/types/helpers/getVariantExtras.d.ts +0 -4
  583. package/types/helpers/getVariantExtras.d.ts.map +0 -1
  584. package/types/helpers/themeable.d.ts +0 -3
  585. package/types/helpers/themeable.d.ts.map +0 -1
  586. package/types/hooks/useProps.d.ts +0 -39
  587. package/types/hooks/useProps.d.ts.map +0 -1
@@ -22,557 +22,244 @@ 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
- getContextPropSet: () => getContextPropSet,
30
- getDirectDynamicThemeAccess: () => getDirectDynamicThemeAccess,
25
+ emitVariantStyle: () => emitVariantStyle,
31
26
  getFontFamilyFromNameOrVariable: () => getFontFamilyFromNameOrVariable,
32
27
  getSplitStyles: () => getSplitStyles,
28
+ getStyleStaticConfig: () => import_styleStaticConfig.getStyleStaticConfig,
33
29
  getStyleTokenProvenance: () => import_styleProvenance2.getStyleTokenProvenance,
34
30
  isValidStyleKey: () => isValidStyleKey,
35
- prepareStyleStaticConfig: () => prepareStyleStaticConfig,
36
- styleOriginalValues: () => import_styleOriginalValues.styleOriginalValues
31
+ styleOriginalValues: () => import_styleOriginalValues.styleOriginalValues,
32
+ walkConditionalValue: () => walkConditionalValue
37
33
  });
38
34
  module.exports = __toCommonJS(getSplitStyles_exports);
39
35
  var import_constants = require("@tamagui/constants");
40
36
  var import_helpers = require("@tamagui/helpers");
37
+ var import_runtime = require("@tamagui/style-grammar/runtime");
41
38
  var import_config = require("../config.cjs");
42
- var import_createVariable = require("../createVariable.cjs");
43
39
  var import_isDevTools = require("../constants/isDevTools.cjs");
44
- var import_mediaState = require("./mediaState.cjs");
40
+ var import_defaultComponentState = require("../defaultComponentState.cjs");
41
+ var import_createVariable = require("../createVariable.cjs");
45
42
  var import_types = require("../types.cjs");
46
- var import_runtime = require("@tamagui/style-grammar/runtime");
47
- var import_mediaState2 = require("./mediaState.cjs");
48
- var import_warnOnce = require("./warnOnce.cjs");
49
- var import_expandStyle = require("./expandStyle.cjs");
50
- var import_expandStyles = require("./expandStyles.cjs");
51
- var import_styleToCSS = require("./styleToCSS.cjs");
52
- var import_directStyleCSS = require("./directStyleCSS.cjs");
53
- var import_directStyleCSS2 = require("./directStyleCSS.cjs");
43
+ var import_getCSSStylesAtomic = require("./getCSSStylesAtomic.cjs");
44
+ require("./expandStyle.cjs");
45
+ var import_borderComponents = require("./borderComponents.cjs");
46
+ require("./expandStyles.cjs");
54
47
  var import_grammarConfig = require("./grammarConfig.cjs");
48
+ var import_mediaState = require("./mediaState.cjs");
49
+ var import_styleStaticConfig = require("./styleStaticConfig.cjs");
50
+ require("./nativeStyleEngine.cjs");
51
+ var import_warnOnce = require("./warnOnce.cjs");
55
52
  require("./getDynamicVal.cjs");
56
- var import_getDefaultProps = require("./getDefaultProps.cjs");
57
- require("./insertStyleRule.cjs");
58
- var import_isObj = require("./isObj.cjs");
59
- var import_isObj2 = require("./isObj.cjs");
53
+ var import_styledDynamic = require("./styledDynamic.cjs");
54
+ var import_insertStyleRule = require("./insertStyleRule.cjs");
60
55
  var import_log = require("./log.cjs");
61
- var import_normalizeStyle = require("./normalizeStyle.cjs");
62
56
  var import_normalizeColor = require("./normalizeColor.cjs");
63
57
  var import_normalizeValueWithProperty = require("./normalizeValueWithProperty.cjs");
64
58
  require("./parseNativeStyle.native.cjs");
65
59
  require("./parseNativeTransform.native.cjs");
66
- var import_getVariantExtras = require("./getVariantExtras.cjs");
67
- var import_resolveRem = require("./resolveRem.cjs");
68
- var import_resolveSafeArea = require("./resolveSafeArea.cjs");
69
- var import_resolveSafeAreaVariable = require("./resolveSafeAreaVariable.cjs");
70
60
  var import_resolveVariableValue = require("./resolveVariableValue.cjs");
71
- var import_themeRef = require("./themeRef.cjs");
72
- var import_tokenCategories = require("./tokenCategories.cjs");
73
61
  var import_skipProps = require("./skipProps.cjs");
74
62
  var import_styleOriginalValues = require("./styleOriginalValues.cjs");
75
63
  var import_styleProvenance = require("./styleProvenance.cjs");
64
+ var import_themeRef = require("./themeRef.cjs");
76
65
  var import_transformsToString = require("./transformsToString.cjs");
66
+ var import_style = require("../style.cjs");
77
67
  var import_styleProvenance2 = require("./styleProvenance.cjs");
78
68
  __reExport(getSplitStyles_exports, require("./tokenCategories.cjs"), module.exports);
79
- const TAMAGUI_CLASS_PROPS = "$$tamaguiClassProps";
80
69
  const shouldTrackStyleTokenProvenance = process.env.NODE_ENV === "development" && process.env.TAMAGUI_ENABLE_STYLE_TOKEN_PROVENANCE === "1";
81
- function compoundMatcherMatches(expected, actual) {
82
- if (Array.isArray(expected)) {
83
- for (let index = 0; index < expected.length; index++) if (expected[index] === actual) return true;
84
- return false;
85
- }
86
- return expected === actual;
87
- }
88
- function compoundMatcherMatchesPayload(expected, source, start, end) {
89
- if (Array.isArray(expected)) {
90
- for (let index = 0; index < expected.length; index++) if (compoundMatcherMatchesPayload(expected[index], source, start, end)) return true;
91
- return false;
92
- }
93
- const expectedValue = typeof expected === "string" ? expected : String(expected);
94
- if (expectedValue.length !== end - start) return false;
95
- for (let index = 0; index < expectedValue.length; index++) if (expectedValue.charCodeAt(index) !== source.charCodeAt(start + index)) return false;
96
- return true;
97
- }
98
- const preparedCompoundsKey = /* @__PURE__ */ Symbol();
99
- function prepareStaticConfigCompounds(staticConfig) {
100
- const compoundVariants = staticConfig.compoundVariants;
101
- const preparedConfig = staticConfig;
102
- if (!compoundVariants?.length) {
103
- preparedConfig[preparedCompoundsKey] = null;
104
- return;
105
- }
106
- const selectorCounts = [];
107
- const indexesByKey = /* @__PURE__ */ Object.create(null);
108
- indexesByKey[preparedCompoundsKey] = selectorCounts;
109
- for (let index = 0; index < compoundVariants.length; index++) {
110
- const compoundVariant = compoundVariants[index];
111
- let selectorCount = 0;
112
- for (const key in compoundVariant) {
113
- if (key === "style") continue;
114
- selectorCount++;
115
- (indexesByKey[key] ||= []).push(index);
116
- }
117
- selectorCounts[index] = selectorCount;
118
- }
119
- preparedConfig[preparedCompoundsKey] = indexesByKey;
120
- }
121
- const conditionWidth = 4;
122
- const conditionValueOffset = 0;
123
- const conditionFlagsOffset = 1;
124
- const conditionPrecedenceOffset = 2;
125
- const conditionWrapperOffset = 3;
126
- const conditionActiveFlag = 1;
127
- const conditionEmitFlag = 2;
128
- const conditionResolvedFlag = 4;
129
- const conditionEnterFlag = 8;
130
- 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;
131
79
  const conditionPlatformPseudoFlag = 32;
132
- const conditionInitialFlags = conditionEmitFlag | 5;
133
- const conditionTextWidth = 5;
134
- const conditionKeyOffset = 0;
135
- const conditionSelectorOffset = 1;
136
- const conditionThemeOffset = 2;
137
- const conditionUnsupportedStateOffset = 3;
138
- const conditionUnresolvedNameOffset = 4;
139
- let conditionNumbers = new Float64Array(2048);
140
- const conditionTexts = [];
141
- const conditionWrappers = [];
142
- let conditionWrapperTop = 0;
143
- let conditionCursorTop = conditionWidth;
144
- function reserveConditionCursor(cursor) {
145
- const required = cursor + conditionWidth;
146
- if (required > conditionTexts.length) {
147
- const previous2 = conditionTexts.length;
148
- conditionTexts.length = required;
149
- conditionTexts.fill("", previous2);
150
- }
151
- if (required <= conditionNumbers.length) return;
152
- let length = conditionNumbers.length * 2;
153
- while (length < required) length *= 2;
154
- const previous = conditionNumbers;
155
- conditionNumbers = new Float64Array(length);
156
- conditionNumbers.set(previous);
157
- }
158
- function conditionWrapperCopy(cursor) {
159
- const wrapper = conditionNumbers[cursor + conditionWrapperOffset];
160
- const count = wrapper & 7;
161
- if (!count) return void 0;
162
- const start = wrapper >> 3;
163
- const wrappers = new Array(count);
164
- for (let index = 0; index < count; index++) wrappers[index] = conditionWrappers[start + index];
165
- return wrappers;
166
- }
167
- function setConditionUnresolved(cursor, name = "") {
168
- conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionResolvedFlag;
169
- if (name) {
170
- const text = cursor + conditionUnresolvedNameOffset;
171
- conditionTexts[text] ||= name;
172
- }
173
- }
174
- function appendConditionWrapper(cursor, wrapper) {
175
- conditionWrappers[conditionWrapperTop++] = wrapper;
176
- conditionNumbers[cursor + conditionWrapperOffset]++;
177
- }
178
- function copyConditionCursor(target, source) {
179
- for (let offset = 0; offset <= conditionPrecedenceOffset; offset++) conditionNumbers[target + offset] = conditionNumbers[source + offset];
180
- for (let offset = 0; offset < conditionTextWidth; offset++) conditionTexts[target + offset] = conditionTexts[source + offset] || "";
181
- const wrapper = conditionNumbers[source + conditionWrapperOffset];
182
- const wrapperStart = wrapper >> 3;
183
- const wrapperCount = wrapper & 7;
184
- for (let index = 0; index < wrapperCount; index++) conditionWrappers[conditionWrapperTop++] = conditionWrappers[wrapperStart + index];
185
- conditionNumbers[target + conditionWrapperOffset] += wrapperCount;
186
- }
187
- function resetConditionCursor(cursor, parent) {
188
- conditionNumbers[cursor + conditionValueOffset] = 0;
189
- conditionNumbers[cursor + conditionFlagsOffset] = conditionInitialFlags;
190
- conditionNumbers[cursor + conditionPrecedenceOffset] = 0;
191
- conditionNumbers[cursor + conditionWrapperOffset] = conditionWrapperTop << 3;
192
- conditionTexts.fill("", cursor, cursor + conditionTextWidth);
193
- if (parent) copyConditionCursor(cursor, parent);
194
- }
195
- function acquireConditionCursor(parent = 0) {
196
- const cursor = conditionCursorTop;
197
- conditionCursorTop += conditionWidth;
198
- reserveConditionCursor(cursor);
199
- resetConditionCursor(cursor, parent);
200
- 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
+ ];
201
100
  }
202
- function releaseConditionCursors(watermark) {
203
- if (watermark >= conditionCursorTop) return;
204
- conditionTexts.fill("", watermark, conditionCursorTop);
205
- conditionCursorTop = watermark;
101
+ function setConditionUnresolved(condition, name = "") {
102
+ condition[conditionValue] &= ~conditionResolvedFlag;
103
+ if (process.env.NODE_ENV !== "production") condition.problem ||= name;
206
104
  }
207
- function releaseConditionPayloads(wrapperBase) {
208
- conditionWrappers.fill("", wrapperBase, conditionWrapperTop);
209
- conditionWrapperTop = wrapperBase;
105
+ function appendConditionWrapper(condition, wrapper) {
106
+ const wrappers = condition[conditionWrappers];
107
+ if (!wrappers.includes(wrapper)) wrappers.push(wrapper);
210
108
  }
211
- function accumulateConditionAtom(state, cursor, kind, rank, name) {
212
- const keySlot = cursor + conditionKeyOffset;
213
- const key = conditionTexts[keySlot];
214
- if (!key) conditionTexts[keySlot] = name;
215
- else {
216
- let slotStart = 0;
217
- let inserted = false;
218
- while (slotStart <= key.length) {
219
- let slotEnd = key.indexOf(":", slotStart);
220
- if (slotEnd === -1) slotEnd = key.length;
221
- let order = 0;
222
- const compareLength = Math.min(name.length, slotEnd - slotStart);
223
- for (let offset = 0; offset < compareLength; offset++) {
224
- order = name.charCodeAt(offset) - key.charCodeAt(slotStart + offset);
225
- if (order) break;
226
- }
227
- order ||= name.length - (slotEnd - slotStart);
228
- if (!order) return;
229
- if (order < 0) {
230
- conditionTexts[keySlot] = `${key.slice(0, slotStart)}${name}:${key.slice(slotStart)}`;
231
- inserted = true;
232
- break;
233
- }
234
- if (slotEnd === key.length) break;
235
- slotStart = slotEnd + 1;
236
- }
237
- 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;
238
114
  }
239
- if (kind === import_runtime.modifierKindPlatform) {
240
- const precedence2 = conditionNumbers[cursor + conditionPrecedenceOffset];
241
- if (rank > precedence2 >>> 26) conditionNumbers[cursor + conditionPrecedenceOffset] = precedence2 & 67108863 | rank << 26;
242
- 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;
243
125
  return;
244
126
  }
245
- let precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
246
- const depth = Math.min((precedence >> 23 & 7) + 1, 7);
247
- const nextCategory = kind === import_runtime.modifierKindMedia ? 0 : kind === 6 ? 1 : kind === import_runtime.modifierKindTheme ? 2 : kind === 5 ? 3 : 4;
248
- let categoryRank = precedence >> 20 & 7;
249
- let withinRank = precedence & 1048575;
250
- if (nextCategory > categoryRank) {
251
- categoryRank = nextCategory;
252
- withinRank = rank;
253
- } else if (nextCategory === categoryRank && rank > withinRank) withinRank = rank;
254
- precedence = precedence & -67108864 | depth << 23 | categoryRank << 20 | withinRank;
255
- conditionNumbers[cursor + conditionPrecedenceOffset] = precedence;
256
- const buildCSS = import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses;
257
- if (kind === import_runtime.modifierKindMedia) {
258
- const query = (0, import_grammarConfig.getConfigRevisionState)(state.conf).mediaQueries[name];
259
- if (!query) {
260
- setConditionUnresolved(cursor, name);
261
- return;
262
- }
263
- if (buildCSS) appendConditionWrapper(cursor, `@media ${query}`);
264
- 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;
265
139
  (state.flatMediaKeys ||= /* @__PURE__ */ new Set()).add(name);
266
- } else if (kind === import_runtime.modifierKindTheme) {
267
- conditionTexts[cursor + conditionThemeOffset] = name;
268
- if (buildCSS) {
269
- const selector = cursor + conditionSelectorOffset;
270
- conditionTexts[selector] += `:where(.t_${name}, .t_${name} *)`;
271
- }
272
- if (state.flatThemeName !== name && state.flatThemeName?.startsWith(`${name}_`) !== true) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
273
- } else if (kind === 5) {
274
- const slash = name.indexOf("/");
275
- const groupName = slash === -1 ? "true" : name.slice(slash + 1);
276
- const stateSelector = import_runtime.stateModifierSelectors[rank];
277
- 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}`;
278
151
  if (buildCSS) {
279
- const selector = cursor + conditionSelectorOffset;
280
- conditionTexts[selector] += `:where(.t_group_${groupName}${stateSelector} *)`;
281
- if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
152
+ const query = modifier[3];
153
+ appendConditionWrapper(condition, containerName ? `@container ${containerName} ${query}` : `@container ${query}`);
282
154
  }
283
155
  const component = state.componentState.group?.[groupName];
284
156
  const context = state.flatGroupContext?.[groupName];
285
- 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;
286
159
  (state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupName);
287
- } else if (kind === 6) {
288
- const slash = name.indexOf("/");
289
- const containerSize = name.slice(1, slash === -1 ? name.length : slash);
290
- const containerName = slash === -1 ? "" : name.slice(slash + 1);
291
- const containerQuery = (0, import_grammarConfig.getConfigRevisionState)(state.conf).mediaQueries[containerSize];
292
- const groupKey = `@${containerName}`;
293
- if (buildCSS) appendConditionWrapper(cursor, containerName ? `@container ${containerName} ${containerQuery}` : `@container ${containerQuery}`);
294
- const component = state.componentState.group?.[groupKey];
295
- const context = state.flatGroupContext?.[groupKey];
296
- 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.`);
297
- const match = component?.media?.[containerSize];
298
- if (!(match === void 0 ? context?.state.layout && (0, import_mediaState2.mediaKeyMatch)(containerSize, context.state.layout) : match)) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
299
- (state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupKey);
300
- (state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(containerSize);
301
- } else {
302
- const stateSelector = import_runtime.stateModifierSelectors[rank];
303
- conditionNumbers[cursor + conditionFlagsOffset] += 64;
304
- if (rank === 6) conditionNumbers[cursor + conditionFlagsOffset] |= conditionEnterFlag;
305
- else if (rank === 7) conditionNumbers[cursor + conditionFlagsOffset] |= conditionExitFlag;
306
- else if (rank === 0 || rank === 2 || rank === 4) conditionNumbers[cursor + conditionFlagsOffset] |= conditionPlatformPseudoFlag;
307
- if (buildCSS) {
308
- const selector = cursor + conditionSelectorOffset;
309
- if (stateSelector[0] === ".") conditionTexts[selector] += `:is(${stateSelector}, ${stateSelector} *)`;
310
- else conditionTexts[selector] += stateSelector;
311
- if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
312
- }
313
- const component = state.componentState;
314
- 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;
315
- if (stateSelector[0] === ":") (state.flatStateKeys ||= /* @__PURE__ */ new Set()).add(name);
316
- }
317
- }
318
- function resolveConditionModifier(state, cursor, modifier) {
319
- const compiled = (0, import_grammarConfig.getConfigRevisionState)(state.conf);
320
- let code = compiled.modifiers[modifier];
321
- let kind = code & 7;
322
- let rank = code >> 3;
323
- if (kind === import_runtime.modifierKindState) {
324
- accumulateConditionAtom(state, cursor, kind, rank, import_runtime.canonicalStateModifierNames[rank]);
160
+ (state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(size);
325
161
  return;
326
162
  }
327
- if (!kind && modifier.startsWith("group-")) {
328
- const slash = modifier.indexOf("/");
329
- const authoredState = modifier.slice(6, slash === -1 ? void 0 : slash);
330
- code = compiled.modifiers[authoredState];
331
- if ((code & 7) === import_runtime.modifierKindState) {
332
- rank = code >> 3;
333
- const groupName = slash === -1 ? "true" : modifier.slice(slash + 1);
334
- if (rank !== 6 && rank !== 7 && (slash === -1 || (0, import_runtime.isModifierName)(groupName, 0, groupName.length))) {
335
- const stateName = import_runtime.canonicalStateModifierNames[rank];
336
- accumulateConditionAtom(state, cursor, 5, rank, `group-${stateName}${slash === -1 ? "" : modifier.slice(slash)}`);
337
- return;
338
- }
339
- }
340
- } else if (!kind && modifier.charCodeAt(0) === 64) {
341
- const slash = modifier.indexOf("/");
342
- const containerSize = modifier.slice(1, slash === -1 ? void 0 : slash);
343
- const containerName = slash === -1 ? "" : modifier.slice(slash + 1);
344
- let containerQuery = "";
345
- 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)) {
346
- accumulateConditionAtom(state, cursor, 6, code >> 3, modifier);
347
- return;
348
- }
349
- } else if (kind) {
350
- accumulateConditionAtom(state, cursor, kind, rank, modifier);
351
- 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);
352
179
  }
353
- setConditionUnresolved(cursor, modifier);
180
+ if (rank === 0 && buildCSS) appendConditionWrapper(condition, "@media (hover: hover)");
354
181
  }
355
- function resolveConditionText(state, cursor, text) {
182
+ function resolveConditionText(state, condition, text) {
356
183
  let start = 0;
357
184
  for (let index = 0; index <= text.length; index++) {
358
185
  if (index !== text.length && text.charCodeAt(index) !== 58) continue;
359
186
  if (index === start) {
360
- setConditionUnresolved(cursor);
187
+ setConditionUnresolved(condition);
361
188
  return;
362
189
  }
363
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) return;
364
- resolveConditionModifier(state, cursor, text.slice(start, index));
190
+ if (!(condition[conditionValue] & conditionResolvedFlag)) return;
191
+ resolveConditionModifier(state, condition, text.slice(start, index));
365
192
  start = index + 1;
366
193
  }
367
194
  }
368
- function commitConditionCursor(state, cursor) {
369
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
370
- conditionNumbers[cursor + conditionValueOffset] = 0;
195
+ function commitCondition(condition) {
196
+ if (!(condition[conditionValue] & conditionResolvedFlag)) {
197
+ condition[conditionValue] = 0;
371
198
  return 0;
372
199
  }
373
- const key = conditionTexts[cursor + conditionKeyOffset] || "";
374
- const precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
375
- const depth = precedence >> 23 & 7;
376
- if (depth > 5) throw new Error(`a flat value clause supports at most 5 non-platform conditions; received ${depth} in "${key}:"`);
377
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
378
- const condition = precedence * 256 + (flags >> 6) * 32 + 16 + (flags & conditionActiveFlag ? 1 : 0) + (flags & conditionEmitFlag ? 2 : 0) + (flags & conditionEnterFlag ? 4 : 0) + (flags & conditionExitFlag ? 8 : 0);
379
- conditionNumbers[cursor + conditionValueOffset] = condition;
380
- return condition;
381
- }
382
- function acquireConditionKeyCursor(state, key) {
383
- const cursor = acquireConditionCursor();
384
- if (key) {
385
- resolveConditionText(state, cursor, key);
386
- commitConditionCursor(state, cursor);
387
- }
388
- return cursor;
389
- }
390
- function combineConditionKeys(state, first, second) {
391
- if (!first) return second;
392
- if (!second || first === second) return first;
393
- const watermark = conditionCursorTop;
394
- const target = acquireConditionKeyCursor(state, first);
395
- resolveConditionText(state, target, second);
396
- commitConditionCursor(state, target);
397
- const key = conditionTexts[target + conditionKeyOffset] || "";
398
- releaseConditionCursors(watermark);
399
- return key;
400
- }
401
- function freshCompoundState() {
402
- return {
403
- seen: 0,
404
- failed: false,
405
- matchedBase: false,
406
- scanned: false,
407
- pending: null,
408
- combinations: null
409
- };
410
- }
411
- function beginCompoundEdges(indexes, states) {
412
- if (!indexes) return;
413
- for (let index = 0; index < indexes.length; index++) {
414
- const state = states[indexes[index]] ||= freshCompoundState();
415
- state.pending = null;
416
- state.matchedBase = false;
417
- state.scanned = false;
418
- }
419
- }
420
- function feedCompoundSegment(state, source, start, end, isBase, valid, conditionKey) {
421
- if (state.flatCompoundOutputDepth) return;
422
- const pass = state.flatPass;
423
- const indexes = pass[passCompoundIndexes];
424
- const states = pass[passCompoundStates];
425
- const key = pass[passCompoundKey];
426
- if (!indexes || !states || !key) return;
427
- const compoundVariants = state.staticConfig.compoundVariants;
428
- for (let index = 0; index < indexes.length; index++) {
429
- const compoundIndex = indexes[index];
430
- const compoundState = states[compoundIndex] ||= freshCompoundState();
431
- compoundState.scanned = true;
432
- if (!valid || start === end || !compoundMatcherMatchesPayload(compoundVariants[compoundIndex][key], source, start, end)) continue;
433
- if (isBase) compoundState.matchedBase = true;
434
- else if (!compoundState.matchedBase) (compoundState.pending ||= []).push(conditionKey);
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;
435
206
  }
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;
436
212
  }
437
- const compoundOnlyHandler = {
438
- segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
439
- if (isBase) {
440
- feedCompoundSegment(state, source, start, end, true, valid, "");
441
- return;
442
- }
443
- const cursor = state.flatScanCursor;
444
- if (!chainValid || !cursor || !(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) || !conditionNumbers[cursor + conditionValueOffset]) {
445
- feedCompoundSegment(state, source, start, end, false, false, "");
446
- return;
447
- }
448
- feedCompoundSegment(state, source, start, end, false, valid, conditionTexts[cursor + conditionKeyOffset] || "");
449
- },
450
- modifier(state, start, end, valid, first, source) {
451
- let cursor = state.flatScanCursor;
452
- if (!cursor) cursor = state.flatScanCursor = acquireConditionCursor();
453
- else if (first) resetConditionCursor(cursor, 0);
454
- if (!valid) {
455
- setConditionUnresolved(cursor);
456
- return;
457
- }
458
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
459
- },
460
- chain(state, _start, _end, valid) {
461
- const cursor = state.flatScanCursor;
462
- if (cursor) {
463
- if (!valid) setConditionUnresolved(cursor);
464
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
465
- }
466
- return true;
467
- }
468
- };
469
- function finishCompoundEdges(pass, key, value, indexes, states) {
470
- if (!indexes) return;
471
- const state = pass[passStyleState];
472
- pass[passCompoundIndexes] = indexes;
473
- pass[passCompoundKey] = key;
474
- pass[passCompoundStates] = states;
475
- let needsScan = false;
476
- for (let index = 0; index < indexes.length; index++) if (!(states[indexes[index]] ||= freshCompoundState()).scanned) {
477
- needsScan = true;
478
- break;
479
- }
480
- if (needsScan) if (typeof value === "string") {
481
- const watermark = conditionCursorTop;
482
- const previousCursor = state.flatScanCursor;
483
- state.flatScanCursor = null;
484
- try {
485
- (0, import_runtime.scanFlatValue)(value, compoundOnlyHandler, state);
486
- } finally {
487
- state.flatScanCursor = previousCursor;
488
- releaseConditionCursors(watermark);
489
- }
490
- } else if (value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && Object.prototype.hasOwnProperty.call(value, "default")) for (const conditionKey in value) {
491
- const payload = value[conditionKey];
492
- if (conditionKey === "default") {
493
- const payloadString = String(payload);
494
- feedCompoundSegment(state, payloadString, 0, payloadString.length, true, true, "");
495
- } else {
496
- const watermark = conditionCursorTop;
497
- const cursor = acquireConditionCursor();
498
- resolveConditionText(state, cursor, conditionKey);
499
- const condition = commitConditionCursor(state, cursor);
500
- const payloadString = String(payload);
501
- feedCompoundSegment(state, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
502
- releaseConditionCursors(watermark);
503
- }
504
- }
505
- else {
506
- const variants2 = state.staticConfig.compoundVariants;
507
- for (let index = 0; index < indexes.length; index++) {
508
- const compoundIndex = indexes[index];
509
- const compoundState = states[compoundIndex] ||= freshCompoundState();
510
- compoundState.scanned = true;
511
- if (compoundMatcherMatches(variants2[compoundIndex][key], value)) compoundState.matchedBase = true;
512
- }
513
- }
514
- const variants = state.staticConfig.compoundVariants;
515
- const selectorCounts = state.staticConfig[preparedCompoundsKey][preparedCompoundsKey];
516
- for (let index = 0; index < indexes.length; index++) {
517
- const compoundIndex = indexes[index];
518
- const compoundState = states[compoundIndex];
519
- if (compoundState.failed) continue;
520
- const branches = compoundState.matchedBase ? [""] : compoundState.pending;
521
- if (!branches || !branches.length) {
522
- compoundState.failed = true;
523
- continue;
524
- }
525
- if (!compoundState.seen) compoundState.combinations = branches;
526
- else {
527
- const previous = compoundState.combinations;
528
- const next = [];
529
- for (let left = 0; left < previous.length; left++) for (let right = 0; right < branches.length; right++) {
530
- const conditionKey = combineConditionKeys(state, previous[left], branches[right]);
531
- if (!next.includes(conditionKey)) next.push(conditionKey);
532
- }
533
- compoundState.combinations = next;
534
- }
535
- compoundState.seen++;
536
- if (compoundState.seen !== selectorCounts[compoundIndex]) continue;
537
- const style = variants[compoundIndex].style;
538
- if (!(0, import_isObj.isPlainObject)(style)) continue;
539
- const combinations = compoundState.combinations;
540
- for (let combination = 0; combination < combinations.length; combination++) for (const styleKey in style) contributeProp(pass, styleKey, style[styleKey], void 0, states, combinations[combination]);
541
- }
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;
542
234
  }
543
- function classifyConditionalObject(value, state, isChain, firstCursor) {
544
- if (Object.prototype.hasOwnProperty.call(value, "default")) return -1;
235
+ function classifyConditionalObject(value, state, isChain, firstCondition) {
236
+ if ("default" in value) return -1;
545
237
  for (const key in value) {
546
238
  if (!key.length) return 0;
547
239
  if (!state) return isChain?.(key) ? 1 : 0;
548
- const watermark = conditionCursorTop;
549
- const cursor = firstCursor || acquireConditionCursor();
550
- try {
551
- resolveConditionText(state, cursor, key);
552
- return commitConditionCursor(state, cursor);
553
- } finally {
554
- if (!firstCursor) releaseConditionCursors(watermark);
555
- }
240
+ const condition = firstCondition || createCondition();
241
+ resolveConditionText(state, condition, key);
242
+ return commitCondition(condition);
556
243
  }
557
244
  return 0;
558
245
  }
559
- const passStyleState = 0;
560
- const passClassName = 21;
561
- const passShouldDoClasses = 22;
562
- const passContainerValue = 23;
563
- const passContainerName = 24;
564
- const passContainerType = 25;
565
- const passFrontendGroup = 26;
566
- const passFrontendContainer = 27;
567
- const passFrontendContainerType = 28;
568
- const passHocMappedProperties = 29;
569
- const passHocMappedClasses = 30;
570
- const passCompoundIndexes = 31;
571
- const passCompoundKey = 32;
572
- const passCompoundStates = 33;
573
- const passParentCursor = 35;
574
- const passMapSourceKey = 36;
575
- 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;
576
263
  const passNoSkipFlag = 1;
577
264
  const passDisableShorthandsFlag = 2;
578
265
  const passNoExpandFlag = 4;
@@ -581,102 +268,8 @@ const passHocFlag = 16;
581
268
  const passTextFlag = 32;
582
269
  const passInputFlag = 64;
583
270
  const passAsChildStyleFlag = 128;
584
- const styledDefaultsCache = /* @__PURE__ */ new WeakMap();
585
- function getStyledDefaults(staticConfig, shorthands) {
586
- let prepared = styledDefaultsCache.get(staticConfig);
587
- if (prepared === void 0) {
588
- let entries = null;
589
- const defaults = staticConfig.defaultProps;
590
- if (defaults) for (const key in defaults) {
591
- if (!(key in import_helpers.stylePropsAll || key in shorthands)) continue;
592
- const value = defaults[key];
593
- if (maybeStyleProgram(value)) (entries ||= []).push(key, value);
594
- }
595
- prepared = entries;
596
- styledDefaultsCache.set(staticConfig, prepared);
597
- }
598
- return prepared;
599
- }
600
- const maybeStyleProgram = (value) => typeof value === "string" ? value.indexOf(":") !== -1 : !!value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
601
- function contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass) {
602
- if (!styledDefaults) return;
603
- for (let offset = 0; offset < styledDefaults.length; offset += 2) {
604
- const key = styledDefaults[offset];
605
- const value = styledDefaults[offset + 1];
606
- const propValue = processedProps[key];
607
- if (propValue !== void 0 && propValue !== value) contributeProp(pass, key, value);
608
- }
609
- }
610
- function injectDisplacedStyledDefault(pass, key, value) {
611
- const defaultValue = pass[4].defaultProps?.[key];
612
- if (defaultValue === void 0 || value === void 0 || value === defaultValue || maybeStyleProgram(defaultValue)) return;
613
- const state = pass[passStyleState];
614
- state.flatWeakContribution = true;
615
- try {
616
- contributeProp(pass, key, defaultValue);
617
- } finally {
618
- state.flatWeakContribution = false;
619
- }
620
- }
621
- function forEachPropInForwardOrder(pass) {
622
- const styleState = pass[passStyleState];
623
- const staticConfig = styleState.staticConfig;
624
- const processedProps = styleState.props;
625
- const shorthands = styleState.conf.shorthands;
626
- const processedBaseStyle = staticConfig.baseStyle;
627
- const styledDefaults = getStyledDefaults(staticConfig, shorthands);
628
- const directState = styleState;
629
- const preparedCompounds = staticConfig[preparedCompoundsKey];
630
- if (preparedCompounds === void 0 && staticConfig.compoundVariants?.length) throw new Error("A component with compoundVariants reached style resolution before its static config was prepared.");
631
- const conditionWrapperBase = conditionWrapperTop;
632
- if (!preparedCompounds) {
633
- try {
634
- if (processedBaseStyle) for (const key in processedBaseStyle) contributeProp(pass, key, processedBaseStyle[key]);
635
- contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass);
636
- for (const key in processedProps) {
637
- const value = processedProps[key];
638
- directState.flatPropSawCondition = false;
639
- contributeProp(pass, key, value);
640
- if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
641
- }
642
- } finally {
643
- releaseConditionPayloads(conditionWrapperBase);
644
- }
645
- return;
646
- }
647
- const compoundVariants = staticConfig.compoundVariants;
648
- const compoundStates = new Array(compoundVariants.length);
649
- try {
650
- if (processedBaseStyle) for (const key in processedBaseStyle) contributeProp(pass, key, processedBaseStyle[key]);
651
- contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass);
652
- const selectorCounts = preparedCompounds[preparedCompoundsKey];
653
- for (let compoundIndex = 0; compoundIndex < compoundVariants.length; compoundIndex++) {
654
- if (selectorCounts[compoundIndex]) continue;
655
- const style = compoundVariants[compoundIndex].style;
656
- if (!(0, import_isObj.isPlainObject)(style)) continue;
657
- for (const key in style) contributeProp(pass, key, style[key]);
658
- }
659
- for (const key in processedProps) {
660
- const compoundIndexes = preparedCompounds[key];
661
- const value = processedProps[key];
662
- beginCompoundEdges(compoundIndexes, compoundStates);
663
- directState.flatPropSawCondition = false;
664
- contributeProp(pass, key, value, compoundIndexes, compoundStates);
665
- if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
666
- finishCompoundEdges(pass, key, value, compoundIndexes, compoundStates);
667
- }
668
- } finally {
669
- releaseConditionPayloads(conditionWrapperBase);
670
- }
671
- }
672
- function isValidStyleKey(key, validStyles, accept) {
673
- return Boolean(key in validStyles || accept && key in accept);
674
- }
675
- function flushForwardStylesToClasses(pass) {
676
- const styleState = pass[passStyleState];
677
- if (!pass[passShouldDoClasses]) return;
678
- (0, import_directStyleCSS.completeStreamingCSS)(styleState);
679
- (0, import_directStyleCSS.flushDirectStyles)(styleState, true);
271
+ function isValidStyleKey(key, validStyles) {
272
+ return key in validStyles;
680
273
  }
681
274
  function effectiveLifecycleKeys(keys) {
682
275
  if (!keys) return;
@@ -684,317 +277,254 @@ function effectiveLifecycleKeys(keys) {
684
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);
685
278
  return out;
686
279
  }
687
- function mapContributedProp(styleState, key, val, originalVal, condition) {
688
- const pass = styleState.flatPass;
689
- const keyInit = pass[passMapSourceKey];
690
- const disablePropMap = Boolean(pass[passMapFlags]);
691
- 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);
692
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;
693
294
  const hocParentVariants = isHOC ? parentVariants : void 0;
694
- const canResolveContextPrograms = !isHOC;
695
- const isStyledContextProp = styledContextKeys?.has(key) || styledContext && key in styledContext;
696
- if (key === "className") {
697
- if (typeof val === "string" && val) pass[passClassName] = `${pass[passClassName]} ${val}`.trim();
698
- return;
699
- }
700
- if (canResolveContextPrograms && disablePropMap && !isStyledContextProp) {
701
- if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
702
- 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.`);
703
- return;
704
- }
705
- viewProps[key] = val;
706
- return;
707
- }
708
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
709
- console.groupCollapsed(" 💠 expanded", keyInit, "=>", key);
710
- (0, import_log.log)(val);
711
- console.groupEnd();
712
- }
713
- if (val == null) return;
714
- if (accept && key in accept) {
715
- viewProps[key] = val;
716
- return;
717
- }
718
- const isHostStyleKey = isValidStyleKey(key, validStyles, accept) || false;
719
- const isContextProgramKey = canResolveContextPrograms && Boolean(isStyledContextProp);
720
- if (condition !== void 0) {
721
- const conditionCursor = condition;
722
- if (isHostStyleKey || isContextProgramKey) contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey, conditionCursor);
723
- else if (isHOC) {
724
- const structured = mergeConditionTransport(styleState, viewProps[key], conditionCursor, val);
725
- if (key in viewProps) delete viewProps[key];
726
- viewProps[key] = structured;
727
- } 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.`);
728
- return;
729
- }
730
- if (isHostStyleKey || isContextProgramKey) {
731
- contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey);
732
- return;
733
- }
734
- const isVariant = Boolean(variants && key in variants);
735
- if (inlineProps?.has(key)) viewProps[key] = props[key] ?? val;
736
- if (Boolean(hocParentVariants && hocParentVariants[keyInit])) {
737
- passDownProp(viewProps, key, val);
738
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
739
- console.groupCollapsed(` - passing down prop ${key}`);
740
- (0, import_log.log)({
741
- val,
742
- after: { ...viewProps[key] }
743
- });
744
- console.groupEnd();
745
- }
295
+ let keyInit = keyOg;
296
+ let valInit = valOg;
297
+ if (keyInit === "children") {
298
+ viewProps[keyInit] = valInit;
746
299
  return;
747
300
  }
748
- if (!isVariant) {
749
- if (isStyledContextProp) return;
750
- if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
751
- 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.`);
752
- return;
753
- }
754
- 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];
755
306
  }
756
- }
757
- function contributeProp(pass, keyOg, valOg, compoundIndexes, compoundStates, parentConditionKey) {
758
- const parentWatermark = conditionCursorTop;
759
- if (compoundIndexes) {
760
- pass[passCompoundIndexes] = compoundIndexes;
761
- pass[passCompoundKey] = keyOg;
762
- pass[passCompoundStates] = compoundStates;
763
- } else if (pass[passCompoundIndexes]) pass[passCompoundIndexes] = void 0;
764
- if (parentConditionKey) pass[passParentCursor] = acquireConditionKeyCursor(pass[passStyleState], parentConditionKey);
765
- try {
766
- const [styleState, conf, props, viewProps, staticConfig, validStyles, accept, neverSkipProps, variants, inlineProps, parentVariants, styleFrontend, styledContext, styledContextKeys, flags, debug, parentStaticConfig, defaultProps, driverAnimations, driverOutputStyle, elementType] = pass;
767
- const noSkip = Boolean(flags & passNoSkipFlag);
768
- const disableExpandShorthands = Boolean(flags & passDisableShorthandsFlag);
769
- const noExpand = Boolean(flags & passNoExpandFlag);
770
- const noMergeStyle = Boolean(flags & passNoMergeFlag);
771
- const isHOC = Boolean(flags & passHocFlag);
772
- const isText = Boolean(flags & passTextFlag);
773
- const isInput = Boolean(flags & passInputFlag);
774
- const shorthands = conf.shorthands;
775
- const shouldSkipDirectProps = !noSkip && !isHOC;
776
- const shouldCheckSkipProps = !noSkip;
777
- const asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
778
- const isTextOrInput = isText || isInput;
779
- const hocParentVariants = isHOC ? parentVariants : void 0;
780
- let keyInit = keyOg;
781
- let valInit = valOg;
782
- if (keyInit === "children") {
783
- viewProps[keyInit] = valInit;
307
+ if (keyInit === "className") {
308
+ if (pass[passParentCursor]) {
309
+ if (typeof valInit === "string") pass[passClassName] = `${pass[passClassName]} ${valInit}`.trim();
784
310
  return;
785
311
  }
786
- if (keyInit === "ref") return;
787
- if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`before-prop-${keyInit}`;
788
- if (process.env.NODE_ENV === "test" && keyInit === "jestAnimatedStyle") return;
789
- if (accept) {
790
- const accepted = accept[keyInit];
791
- if ((accepted === "style" || accepted === "textStyle") && valInit && typeof valInit === "object") {
792
- viewProps[keyInit] = resolveAcceptedStyle(styleState, valInit);
312
+ if (typeof valInit === "string" && valInit && true) {
313
+ if (noMergeStyle) {
314
+ viewProps.className = valInit;
793
315
  return;
794
316
  }
795
- }
796
- if (!disableExpandShorthands) {
797
- if (keyInit in shorthands) keyInit = shorthands[keyInit];
798
- }
799
- if (keyInit === "className") {
800
- if (typeof valInit === "string" && valInit && true) {
801
- if (noMergeStyle) {
802
- viewProps.className = valInit;
803
- 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]);
804
328
  }
805
- const hocClassNames = props[import_skipProps.HOC_CLASSNAME_MARKER];
806
- if (hocClassNames && typeof hocClassNames === "object") {
807
- flushForwardStylesToClasses(pass);
808
- for (const property in hocClassNames) {
809
- const generatedClass = hocClassNames[property];
810
- if (typeof generatedClass !== "string") continue;
811
- clearDirectStyle(styleState, property);
812
- styleState.classNames[property] = generatedClass;
813
- (pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
814
- (pass[passHocMappedClasses] ||= /* @__PURE__ */ new Set()).add(generatedClass);
815
- }
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;
816
336
  }
817
- const getClassPlan = styleFrontend?.getClassPlan;
818
- let start = 0;
819
- for (let index = 0; index <= valInit.length; index++) {
820
- if (index !== valInit.length && valInit.charCodeAt(index) > 32) continue;
821
- if (index === start) {
822
- start = index + 1;
823
- continue;
824
- }
825
- const candidate = valInit.slice(start, index);
826
- if (pass[passHocMappedClasses]?.has(candidate)) {
827
- start = index + 1;
828
- continue;
829
- }
830
- const plan = getClassPlan ? getClassPlan(candidate, conf) : "raw";
831
- if (plan === null) {
832
- if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`[tamagui] frontend candidate "${candidate}" is unavailable on this platform and was dropped.`);
833
- } else if (plan === "raw") {
834
- pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
835
- if (getClassPlan) {
836
- flushForwardStylesToClasses(pass);
837
- pass[passShouldDoClasses] = false;
838
- styleState.flatShouldDoClasses = false;
839
- }
840
- } else {
841
- const parentPlan = plan;
842
- if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
843
- pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
844
- flushForwardStylesToClasses(pass);
845
- pass[passShouldDoClasses] = false;
846
- styleState.flatShouldDoClasses = false;
847
- }
848
- const entries = Array.isArray(plan) ? plan : parentPlan.entries;
849
- for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
850
- const entry = entries[entryIndex];
851
- if (entry[2] !== void 0) {
852
- if (isValidStyleKey(entry[0], validStyles, accept)) contributeValue(styleState, entry[0], entry[1], mergeStyle, void 0, false, entry[2]);
853
- 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.`);
854
- } else {
855
- if (entry[0] === "group") pass[passFrontendGroup] = entry[1];
856
- else if (entry[0] === "container") pass[passFrontendContainer] = entry[1];
857
- else if (entry[0] === "containerType") pass[passFrontendContainerType] = entry[1];
858
- contributeProp(pass, entry[0], entry[1]);
859
- }
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);
860
347
  }
348
+ pass[passShouldDoClasses] = false;
349
+ styleState.flatShouldDoClasses = false;
861
350
  }
862
- start = index + 1;
863
- }
864
- if (props[import_skipProps.HOC_CLASSNAME_MARKER] !== void 0) {
865
- flushForwardStylesToClasses(pass);
866
- pass[passShouldDoClasses] = false;
867
- styleState.flatShouldDoClasses = false;
868
351
  }
352
+ start = index + 1;
869
353
  }
870
- return;
871
354
  }
872
- if (keyInit === "style") {
873
- if (!valInit) return;
874
- if (noMergeStyle) {
875
- viewProps.style = valInit;
876
- return;
877
- }
878
- const isArray = Array.isArray(valInit);
879
- const length = isArray ? valInit.length : 1;
880
- for (let index = 0; index < length; index++) {
881
- const style = isArray ? valInit[index] : valInit;
882
- if (!style) continue;
883
- const hocClassNames = style[TAMAGUI_CLASS_PROPS];
884
- if (hocClassNames) {
885
- for (const property in hocClassNames) {
886
- clearDirectStyle(styleState, property);
887
- styleState.classNames[property] = hocClassNames[property];
888
- (pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
889
- }
890
- continue;
891
- }
892
- const normalized = (0, import_normalizeStyle.normalizeStyle)(style, false, true);
893
- const styleOriginals = shouldTrackStyleTokenProvenance ? import_styleOriginalValues.styleOriginalValues.get(style) : void 0;
894
- for (const key in normalized) {
895
- if (normalized[key] == null) continue;
896
- if (pass[passHocMappedProperties]?.delete(key)) clearDirectStyle(styleState, key);
897
- if (key === "containerName" && typeof normalized[key] === "string" && normalized[key].indexOf(":") === -1) pass[passContainerName] = normalized[key];
898
- if (key === "containerType" && typeof normalized[key] === "string" && normalized[key].indexOf(":") === -1) pass[passContainerType] = normalized[key];
899
- contributeValue(styleState, key, normalized[key], mergeStyle, styleOriginals?.[key]);
900
- }
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]);
901
365
  }
902
- return;
903
- }
904
- if (defaultProps) {
905
- const defaultVal = defaultProps[keyOg] ?? defaultProps[keyInit];
906
- if (defaultVal !== void 0 && valInit === defaultVal) return;
907
- }
908
- if (keyInit in import_skipProps.skipProps && shouldSkipDirectProps && !neverSkipProps?.[keyInit]) {
909
- if (keyInit === "container") pass[passContainerValue] = valInit;
910
- if (keyInit === "transition" && typeof valInit === "string") {
911
- const animationConfig = driverAnimations?.[valInit];
912
- if (animationConfig && driverOutputStyle === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
913
- else if (animationConfig) return;
914
- } else return;
915
366
  }
916
- let isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles, accept);
917
- if (keyInit.startsWith("data-")) {
918
- viewProps[keyInit] = valInit;
367
+ return;
368
+ }
369
+ if (keyInit === "style") {
370
+ if (!valInit) return;
371
+ if (noMergeStyle) {
372
+ viewProps.style = valInit;
919
373
  return;
920
374
  }
921
- if (!noExpand) {
922
- if (keyInit === "disabled" && valInit === true) {
923
- viewProps["aria-disabled"] = true;
924
- if (isInput || elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") viewProps.disabled = true;
925
- if (!variants?.disabled) return;
926
- }
927
- if (keyInit === "testID") {
928
- viewProps["data-testid"] = valInit;
929
- 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;
930
391
  }
931
- if (keyInit === "id") {
932
- viewProps.id = valInit;
933
- 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]);
934
398
  }
935
399
  }
936
- let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
937
- const isStyleLikeKey = isValidStyleKeyInit || isVariant;
938
- const isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
939
- if (isStyleProp && asChildExceptStyleLike) return;
940
- const shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || inlineProps?.has(keyInit);
941
- const parentVariant = parentVariants?.[keyInit];
942
- const isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in import_skipProps.skipProps));
943
- const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
944
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
945
- console.groupCollapsed(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`);
946
- (0, import_log.log)({
947
- isVariant,
948
- valInit,
949
- shouldPassProp
950
- });
951
- if (import_constants.isClient) (0, import_log.log)({
952
- variants,
953
- variant: variants?.[keyInit],
954
- isVariant,
955
- isHOCShouldPassThrough,
956
- parentStaticConfig
957
- });
958
- }
959
- if (shouldPassThrough) {
960
- passDownProp(viewProps, keyInit, valInit);
961
- if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
962
- if (!isVariant) return;
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;
963
425
  }
964
- if (shouldCheckSkipProps && !neverSkipProps?.[keyInit]) {
965
- if (keyInit in import_skipProps.skipProps && !(keyInit === "transition" && typeof valInit === "string" && !driverAnimations?.[valInit])) {
966
- if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
967
- return;
968
- }
426
+ if (keyInit === "testID") {
427
+ viewProps["data-testid"] = valInit;
428
+ return;
969
429
  }
970
- if (isTextOrInput) {
971
- if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
430
+ if (keyInit === "id") {
431
+ viewProps.id = valInit;
432
+ return;
972
433
  }
973
- const disablePropMap = !isStyleLikeKey;
974
- if (isValidStyleKeyInit && valInit != null && !(variants && keyInit in variants) && !(accept && keyInit in accept) && !(styledContextKeys?.has(keyInit) || styledContext && keyInit in styledContext)) {
975
- contributeValue(styleState, keyInit, valInit, mergeStyle);
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])) {
470
+ if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
976
471
  return;
977
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;
978
484
  pass[passMapSourceKey] = keyInit;
979
- pass[passMapFlags] = disablePropMap ? 1 : 0;
980
- contributeMappedValue(keyInit, valInit, styleState, disablePropMap);
981
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
982
- try {
983
- (0, import_log.log)(` \u2714\uFE0F expand complete`, keyInit);
984
- (0, import_log.log)("style", { ...styleState.style });
985
- (0, import_log.log)("viewProps", { ...viewProps });
986
- (0, import_log.log)("transforms", styleState.transformAccumulator);
987
- } catch {}
988
- console.groupEnd();
989
- }
990
- } finally {
991
- if (parentConditionKey) pass[passParentCursor] = null;
992
- 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();
993
523
  }
994
524
  }
995
- const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) => {
525
+ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver, styleStaticConfig) => {
996
526
  const conf = (0, import_config.getConfig)();
997
- if (staticConfig.styleFrontend?.normalizeStaticConfig) staticConfig = staticConfig.styleFrontend.normalizeStaticConfig(staticConfig, conf);
527
+ styleStaticConfig ||= (0, import_styleStaticConfig.getStyleStaticConfig)(staticConfig, conf);
998
528
  const driver = animationDriver || componentContext?.animationDriver || conf.animations;
999
529
  const driverAnimations = driver?.animations;
1000
530
  const driverInputStyle = driver?.inputStyle;
@@ -1002,7 +532,8 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1002
532
  const resolvedDriver = driver?.isStub ? null : driver;
1003
533
  if (props.passThrough) return null;
1004
534
  const { shorthands } = conf;
1005
- const { isHOC, isText, isInput, variants, inlineProps, parentStaticConfig, acceptsClassName } = staticConfig;
535
+ const { isHOC, isText, isInput, inlineProps, parentStaticConfig, acceptsClassName } = staticConfig;
536
+ const variants = styleStaticConfig.variants;
1006
537
  const viewProps = {};
1007
538
  const mediaState = styleProps.mediaState || import_mediaState.mediaState;
1008
539
  let shouldDoClasses = !process.env.TAMAGUI_DID_OUTPUT_CSS && acceptsClassName && !styleProps.noClass;
@@ -1011,10 +542,10 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1011
542
  let hasMedia = false;
1012
543
  let pseudoGroups;
1013
544
  let mediaGroups;
1014
- const staticPassthroughClassName = staticConfig.passthroughClassName || "";
545
+ const staticPassthroughClassName = styleStaticConfig.passthroughClassName || "";
1015
546
  let className = staticPassthroughClassName;
1016
547
  if (staticPassthroughClassName) shouldDoClasses = false;
1017
- 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);
1018
549
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-setup`;
1019
550
  const styleState = {
1020
551
  classNames,
@@ -1035,7 +566,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1035
566
  flatGroupContext: groupContext,
1036
567
  animationDriver: resolvedDriver
1037
568
  };
1038
- if (import_directStyleCSS.canGenerateCSS && shouldDoClasses && styleProps.canPlatformPseudo) styleState.flatDeferCSS = true;
569
+ styleState.flatStyleStaticConfig = styleStaticConfig;
1039
570
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`style-state`;
1040
571
  if (process.env.NODE_ENV === "development" && debug === "verbose" && import_constants.isClient) {
1041
572
  if (import_isDevTools.isDevTools) {
@@ -1053,28 +584,22 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1053
584
  }
1054
585
  }
1055
586
  const { asChild } = props;
1056
- const { accept, neverSkipProps } = staticConfig;
1057
- const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext, styledContextKeys } = styleProps;
587
+ const { neverSkipProps } = staticConfig;
588
+ const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext } = styleProps;
589
+ const styledContextKeys = styleStaticConfig.styledContextKeys;
1058
590
  const styleFrontend = staticConfig.styleFrontend;
1059
591
  let frontendGroup;
1060
592
  let frontendContainer;
1061
593
  let frontendContainerType;
1062
594
  const processedProps = props;
1063
- const parentVariants = parentStaticConfig?.variants;
1064
- const defaultProps = asChild ? (0, import_getDefaultProps.getDefaultProps)(staticConfig) : void 0;
595
+ const parentVariants = parentStaticConfig ? (0, import_styleStaticConfig.getStyleStaticConfig)(parentStaticConfig, conf).variants : void 0;
596
+ const defaultProps = asChild ? styleStaticConfig.defaultProps : void 0;
1065
597
  const asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
1066
598
  let containerValue;
1067
599
  let containerName;
1068
600
  let containerType;
1069
- {
1070
- const authoredContainerName = processedProps.containerName;
1071
- const authoredContainerType = processedProps.containerType;
1072
- containerName = typeof authoredContainerName === "string" && authoredContainerName.indexOf(":") === -1 ? authoredContainerName : void 0;
1073
- containerType = typeof authoredContainerType === "string" && authoredContainerType.indexOf(":") === -1 ? authoredContainerType : void 0;
1074
- }
1075
- let hocMappedClassProperties;
1076
- let hocMappedClasses;
1077
- const stylePassFlags = (noSkip ? passNoSkipFlag : 0) | (disableExpandShorthands ? passDisableShorthandsFlag : 0) | (noExpand ? passNoExpandFlag : 0) | (noMergeStyle ? passNoMergeFlag : 0) | (isHOC ? passHocFlag : 0) | (isText ? passTextFlag : 0) | (isInput ? passInputFlag : 0) | (asChildExceptStyleLike ? passAsChildStyleFlag : 0);
601
+ containerName = processedProps.containerName;
602
+ containerType = processedProps.containerType;
1078
603
  const pass = [
1079
604
  styleState,
1080
605
  conf,
@@ -1082,7 +607,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1082
607
  viewProps,
1083
608
  staticConfig,
1084
609
  validStyles,
1085
- accept,
1086
610
  neverSkipProps,
1087
611
  variants,
1088
612
  inlineProps,
@@ -1090,7 +614,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1090
614
  styleFrontend,
1091
615
  styledContext,
1092
616
  styledContextKeys,
1093
- stylePassFlags,
617
+ (noSkip ? passNoSkipFlag : 0) | (disableExpandShorthands ? passDisableShorthandsFlag : 0) | (noExpand ? passNoExpandFlag : 0) | (noMergeStyle ? passNoMergeFlag : 0) | (isHOC ? passHocFlag : 0) | (isText ? passTextFlag : 0) | (isInput ? passInputFlag : 0) | (asChildExceptStyleLike ? passAsChildStyleFlag : 0),
1094
618
  debug,
1095
619
  parentStaticConfig,
1096
620
  defaultProps,
@@ -1104,50 +628,101 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1104
628
  containerType,
1105
629
  frontendGroup,
1106
630
  frontendContainer,
1107
- frontendContainerType,
1108
- hocMappedClassProperties,
1109
- hocMappedClasses
631
+ frontendContainerType
1110
632
  ];
1111
633
  styleState.flatPass = pass;
1112
- forEachPropInForwardOrder(pass);
1113
- [, , , , , , , , , , , , , , , , , , , , , className, shouldDoClasses, containerValue, containerName, containerType, frontendGroup, frontendContainer, frontendContainerType, hocMappedClassProperties, hocMappedClasses] = pass;
634
+ let conditionalStates = null;
635
+ let usesSafeArea = false;
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]);
675
+ }
676
+ }
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];
1114
687
  if (containerValue) {
1115
688
  containerName ??= typeof containerValue === "string" ? containerValue : void 0;
1116
689
  containerType ??= "inline-size";
1117
- contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType, mergeStyle);
690
+ contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType);
1118
691
  }
1119
692
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
1120
- const conditionalStates = styleState.flatStateKeys || null;
1121
- const usesSafeArea = !!styleState.flatUsesSafeArea;
1122
- if (styleState.flatMediaKeys?.size) {
1123
- if (!hasMedia) hasMedia = /* @__PURE__ */ new Set();
1124
- if (typeof hasMedia !== "boolean") for (const key of styleState.flatMediaKeys) hasMedia.add(key);
1125
- }
1126
- if (styleState.flatGroupKeys?.size) {
1127
- pseudoGroups ||= /* @__PURE__ */ new Set();
1128
- for (const key of styleState.flatGroupKeys) pseudoGroups.add(key);
1129
- }
1130
- if (styleState.flatGroupMedia?.size) {
1131
- mediaGroups ||= /* @__PURE__ */ new Set();
1132
- for (const key of styleState.flatGroupMedia) mediaGroups.add(key);
1133
- }
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;
1134
698
  if (styleProps.canPlatformPseudo && styleState.flatHasPlatformPseudo) {
1135
699
  shouldDoClasses = false;
1136
700
  styleState.flatShouldDoClasses = false;
1137
701
  if (styleState.transformAccumulator) {
1138
- mergeStyle(styleState, "transform", (0, import_runtime.finalizeTransformAccumulator)(styleState.transformAccumulator), 1, true);
702
+ mergeStyle(styleState, "transform", (0, import_runtime.finalizeTransformAccumulator)(styleState.transformAccumulator), true);
1139
703
  styleState.transformAccumulator = void 0;
1140
704
  }
1141
- convertDeferredInline(styleState, mergeStyle);
1142
705
  }
1143
- completeStreaming(styleState, mergeStyle);
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
+ ];
722
+ }
1144
723
  const effectiveTransition = styleState.style?.transition;
1145
724
  if (effectiveTransition != null && styleState.style && driverOutputStyle !== "css") delete styleState.style.transition;
1146
725
  if (!(noNormalize === false)) {
1147
- if (styleState.style) {
1148
- (0, import_expandStyles.fixStyles)(styleState.style);
1149
- if (!noExpand && !noMergeStyle) (0, import_styleToCSS.styleToCSS)(styleState.style);
1150
- }
1151
726
  if (styleState.transformAccumulator && !styleState.flatShouldDoClasses) {
1152
727
  styleState.style ||= {};
1153
728
  styleState.style.transform = (0, import_runtime.finalizeTransformAccumulator)(styleState.transformAccumulator);
@@ -1166,7 +741,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1166
741
  }
1167
742
  }
1168
743
  if (!noNormalize && !isHOC && (!isAnimated || driverInputStyle === "css") && Array.isArray(styleState.style?.transform)) styleState.style.transform = (0, import_transformsToString.transformsToString)(styleState.style.transform);
1169
- (0, import_directStyleCSS.flushDirectStyles)(styleState);
744
+ (0, import_getCSSStylesAtomic.flushDirectStyles)(styleState);
1170
745
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-pre-result`;
1171
746
  if (shouldTrackStyleTokenProvenance && styleState.style && styleState.tokenProvenance) {
1172
747
  const provenance = {};
@@ -1194,7 +769,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1194
769
  if (effectiveTransition != null) result.effectiveTransition = effectiveTransition;
1195
770
  if (conditionalStates) result.programStates = conditionalStates;
1196
771
  if (usesSafeArea) result.usesSafeArea = true;
1197
- if (getDirectDynamicThemeAccess(styleState)) result.dynamicThemeAccess = true;
772
+ if (styleState.flatDynamicThemeAccess) result.dynamicThemeAccess = true;
1198
773
  if (styleState.flatEnterKeys || styleState.flatExitKeys) result.programLifecycleStyleKeys = {
1199
774
  enter: effectiveLifecycleKeys(styleState.flatEnterKeys),
1200
775
  exit: effectiveLifecycleKeys(styleState.flatExitKeys)
@@ -1217,27 +792,13 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1217
792
  let hasPropertyClassNames = false;
1218
793
  if (classNames) for (const key in classNames) {
1219
794
  hasPropertyClassNames = true;
1220
- finalClassName += ` ${classNames[key]}`;
795
+ if (!isHOC) finalClassName += ` ${classNames[key]}`;
1221
796
  }
1222
797
  if (groupClassName) finalClassName += ` ${groupClassName}`;
1223
798
  if (className) finalClassName += ` ${className}`;
1224
- if (isAnimated && driverInputStyle === "css") {
1225
- viewProps.className = finalClassName;
1226
- if (style) viewProps.style = style;
1227
- } else {
1228
- if (finalClassName) {
1229
- if (isHOC) viewProps[import_skipProps.HOC_CLASSNAME_MARKER] = classNames;
1230
- viewProps.className = finalClassName;
1231
- }
1232
- if (isHOC && hasPropertyClassNames) {
1233
- const classStyle = {};
1234
- Object.defineProperty(classStyle, TAMAGUI_CLASS_PROPS, {
1235
- value: classNames,
1236
- enumerable: false
1237
- });
1238
- viewProps.style = style ? [classStyle, style] : classStyle;
1239
- } else if (style) viewProps.style = style;
1240
- }
799
+ if (isHOC && hasPropertyClassNames) viewProps[import_skipProps.HOC_CLASSNAME_MARKER] = classNames;
800
+ if (finalClassName) viewProps.className = finalClassName;
801
+ if (style) viewProps.style = style;
1241
802
  }
1242
803
  }
1243
804
  }
@@ -1263,9 +824,161 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
1263
824
  if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-done`;
1264
825
  return result;
1265
826
  };
1266
- function mergeStyle(styleState, key, val, _importance, disableNormalize = false, originalVal) {
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
+ }
979
+ function mergeStyle(styleState, key, val, disableNormalize = false, originalVal) {
1267
980
  const { viewProps, styleProps, staticConfig } = styleState;
1268
- if (getContextPropSet(staticConfig)?.has(key)) {
981
+ if (styleState.flatStyleStaticConfig.styledContextKeys?.has(key)) {
1269
982
  styleState.overriddenContextProps ||= {};
1270
983
  const originalFromState = styleState.originalContextPropValues?.[key];
1271
984
  styleState.overriddenContextProps[key] = originalVal ?? originalFromState ?? val;
@@ -1275,12 +988,9 @@ function mergeStyle(styleState, key, val, _importance, disableNormalize = false,
1275
988
  (0, import_runtime.addTransformValue)(styleState.transformAccumulator, key, val);
1276
989
  } else {
1277
990
  const out = !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
1278
- if (staticConfig.accept && key in staticConfig.accept) viewProps[key] = out;
1279
- else {
1280
- styleState.style ||= {};
1281
- styleState.style[key] = out;
1282
- if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
1283
- }
991
+ styleState.style ||= {};
992
+ styleState.style[key] = out;
993
+ if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
1284
994
  }
1285
995
  }
1286
996
  function recordStyleTokenProvenance(styleState, key, originalVal) {
@@ -1290,10 +1000,10 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
1290
1000
  const opacity = slash === -1 ? NaN : Number(tokenName.slice(slash + 1));
1291
1001
  if (Number.isInteger(opacity) && opacity >= 0 && opacity <= 100) tokenName = tokenName.slice(0, slash);
1292
1002
  }
1293
- if (tokenName !== "" && (Object.prototype.hasOwnProperty.call(styleState.theme, tokenName) || Object.prototype.hasOwnProperty.call(styleState.conf.themes?.[styleState.flatThemeName || ""] || {}, tokenName) || Object.values(styleState.conf.tokensParsed).some((category) => Object.prototype.hasOwnProperty.call(category, tokenName)))) (styleState.tokenProvenance ||= {})[key] = originalVal;
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;
1294
1004
  else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
1295
1005
  }
1296
- const resolveAcceptedStyle = (styleState, styleIn) => {
1006
+ const resolveStyleObject = (styleState, styleIn) => {
1297
1007
  const { conf, styleProps } = styleState;
1298
1008
  const styleOut = {};
1299
1009
  let originalValues;
@@ -1306,13 +1016,10 @@ const resolveAcceptedStyle = (styleState, styleIn) => {
1306
1016
  style: styleOut,
1307
1017
  transformAccumulator: void 0
1308
1018
  };
1309
- childState.flatUsed = void 0;
1310
- childState.flatTransitions = void 0;
1311
1019
  childState.flatAtomics = void 0;
1312
- childState.flatSingleEntries = void 0;
1313
1020
  childState.flatSlots = void 0;
1314
- childState.flatBorderDefaultRequests = void 0;
1315
- const mergeAccepted = (_state, key, value, _importance, disableNormalize, originalValue) => {
1021
+ childState.flatPropertyLayers = void 0;
1022
+ const mergeAccepted = (_state, key, value, disableNormalize, originalValue) => {
1316
1023
  styleOut[key] = disableNormalize || styleProps.noNormalize ? value : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(value, key);
1317
1024
  const trackedOriginal = styleInOriginalValues?.[key] ?? originalValue;
1318
1025
  if (trackedOriginal !== void 0) (originalValues ||= {})[key] = trackedOriginal;
@@ -1321,93 +1028,76 @@ const resolveAcceptedStyle = (styleState, styleIn) => {
1321
1028
  const value = styleIn[key];
1322
1029
  key = conf.shorthands[key] || key;
1323
1030
  if (key in import_skipProps.skipProps || value == null) continue;
1324
- contributeValue(childState, key, value, mergeAccepted);
1031
+ contributeValue(childState, key, value);
1325
1032
  }
1326
- completeStreaming(childState, mergeAccepted);
1033
+ completeResolvedStyles(childState, mergeAccepted);
1327
1034
  if (childState.transformAccumulator) styleOut.transform = (0, import_runtime.finalizeTransformAccumulator)(childState.transformAccumulator);
1328
- if (!styleProps.noNormalize) (0, import_expandStyles.fixStyles)(styleOut);
1329
1035
  if (originalValues) import_styleOriginalValues.styleOriginalValues.set(styleOut, originalValues);
1330
1036
  return styleOut;
1331
1037
  };
1332
- function passDownProp(viewProps, key, val) {
1333
- if (key in viewProps) delete viewProps[key];
1334
- viewProps[key] = val;
1335
- }
1336
1038
  let frameSequence = 0;
1337
- 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] : "";
1338
1065
  const direct = state;
1339
- const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1340
- const identity = cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "";
1341
- if (property.charCodeAt(0) === 116 && property.startsWith("transition")) {
1342
- const transitions = direct.flatTransitions ||= [];
1343
- for (let index = 0; index < transitions.length; index++) if (transitions[index].property === property && transitions[index].identity === identity) {
1344
- transitions[index].value = value;
1345
- transitions[index].condition = condition;
1346
- 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;
1080
+ }
1081
+ if (entry[3] === identity) {
1082
+ list.splice(index, 1);
1083
+ break;
1347
1084
  }
1348
- transitions.push({
1349
- property,
1350
- value,
1351
- condition,
1352
- identity,
1353
- selector: cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "",
1354
- wrappers: cursor ? conditionWrapperCopy(cursor) : void 0
1355
- });
1356
- return;
1357
1085
  }
1358
- (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, direct.flatWeakContribution === true, original);
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
+ ]);
1359
1096
  }
1360
- function streamWriteInline(state, property, value, cursor, merge, original, normalize = false, conditionOverride = -1) {
1361
- const direct = state;
1362
- const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1363
- const importance = condition ? Math.floor(condition / 256) + 1 : 0;
1364
- const used = direct.flatUsed ||= {};
1365
- const previous = used[property];
1366
- if (previous !== void 0) {
1367
- if (previous > importance) return;
1368
- if (direct.flatWeakContribution === true) return;
1369
- }
1370
- used[property] = importance;
1371
- merge(state, property, value, 1, !normalize, original);
1372
- }
1373
- function streamRetractInline(state, property, cursor) {
1374
- const direct = state;
1375
- const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
1376
- const importance = condition ? Math.floor(condition / 256) + 1 : 0;
1377
- const used = direct.flatUsed ||= {};
1378
- const previous = used[property];
1379
- if (previous !== void 0 && previous > importance) return;
1380
- used[property] = importance;
1381
- if (state.style) delete state.style[property];
1382
- }
1383
- function convertDeferredInline(state, merge) {
1384
- const direct = state;
1385
- const used = direct.flatUsed ||= {};
1386
- const consume = (entries) => {
1387
- for (let index = 0; index < entries.length; index++) {
1388
- const entry = entries[index];
1389
- const condition = entry.condition;
1390
- if (condition && !(condition & 1)) continue;
1391
- const importance = condition ? Math.floor(condition / 256) + 1 : 0;
1392
- const previous = used[entry.property];
1393
- if (previous !== void 0 && previous > importance) continue;
1394
- used[entry.property] = importance;
1395
- merge(state, entry.property, entry.value, 1, true, entry.original !== void 0 ? entry.original : entry.value);
1396
- }
1397
- };
1398
- const slots = direct.flatSlots;
1399
- if (slots) {
1400
- direct.flatSlots = void 0;
1401
- for (const property in slots) consume(slots[property]);
1402
- }
1403
- const transitions = direct.flatTransitions;
1404
- if (transitions) {
1405
- direct.flatTransitions = void 0;
1406
- consume(transitions);
1407
- }
1408
- direct.flatBorderDefaultRequests = void 0;
1409
- }
1410
- function completeStreaming(state, merge) {
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);
1099
+ }
1100
+ function completeResolvedStyles(state, merge = mergeStyle) {
1411
1101
  const direct = state;
1412
1102
  const shadow = direct.flatWebShadow;
1413
1103
  if (shadow && (direct.flatBoxShadowSequence || 0) <= shadow[4]) {
@@ -1418,275 +1108,83 @@ function completeStreaming(state, merge) {
1418
1108
  const color = (0, import_normalizeColor.normalizeColor)(shadow[0], shadow[2] ?? 1);
1419
1109
  if (color) {
1420
1110
  const next = `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow[3])} ${color}`;
1421
- 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]);
1422
1112
  }
1113
+ direct.flatWebShadow = void 0;
1423
1114
  }
1424
- (0, import_directStyleCSS.completeStreamingCSS)(state);
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
+ }
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]);
1154
+ }
1155
+ direct.flatSlots = void 0;
1425
1156
  }
1426
- function emitAtParentCondition(state, property, value, merge, originalValue, contextOnly) {
1427
- 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);
1428
1161
  }
1429
- function emitUnderCondition(state, property, value, cursor, merge, originalValue, contextOnly, warnMode, warnSource) {
1430
- const condition = conditionNumbers[cursor + conditionValueOffset];
1431
- if (merge && property && condition) state.flatPropSawCondition = true;
1432
- if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
1433
- 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}"`);
1434
1166
  return 0;
1435
1167
  }
1436
- const unsupportedState = conditionTexts[cursor + conditionUnsupportedStateOffset] || "";
1437
- if (warnMode && unsupportedState && process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`${property}: "${unsupportedState}:" has no native component-state source; dropping the clause`);
1438
- if (merge && property && condition & 2 && (condition & 1 || import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses || warnMode === 1 && false)) {
1439
- emitValue(state, property, value, cursor, merge, warnMode === 2 ? originalValue : originalValue ?? value, contextOnly);
1440
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
1441
- if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
1442
- if (flags & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
1443
- } else if (merge && property && condition & 2) {
1444
- const flags = conditionNumbers[cursor + conditionFlagsOffset];
1445
- if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
1446
- 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;
1447
1172
  }
1448
1173
  return condition;
1449
1174
  }
1450
- const directStyleHandler = {
1451
- segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid, chainCount, _result, failure, failureIndex, property, merge, originalValue, contextOnly) {
1452
- if (isBase) {
1453
- if (start === end) return;
1454
- feedCompoundSegment(state, source, start, end, true, valid || failure === "invalid-character" || failure === "stray-comment-close", "");
1455
- if (!valid) {
1456
- if (failure === "invalid-character" || failure === "stray-comment-close") return 16;
1457
- 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 \"(\"");
1458
- return;
1459
- }
1460
- const value = source.slice(start, end);
1461
- emitAtParentCondition(state, property, value, merge, value, contextOnly);
1462
- return 5;
1463
- }
1464
- if (!chainValid) {
1465
- 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 \"(\"");
1466
- return;
1467
- }
1468
- if (start === end) {
1469
- if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, "a conditional clause has no value");
1470
- return;
1471
- }
1472
- if (property === "aspectRatio" && chainCount === 1) {
1473
- const left = Number(source.slice(chainStart, chainEnd));
1474
- const right = Number(source.slice(start, end));
1475
- if (chainStart < chainEnd && Number.isFinite(left) && left > 0 && Number.isFinite(right) && right > 0) return 12;
1476
- }
1477
- const directState = state;
1478
- const cursor = directState.flatScanCursor;
1479
- 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;
1480
- feedCompoundSegment(directState, source, start, end, false, valid && Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
1481
- if (!condition) return;
1482
- if (!valid) {
1483
- 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 \"(\"");
1484
- return;
1485
- }
1486
- return 4 | (condition & 12 ? 2 : 0);
1487
- },
1488
- modifier(state, start, end, valid, first, source) {
1489
- const directState = state;
1490
- let cursor = directState.flatScanCursor;
1491
- if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor(directState.flatPass?.[passParentCursor] || null);
1492
- else if (first) resetConditionCursor(cursor, directState.flatPass?.[passParentCursor] || null);
1493
- if (!valid) {
1494
- setConditionUnresolved(cursor);
1495
- return;
1496
- }
1497
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
1498
- },
1499
- chain(state, _start, _end, valid) {
1500
- const cursor = state.flatScanCursor;
1501
- if (cursor) {
1502
- if (!valid) setConditionUnresolved(cursor);
1503
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
1504
- }
1505
- return true;
1506
- },
1507
- end(state, source, result, lastPayloadStart, chainCount, property, merge, originalValue, contextOnly, failure, failureIndex) {
1508
- let hasBase = !!(result & 1);
1509
- if (result & 16) {
1510
- if (chainCount === 0) {
1511
- emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
1512
- hasBase = true;
1513
- } 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 \"(\"");
1514
- }
1515
- if (result & 8 && chainCount === 1) {
1516
- emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
1517
- hasBase = true;
1518
- }
1519
- if (process.env.NODE_ENV === "development" && !hasBase && result & 4 && (property in import_helpers.tokenCategories.color || property in import_tokenCategories.tokenCategoryByProperty) && 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.`);
1520
- if ((!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) && result & 2 && !hasBase) {
1521
- const value = implicitLifecycleBase(property);
1522
- if (value !== null) emitAtParentCondition(state, property, value, merge, value, contextOnly);
1523
- }
1524
- }
1525
- };
1526
- function implicitLifecycleBase(property) {
1527
- return property === "opacity" || property === "scale" || property === "scaleX" || property === "scaleY" ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
1528
- }
1529
- const legacyTransformParts = /* @__PURE__ */ new Set([
1530
- "matrix",
1531
- "perspective",
1532
- "rotateX",
1533
- "rotateY",
1534
- "rotateZ",
1535
- "scaleZ",
1536
- "skewX",
1537
- "skewY"
1538
- ]);
1539
- const webShadowParts = {
1540
- shadowColor: 1,
1541
- shadowOffset: 2,
1542
- shadowOpacity: 3,
1543
- shadowRadius: 4
1544
- };
1545
- const webTextShadowParts = /* @__PURE__ */ new Set([
1546
- "textShadowColor",
1547
- "textShadowOffset",
1548
- "textShadowRadius"
1549
- ]);
1550
- const lineStyles = /* @__PURE__ */ new Set([
1551
- "none",
1552
- "hidden",
1553
- "dotted",
1554
- "dashed",
1555
- "solid",
1556
- "double",
1557
- "groove",
1558
- "ridge",
1559
- "inset",
1560
- "outset"
1561
- ]);
1562
- const borderTargets = {
1563
- border: {
1564
- width: [
1565
- "borderTopWidth",
1566
- "borderRightWidth",
1567
- "borderBottomWidth",
1568
- "borderLeftWidth"
1569
- ],
1570
- style: [
1571
- "borderTopStyle",
1572
- "borderRightStyle",
1573
- "borderBottomStyle",
1574
- "borderLeftStyle"
1575
- ],
1576
- color: [
1577
- "borderTopColor",
1578
- "borderRightColor",
1579
- "borderBottomColor",
1580
- "borderLeftColor"
1581
- ]
1582
- },
1583
- borderTop: {
1584
- width: ["borderTopWidth"],
1585
- style: ["borderTopStyle"],
1586
- color: ["borderTopColor"]
1587
- },
1588
- borderRight: {
1589
- width: ["borderRightWidth"],
1590
- style: ["borderRightStyle"],
1591
- color: ["borderRightColor"]
1592
- },
1593
- borderBottom: {
1594
- width: ["borderBottomWidth"],
1595
- style: ["borderBottomStyle"],
1596
- color: ["borderBottomColor"]
1597
- },
1598
- borderLeft: {
1599
- width: ["borderLeftWidth"],
1600
- style: ["borderLeftStyle"],
1601
- color: ["borderLeftColor"]
1602
- },
1603
- outline: {
1604
- width: ["outlineWidth"],
1605
- style: ["outlineStyle"],
1606
- color: ["outlineColor"]
1607
- },
1608
- borderBlock: {
1609
- width: ["borderBlockStartWidth", "borderBlockEndWidth"],
1610
- style: ["borderBlockStartStyle", "borderBlockEndStyle"],
1611
- color: ["borderBlockStartColor", "borderBlockEndColor"]
1612
- },
1613
- borderInline: {
1614
- width: ["borderInlineStartWidth", "borderInlineEndWidth"],
1615
- style: ["borderInlineStartStyle", "borderInlineEndStyle"],
1616
- color: ["borderInlineStartColor", "borderInlineEndColor"]
1617
- }
1618
- };
1619
- const tokenLookup = {
1620
- value: void 0,
1621
- fromTheme: false,
1622
- themeKey: ""
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));
1623
1178
  };
1624
- function fillTokenLookup(value, fromTheme, themeKey) {
1625
- tokenLookup.value = value;
1626
- tokenLookup.fromTheme = fromTheme;
1627
- tokenLookup.themeKey = themeKey;
1628
- return tokenLookup;
1629
- }
1630
- function tokenVariable(state, property, name) {
1631
- let lookupName = name.charCodeAt(0) === 36 ? name.slice(1) : name;
1632
- if (property === "fontFamily") {
1633
- const family = state.conf.fontsParsed[lookupName]?.family;
1634
- return family ? fillTokenLookup(family, false, lookupName) : void 0;
1635
- }
1636
- const fontKey = property === "fontSize" ? "size" : property === "fontWeight" ? "weight" : property === "lineHeight" || property === "letterSpacing" ? property : void 0;
1637
- if (fontKey) {
1638
- const value = (state.conf.fontsParsed[state.fontFamily || state.conf.defaultFontToken] || state.conf.fontsParsed[state.conf.defaultFontToken])?.[fontKey]?.[lookupName];
1639
- return value ? fillTokenLookup(value, false, lookupName) : void 0;
1640
- }
1641
- const category = (0, import_tokenCategories.getTokenCategoryForProperty)(property);
1642
- const dot = lookupName.indexOf(".");
1643
- if (dot !== -1) {
1644
- const prefix = lookupName.slice(0, dot);
1645
- if (!category || prefix === category || prefix === "color") lookupName = lookupName.slice(dot + 1);
1646
- }
1647
- if (category) {
1648
- const own = state.conf.tokensParsed[category]?.[lookupName];
1649
- if (own) return fillTokenLookup(own, false, lookupName);
1650
- for (const sibling of [
1651
- "color",
1652
- "space",
1653
- "size",
1654
- "radius",
1655
- "zIndex"
1656
- ]) if (sibling !== category && state.conf.tokensParsed[sibling]?.[lookupName]) return;
1657
- } else {
1658
- const first = lookupName.charCodeAt(0);
1659
- if (first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46) return;
1660
- }
1661
- const theme = state.theme?.[lookupName] || state.conf.themes?.[state.flatThemeName || ""]?.[lookupName];
1662
- if (theme) return fillTokenLookup(theme, true, lookupName);
1663
- if (category) return;
1664
- const token = state.conf.tokensParsed.space?.[lookupName] || state.conf.tokensParsed.color?.[lookupName];
1665
- return token ? fillTokenLookup(token, false, lookupName) : void 0;
1666
- }
1667
- let literalMissConf = null;
1668
- let literalMissRevision = -1;
1669
- let literalMisses = /* @__PURE__ */ new WeakMap();
1670
- const literalMissRootTheme = {};
1671
- function isFontKeyedProperty(property) {
1672
- return property === "fontFamily" || property === "fontSize" || property === "fontWeight" || property === "lineHeight" || property === "letterSpacing";
1673
- }
1674
- function literalMissSet(state) {
1675
- const revision = (0, import_grammarConfig.getConfigRevisionState)(state.conf).revision;
1676
- if (state.conf !== literalMissConf || revision !== literalMissRevision) {
1677
- literalMissConf = state.conf;
1678
- literalMissRevision = revision;
1679
- literalMisses = /* @__PURE__ */ new WeakMap();
1680
- }
1681
- const themeKey = state.theme && typeof state.theme === "object" ? state.theme : literalMissRootTheme;
1682
- let set = literalMisses.get(themeKey);
1683
- if (!set) {
1684
- set = /* @__PURE__ */ new Set();
1685
- literalMisses.set(themeKey, set);
1686
- }
1687
- return set;
1688
- }
1689
- 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);
1690
1188
  let name = raw;
1691
1189
  let opacity;
1692
1190
  const slash = raw.lastIndexOf("/");
@@ -1697,185 +1195,136 @@ function configuredValue(state, property, raw) {
1697
1195
  opacity = amount;
1698
1196
  }
1699
1197
  }
1700
- const safeArea = (0, import_resolveSafeAreaVariable.resolveSafeAreaVariable)(name);
1198
+ const safeArea = grammar.safeAreaVariable(name);
1701
1199
  if (safeArea !== void 0) {
1702
1200
  state.flatUsesSafeArea = true;
1703
1201
  return safeArea;
1704
1202
  }
1705
- const cacheable = !isFontKeyedProperty(property);
1706
- let misses;
1707
- let missKey = "";
1708
- if (cacheable) {
1709
- misses = literalMissSet(state);
1710
- missKey = `${state.flatThemeName || ""}${property}${name}`;
1711
- if (misses.has(missKey)) return raw;
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);
1712
1207
  }
1713
- const lookup = tokenVariable(state, property, name);
1714
- if (!lookup || !(0, import_createVariable.isVariable)(lookup.value)) {
1715
- if (misses) misses.add(missKey);
1716
- if (process.env.NODE_ENV === "development" && import_tokenCategories.tokenCategoryByProperty[property] && state.conf.tokensParsed.color?.[name]) (0, import_warnOnce.warnOnce)(`"${name}" contributes to "color", not "${property}"; keeping it literal`);
1717
- 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;
1718
1215
  }
1719
1216
  const resolveValues = !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues;
1720
- if (resolveValues === "except-theme" && lookup.fromTheme) return `${import_themeRef.THEME_REF_PREFIX}${lookup.themeKey}${opacity !== void 0 ? `/${opacity}` : ""}`;
1721
- let value = (0, import_resolveVariableValue.resolveVariableValue)(property, lookup.value, resolveValues);
1722
- if (opacity !== void 0) value = `color-mix(in srgb, ${value} ${opacity}%, transparent)`;
1723
- return value;
1724
- }
1725
- function resolveEmbeddedTokens(state, property, raw) {
1726
- let copyFrom = 0;
1727
- let out = "";
1728
- let quote = 0;
1729
- for (let index = 0; index < raw.length; index++) {
1730
- const code = raw.charCodeAt(index);
1731
- if (quote) {
1732
- if (code === 92) index++;
1733
- else if (code === quote) quote = 0;
1734
- continue;
1735
- }
1736
- if (code === 34 || code === 39) {
1737
- quote = code;
1738
- continue;
1739
- }
1740
- if (!(code === 36 || code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122)) continue;
1741
- let end = index + 1;
1742
- while (end < raw.length) {
1743
- const next = raw.charCodeAt(end);
1744
- if (next === 36 || next === 45 || next === 46 || next === 95 || next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122) end++;
1745
- else break;
1746
- }
1747
- if (raw.charCodeAt(end) === 47) {
1748
- let suffix = end + 1;
1749
- while (suffix < raw.length) {
1750
- const next = raw.charCodeAt(suffix);
1751
- if (next < 48 || next > 57) break;
1752
- suffix++;
1753
- }
1754
- if (suffix > end + 1) end = suffix;
1755
- }
1756
- const before = raw.charCodeAt(index - 1);
1757
- if (code !== 36 && (before >= 48 && before <= 57 || before === 35 || before === 45 && raw.charCodeAt(index - 2) === 45 || raw.charCodeAt(end) === 40)) {
1758
- index = end - 1;
1759
- continue;
1760
- }
1761
- const word = raw.slice(index, end);
1762
- const value = configuredValue(state, property, word);
1763
- if (value !== word) {
1764
- out += raw.slice(copyFrom, index);
1765
- out += String(value);
1766
- copyFrom = end;
1767
- }
1768
- 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;
1769
1235
  }
1770
- return copyFrom ? out + raw.slice(copyFrom) : raw;
1771
- }
1772
- function normalizeTransitionNames(state, raw) {
1773
- let quote = 0;
1774
- let depth = 0;
1775
- let copyFrom = 0;
1776
- let out = "";
1777
- for (let index = 0; index < raw.length; index++) {
1778
- const code = raw.charCodeAt(index);
1779
- if (quote) {
1780
- if (code === 92) index++;
1781
- else if (code === quote) quote = 0;
1782
- continue;
1783
- }
1784
- if (code === 34 || code === 39) {
1785
- quote = code;
1786
- continue;
1787
- }
1788
- if (code === 40) {
1789
- depth++;
1790
- continue;
1791
- }
1792
- if (code === 41) {
1793
- depth--;
1794
- continue;
1795
- }
1796
- 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;
1797
- let end = index + 1;
1798
- while (end < raw.length) {
1799
- const next = raw.charCodeAt(end);
1800
- if (next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 45 || next === 95) end++;
1801
- else break;
1802
- }
1803
- if (raw.charCodeAt(end) !== 40) {
1804
- const authored = raw.slice(index, end);
1805
- let property = state.conf.shorthands[authored] || authored;
1806
- if (property === "x" || property === "y") property = "translate";
1807
- else if (property === "scaleX" || property === "scaleY") property = "scale";
1808
- else if (legacyTransformParts.has(property)) property = "transform";
1809
- let hasUpper = false;
1810
- for (let offset = 0; offset < property.length; offset++) {
1811
- const letter = property.charCodeAt(offset);
1812
- if (letter >= 65 && letter <= 90) {
1813
- hasUpper = true;
1814
- break;
1815
- }
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);
1816
1249
  }
1817
- if (property !== authored || hasUpper) {
1818
- out += raw.slice(copyFrom, index);
1819
- for (let offset = 0; offset < property.length; offset++) {
1820
- const letter = property.charCodeAt(offset);
1821
- 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];
1822
1257
  }
1823
- copyFrom = end;
1824
1258
  }
1825
1259
  }
1826
- index = end - 1;
1827
1260
  }
1828
- 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;
1829
1283
  }
1830
- function getDirectDynamicThemeAccess(state) {
1831
- 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;
1832
1298
  }
1833
- 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;
1834
1301
  const direct = state;
1835
- 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;
1304
+ if (value === false && !condition) {
1305
+ clearDirectStyle(state, property);
1306
+ if (direct.flatStyleStaticConfig?.styledContextKeys?.has(property)) (state.overriddenContextProps ||= {})[property] = false;
1307
+ return;
1308
+ }
1836
1309
  if (condition & 4) (state.flatEnterKeys ||= /* @__PURE__ */ new Set()).add(property);
1837
1310
  if (condition & 8) (state.flatExitKeys ||= /* @__PURE__ */ new Set()).add(property);
1838
- cursor && conditionTexts[cursor + conditionThemeOffset];
1311
+ cursor && cursor[conditionTheme];
1839
1312
  if (contextOnly) {
1840
1313
  if (!condition || condition & 1) (state.overriddenContextProps ||= {})[property] = originalValue;
1841
1314
  return;
1842
1315
  }
1843
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && !condition && property === "transform") {
1316
+ if (import_getCSSStylesAtomic.canGenerateCSS && state.flatShouldDoClasses && !condition && property === "transform") {
1844
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`);
1845
1318
  state.transformAccumulator ||= (0, import_runtime.createTransformAccumulator)();
1846
1319
  (0, import_runtime.addTransformValue)(state.transformAccumulator, property, value);
1847
1320
  return;
1848
1321
  }
1849
- const shouldPromoteAnimatedStyle = import_directStyleCSS.canGenerateCSS && !condition && !state.flatShouldDoClasses && !state.styleProps.noMergeStyle && state.styleProps.isAnimated && state.animationDriver?.inputStyle === "css" && property in import_helpers.nonAnimatableStyleProps;
1850
- if (import_directStyleCSS.canGenerateCSS && (state.flatShouldDoClasses || shouldPromoteAnimatedStyle)) {
1851
- if (!condition && state.style && direct.flatWeakContribution !== true && !(direct.flatUsed && direct.flatUsed[property])) delete state.style[property];
1852
- 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);
1853
1325
  return;
1854
1326
  }
1855
- if (condition && !(condition & 1)) return;
1856
- streamWriteInline(state, property, value, cursor, merge, originalValue);
1857
- }
1858
- function splitComponents(value) {
1859
- const parts = [];
1860
- let start = 0;
1861
- let quote = 0;
1862
- let depth = 0;
1863
- for (let index = 0; index <= value.length; index++) {
1864
- const code = index === value.length ? 32 : value.charCodeAt(index);
1865
- if (quote) {
1866
- if (code === 92) index++;
1867
- else if (code === quote) quote = 0;
1868
- continue;
1869
- }
1870
- if (code === 34 || code === 39) quote = code;
1871
- else if (code === 40) depth++;
1872
- else if (code === 41) depth--;
1873
- else if (!depth && code <= 32) {
1874
- if (index > start) parts.push(value.slice(start, index));
1875
- start = index + 1;
1876
- }
1877
- }
1878
- return parts;
1327
+ streamWriteInline(state, property, value, cursor, originalValue);
1879
1328
  }
1880
1329
  function numericUnitValue(value, first, second) {
1881
1330
  const unitLength = value.endsWith(first) || second !== void 0 && value.endsWith(second) ? first.length : 0;
@@ -1883,126 +1332,19 @@ function numericUnitValue(value, first, second) {
1883
1332
  const numeric = Number(value.slice(0, value.length - unitLength));
1884
1333
  return Number.isFinite(numeric) ? numeric : NaN;
1885
1334
  }
1886
- function isNumericCSSComponent(value) {
1887
- let index = 0;
1888
- if (value.charCodeAt(index) === 43 || value.charCodeAt(index) === 45) index++;
1889
- let digits = 0;
1890
- let dot = false;
1891
- for (; index < value.length; index++) {
1892
- const code = value.charCodeAt(index);
1893
- if (code >= 48 && code <= 57) {
1894
- digits++;
1895
- continue;
1896
- }
1897
- if (code === 46 && !dot) {
1898
- dot = true;
1899
- continue;
1900
- }
1901
- break;
1902
- }
1903
- if (!digits) return false;
1904
- for (; index < value.length; index++) {
1905
- const code = value.charCodeAt(index);
1906
- if (code !== 37 && (code < 97 || code > 122)) return false;
1907
- }
1908
- return true;
1909
- }
1910
- function startsValueFunction(value) {
1911
- let index = 0;
1912
- while (index < value.length) {
1913
- const code = value.charCodeAt(index);
1914
- if (code === 45 || code >= 97 && code <= 122) {
1915
- index++;
1916
- continue;
1917
- }
1918
- break;
1919
- }
1920
- return index > 0 && value.charCodeAt(index) === 40;
1921
- }
1922
- function emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly) {
1923
- let width;
1924
- let style;
1925
- let color;
1926
- for (const part of splitComponents(raw)) if (lineStyles.has(part) || property === "outline" && part === "auto") style = part;
1927
- else if (part === "thin" || part === "medium" || part === "thick" || isNumericCSSComponent(part) || startsValueFunction(part)) width = part;
1928
- else color = part;
1929
- if (style === "none" && width === void 0) width = "0";
1930
- const targets = borderTargets[property];
1931
- if (width !== void 0) for (const target of targets.width) emitResolved(state, target, width, cursor, merge, originalValue, contextOnly);
1932
- if (style !== void 0) {
1933
- const styleTargets = targets.style;
1934
- for (const target of styleTargets) emitProperty(state, target, style, cursor, merge, originalValue, contextOnly);
1935
- }
1936
- if (color !== void 0) for (const target of targets.color) emitResolved(state, target, color, cursor, merge, originalValue, contextOnly);
1937
- }
1938
- function emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly) {
1939
- 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);
1940
- }
1941
- function emitTransform(state, property, value, cursor, merge, originalValue, contextOnly) {
1942
- if (!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) {
1943
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
1944
- return;
1945
- }
1946
- 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"];
1947
- for (const target of targets) {
1948
- let targetValue = value;
1949
- if (typeof targetValue === "number") {
1950
- if (target === "--t-x" || target === "--t-y") targetValue = `${targetValue}px`;
1951
- else if (target === "rotate") targetValue = `${targetValue}deg`;
1952
- }
1953
- emitProperty(state, target, targetValue, cursor, merge, originalValue, contextOnly);
1954
- if (target === "--t-x" || target === "--t-y") (0, import_directStyleCSS.addComposition)(state, "translate");
1955
- else if (target.startsWith("--t-scale")) (0, import_directStyleCSS.addComposition)(state, "scale");
1956
- }
1957
- }
1958
- function emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly) {
1959
- let value = configuredValue(state, property, raw);
1960
- 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);
1961
1337
  if (!state.flatShouldDoClasses && typeof value === "string") {
1962
1338
  const unitValue = numericUnitValue(value, "px", "dp");
1963
1339
  if (Number.isFinite(unitValue)) value = unitValue;
1964
1340
  else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
1965
1341
  }
1966
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
1342
+ emitProperty(state, property, value, cursor, originalValue, contextOnly);
1967
1343
  }
1968
- const emitKindTransition = 1;
1969
- const emitKindTransformPart = 2;
1970
- const emitKindWebShadow = 3;
1971
- const emitKindWebTextShadow = 4;
1972
- const emitKindTransform = 5;
1973
- const emitKindBorder = 6;
1974
- const emitKindTextDecoration = 7;
1975
- const emitKindBackground = 8;
1976
- const emitKindAxis = 9;
1977
- const emitKindBorderRadius = 10;
1978
- const emitKindBorderWidth = 11;
1979
- const emitValueKinds = {
1980
- transition: emitKindTransition,
1981
- transitionProperty: emitKindTransition,
1982
- transform: emitKindTransform,
1983
- textDecoration: emitKindTextDecoration,
1984
- background: emitKindBackground,
1985
- x: emitKindAxis,
1986
- y: emitKindAxis,
1987
- scale: emitKindAxis,
1988
- scaleX: emitKindAxis,
1989
- scaleY: emitKindAxis,
1990
- rotate: emitKindAxis,
1991
- borderRadius: emitKindBorderRadius,
1992
- borderWidth: emitKindBorderWidth,
1993
- borderTopWidth: emitKindBorderWidth,
1994
- borderRightWidth: emitKindBorderWidth,
1995
- borderBottomWidth: emitKindBorderWidth,
1996
- borderLeftWidth: emitKindBorderWidth
1997
- };
1998
- for (const part of legacyTransformParts) emitValueKinds[part] = emitKindTransformPart;
1999
- for (const part in webShadowParts) emitValueKinds[part] = emitKindWebShadow;
2000
- for (const part of webTextShadowParts) emitValueKinds[part] = emitKindWebTextShadow;
2001
- for (const target in borderTargets) emitValueKinds[target] = emitKindBorder;
2002
1344
  function shadowUnit(part) {
2003
1345
  return typeof part === "number" ? `${part}px` : part || "0px";
2004
1346
  }
2005
- function emitWebTextShadow(state, property, value, merge, originalValue, contextOnly) {
1347
+ function emitWebTextShadow(state, property, value, originalValue, contextOnly) {
2006
1348
  const shadow = state.flatTextShadow ||= {};
2007
1349
  shadow[property] = value;
2008
1350
  const offset = shadow.textShadowOffset || {
@@ -2010,613 +1352,246 @@ function emitWebTextShadow(state, property, value, merge, originalValue, context
2010
1352
  height: 0
2011
1353
  };
2012
1354
  if (!shadow.textShadowColor) return;
2013
- 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);
2014
1356
  }
2015
- function emitValue(state, property, raw, cursor, merge, originalValue, contextOnly) {
2016
- 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);
2017
1362
  if ((0, import_createVariable.isVariable)(raw)) raw = (0, import_resolveVariableValue.resolveVariableValue)(property, raw, !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues);
2018
- const emitKind = emitValueKinds[property];
2019
- if (emitKind !== void 0) switch (emitKind) {
2020
- case emitKindTransition:
2021
- if (typeof raw === "string") raw = normalizeTransitionNames(state, raw);
2022
- break;
2023
- case emitKindBorderWidth:
2024
- (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);
2025
- break;
2026
- case emitKindTransformPart: {
2027
- const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
2028
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && !condition) {
2029
- state.transformAccumulator ||= (0, import_runtime.createTransformAccumulator)();
2030
- (0, import_runtime.addTransformValue)(state.transformAccumulator, property, value2);
2031
- } else if (condition && import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) emitProperty(state, "transform", `${property}(${value2})`, cursor, merge, originalValue, contextOnly);
2032
- 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);
2033
1370
  return;
2034
1371
  }
2035
- 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) {
2036
1385
  const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
2037
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) {
1386
+ if (state.styleProps.noNormalize !== false) if (webShadowPart) {
2038
1387
  const shadow = state.flatWebShadow ||= [];
2039
- shadow[webShadowParts[property] - 1] = value2;
1388
+ shadow[webShadowPart - 1] = value2;
2040
1389
  shadow[4] = ++frameSequence;
2041
1390
  shadow[5] = originalValue;
2042
1391
  shadow[6] = contextOnly;
2043
- } 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);
2044
1394
  return;
2045
1395
  }
2046
- case emitKindWebTextShadow: {
2047
- const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
2048
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) emitWebTextShadow(state, property, value2, merge, originalValue, contextOnly);
2049
- 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);
2050
1404
  return;
2051
1405
  }
2052
- case emitKindTransform:
2053
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && Array.isArray(raw)) raw = (0, import_transformsToString.transformsToString)(raw);
2054
- break;
2055
- case emitKindBorder:
2056
- if (typeof raw === "string") {
2057
- emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly);
2058
- return;
2059
- }
2060
- break;
2061
- case emitKindTextDecoration:
2062
- if (typeof raw === "string") {
2063
- emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly);
2064
- return;
2065
- }
2066
- break;
2067
- case emitKindBackground:
2068
- if (typeof raw === "string") {
2069
- const parts = splitComponents(raw);
2070
- if (parts.length === 1 && !startsValueFunction(parts[0])) {
2071
- emitResolved(state, "backgroundColor", parts[0], cursor, merge, originalValue, contextOnly);
2072
- return;
2073
- }
2074
- }
2075
- break;
2076
- case emitKindAxis: {
2077
- let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
2078
- if (!state.flatShouldDoClasses && typeof value2 === "string" && !value2.startsWith(import_themeRef.THEME_REF_PREFIX)) {
2079
- if (property === "rotate" && !Number.isFinite(numericUnitValue(value2, "deg", "rad"))) {
2080
- if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`native transform "${property}" cannot represent "${value2}"; dropping it`);
2081
- if (condition & 1) {
2082
- (0, import_runtime.removeTransformValue)(state.transformAccumulator, property);
2083
- streamRetractInline(state, property, cursor);
2084
- }
2085
- 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);
2086
1415
  }
2087
- const unitValue = numericUnitValue(value2, "px", "dp");
2088
- if (Number.isFinite(unitValue)) value2 = unitValue;
2089
- else if (Number.isFinite(Number(value2))) value2 = Number(value2);
1416
+ return;
2090
1417
  }
2091
- 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);
2092
1424
  return;
2093
1425
  }
2094
- case emitKindBorderRadius:
2095
- if (!state.flatShouldDoClasses && !condition) {
2096
- if (typeof raw === "string") emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly);
2097
- else emitProperty(state, property, raw, cursor, merge, originalValue, contextOnly);
2098
- 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`;
2099
1432
  }
2100
- 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;
2101
1438
  }
2102
- let value = raw;
2103
- if (typeof raw === "string") {
2104
- value = configuredValue(state, property, raw);
2105
- 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;
2106
1443
  }
1444
+ let value = raw;
1445
+ if (typeof raw === "string") value = configuredValue(state, property, raw, true);
2107
1446
  if (!state.flatShouldDoClasses && typeof value === "string") {
2108
1447
  const unitValue = numericUnitValue(value, "px", "dp");
2109
1448
  if (Number.isFinite(unitValue)) value = unitValue;
2110
1449
  else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
2111
1450
  }
2112
- if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
1451
+ if (import_getCSSStylesAtomic.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
2113
1452
  state.flatBoxShadow = value;
2114
1453
  state.flatBoxShadowSequence = frameSequence + 1;
2115
1454
  }
2116
- const expanded = state.styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(property, value, state.conf.settings.styleCompat || "web");
2117
- if (!expanded) {
2118
- emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
2119
- return;
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`;
2120
1458
  }
2121
- if (typeof raw === "string" && expanded.length > 1) {
2122
- const parts = splitComponents(raw);
2123
- if (parts.length > 0 && parts.length <= (expanded.length === 4 ? 4 : 2)) {
2124
- for (let index = 0; index < expanded.length; index++) {
2125
- const partIndex = index === 0 || parts.length === 1 ? 0 : index === 1 || index === 3 && parts.length < 4 ? 1 : index === 2 && parts.length < 3 ? 0 : index;
2126
- emitResolved(state, expanded[index][0], parts[partIndex], cursor, merge, originalValue, contextOnly);
2127
- }
2128
- return;
2129
- }
2130
- }
2131
- for (let index = 0; index < expanded.length; index++) emitProperty(state, expanded[index][0], expanded[index][1], cursor, merge, originalValue, contextOnly);
1459
+ emitProperty(state, property, value, cursor, originalValue, contextOnly);
2132
1460
  }
2133
- function contributeStyleString(state, property, source, merge, originalValue, contextOnly = false) {
2134
- const directState = state;
2135
- const watermark = conditionCursorTop;
2136
- const previousCursor = directState.flatScanCursor;
2137
- const previousExpectMulti = directState.flatExpectMulti;
2138
- directState.flatScanCursor = null;
2139
- directState.flatExpectMulti = source.indexOf(":") !== -1;
2140
- try {
2141
- (0, import_runtime.scanFlatValue)(source, directStyleHandler, state, property, merge, originalValue, contextOnly);
2142
- } finally {
2143
- directState.flatScanCursor = previousCursor;
2144
- directState.flatExpectMulti = previousExpectMulti;
2145
- releaseConditionCursors(watermark);
2146
- }
2147
- return true;
2148
- }
2149
- function contributeStyleObject(state, property, value, merge, contextOnly) {
2150
- const outerState = state;
2151
- const previousExpectMulti = outerState.flatExpectMulti;
2152
- outerState.flatExpectMulti = true;
2153
- try {
2154
- return contributeStyleObjectInner(state, property, value, merge, contextOnly);
2155
- } finally {
2156
- outerState.flatExpectMulti = previousExpectMulti;
2157
- }
2158
- }
2159
- function contributeStyleObjectInner(state, property, value, merge, contextOnly) {
2160
- const directState = state;
2161
- const parent = directState.flatPass?.[passParentCursor] || null;
2162
- const hasDefault = Object.prototype.hasOwnProperty.call(value, "default");
1461
+ function walkConditionalValue(state, property, value, parent, sink, warnMode = 0) {
1462
+ const parentCondition = parent || null;
2163
1463
  let hasBase = false;
2164
- const base = hasDefault ? value.default : void 0;
2165
- if (base != null) {
2166
- const baseString = String(base);
2167
- feedCompoundSegment(directState, baseString, 0, baseString.length, true, true, "");
2168
- emitAtParentCondition(state, property, base, merge, base, contextOnly);
2169
- hasBase = true;
2170
- }
2171
1464
  let conditions = 0;
2172
- let firstCondition = !hasDefault;
2173
- for (const key in value) {
2174
- if (key === "default") continue;
2175
- const payload = value[key];
2176
- const watermark = conditionCursorTop;
2177
- const cursor = acquireConditionCursor(parent);
2178
- resolveConditionText(state, cursor, key);
2179
- const condition = commitConditionCursor(state, cursor);
2180
- if (firstCondition) {
2181
- firstCondition = false;
2182
- if (!condition) {
2183
- releaseConditionCursors(watermark);
2184
- 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;
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;
2185
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);
2186
1510
  }
2187
- if (payload != null) {
2188
- conditions |= emitUnderCondition(state, property, payload, cursor, merge, payload, contextOnly, 1, payload);
2189
- const payloadString = String(payload);
2190
- feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
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]);
2191
1523
  }
2192
- releaseConditionCursors(watermark);
2193
1524
  }
2194
- if (!hasDefault && firstCondition) return false;
2195
- if ((!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
2196
- const resting = implicitLifecycleBase(property);
2197
- 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);
2198
1529
  }
2199
1530
  return true;
2200
1531
  }
2201
- function contributeValue(state, property, value, merge, originalValue, contextOnly = false, condition) {
2202
- if (isConditionTransport(value)) {
2203
- if (value.hasBase) contributeValue(state, property, value.base, merge, value.base, contextOnly);
2204
- for (let offset = 0; offset < value.entries.length;) {
2205
- const entryValue = value.entries[offset];
2206
- const watermark = conditionCursorTop;
2207
- try {
2208
- emitUnderCondition(state, property, entryValue, acquireTransportCursor(state, value.entries, offset, state.flatPass?.[passParentCursor] || null), merge, entryValue, contextOnly, 2, entryValue);
2209
- } finally {
2210
- releaseConditionCursors(watermark);
2211
- }
2212
- offset += transportEntryWidth;
2213
- }
2214
- return true;
2215
- }
1532
+ function contributeValue(state, property, value, originalValue, contextOnly = false, condition) {
2216
1533
  if (condition !== void 0) {
2217
- const parent = state.flatPass?.[passParentCursor] || null;
2218
- const watermark = conditionCursorTop;
2219
- try {
2220
- let effective;
2221
- if (typeof condition === "string") {
2222
- effective = acquireConditionCursor(parent);
2223
- resolveConditionText(state, effective, condition);
2224
- commitConditionCursor(state, effective);
2225
- } else if (parent) {
2226
- effective = acquireConditionCursor(parent);
2227
- const conditionKey = conditionTexts[condition + conditionKeyOffset] || "";
2228
- if (conditionKey) resolveConditionText(state, effective, conditionKey);
2229
- if (!(conditionNumbers[condition + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(effective);
2230
- commitConditionCursor(state, effective);
2231
- } else effective = condition;
2232
- const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
2233
- const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(value, "default");
2234
- const firstChild = isObjectValue && !objectHasDefault ? acquireConditionCursor(effective) : null;
2235
- if (isObjectValue && classifyConditionalObject(value, state, void 0, firstChild || void 0)) {
2236
- let useFirstChild = firstChild !== null;
2237
- for (const key in value) {
2238
- const payload = value[key];
2239
- if (payload == null) continue;
2240
- if (key === "default") emitUnderCondition(state, property, payload, effective, merge, payload, contextOnly, 2, payload);
2241
- else {
2242
- const keyWatermark = conditionCursorTop;
2243
- const child = useFirstChild ? firstChild : acquireConditionCursor(effective);
2244
- if (useFirstChild) useFirstChild = false;
2245
- else {
2246
- resolveConditionText(state, child, key);
2247
- commitConditionCursor(state, child);
2248
- }
2249
- emitUnderCondition(state, property, payload, child, merge, payload, contextOnly, 2, payload);
2250
- if (child !== firstChild) releaseConditionCursors(keyWatermark);
2251
- }
2252
- }
2253
- return true;
2254
- }
2255
- emitUnderCondition(state, property, value, effective, merge, originalValue, contextOnly, 2, value);
2256
- return true;
2257
- } finally {
2258
- releaseConditionCursors(watermark);
2259
- }
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;
2260
1545
  }
2261
- 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))) {
2262
1548
  if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`conditional "${property}" needs its composite property; dropping it`);
2263
1549
  return true;
2264
1550
  }
2265
- if (value === "safe" && (0, import_resolveSafeArea.isSafeAreaKey)(property)) {
2266
- const expanded = (0, import_resolveSafeArea.expandSafeAreaValue)(property);
1551
+ if (value === "safe") {
1552
+ const expanded = (0, import_grammarConfig.getConfigRevisionState)(state.conf).expandSafeArea(property);
2267
1553
  if (expanded) {
2268
1554
  state.flatUsesSafeArea = true;
2269
- 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);
2270
1556
  return true;
2271
1557
  }
2272
1558
  }
2273
- if (typeof value === "string") return contributeStyleString(state, property, value, merge, originalValue, contextOnly);
2274
- 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;
2275
1560
  if (value != null) {
2276
- emitAtParentCondition(state, property, value, merge, originalValue ?? value, contextOnly);
1561
+ emitAtParentCondition(state, property, value, originalValue ?? value, contextOnly);
2277
1562
  return true;
2278
1563
  }
2279
1564
  return false;
2280
1565
  }
2281
1566
  function clearDirectStyle(state, property) {
2282
1567
  const direct = state;
2283
- const atomicKey = property.startsWith("transition") ? "transition" : webShadowParts[property] ? "boxShadow" : webTextShadowParts.has(property) ? "textShadow" : legacyTransformParts.has(property) ? "transform" : property;
2284
- (0, import_directStyleCSS.clearFrameAtomic)(state, atomicKey);
2285
- const used = direct.flatUsed;
2286
- if (used) delete used[atomicKey];
2287
- if (atomicKey === "transform") state.transformAccumulator = void 0;
2288
- if (state.style) delete state.style[atomicKey];
2289
- delete state.classNames[atomicKey];
2290
- }
2291
- const conditionTransports = /* @__PURE__ */ new WeakSet();
2292
- function isConditionTransport(value) {
2293
- return typeof value === "object" && value !== null && conditionTransports.has(value);
2294
- }
2295
- const transportEntryWidth = 2;
2296
- function appendConditionEntry(entries, cursor, value) {
2297
- entries.push(value, conditionTexts[cursor + conditionKeyOffset] || "");
2298
- }
2299
- function acquireTransportCursor(state, entries, offset, parent) {
2300
- const cursor = acquireConditionCursor(parent);
2301
- const key = entries[offset + 1];
2302
- if (key) resolveConditionText(state, cursor, key);
2303
- commitConditionCursor(state, cursor);
2304
- return cursor;
2305
- }
2306
- function mergeConditionTransport(state, prev, cursor, value) {
2307
- let transport;
2308
- if (isConditionTransport(prev)) transport = prev;
2309
- else {
2310
- transport = {
2311
- hasBase: false,
2312
- base: void 0,
2313
- entries: []
2314
- };
2315
- conditionTransports.add(transport);
2316
- if (prev != null) {
2317
- const isObjectValue = typeof prev === "object" && !Array.isArray(prev) && !(0, import_createVariable.isVariable)(prev);
2318
- const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(prev, "default");
2319
- const authoredWatermark = conditionCursorTop;
2320
- try {
2321
- const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
2322
- if (isObjectValue && classifyConditionalObject(prev, state, void 0, firstCursor || void 0)) {
2323
- let useFirstCursor = firstCursor !== null;
2324
- for (const key in prev) {
2325
- const payload = prev[key];
2326
- if (payload == null) continue;
2327
- if (key === "default") {
2328
- transport.hasBase = true;
2329
- transport.base = payload;
2330
- continue;
2331
- }
2332
- const watermark = conditionCursorTop;
2333
- const keyCursor = useFirstCursor ? firstCursor : acquireConditionCursor();
2334
- if (useFirstCursor) useFirstCursor = false;
2335
- else {
2336
- resolveConditionText(state, keyCursor, key);
2337
- commitConditionCursor(state, keyCursor);
2338
- }
2339
- appendConditionEntry(transport.entries, keyCursor, payload);
2340
- if (keyCursor !== firstCursor) releaseConditionCursors(watermark);
2341
- }
2342
- } else {
2343
- transport.hasBase = true;
2344
- transport.base = prev;
2345
- }
2346
- } finally {
2347
- 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);
2348
1578
  }
2349
1579
  }
1580
+ direct.flatSlots.delete(atomicKey);
2350
1581
  }
2351
- const cursorKey = conditionTexts[cursor + conditionKeyOffset] || "";
2352
- for (let offset = 0; offset < transport.entries.length; offset += transportEntryWidth) if (transport.entries[offset + 1] === cursorKey) {
2353
- transport.entries.splice(offset, transportEntryWidth);
2354
- break;
2355
- }
2356
- appendConditionEntry(transport.entries, cursor, value);
2357
- return transport;
2358
- }
2359
- const variantValueHandler = {
2360
- segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
2361
- const state = ctx[0];
2362
- const directState = state;
2363
- if (start === end) return;
2364
- if (isBase) {
2365
- feedCompoundSegment(directState, source, start, end, true, valid, "");
2366
- if (!valid) return;
2367
- emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], null);
2368
- return;
2369
- }
2370
- if (!valid || !chainValid) return;
2371
- const cursor = directState.flatScanCursor;
2372
- const condition = cursor && conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0;
2373
- feedCompoundSegment(directState, source, start, end, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
2374
- if (!condition) return;
2375
- emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], cursor);
2376
- },
2377
- modifier(ctx, start, end, valid, first, source) {
2378
- const directState = ctx[0];
2379
- let cursor = directState.flatScanCursor;
2380
- if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor();
2381
- else if (first) resetConditionCursor(cursor, 0);
2382
- if (!valid) {
2383
- setConditionUnresolved(cursor);
2384
- return;
2385
- }
2386
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(ctx[0], cursor, source.slice(start, end));
2387
- },
2388
- chain(ctx, _start, _end, valid) {
2389
- const cursor = ctx[0].flatScanCursor;
2390
- if (cursor) {
2391
- if (!valid) setConditionUnresolved(cursor);
2392
- if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(ctx[0], cursor);
2393
- }
2394
- return true;
2395
- }
2396
- };
2397
- const contextPropSets = /* @__PURE__ */ new WeakMap();
2398
- function getContextPropSet(staticConfig) {
2399
- const cached = contextPropSets.get(staticConfig);
2400
- if (cached !== void 0) return cached;
2401
- const contextConfig = staticConfig.context || staticConfig.parentStaticConfig?.context;
2402
- const inheritedContextPropKeys = !staticConfig.context || staticConfig.context === staticConfig.parentStaticConfig?.context ? staticConfig.parentStaticConfig?.contextProps : void 0;
2403
- const contextPropKeys = staticConfig.contextProps || inheritedContextPropKeys;
2404
- let set = null;
2405
- if (contextConfig?.props) {
2406
- set ||= /* @__PURE__ */ new Set();
2407
- for (const key in contextConfig.props) set.add(key);
2408
- }
2409
- if (contextPropKeys) {
2410
- set ||= /* @__PURE__ */ new Set();
2411
- for (const key of contextPropKeys) set.add(key);
2412
- }
2413
- if (contextConfig?.propKeys) {
2414
- set ||= /* @__PURE__ */ new Set();
2415
- for (const key of contextConfig.propKeys) set.add(key);
2416
- }
2417
- const parentPropKeys = staticConfig.parentStaticConfig?.context?.propKeys;
2418
- if (parentPropKeys) {
2419
- set ||= /* @__PURE__ */ new Set();
2420
- for (const key of parentPropKeys) set.add(key);
2421
- }
2422
- contextPropSets.set(staticConfig, set);
2423
- return set;
2424
- }
2425
- function emitMappedValue(styleState, key, value, originalValue, nestedCondition, parentCondition, fallbackOriginal) {
2426
- const nested = nestedCondition;
2427
- const parent = parentCondition;
2428
- let resolvedCondition = nested ?? parent;
2429
- const watermark = conditionCursorTop;
2430
- if (nested && parent) {
2431
- const composed = acquireConditionCursor(parent);
2432
- const nestedKey = conditionTexts[nested + conditionKeyOffset] || "";
2433
- if (nestedKey) resolveConditionText(styleState, composed, nestedKey);
2434
- if (!(conditionNumbers[nested + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(composed);
2435
- commitConditionCursor(styleState, composed);
2436
- resolvedCondition = composed;
2437
- }
2438
- const conf = styleState.conf;
2439
- if (key === "fontFamily" || key === conf.inverseShorthands.fontFamily) styleState.fontFamily = getFontFamilyFromNameOrVariable(value, conf);
2440
- mapContributedProp(styleState, key, value, originalValue ?? fallbackOriginal, resolvedCondition);
2441
- releaseConditionCursors(watermark);
2442
- }
2443
- const contributeMappedValue = (key, value, styleState, disabled, parentCondition, fallbackOriginal) => {
2444
- if (disabled) return emitMappedValue(styleState, key, value, void 0, void 0, parentCondition, fallbackOriginal);
2445
- const { conf, styleProps, staticConfig } = styleState;
2446
- const { variants } = staticConfig;
2447
- const { disableExpandShorthands, noExpand, resolveValues } = styleProps;
2448
- const shorthands = conf.shorthands;
2449
- if (!noExpand) {
2450
- if (variants && key in variants) {
2451
- resolveVariants(key, value, styleProps, styleState, key);
2452
- return;
2453
- }
2454
- }
2455
- if (!disableExpandShorthands) {
2456
- if (key in shorthands) key = shorthands[key];
2457
- }
2458
- const originalValue = value;
2459
- if (value === "safe" && (0, import_resolveSafeArea.isSafeAreaKey)(key)) {
2460
- const expanded = (0, import_resolveSafeArea.expandSafeAreaValue)(key);
2461
- if (expanded) {
2462
- for (let i = 0; i < expanded.length; i++) {
2463
- const [nkey, nvalue] = expanded[i];
2464
- emitMappedValue(styleState, nkey, nvalue, originalValue, void 0, parentCondition, fallbackOriginal);
2465
- }
2466
- return;
2467
- }
2468
- }
2469
- if (value != null) {
2470
- if (typeof value === "string") value = (0, import_resolveRem.isRemValue)(value) ? (0, import_resolveRem.resolveRem)(value) : value;
2471
- else if ((0, import_createVariable.isVariable)(value)) value = (0, import_resolveVariableValue.resolveVariableValue)(key, value, resolveValues);
2472
- else if ((0, import_resolveRem.isRemValue)(value)) value = (0, import_resolveRem.resolveRem)(value);
2473
- }
2474
- if (value != null) {
2475
- if (key === "fontFamily" && typeof originalValue === "string") {
2476
- if (originalValue in conf.fontsParsed) styleState.fontFamily = originalValue;
2477
- }
2478
- const expanded = noExpand || typeof value === "string" ? null : (0, import_expandStyle.expandStyle)(key, value, conf.settings.styleCompat || "web");
2479
- if (expanded) {
2480
- const max = expanded.length;
2481
- for (let i = 0; i < max; i++) {
2482
- const [nkey, nvalue, noriginalValue] = expanded[i];
2483
- emitMappedValue(styleState, nkey, nvalue, noriginalValue ?? originalValue, void 0, parentCondition, fallbackOriginal);
2484
- }
2485
- } else emitMappedValue(styleState, key, value, originalValue, void 0, parentCondition, fallbackOriginal);
2486
- }
2487
- };
2488
- function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
2489
- const variantDefinition = styleState.staticConfig.variants?.[key];
2490
- if (isConditionTransport(value)) {
2491
- if (value.hasBase) emitResolvedVariant(key, value.base, styleState, parentVariantKey, null);
2492
- for (let offset = 0; offset < value.entries.length;) {
2493
- const entryValue = value.entries[offset];
2494
- const watermark = conditionCursorTop;
2495
- try {
2496
- emitResolvedVariant(key, entryValue, styleState, parentVariantKey, acquireTransportCursor(styleState, value.entries, offset, null));
2497
- } finally {
2498
- releaseConditionCursors(watermark);
2499
- }
2500
- offset += transportEntryWidth;
2501
- }
2502
- return;
2503
- }
2504
- if (typeof value === "string" && !(variantDefinition && typeof variantDefinition === "object" && value in variantDefinition)) {
2505
- const directState = styleState;
2506
- const watermark = conditionCursorTop;
2507
- const previousCursor = directState.flatScanCursor;
2508
- directState.flatScanCursor = null;
2509
- try {
2510
- (0, import_runtime.scanFlatValue)(value, variantValueHandler, [
2511
- styleState,
2512
- key,
2513
- parentVariantKey
2514
- ]);
2515
- } finally {
2516
- directState.flatScanCursor = previousCursor;
2517
- releaseConditionCursors(watermark);
2518
- }
2519
- return;
2520
- }
2521
- const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
2522
- const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(value, "default");
2523
- const objectWatermark = conditionCursorTop;
2524
- try {
2525
- const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
2526
- if (isObjectValue && classifyConditionalObject(value, styleState, void 0, firstCursor || void 0)) {
2527
- let useFirstCursor = firstCursor !== null;
2528
- for (const objKey in value) {
2529
- const payload = value[objKey];
2530
- if (payload == null) continue;
2531
- const directState = styleState;
2532
- const payloadString = String(payload);
2533
- if (objKey === "default") {
2534
- feedCompoundSegment(directState, payloadString, 0, payloadString.length, true, true, "");
2535
- emitResolvedVariant(key, payload, styleState, parentVariantKey, null);
2536
- continue;
2537
- }
2538
- const watermark = conditionCursorTop;
2539
- const cursor = useFirstCursor ? firstCursor : acquireConditionCursor();
2540
- let condition = conditionNumbers[cursor + conditionValueOffset];
2541
- if (useFirstCursor) useFirstCursor = false;
2542
- else {
2543
- resolveConditionText(styleState, cursor, objKey);
2544
- condition = commitConditionCursor(styleState, cursor);
2545
- }
2546
- if (directState.flatPass?.[passCompoundIndexes]) feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
2547
- emitResolvedVariant(key, payload, styleState, parentVariantKey, cursor);
2548
- if (cursor !== firstCursor) releaseConditionCursors(watermark);
2549
- }
2550
- return;
2551
- }
2552
- } finally {
2553
- releaseConditionCursors(objectWatermark);
2554
- }
2555
- emitResolvedVariant(key, value, styleState, parentVariantKey, null);
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];
2556
1586
  }
2557
- function emitResolvedVariant(key, value, styleState, parentVariantKey, conditionCursor) {
2558
- const { staticConfig, conf, debug } = styleState;
2559
- const styleProps = styleState.styleProps;
2560
- const { variants } = staticConfig;
2561
- if (!variants) return;
2562
- const variant = variants[key];
2563
- let variantValue = getVariantDefinition(variant, value, conf, styleState);
2564
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
2565
- console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`);
2566
- console.info({
2567
- key,
2568
- value,
2569
- variantValue,
2570
- variants
2571
- });
2572
- console.groupEnd();
2573
- }
2574
- if (!variantValue) {
2575
- if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1") {
2576
- if (typeof value !== "boolean") {
2577
- const name = styleState.styleProps.displayName || "[UnnamedComponent]";
2578
- console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
2579
- }
2580
- }
2581
- return;
2582
- }
2583
- if (typeof variantValue === "function") {
2584
- const fn = variantValue;
2585
- const extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
2586
- variantValue = fn(value, extras);
2587
- if (process.env.NODE_ENV === "development" && debug === "verbose" && true) {
2588
- console.groupCollapsed(" expanded functional variant", key);
2589
- console.info({
2590
- fn,
2591
- variantValue,
2592
- extras
2593
- });
2594
- console.groupEnd();
2595
- }
2596
- }
2597
- if (!(0, import_isObj2.isObj)(variantValue)) return;
2598
- if (process.env.NODE_ENV === "development" && debug === "verbose") console.info(` expanding styles from `, variantValue);
2599
- const { noSkip } = styleProps;
2600
- const originals = import_styleOriginalValues.styleOriginalValues.get(variantValue);
2601
- const directState = styleState;
2602
- directState.flatCompoundOutputDepth = (directState.flatCompoundOutputDepth || 0) + 1;
2603
- try {
2604
- for (const outputKey in variantValue) {
2605
- if (!noSkip && outputKey in import_skipProps.skipProps) continue;
2606
- const rawOutputValue = variantValue[outputKey];
2607
- const outputValue = styleProps.noNormalize ? rawOutputValue : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(rawOutputValue, conf.shorthands[outputKey] || outputKey);
2608
- const originalValue = originals?.[outputKey] ?? rawOutputValue;
2609
- if (getContextPropSet(staticConfig)?.has(outputKey)) {
2610
- styleState.overriddenContextProps ||= {};
2611
- styleState.overriddenContextProps[outputKey] = originalValue;
2612
- styleState.originalContextPropValues ||= {};
2613
- styleState.originalContextPropValues[outputKey] = originalValue;
2614
- }
2615
- contributeMappedValue(outputKey, outputValue, styleState, parentVariantKey === key && outputKey === key, conditionCursor || void 0, originalValue);
2616
- }
2617
- } finally {
2618
- directState.flatCompoundOutputDepth--;
2619
- }
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;
2620
1595
  }
2621
1596
  function getFontFamilyFromNameOrVariable(input, conf) {
2622
1597
  if ((0, import_createVariable.isVariable)(input)) {
@@ -2632,83 +1607,3 @@ function getFontFamilyFromNameOrVariable(input, conf) {
2632
1607
  } else if (typeof input === "string" && input in conf.fontsParsed) return input;
2633
1608
  }
2634
1609
  const variableToFontNameCache = /* @__PURE__ */ new WeakMap();
2635
- function getVariantDefinition(variant, value, conf, { theme }) {
2636
- if (!variant) return;
2637
- if (value === void 0) return;
2638
- if (typeof variant === "function") return variant;
2639
- if (Object.prototype.hasOwnProperty.call(variant, value)) return variant[value];
2640
- for (const { key, parts } of getCompiledVariantResolvers(variant)) for (const part of parts) if (matchesVariantResolver(part, value, conf, theme)) return variant[key];
2641
- }
2642
- const variantResolverNameSet = new Set(import_types.variantResolverNames);
2643
- const variantResolverCache = /* @__PURE__ */ new WeakMap();
2644
- const preparedStyleStaticConfigs = /* @__PURE__ */ new WeakSet();
2645
- function prepareStyleStaticConfig(staticConfig) {
2646
- if (preparedStyleStaticConfigs.has(staticConfig)) return staticConfig;
2647
- preparedStyleStaticConfigs.add(staticConfig);
2648
- getContextPropSet(staticConfig);
2649
- prepareStaticConfigCompounds(staticConfig);
2650
- const variants = staticConfig.variants;
2651
- if (variants) for (const key in variants) {
2652
- const variant = variants[key];
2653
- if (variant && typeof variant === "object") getCompiledVariantResolvers(variant);
2654
- }
2655
- return staticConfig;
2656
- }
2657
- function getCompiledVariantResolvers(variant) {
2658
- let cached = variantResolverCache.get(variant);
2659
- if (cached) return cached;
2660
- const compiled = [];
2661
- for (const key in variant) {
2662
- const parts = parseVariantResolverKey(key);
2663
- if (parts) compiled.push({
2664
- key,
2665
- parts
2666
- });
2667
- }
2668
- variantResolverCache.set(variant, compiled);
2669
- return compiled;
2670
- }
2671
- function parseVariantResolverKey(key) {
2672
- if (!key) return null;
2673
- const parts = [];
2674
- let start = 0;
2675
- for (let index = 0; index <= key.length; index++) {
2676
- if (index !== key.length && key.charCodeAt(index) !== 124) continue;
2677
- let partStart = start;
2678
- let partEnd = index;
2679
- while (partStart < partEnd && key.charCodeAt(partStart) <= 32) partStart++;
2680
- while (partEnd > partStart && key.charCodeAt(partEnd - 1) <= 32) partEnd--;
2681
- if (partStart === partEnd) return null;
2682
- const part = key.slice(partStart, partEnd);
2683
- if (!variantResolverNameSet.has(part)) return null;
2684
- parts.push(part);
2685
- start = index + 1;
2686
- }
2687
- return parts;
2688
- }
2689
- function hasNumericPrefix(value, suffixLength) {
2690
- if (value.length <= suffixLength) return false;
2691
- return Number.isFinite(Number(value.slice(0, value.length - suffixLength)));
2692
- }
2693
- function matchesVariantResolver(resolverName, value, conf, theme) {
2694
- const string = typeof value === "string";
2695
- const number = typeof value === "number";
2696
- const rem = string && value.endsWith("rem") && hasNumericPrefix(value, 3);
2697
- switch (resolverName) {
2698
- case "Size":
2699
- case "Space":
2700
- case "Radius":
2701
- case "ZIndex": return value === true || number || string || resolverName !== "Size" && (0, import_createVariable.isVariable)(value);
2702
- case "Color": return value != null && value in conf.tokensParsed.color || string;
2703
- case "Theme": return string && !!theme && value in theme;
2704
- case "FontSize": return value === true || !!conf.fontsParsed.body?.size?.[value] || number || rem;
2705
- case "FontStyle": return !!conf.fontsParsed.body?.style?.[value] || value === "normal" || value === "italic";
2706
- case "FontTransform": return !!conf.fontsParsed.body?.transform?.[value] || value === "none" || value === "capitalize" || value === "uppercase" || value === "lowercase";
2707
- case "FontLineHeight": return !!conf.fontsParsed.body?.lineHeight?.[value] || number || rem;
2708
- case "FontLetterSpacing": return !!conf.fontsParsed.body?.letterSpacing?.[value] || number || rem;
2709
- case "number":
2710
- case "string":
2711
- case "boolean": return typeof value === resolverName;
2712
- case "any": return true;
2713
- }
2714
- }