@tamagui/style-grammar 0.0.0-bootstrap.0 → 3.0.0-beta.643.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 (458) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -1
  3. package/dist/cjs/backgroundFamily.cjs +176 -0
  4. package/dist/cjs/backgroundFamily.native.cjs +195 -0
  5. package/dist/cjs/backgroundFamily.native.js +197 -0
  6. package/dist/cjs/backgroundFamily.native.js.map +1 -0
  7. package/dist/cjs/borderFamily.cjs +169 -0
  8. package/dist/cjs/borderFamily.native.cjs +247 -0
  9. package/dist/cjs/borderFamily.native.js +249 -0
  10. package/dist/cjs/borderFamily.native.js.map +1 -0
  11. package/dist/cjs/candidate.cjs +608 -0
  12. package/dist/cjs/candidate.native.cjs +821 -0
  13. package/dist/cjs/candidate.native.js +823 -0
  14. package/dist/cjs/candidate.native.js.map +1 -0
  15. package/dist/cjs/candidateTarget.cjs +50 -0
  16. package/dist/cjs/candidateTarget.native.cjs +88 -0
  17. package/dist/cjs/candidateTarget.native.js +90 -0
  18. package/dist/cjs/candidateTarget.native.js.map +1 -0
  19. package/dist/cjs/clauseCapability.cjs +130 -0
  20. package/dist/cjs/clauseCapability.native.cjs +152 -0
  21. package/dist/cjs/clauseCapability.native.js +154 -0
  22. package/dist/cjs/clauseCapability.native.js.map +1 -0
  23. package/dist/cjs/clausePrecedence.cjs +153 -0
  24. package/dist/cjs/clausePrecedence.native.cjs +204 -0
  25. package/dist/cjs/clausePrecedence.native.js +206 -0
  26. package/dist/cjs/clausePrecedence.native.js.map +1 -0
  27. package/dist/cjs/clauseSources.cjs +47 -0
  28. package/dist/cjs/clauseSources.native.cjs +49 -0
  29. package/dist/cjs/clauseSources.native.js +51 -0
  30. package/dist/cjs/clauseSources.native.js.map +1 -0
  31. package/dist/cjs/config.cjs +130 -0
  32. package/dist/cjs/config.native.cjs +185 -0
  33. package/dist/cjs/config.native.js +187 -0
  34. package/dist/cjs/config.native.js.map +1 -0
  35. package/dist/cjs/evaluateProgram.cjs +65 -0
  36. package/dist/cjs/evaluateProgram.native.cjs +70 -0
  37. package/dist/cjs/evaluateProgram.native.js +72 -0
  38. package/dist/cjs/evaluateProgram.native.js.map +1 -0
  39. package/dist/cjs/fontShorthand.cjs +207 -0
  40. package/dist/cjs/fontShorthand.native.cjs +260 -0
  41. package/dist/cjs/fontShorthand.native.js +262 -0
  42. package/dist/cjs/fontShorthand.native.js.map +1 -0
  43. package/dist/cjs/geometricShorthand.cjs +122 -0
  44. package/dist/cjs/geometricShorthand.native.cjs +128 -0
  45. package/dist/cjs/geometricShorthand.native.js +130 -0
  46. package/dist/cjs/geometricShorthand.native.js.map +1 -0
  47. package/dist/cjs/index.cjs +19 -0
  48. package/dist/cjs/index.native.cjs +21 -0
  49. package/dist/cjs/index.native.js +23 -0
  50. package/dist/cjs/index.native.js.map +1 -0
  51. package/dist/cjs/lowerProgram.cjs +205 -0
  52. package/dist/cjs/lowerProgram.native.cjs +257 -0
  53. package/dist/cjs/lowerProgram.native.js +259 -0
  54. package/dist/cjs/lowerProgram.native.js.map +1 -0
  55. package/dist/cjs/mergeFlatValues.cjs +50 -0
  56. package/dist/cjs/mergeFlatValues.native.cjs +71 -0
  57. package/dist/cjs/mergeFlatValues.native.js +73 -0
  58. package/dist/cjs/mergeFlatValues.native.js.map +1 -0
  59. package/dist/cjs/modifierRegistry.cjs +246 -0
  60. package/dist/cjs/modifierRegistry.native.cjs +426 -0
  61. package/dist/cjs/modifierRegistry.native.js +428 -0
  62. package/dist/cjs/modifierRegistry.native.js.map +1 -0
  63. package/dist/cjs/payloadShape.cjs +69 -0
  64. package/dist/cjs/payloadShape.native.cjs +71 -0
  65. package/dist/cjs/payloadShape.native.js +73 -0
  66. package/dist/cjs/payloadShape.native.js.map +1 -0
  67. package/dist/cjs/programEligibility.cjs +46 -0
  68. package/dist/cjs/programEligibility.native.cjs +48 -0
  69. package/dist/cjs/programEligibility.native.js +50 -0
  70. package/dist/cjs/programEligibility.native.js.map +1 -0
  71. package/dist/cjs/programHash.cjs +86 -0
  72. package/dist/cjs/programHash.native.cjs +106 -0
  73. package/dist/cjs/programHash.native.js +108 -0
  74. package/dist/cjs/programHash.native.js.map +1 -0
  75. package/dist/cjs/programs.cjs +128 -0
  76. package/dist/cjs/programs.native.cjs +220 -0
  77. package/dist/cjs/programs.native.js +222 -0
  78. package/dist/cjs/programs.native.js.map +1 -0
  79. package/dist/cjs/registry.cjs +629 -0
  80. package/dist/cjs/registry.native.cjs +635 -0
  81. package/dist/cjs/registry.native.js +637 -0
  82. package/dist/cjs/registry.native.js.map +1 -0
  83. package/dist/cjs/resolvePayload.cjs +296 -0
  84. package/dist/cjs/resolvePayload.native.cjs +302 -0
  85. package/dist/cjs/resolvePayload.native.js +304 -0
  86. package/dist/cjs/resolvePayload.native.js.map +1 -0
  87. package/dist/cjs/runtime.cjs +50 -0
  88. package/dist/cjs/runtime.native.cjs +52 -0
  89. package/dist/cjs/runtime.native.js +54 -0
  90. package/dist/cjs/runtime.native.js.map +1 -0
  91. package/dist/cjs/safeAreaVariables.cjs +42 -0
  92. package/dist/cjs/safeAreaVariables.native.cjs +44 -0
  93. package/dist/cjs/safeAreaVariables.native.js +46 -0
  94. package/dist/cjs/safeAreaVariables.native.js.map +1 -0
  95. package/dist/cjs/scanFlatValue.cjs +181 -0
  96. package/dist/cjs/scanFlatValue.native.cjs +183 -0
  97. package/dist/cjs/scanFlatValue.native.js +185 -0
  98. package/dist/cjs/scanFlatValue.native.js.map +1 -0
  99. package/dist/cjs/serializePayload.cjs +149 -0
  100. package/dist/cjs/serializePayload.native.cjs +187 -0
  101. package/dist/cjs/serializePayload.native.js +189 -0
  102. package/dist/cjs/serializePayload.native.js.map +1 -0
  103. package/dist/cjs/stateModifiers.cjs +43 -0
  104. package/dist/cjs/stateModifiers.native.cjs +45 -0
  105. package/dist/cjs/stateModifiers.native.js +47 -0
  106. package/dist/cjs/stateModifiers.native.js.map +1 -0
  107. package/dist/cjs/states.cjs +97 -0
  108. package/dist/cjs/states.native.cjs +131 -0
  109. package/dist/cjs/states.native.js +133 -0
  110. package/dist/cjs/states.native.js.map +1 -0
  111. package/dist/cjs/table.cjs +54 -0
  112. package/dist/cjs/table.native.cjs +135 -0
  113. package/dist/cjs/table.native.js +137 -0
  114. package/dist/cjs/table.native.js.map +1 -0
  115. package/dist/cjs/textDecorationFamily.cjs +129 -0
  116. package/dist/cjs/textDecorationFamily.native.cjs +199 -0
  117. package/dist/cjs/textDecorationFamily.native.js +201 -0
  118. package/dist/cjs/textDecorationFamily.native.js.map +1 -0
  119. package/dist/cjs/tooling.cjs +26 -0
  120. package/dist/cjs/tooling.native.cjs +28 -0
  121. package/dist/cjs/tooling.native.js +30 -0
  122. package/dist/cjs/tooling.native.js.map +1 -0
  123. package/dist/cjs/toolingAnnotations.cjs +105 -0
  124. package/dist/cjs/toolingAnnotations.native.cjs +133 -0
  125. package/dist/cjs/toolingAnnotations.native.js +135 -0
  126. package/dist/cjs/toolingAnnotations.native.js.map +1 -0
  127. package/dist/cjs/toolingDiagnostics.cjs +459 -0
  128. package/dist/cjs/toolingDiagnostics.native.cjs +788 -0
  129. package/dist/cjs/toolingDiagnostics.native.js +790 -0
  130. package/dist/cjs/toolingDiagnostics.native.js.map +1 -0
  131. package/dist/cjs/toolingRegistry.cjs +159 -0
  132. package/dist/cjs/toolingRegistry.native.cjs +164 -0
  133. package/dist/cjs/toolingRegistry.native.js +166 -0
  134. package/dist/cjs/toolingRegistry.native.js.map +1 -0
  135. package/dist/cjs/transformFamily.cjs +425 -0
  136. package/dist/cjs/transformFamily.native.cjs +517 -0
  137. package/dist/cjs/transformFamily.native.js +519 -0
  138. package/dist/cjs/transformFamily.native.js.map +1 -0
  139. package/dist/cjs/transition.cjs +459 -0
  140. package/dist/cjs/transition.native.cjs +499 -0
  141. package/dist/cjs/transition.native.js +501 -0
  142. package/dist/cjs/transition.native.js.map +1 -0
  143. package/dist/cjs/transitionAlign.cjs +115 -0
  144. package/dist/cjs/transitionAlign.native.cjs +154 -0
  145. package/dist/cjs/transitionAlign.native.js +156 -0
  146. package/dist/cjs/transitionAlign.native.js.map +1 -0
  147. package/dist/cjs/transitionLegacy.cjs +217 -0
  148. package/dist/cjs/transitionLegacy.native.cjs +260 -0
  149. package/dist/cjs/transitionLegacy.native.js +262 -0
  150. package/dist/cjs/transitionLegacy.native.js.map +1 -0
  151. package/dist/cjs/transitionNative.cjs +281 -0
  152. package/dist/cjs/transitionNative.native.cjs +285 -0
  153. package/dist/cjs/transitionNative.native.js +287 -0
  154. package/dist/cjs/transitionNative.native.js.map +1 -0
  155. package/dist/cjs/unitlessNumbers.cjs +86 -0
  156. package/dist/cjs/unitlessNumbers.native.cjs +106 -0
  157. package/dist/cjs/unitlessNumbers.native.js +108 -0
  158. package/dist/cjs/unitlessNumbers.native.js.map +1 -0
  159. package/dist/cjs/v6ThemeNames.cjs +47 -0
  160. package/dist/cjs/v6ThemeNames.native.cjs +53 -0
  161. package/dist/cjs/v6ThemeNames.native.js +55 -0
  162. package/dist/cjs/v6ThemeNames.native.js.map +1 -0
  163. package/dist/cjs/valueParser.cjs +148 -0
  164. package/dist/cjs/valueParser.native.cjs +150 -0
  165. package/dist/cjs/valueParser.native.js +152 -0
  166. package/dist/cjs/valueParser.native.js.map +1 -0
  167. package/dist/cjs/valueTypes.cjs +38 -0
  168. package/dist/cjs/valueTypes.native.cjs +40 -0
  169. package/dist/cjs/valueTypes.native.js +42 -0
  170. package/dist/cjs/valueTypes.native.js.map +1 -0
  171. package/dist/esm/backgroundFamily.mjs +150 -0
  172. package/dist/esm/backgroundFamily.mjs.map +1 -0
  173. package/dist/esm/backgroundFamily.native.js +167 -0
  174. package/dist/esm/backgroundFamily.native.js.map +1 -0
  175. package/dist/esm/borderFamily.mjs +146 -0
  176. package/dist/esm/borderFamily.mjs.map +1 -0
  177. package/dist/esm/borderFamily.native.js +222 -0
  178. package/dist/esm/borderFamily.native.js.map +1 -0
  179. package/dist/esm/candidate.mjs +581 -0
  180. package/dist/esm/candidate.mjs.map +1 -0
  181. package/dist/esm/candidate.native.js +792 -0
  182. package/dist/esm/candidate.native.js.map +1 -0
  183. package/dist/esm/candidateTarget.mjs +29 -0
  184. package/dist/esm/candidateTarget.mjs.map +1 -0
  185. package/dist/esm/candidateTarget.native.js +65 -0
  186. package/dist/esm/candidateTarget.native.js.map +1 -0
  187. package/dist/esm/clauseCapability.mjs +107 -0
  188. package/dist/esm/clauseCapability.mjs.map +1 -0
  189. package/dist/esm/clauseCapability.native.js +127 -0
  190. package/dist/esm/clauseCapability.native.js.map +1 -0
  191. package/dist/esm/clausePrecedence.mjs +121 -0
  192. package/dist/esm/clausePrecedence.mjs.map +1 -0
  193. package/dist/esm/clausePrecedence.native.js +170 -0
  194. package/dist/esm/clausePrecedence.native.js.map +1 -0
  195. package/dist/esm/clauseSources.mjs +23 -0
  196. package/dist/esm/clauseSources.mjs.map +1 -0
  197. package/dist/esm/clauseSources.native.js +23 -0
  198. package/dist/esm/clauseSources.native.js.map +1 -0
  199. package/dist/esm/config.mjs +103 -0
  200. package/dist/esm/config.mjs.map +1 -0
  201. package/dist/esm/config.native.js +156 -0
  202. package/dist/esm/config.native.js.map +1 -0
  203. package/dist/esm/evaluateProgram.mjs +45 -0
  204. package/dist/esm/evaluateProgram.mjs.map +1 -0
  205. package/dist/esm/evaluateProgram.native.js +48 -0
  206. package/dist/esm/evaluateProgram.native.js.map +1 -0
  207. package/dist/esm/fontShorthand.mjs +184 -0
  208. package/dist/esm/fontShorthand.mjs.map +1 -0
  209. package/dist/esm/fontShorthand.native.js +235 -0
  210. package/dist/esm/fontShorthand.native.js.map +1 -0
  211. package/dist/esm/geometricShorthand.mjs +102 -0
  212. package/dist/esm/geometricShorthand.mjs.map +1 -0
  213. package/dist/esm/geometricShorthand.native.js +106 -0
  214. package/dist/esm/geometricShorthand.native.js.map +1 -0
  215. package/dist/esm/index.mjs +1 -0
  216. package/dist/esm/index.native.js +1 -0
  217. package/dist/esm/lowerProgram.mjs +182 -0
  218. package/dist/esm/lowerProgram.mjs.map +1 -0
  219. package/dist/esm/lowerProgram.native.js +232 -0
  220. package/dist/esm/lowerProgram.native.js.map +1 -0
  221. package/dist/esm/mergeFlatValues.mjs +27 -0
  222. package/dist/esm/mergeFlatValues.mjs.map +1 -0
  223. package/dist/esm/mergeFlatValues.native.js +46 -0
  224. package/dist/esm/mergeFlatValues.native.js.map +1 -0
  225. package/dist/esm/modifierRegistry.mjs +219 -0
  226. package/dist/esm/modifierRegistry.mjs.map +1 -0
  227. package/dist/esm/modifierRegistry.native.js +397 -0
  228. package/dist/esm/modifierRegistry.native.js.map +1 -0
  229. package/dist/esm/payloadShape.mjs +49 -0
  230. package/dist/esm/payloadShape.mjs.map +1 -0
  231. package/dist/esm/payloadShape.native.js +49 -0
  232. package/dist/esm/payloadShape.native.js.map +1 -0
  233. package/dist/esm/programEligibility.mjs +22 -0
  234. package/dist/esm/programEligibility.mjs.map +1 -0
  235. package/dist/esm/programEligibility.native.js +22 -0
  236. package/dist/esm/programEligibility.native.js.map +1 -0
  237. package/dist/esm/programHash.mjs +62 -0
  238. package/dist/esm/programHash.mjs.map +1 -0
  239. package/dist/esm/programHash.native.js +80 -0
  240. package/dist/esm/programHash.native.js.map +1 -0
  241. package/dist/esm/programs.mjs +103 -0
  242. package/dist/esm/programs.mjs.map +1 -0
  243. package/dist/esm/programs.native.js +193 -0
  244. package/dist/esm/programs.native.js.map +1 -0
  245. package/dist/esm/registry.mjs +595 -0
  246. package/dist/esm/registry.mjs.map +1 -0
  247. package/dist/esm/registry.native.js +599 -0
  248. package/dist/esm/registry.native.js.map +1 -0
  249. package/dist/esm/resolvePayload.mjs +273 -0
  250. package/dist/esm/resolvePayload.mjs.map +1 -0
  251. package/dist/esm/resolvePayload.native.js +277 -0
  252. package/dist/esm/resolvePayload.native.js.map +1 -0
  253. package/dist/esm/runtime.mjs +63 -0
  254. package/dist/esm/runtime.native.js +63 -0
  255. package/dist/esm/safeAreaVariables.mjs +18 -0
  256. package/dist/esm/safeAreaVariables.mjs.map +1 -0
  257. package/dist/esm/safeAreaVariables.native.js +18 -0
  258. package/dist/esm/safeAreaVariables.native.js.map +1 -0
  259. package/dist/esm/scanFlatValue.mjs +160 -0
  260. package/dist/esm/scanFlatValue.mjs.map +1 -0
  261. package/dist/esm/scanFlatValue.native.js +160 -0
  262. package/dist/esm/scanFlatValue.native.js.map +1 -0
  263. package/dist/esm/serializePayload.mjs +125 -0
  264. package/dist/esm/serializePayload.mjs.map +1 -0
  265. package/dist/esm/serializePayload.native.js +161 -0
  266. package/dist/esm/serializePayload.native.js.map +1 -0
  267. package/dist/esm/stateModifiers.mjs +19 -0
  268. package/dist/esm/stateModifiers.mjs.map +1 -0
  269. package/dist/esm/stateModifiers.native.js +19 -0
  270. package/dist/esm/stateModifiers.native.js.map +1 -0
  271. package/dist/esm/states.mjs +69 -0
  272. package/dist/esm/states.mjs.map +1 -0
  273. package/dist/esm/states.native.js +101 -0
  274. package/dist/esm/states.native.js.map +1 -0
  275. package/dist/esm/table.mjs +31 -0
  276. package/dist/esm/table.mjs.map +1 -0
  277. package/dist/esm/table.native.js +110 -0
  278. package/dist/esm/table.native.js.map +1 -0
  279. package/dist/esm/textDecorationFamily.mjs +106 -0
  280. package/dist/esm/textDecorationFamily.mjs.map +1 -0
  281. package/dist/esm/textDecorationFamily.native.js +174 -0
  282. package/dist/esm/textDecorationFamily.native.js.map +1 -0
  283. package/dist/esm/tooling.mjs +15 -0
  284. package/dist/esm/tooling.native.js +15 -0
  285. package/dist/esm/toolingAnnotations.mjs +85 -0
  286. package/dist/esm/toolingAnnotations.mjs.map +1 -0
  287. package/dist/esm/toolingAnnotations.native.js +111 -0
  288. package/dist/esm/toolingAnnotations.native.js.map +1 -0
  289. package/dist/esm/toolingDiagnostics.mjs +428 -0
  290. package/dist/esm/toolingDiagnostics.mjs.map +1 -0
  291. package/dist/esm/toolingDiagnostics.native.js +755 -0
  292. package/dist/esm/toolingDiagnostics.native.js.map +1 -0
  293. package/dist/esm/toolingRegistry.mjs +135 -0
  294. package/dist/esm/toolingRegistry.mjs.map +1 -0
  295. package/dist/esm/toolingRegistry.native.js +138 -0
  296. package/dist/esm/toolingRegistry.native.js.map +1 -0
  297. package/dist/esm/transformFamily.mjs +392 -0
  298. package/dist/esm/transformFamily.mjs.map +1 -0
  299. package/dist/esm/transformFamily.native.js +482 -0
  300. package/dist/esm/transformFamily.native.js.map +1 -0
  301. package/dist/esm/transition.mjs +434 -0
  302. package/dist/esm/transition.mjs.map +1 -0
  303. package/dist/esm/transition.native.js +472 -0
  304. package/dist/esm/transition.native.js.map +1 -0
  305. package/dist/esm/transitionAlign.mjs +95 -0
  306. package/dist/esm/transitionAlign.mjs.map +1 -0
  307. package/dist/esm/transitionAlign.native.js +132 -0
  308. package/dist/esm/transitionAlign.native.js.map +1 -0
  309. package/dist/esm/transitionLegacy.mjs +197 -0
  310. package/dist/esm/transitionLegacy.mjs.map +1 -0
  311. package/dist/esm/transitionLegacy.native.js +238 -0
  312. package/dist/esm/transitionLegacy.native.js.map +1 -0
  313. package/dist/esm/transitionNative.mjs +257 -0
  314. package/dist/esm/transitionNative.mjs.map +1 -0
  315. package/dist/esm/transitionNative.native.js +259 -0
  316. package/dist/esm/transitionNative.native.js.map +1 -0
  317. package/dist/esm/unitlessNumbers.mjs +65 -0
  318. package/dist/esm/unitlessNumbers.mjs.map +1 -0
  319. package/dist/esm/unitlessNumbers.native.js +83 -0
  320. package/dist/esm/unitlessNumbers.native.js.map +1 -0
  321. package/dist/esm/v6ThemeNames.mjs +23 -0
  322. package/dist/esm/v6ThemeNames.mjs.map +1 -0
  323. package/dist/esm/v6ThemeNames.native.js +27 -0
  324. package/dist/esm/v6ThemeNames.native.js.map +1 -0
  325. package/dist/esm/valueParser.mjs +125 -0
  326. package/dist/esm/valueParser.mjs.map +1 -0
  327. package/dist/esm/valueParser.native.js +125 -0
  328. package/dist/esm/valueParser.native.js.map +1 -0
  329. package/dist/esm/valueTypes.mjs +14 -0
  330. package/dist/esm/valueTypes.mjs.map +1 -0
  331. package/dist/esm/valueTypes.native.js +14 -0
  332. package/dist/esm/valueTypes.native.js.map +1 -0
  333. package/package.json +98 -4
  334. package/src/backgroundFamily.ts +182 -0
  335. package/src/borderFamily.ts +172 -0
  336. package/src/candidate.ts +691 -0
  337. package/src/candidateTarget.ts +67 -0
  338. package/src/clauseCapability.ts +209 -0
  339. package/src/clausePrecedence.ts +198 -0
  340. package/src/clauseSources.ts +29 -0
  341. package/src/config.ts +169 -0
  342. package/src/evaluateProgram.ts +91 -0
  343. package/src/fontShorthand.ts +177 -0
  344. package/src/geometricShorthand.ts +105 -0
  345. package/src/index.ts +1 -0
  346. package/src/lowerProgram.ts +398 -0
  347. package/src/modifierRegistry.ts +340 -0
  348. package/src/payloadShape.ts +92 -0
  349. package/src/programEligibility.ts +46 -0
  350. package/src/programHash.ts +128 -0
  351. package/src/programs.ts +95 -0
  352. package/src/registry.ts +367 -0
  353. package/src/resolvePayload.ts +480 -0
  354. package/src/runtime.ts +32 -0
  355. package/src/safeAreaVariables.ts +19 -0
  356. package/src/scanFlatValue.ts +327 -0
  357. package/src/serializePayload.ts +199 -0
  358. package/src/stateModifiers.ts +36 -0
  359. package/src/states.ts +128 -0
  360. package/src/table.ts +47 -0
  361. package/src/textDecorationFamily.ts +119 -0
  362. package/src/tooling.ts +8 -0
  363. package/src/toolingAnnotations.ts +151 -0
  364. package/src/toolingDiagnostics.ts +735 -0
  365. package/src/toolingRegistry.ts +130 -0
  366. package/src/transformFamily.ts +590 -0
  367. package/src/transition.ts +553 -0
  368. package/src/transitionAlign.ts +165 -0
  369. package/src/transitionLegacy.ts +237 -0
  370. package/src/transitionNative.ts +357 -0
  371. package/src/unitlessNumbers.ts +61 -0
  372. package/src/v6ThemeNames.ts +40 -0
  373. package/src/valueParser.ts +193 -0
  374. package/src/valueTypes.ts +136 -0
  375. package/types/backgroundFamily.d.ts +17 -0
  376. package/types/backgroundFamily.d.ts.map +11 -0
  377. package/types/borderFamily.d.ts +23 -0
  378. package/types/borderFamily.d.ts.map +11 -0
  379. package/types/candidate.d.ts +52 -0
  380. package/types/candidate.d.ts.map +11 -0
  381. package/types/candidateTarget.d.ts +32 -0
  382. package/types/candidateTarget.d.ts.map +11 -0
  383. package/types/clauseCapability.d.ts +69 -0
  384. package/types/clauseCapability.d.ts.map +11 -0
  385. package/types/clausePrecedence.d.ts +30 -0
  386. package/types/clausePrecedence.d.ts.map +11 -0
  387. package/types/clauseSources.d.ts +12 -0
  388. package/types/clauseSources.d.ts.map +11 -0
  389. package/types/config.d.ts +44 -0
  390. package/types/config.d.ts.map +11 -0
  391. package/types/evaluateProgram.d.ts +27 -0
  392. package/types/evaluateProgram.d.ts.map +11 -0
  393. package/types/fontShorthand.d.ts +25 -0
  394. package/types/fontShorthand.d.ts.map +11 -0
  395. package/types/geometricShorthand.d.ts +21 -0
  396. package/types/geometricShorthand.d.ts.map +11 -0
  397. package/types/index.d.ts +3 -0
  398. package/types/index.d.ts.map +11 -0
  399. package/types/lowerProgram.d.ts +73 -0
  400. package/types/lowerProgram.d.ts.map +11 -0
  401. package/types/mergeFlatValues.d.ts +14 -0
  402. package/types/mergeFlatValues.d.ts.map +11 -0
  403. package/types/modifierRegistry.d.ts +70 -0
  404. package/types/modifierRegistry.d.ts.map +11 -0
  405. package/types/payloadShape.d.ts +15 -0
  406. package/types/payloadShape.d.ts.map +11 -0
  407. package/types/programEligibility.d.ts +23 -0
  408. package/types/programEligibility.d.ts.map +11 -0
  409. package/types/programHash.d.ts +20 -0
  410. package/types/programHash.d.ts.map +11 -0
  411. package/types/programs.d.ts +18 -0
  412. package/types/programs.d.ts.map +11 -0
  413. package/types/registry.d.ts +24 -0
  414. package/types/registry.d.ts.map +11 -0
  415. package/types/resolvePayload.d.ts +75 -0
  416. package/types/resolvePayload.d.ts.map +11 -0
  417. package/types/runtime.d.ts +34 -0
  418. package/types/runtime.d.ts.map +11 -0
  419. package/types/safeAreaVariables.d.ts +5 -0
  420. package/types/safeAreaVariables.d.ts.map +11 -0
  421. package/types/scanFlatValue.d.ts +29 -0
  422. package/types/scanFlatValue.d.ts.map +11 -0
  423. package/types/serializePayload.d.ts +13 -0
  424. package/types/serializePayload.d.ts.map +11 -0
  425. package/types/stateModifiers.d.ts +14 -0
  426. package/types/stateModifiers.d.ts.map +11 -0
  427. package/types/states.d.ts +22 -0
  428. package/types/states.d.ts.map +11 -0
  429. package/types/table.d.ts +4 -0
  430. package/types/table.d.ts.map +11 -0
  431. package/types/textDecorationFamily.d.ts +23 -0
  432. package/types/textDecorationFamily.d.ts.map +11 -0
  433. package/types/tooling.d.ts +10 -0
  434. package/types/tooling.d.ts.map +11 -0
  435. package/types/toolingAnnotations.d.ts +29 -0
  436. package/types/toolingAnnotations.d.ts.map +11 -0
  437. package/types/toolingDiagnostics.d.ts +114 -0
  438. package/types/toolingDiagnostics.d.ts.map +11 -0
  439. package/types/toolingRegistry.d.ts +10 -0
  440. package/types/toolingRegistry.d.ts.map +11 -0
  441. package/types/transformFamily.d.ts +83 -0
  442. package/types/transformFamily.d.ts.map +11 -0
  443. package/types/transition.d.ts +65 -0
  444. package/types/transition.d.ts.map +11 -0
  445. package/types/transitionAlign.d.ts +15 -0
  446. package/types/transitionAlign.d.ts.map +11 -0
  447. package/types/transitionLegacy.d.ts +9 -0
  448. package/types/transitionLegacy.d.ts.map +11 -0
  449. package/types/transitionNative.d.ts +41 -0
  450. package/types/transitionNative.d.ts.map +11 -0
  451. package/types/unitlessNumbers.d.ts +3 -0
  452. package/types/unitlessNumbers.d.ts.map +11 -0
  453. package/types/v6ThemeNames.d.ts +7 -0
  454. package/types/v6ThemeNames.d.ts.map +11 -0
  455. package/types/valueParser.d.ts +36 -0
  456. package/types/valueParser.d.ts.map +11 -0
  457. package/types/valueTypes.d.ts +66 -0
  458. package/types/valueTypes.d.ts.map +11 -0
@@ -0,0 +1,553 @@
1
+ export type TransitionBehavior = 'normal' | 'allow-discrete'
2
+
3
+ export interface CSSTransitionTiming {
4
+ type: 'css'
5
+ duration: string
6
+ timingFunction: string
7
+ }
8
+
9
+ export interface PresetTransitionTiming {
10
+ type: 'preset'
11
+ name: string
12
+ config?: Readonly<Record<string, unknown>>
13
+ }
14
+
15
+ export type TransitionTiming = CSSTransitionTiming | PresetTransitionTiming
16
+
17
+ export interface TransitionEntry {
18
+ property: string
19
+ timing: TransitionTiming
20
+ delay: string
21
+ behavior: TransitionBehavior
22
+ }
23
+
24
+ export interface TransitionIR {
25
+ kind: 'transition'
26
+ entries: readonly TransitionEntry[]
27
+ enter?: TransitionEntry
28
+ exit?: TransitionEntry
29
+ config?: Readonly<Record<string, unknown>>
30
+ }
31
+
32
+ export interface TransitionGlobalIR {
33
+ kind: 'global'
34
+ value: 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset'
35
+ }
36
+
37
+ export type ParsedTransition = TransitionIR | TransitionGlobalIR
38
+
39
+ export interface TransitionDiagnostic {
40
+ code:
41
+ | 'transition-empty-item'
42
+ | 'transition-invalid-token'
43
+ | 'transition-duplicate-component'
44
+ | 'transition-invalid-duration'
45
+ | 'transition-invalid-list'
46
+ message: string
47
+ item?: string
48
+ token?: string
49
+ }
50
+
51
+ export type TransitionParseResult =
52
+ | {
53
+ ok: true
54
+ value: ParsedTransition
55
+ }
56
+ | {
57
+ ok: false
58
+ diagnostics: readonly TransitionDiagnostic[]
59
+ }
60
+
61
+ export interface TransitionLonghands {
62
+ transitionProperty?: string
63
+ transitionDuration?: string
64
+ transitionTimingFunction?: string
65
+ transitionDelay?: string
66
+ transitionBehavior?: string
67
+ }
68
+
69
+ const globalValues = new Set(['inherit', 'initial', 'revert', 'revert-layer', 'unset'])
70
+ const timingKeywords = new Set([
71
+ 'ease',
72
+ 'linear',
73
+ 'ease-in',
74
+ 'ease-out',
75
+ 'ease-in-out',
76
+ 'step-start',
77
+ 'step-end',
78
+ ])
79
+ const behaviorValues = new Set(['normal', 'allow-discrete'])
80
+ const reservedPresetNames = new Set([
81
+ ...globalValues,
82
+ ...timingKeywords,
83
+ ...behaviorValues,
84
+ 'all',
85
+ 'none',
86
+ ])
87
+ const noPresetNames: ReadonlySet<string> = new Set()
88
+ const identifierPattern = /^-?(?:[_a-zA-Z]|[^\0-\x7f])(?:[-_a-zA-Z0-9]|[^\0-\x7f])*$/
89
+ const timePattern = /^([+-]?(?:\d+(?:\.\d*)?|\.\d+))(ms|s)$/
90
+
91
+ function splitTopLevel(input: string, separator: ',' | ' '): string[] | null {
92
+ const values: string[] = []
93
+ let start = 0
94
+ let depth = 0
95
+ let quote = ''
96
+
97
+ for (let index = 0; index < input.length; index++) {
98
+ const character = input[index]
99
+ if (quote) {
100
+ if (character === '\\') index++
101
+ else if (character === quote) quote = ''
102
+ continue
103
+ }
104
+ if (character === '"' || character === "'") {
105
+ quote = character
106
+ continue
107
+ }
108
+ if (character === '(') {
109
+ depth++
110
+ continue
111
+ }
112
+ if (character === ')') {
113
+ depth--
114
+ if (depth < 0) return null
115
+ continue
116
+ }
117
+ if (depth !== 0) continue
118
+
119
+ const matches = separator === ',' ? character === ',' : /\s/.test(character)
120
+ if (!matches) continue
121
+
122
+ const value = input.slice(start, index).trim()
123
+ if (value) values.push(value)
124
+ else if (separator === ',') values.push('')
125
+ start = index + 1
126
+ if (separator === ' ') {
127
+ while (start < input.length && /\s/.test(input[start])) start++
128
+ index = start - 1
129
+ }
130
+ }
131
+
132
+ if (depth !== 0 || quote) return null
133
+ values.push(input.slice(start).trim())
134
+ return values
135
+ }
136
+
137
+ function isTime(value: string): boolean {
138
+ return timePattern.test(value)
139
+ }
140
+
141
+ function isTimingFunction(value: string): boolean {
142
+ if (timingKeywords.has(value)) return true
143
+ if (/^cubic-bezier\(\s*[^)]+\s*\)$/.test(value)) {
144
+ const values = value.slice(value.indexOf('(') + 1, -1).split(',')
145
+ if (values.length !== 4) return false
146
+ const numbers: number[] = []
147
+ for (let index = 0; index < values.length; index++) {
148
+ const number = Number(values[index].trim())
149
+ if (!Number.isFinite(number)) return false
150
+ numbers.push(number)
151
+ }
152
+ return numbers[0] >= 0 && numbers[0] <= 1 && numbers[2] >= 0 && numbers[2] <= 1
153
+ }
154
+ if (/^steps\(\s*[^)]+\s*\)$/.test(value)) {
155
+ const parts = value.slice(value.indexOf('(') + 1, -1).split(',')
156
+ if (parts.length > 2) return false
157
+ const count = Number(parts[0].trim())
158
+ if (!Number.isInteger(count) || count <= 0) return false
159
+ const position = parts[1]?.trim()
160
+ if (
161
+ position !== undefined &&
162
+ !/^(jump-start|jump-end|jump-none|jump-both|start|end)$/.test(position)
163
+ ) {
164
+ return false
165
+ }
166
+ return position !== 'jump-none' || count > 1
167
+ }
168
+ if (/^linear\(\s*[^)]+\s*\)$/.test(value)) return true
169
+ return false
170
+ }
171
+
172
+ function parseSingleTransition(item: string): TransitionEntry | TransitionDiagnostic {
173
+ const tokens = splitTopLevel(item, ' ')
174
+ if (tokens === null || tokens.length === 0) {
175
+ return {
176
+ code: 'transition-invalid-token',
177
+ item,
178
+ message: `"${item}" is not a balanced CSS transition`,
179
+ }
180
+ }
181
+ for (let index = 0; index < tokens.length; index++) {
182
+ if (!tokens[index]) {
183
+ return {
184
+ code: 'transition-invalid-token',
185
+ item,
186
+ message: `"${item}" is not a balanced CSS transition`,
187
+ }
188
+ }
189
+ }
190
+
191
+ let property: string | undefined
192
+ let duration: string | undefined
193
+ let delay: string | undefined
194
+ let timingFunction: string | undefined
195
+ let behavior: TransitionBehavior | undefined
196
+
197
+ for (const token of tokens) {
198
+ if (globalValues.has(token)) {
199
+ return {
200
+ code: 'transition-invalid-list',
201
+ item,
202
+ token,
203
+ message: `CSS-wide value "${token}" must be the whole transition`,
204
+ }
205
+ }
206
+ if (isTime(token)) {
207
+ if (duration === undefined) {
208
+ if (Number(token.match(timePattern)?.[1]) < 0) {
209
+ return {
210
+ code: 'transition-invalid-duration',
211
+ item,
212
+ token,
213
+ message: `transition duration "${token}" cannot be negative`,
214
+ }
215
+ }
216
+ duration = token
217
+ } else if (delay === undefined) {
218
+ delay = token
219
+ } else {
220
+ return {
221
+ code: 'transition-duplicate-component',
222
+ item,
223
+ token,
224
+ message: `"${item}" has more than two time values`,
225
+ }
226
+ }
227
+ continue
228
+ }
229
+
230
+ if (isTimingFunction(token)) {
231
+ if (timingFunction !== undefined) {
232
+ return {
233
+ code: 'transition-duplicate-component',
234
+ item,
235
+ token,
236
+ message: `"${item}" has more than one timing function`,
237
+ }
238
+ }
239
+ timingFunction = token
240
+ continue
241
+ }
242
+
243
+ if (behaviorValues.has(token)) {
244
+ if (behavior !== undefined) {
245
+ return {
246
+ code: 'transition-duplicate-component',
247
+ item,
248
+ token,
249
+ message: `"${item}" has more than one transition behavior`,
250
+ }
251
+ }
252
+ behavior = token as TransitionBehavior
253
+ continue
254
+ }
255
+
256
+ if (identifierPattern.test(token) || /^--[-_a-zA-Z0-9]+$/.test(token)) {
257
+ if (property !== undefined) {
258
+ return {
259
+ code: 'transition-duplicate-component',
260
+ item,
261
+ token,
262
+ message: `"${item}" has more than one transition property`,
263
+ }
264
+ }
265
+ property = token
266
+ continue
267
+ }
268
+
269
+ return {
270
+ code: 'transition-invalid-token',
271
+ item,
272
+ token,
273
+ message: `"${token}" is not valid in a CSS transition`,
274
+ }
275
+ }
276
+
277
+ if (
278
+ property === 'none' &&
279
+ (duration !== undefined ||
280
+ delay !== undefined ||
281
+ timingFunction !== undefined ||
282
+ behavior !== undefined)
283
+ ) {
284
+ return {
285
+ code: 'transition-invalid-list',
286
+ item,
287
+ message: '"none" cannot be combined with other transition components',
288
+ }
289
+ }
290
+
291
+ return {
292
+ property: property ?? 'all',
293
+ timing: {
294
+ type: 'css',
295
+ duration: duration ?? '0s',
296
+ timingFunction: timingFunction ?? 'ease',
297
+ },
298
+ delay: delay ?? '0s',
299
+ behavior: behavior ?? 'normal',
300
+ }
301
+ }
302
+
303
+ /**
304
+ * parses CSS transition shorthand or an exact configured preset name.
305
+ *
306
+ * duration-shaped values and css-reserved names always use css semantics.
307
+ * preset matching is exact and never infers aliases.
308
+ */
309
+ export function parseTransition(
310
+ input: string,
311
+ presetNames: ReadonlySet<string> = noPresetNames
312
+ ): TransitionParseResult {
313
+ const value = input.trim()
314
+ if (!value) {
315
+ return {
316
+ ok: false,
317
+ diagnostics: [
318
+ {
319
+ code: 'transition-empty-item',
320
+ message: 'transition cannot be empty',
321
+ },
322
+ ],
323
+ }
324
+ }
325
+
326
+ if (globalValues.has(value)) {
327
+ return {
328
+ ok: true,
329
+ value: {
330
+ kind: 'global',
331
+ value: value as TransitionGlobalIR['value'],
332
+ },
333
+ }
334
+ }
335
+
336
+ if (
337
+ identifierPattern.test(value) &&
338
+ !reservedPresetNames.has(value) &&
339
+ presetNames.has(value)
340
+ ) {
341
+ return {
342
+ ok: true,
343
+ value: {
344
+ kind: 'transition',
345
+ entries: [
346
+ {
347
+ property: 'all',
348
+ timing: { type: 'preset', name: value },
349
+ delay: '0s',
350
+ behavior: 'normal',
351
+ },
352
+ ],
353
+ },
354
+ }
355
+ }
356
+
357
+ const items = splitTopLevel(value, ',')
358
+ if (items === null) {
359
+ return {
360
+ ok: false,
361
+ diagnostics: [
362
+ {
363
+ code: 'transition-invalid-token',
364
+ item: value,
365
+ message: `"${value}" is not a balanced CSS transition`,
366
+ },
367
+ ],
368
+ }
369
+ }
370
+
371
+ const entries: TransitionEntry[] = []
372
+ const diagnostics: TransitionDiagnostic[] = []
373
+ for (const item of items) {
374
+ if (!item) {
375
+ diagnostics.push({
376
+ code: 'transition-empty-item',
377
+ message: 'transition lists cannot contain an empty item',
378
+ })
379
+ continue
380
+ }
381
+ const parsed = parseSingleTransition(item)
382
+ if ('code' in parsed) diagnostics.push(parsed)
383
+ else entries.push(parsed)
384
+ }
385
+
386
+ let hasNone = false
387
+ for (let index = 0; index < entries.length; index++) {
388
+ if (entries[index].property === 'none') {
389
+ hasNone = true
390
+ break
391
+ }
392
+ }
393
+ if (hasNone && entries.length > 1) {
394
+ diagnostics.push({
395
+ code: 'transition-invalid-list',
396
+ message: '"none" cannot be combined with other transition items',
397
+ })
398
+ }
399
+
400
+ return diagnostics.length
401
+ ? { ok: false, diagnostics }
402
+ : { ok: true, value: { kind: 'transition', entries } }
403
+ }
404
+
405
+ function parseLonghandList(value: string | undefined, fallback: string): string[] | null {
406
+ if (value === undefined) return [fallback]
407
+ const values = splitTopLevel(value, ',')
408
+ if (!values?.length) return null
409
+ for (let index = 0; index < values.length; index++) {
410
+ if (!values[index]) return null
411
+ }
412
+ return values
413
+ }
414
+
415
+ /**
416
+ * lowers the five CSS transition longhands into the same IR as the shorthand.
417
+ * css list repetition is based on transition-property, as in the browser.
418
+ */
419
+ export function parseTransitionLonghands(
420
+ input: TransitionLonghands
421
+ ): TransitionParseResult {
422
+ const properties = parseLonghandList(input.transitionProperty, 'all')
423
+ const durations = parseLonghandList(input.transitionDuration, '0s')
424
+ const timings = parseLonghandList(input.transitionTimingFunction, 'ease')
425
+ const delays = parseLonghandList(input.transitionDelay, '0s')
426
+ const behaviors = parseLonghandList(input.transitionBehavior, 'normal')
427
+
428
+ if (!properties || !durations || !timings || !delays || !behaviors) {
429
+ return {
430
+ ok: false,
431
+ diagnostics: [
432
+ {
433
+ code: 'transition-invalid-list',
434
+ message: 'transition longhands must be non-empty comma-separated lists',
435
+ },
436
+ ],
437
+ }
438
+ }
439
+
440
+ const entries: TransitionEntry[] = []
441
+ const diagnostics: TransitionDiagnostic[] = []
442
+ for (let index = 0; index < properties.length; index++) {
443
+ const property = properties[index]
444
+ const duration = durations[index % durations.length]
445
+ const timingFunction = timings[index % timings.length]
446
+ const delay = delays[index % delays.length]
447
+ const behavior = behaviors[index % behaviors.length]
448
+
449
+ if (
450
+ globalValues.has(property) ||
451
+ globalValues.has(duration) ||
452
+ globalValues.has(timingFunction) ||
453
+ globalValues.has(delay) ||
454
+ globalValues.has(behavior)
455
+ ) {
456
+ diagnostics.push({
457
+ code: 'transition-invalid-list',
458
+ message:
459
+ 'CSS-wide values cannot be mixed into transition longhand lists; use the transition shorthand global value',
460
+ })
461
+ break
462
+ }
463
+ if (!(identifierPattern.test(property) || /^--[-_a-zA-Z0-9]+$/.test(property))) {
464
+ diagnostics.push({
465
+ code: 'transition-invalid-token',
466
+ token: property,
467
+ message: `"${property}" is not a transition property`,
468
+ })
469
+ }
470
+ if (!isTime(duration) || Number(duration.match(timePattern)?.[1]) < 0) {
471
+ diagnostics.push({
472
+ code: 'transition-invalid-duration',
473
+ token: duration,
474
+ message: `"${duration}" is not a non-negative transition duration`,
475
+ })
476
+ }
477
+ if (!isTimingFunction(timingFunction)) {
478
+ diagnostics.push({
479
+ code: 'transition-invalid-token',
480
+ token: timingFunction,
481
+ message: `"${timingFunction}" is not a transition timing function`,
482
+ })
483
+ }
484
+ if (!isTime(delay)) {
485
+ diagnostics.push({
486
+ code: 'transition-invalid-token',
487
+ token: delay,
488
+ message: `"${delay}" is not a transition delay`,
489
+ })
490
+ }
491
+ if (!behaviorValues.has(behavior)) {
492
+ diagnostics.push({
493
+ code: 'transition-invalid-token',
494
+ token: behavior,
495
+ message: `"${behavior}" is not a transition behavior`,
496
+ })
497
+ }
498
+
499
+ entries.push({
500
+ property,
501
+ timing: { type: 'css', duration, timingFunction },
502
+ delay,
503
+ behavior: behavior as TransitionBehavior,
504
+ })
505
+ }
506
+
507
+ let hasNone = false
508
+ for (let index = 0; index < properties.length; index++) {
509
+ if (properties[index] === 'none') {
510
+ hasNone = true
511
+ break
512
+ }
513
+ }
514
+ if (hasNone && properties.length > 1) {
515
+ diagnostics.push({
516
+ code: 'transition-invalid-list',
517
+ message: '"none" cannot be combined with other transition properties',
518
+ })
519
+ }
520
+
521
+ return diagnostics.length
522
+ ? { ok: false, diagnostics }
523
+ : { ok: true, value: { kind: 'transition', entries } }
524
+ }
525
+
526
+ export function serializeTransition(value: ParsedTransition): string | null {
527
+ if (value.kind === 'global') return value.value
528
+ if (value.enter || value.exit || value.config) return null
529
+ for (let index = 0; index < value.entries.length; index++) {
530
+ if (value.entries[index].timing.type === 'preset') return null
531
+ }
532
+
533
+ let serialized = ''
534
+ for (let index = 0; index < value.entries.length; index++) {
535
+ const entry = value.entries[index]
536
+ if (index) serialized += ', '
537
+ if (entry.timing.type !== 'css') return null
538
+ if (entry.property === 'none') {
539
+ if (
540
+ entry.timing.duration !== '0s' ||
541
+ entry.timing.timingFunction !== 'ease' ||
542
+ entry.delay !== '0s' ||
543
+ entry.behavior !== 'normal'
544
+ ) {
545
+ return null
546
+ }
547
+ serialized += 'none'
548
+ continue
549
+ }
550
+ serialized += `${entry.property} ${entry.timing.duration} ${entry.timing.timingFunction} ${entry.delay} ${entry.behavior}`
551
+ }
552
+ return serialized
553
+ }
@@ -0,0 +1,165 @@
1
+ // Phase 6 item 4: align transition shorthand and longhand behavior.
2
+ //
3
+ // Ruling (2026-07-31, design record "Web-aligned transitions"): transitions
4
+ // follow the border-family precedent — last-wins per longhand in authored
5
+ // order, the shorthand expands-and-resets — because the five transition
6
+ // longhands are real independent CSS longhands whose composition CSS fully
7
+ // defines. The merge SUBSTRATE is the five longhand LISTS, not the zipped
8
+ // entries: `transition="opacity 200ms"` followed by `transitionDelay="50ms"`
9
+ // must yield opacity/200ms/50ms, which only works when delay replaces the
10
+ // delay list and the zip (property list drives, shorter lists cycle) happens
11
+ // at the end. Zipping and validation have one owner: final assembly goes
12
+ // through parseTransitionLonghands.
13
+ //
14
+ // The one preset exception, where the transform no-invented-composition rule
15
+ // applies: a preset occupies the fused duration+timingFunction pair and is
16
+ // not decomposable into CSS components, so a duration or timing-function
17
+ // longhand AFTER a preset shorthand is a diagnostic naming the fix.
18
+ // property/delay/behavior compose freely around a preset. A longhand after a
19
+ // global-value shorthand (`transition="inherit"`) is a diagnostic for the
20
+ // same reason: the global is whole-value and per-longhand override of it is
21
+ // not representable without pretending to decompose it.
22
+ //
23
+ // Conditional transition clauses (`transition="200ms hover:400ms"`) are
24
+ // EXPLICITLY DEFERRED, not unconsidered: the record does not promise them and
25
+ // they would pull the program engine into the transition IR.
26
+
27
+ import {
28
+ parseTransition,
29
+ parseTransitionLonghands,
30
+ type PresetTransitionTiming,
31
+ type TransitionEntry,
32
+ type TransitionLonghands,
33
+ type TransitionParseResult,
34
+ } from './transition'
35
+
36
+ export type TransitionLonghandName =
37
+ | 'transitionProperty'
38
+ | 'transitionDuration'
39
+ | 'transitionTimingFunction'
40
+ | 'transitionDelay'
41
+ | 'transitionBehavior'
42
+
43
+ export interface TransitionContribution {
44
+ /** the authored prop, in authored order */
45
+ prop: 'transition' | TransitionLonghandName
46
+ value: string
47
+ }
48
+
49
+ interface MergeState {
50
+ global: string | null
51
+ preset: PresetTransitionTiming | null
52
+ /** each slot holds the LAST contribution's list text, or undefined = CSS default */
53
+ lists: Partial<Record<TransitionLonghandName, string>>
54
+ }
55
+
56
+ const timingLonghands: ReadonlySet<TransitionLonghandName> = new Set([
57
+ 'transitionDuration',
58
+ 'transitionTimingFunction',
59
+ ])
60
+
61
+ function listText(values: readonly string[]): string {
62
+ return values.join(', ')
63
+ }
64
+
65
+ /**
66
+ * Merges any mix of `transition` shorthand and longhand contributions, in
67
+ * authored order, into one TransitionIR. Last-wins per longhand; the
68
+ * shorthand resets all five.
69
+ */
70
+ export function alignTransitionContributions(
71
+ contributions: readonly TransitionContribution[],
72
+ presetNames?: ReadonlySet<string>
73
+ ): TransitionParseResult {
74
+ const state: MergeState = { global: null, preset: null, lists: {} }
75
+
76
+ for (const contribution of contributions) {
77
+ if (contribution.prop === 'transition') {
78
+ const parsed = parseTransition(contribution.value, presetNames)
79
+ if (!parsed.ok) return parsed
80
+
81
+ // a shorthand resets everything that came before it
82
+ state.global = null
83
+ state.preset = null
84
+ state.lists = {}
85
+
86
+ if (parsed.value.kind === 'global') {
87
+ state.global = parsed.value.value
88
+ continue
89
+ }
90
+ const entries = parsed.value.entries
91
+ const presetEntry = entries.find((entry) => entry.timing.type === 'preset')
92
+ if (presetEntry) {
93
+ state.preset = presetEntry.timing as PresetTransitionTiming
94
+ state.lists.transitionProperty = listText(entries.map((entry) => entry.property))
95
+ state.lists.transitionDelay = listText(entries.map((entry) => entry.delay))
96
+ state.lists.transitionBehavior = listText(entries.map((entry) => entry.behavior))
97
+ continue
98
+ }
99
+ state.lists.transitionProperty = listText(entries.map((entry) => entry.property))
100
+ state.lists.transitionDuration = listText(
101
+ entries.map((entry) => (entry.timing as { duration: string }).duration)
102
+ )
103
+ state.lists.transitionTimingFunction = listText(
104
+ entries.map(
105
+ (entry) => (entry.timing as { timingFunction: string }).timingFunction
106
+ )
107
+ )
108
+ state.lists.transitionDelay = listText(entries.map((entry) => entry.delay))
109
+ state.lists.transitionBehavior = listText(entries.map((entry) => entry.behavior))
110
+ continue
111
+ }
112
+
113
+ if (state.global) {
114
+ return {
115
+ ok: false,
116
+ diagnostics: [
117
+ {
118
+ code: 'transition-invalid-list',
119
+ token: contribution.prop,
120
+ message: `"${contribution.prop}" cannot override the CSS-wide transition "${state.global}" per longhand; restate the whole transition`,
121
+ },
122
+ ],
123
+ }
124
+ }
125
+ if (state.preset && timingLonghands.has(contribution.prop)) {
126
+ return {
127
+ ok: false,
128
+ diagnostics: [
129
+ {
130
+ code: 'transition-invalid-list',
131
+ token: contribution.prop,
132
+ message: `"${contribution.prop}" cannot partially override the "${state.preset.name}" preset — a preset's timing is not decomposable into CSS components; restate \`transition\` with CSS timing or change the preset`,
133
+ },
134
+ ],
135
+ }
136
+ }
137
+ state.lists[contribution.prop] = contribution.value
138
+ }
139
+
140
+ if (state.global) {
141
+ return {
142
+ ok: true,
143
+ value: { kind: 'global', value: state.global as any },
144
+ }
145
+ }
146
+
147
+ if (state.preset) {
148
+ // validate and zip the three CSS-shaped slots through the one owner, then
149
+ // transplant the preset timing onto every zipped entry
150
+ const zipped = parseTransitionLonghands({
151
+ transitionProperty: state.lists.transitionProperty,
152
+ transitionDelay: state.lists.transitionDelay,
153
+ transitionBehavior: state.lists.transitionBehavior,
154
+ })
155
+ if (!zipped.ok || zipped.value.kind !== 'transition') return zipped
156
+ const preset = state.preset
157
+ const entries: TransitionEntry[] = zipped.value.entries.map((entry) => ({
158
+ ...entry,
159
+ timing: preset,
160
+ }))
161
+ return { ok: true, value: { kind: 'transition', entries } }
162
+ }
163
+
164
+ return parseTransitionLonghands(state.lists as TransitionLonghands)
165
+ }