zyzz 0.0.0 → 0.0.2

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 (678) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +380 -0
  3. package/dist/Config.d.ts +170 -0
  4. package/dist/Config.d.ts.map +1 -0
  5. package/dist/Config.js +249 -0
  6. package/dist/Config.js.map +1 -0
  7. package/dist/Props.d.ts +7 -0
  8. package/dist/Props.d.ts.map +1 -0
  9. package/dist/Props.js +3 -0
  10. package/dist/Props.js.map +1 -0
  11. package/dist/Style.d.ts +167 -0
  12. package/dist/Style.d.ts.map +1 -0
  13. package/dist/Style.js +284 -0
  14. package/dist/Style.js.map +1 -0
  15. package/dist/Theme.d.ts +154 -0
  16. package/dist/Theme.d.ts.map +1 -0
  17. package/dist/Theme.js +257 -0
  18. package/dist/Theme.js.map +1 -0
  19. package/dist/babel/NativeEdits.d.ts +8 -0
  20. package/dist/babel/NativeEdits.d.ts.map +1 -0
  21. package/dist/babel/NativeEdits.js +233 -0
  22. package/dist/babel/NativeEdits.js.map +1 -0
  23. package/dist/babel/NativeJsx.d.ts +10 -0
  24. package/dist/babel/NativeJsx.d.ts.map +1 -0
  25. package/dist/babel/NativeJsx.js +204 -0
  26. package/dist/babel/NativeJsx.js.map +1 -0
  27. package/dist/babel/index.d.ts +51 -0
  28. package/dist/babel/index.d.ts.map +1 -0
  29. package/dist/babel/index.js +220 -0
  30. package/dist/babel/index.js.map +1 -0
  31. package/dist/cli/index.d.ts +3 -0
  32. package/dist/cli/index.d.ts.map +1 -0
  33. package/dist/cli/index.js +178 -0
  34. package/dist/cli/index.js.map +1 -0
  35. package/dist/compiler/Graph.d.ts +64 -0
  36. package/dist/compiler/Graph.d.ts.map +1 -0
  37. package/dist/compiler/Graph.js +1111 -0
  38. package/dist/compiler/Graph.js.map +1 -0
  39. package/dist/compiler/Native.d.ts +53 -0
  40. package/dist/compiler/Native.d.ts.map +1 -0
  41. package/dist/compiler/Native.js +617 -0
  42. package/dist/compiler/Native.js.map +1 -0
  43. package/dist/compiler/Source.d.ts +165 -0
  44. package/dist/compiler/Source.d.ts.map +1 -0
  45. package/dist/compiler/Source.js +990 -0
  46. package/dist/compiler/Source.js.map +1 -0
  47. package/dist/compiler/Transform.d.ts +57 -0
  48. package/dist/compiler/Transform.d.ts.map +1 -0
  49. package/dist/compiler/Transform.js +884 -0
  50. package/dist/compiler/Transform.js.map +1 -0
  51. package/dist/compiler/index.d.ts +13 -0
  52. package/dist/compiler/index.d.ts.map +1 -0
  53. package/dist/compiler/index.js +13 -0
  54. package/dist/compiler/index.js.map +1 -0
  55. package/dist/compiler/internal/Applications.d.ts +35 -0
  56. package/dist/compiler/internal/Applications.d.ts.map +1 -0
  57. package/dist/compiler/internal/Applications.js +248 -0
  58. package/dist/compiler/internal/Applications.js.map +1 -0
  59. package/dist/compiler/internal/AtRules.d.ts +8 -0
  60. package/dist/compiler/internal/AtRules.d.ts.map +1 -0
  61. package/dist/compiler/internal/AtRules.js +180 -0
  62. package/dist/compiler/internal/AtRules.js.map +1 -0
  63. package/dist/compiler/internal/Catalogs.d.ts +19 -0
  64. package/dist/compiler/internal/Catalogs.d.ts.map +1 -0
  65. package/dist/compiler/internal/Catalogs.js +68 -0
  66. package/dist/compiler/internal/Catalogs.js.map +1 -0
  67. package/dist/compiler/internal/ColorProfiles.d.ts +3 -0
  68. package/dist/compiler/internal/ColorProfiles.d.ts.map +1 -0
  69. package/dist/compiler/internal/ColorProfiles.js +84 -0
  70. package/dist/compiler/internal/ColorProfiles.js.map +1 -0
  71. package/dist/compiler/internal/CompositionBindings.d.ts +16 -0
  72. package/dist/compiler/internal/CompositionBindings.d.ts.map +1 -0
  73. package/dist/compiler/internal/CompositionBindings.js +89 -0
  74. package/dist/compiler/internal/CompositionBindings.js.map +1 -0
  75. package/dist/compiler/internal/Compositions.d.ts +32 -0
  76. package/dist/compiler/internal/Compositions.d.ts.map +1 -0
  77. package/dist/compiler/internal/Compositions.js +464 -0
  78. package/dist/compiler/internal/Compositions.js.map +1 -0
  79. package/dist/compiler/internal/Configurations.d.ts +21 -0
  80. package/dist/compiler/internal/Configurations.d.ts.map +1 -0
  81. package/dist/compiler/internal/Configurations.js +171 -0
  82. package/dist/compiler/internal/Configurations.js.map +1 -0
  83. package/dist/compiler/internal/Contract.d.ts +27 -0
  84. package/dist/compiler/internal/Contract.d.ts.map +1 -0
  85. package/dist/compiler/internal/Contract.js +600 -0
  86. package/dist/compiler/internal/Contract.js.map +1 -0
  87. package/dist/compiler/internal/Contributions.d.ts +54 -0
  88. package/dist/compiler/internal/Contributions.d.ts.map +1 -0
  89. package/dist/compiler/internal/Contributions.js +1109 -0
  90. package/dist/compiler/internal/Contributions.js.map +1 -0
  91. package/dist/compiler/internal/Descriptors.d.ts +15 -0
  92. package/dist/compiler/internal/Descriptors.d.ts.map +1 -0
  93. package/dist/compiler/internal/Descriptors.js +183 -0
  94. package/dist/compiler/internal/Descriptors.js.map +1 -0
  95. package/dist/compiler/internal/Dynamic.d.ts +14 -0
  96. package/dist/compiler/internal/Dynamic.d.ts.map +1 -0
  97. package/dist/compiler/internal/Dynamic.js +172 -0
  98. package/dist/compiler/internal/Dynamic.js.map +1 -0
  99. package/dist/compiler/internal/Edits.d.ts +12 -0
  100. package/dist/compiler/internal/Edits.d.ts.map +1 -0
  101. package/dist/compiler/internal/Edits.js +5 -0
  102. package/dist/compiler/internal/Edits.js.map +1 -0
  103. package/dist/compiler/internal/Expression.d.ts +12 -0
  104. package/dist/compiler/internal/Expression.d.ts.map +1 -0
  105. package/dist/compiler/internal/Expression.js +98 -0
  106. package/dist/compiler/internal/Expression.js.map +1 -0
  107. package/dist/compiler/internal/Functions.d.ts +5 -0
  108. package/dist/compiler/internal/Functions.d.ts.map +1 -0
  109. package/dist/compiler/internal/Functions.js +191 -0
  110. package/dist/compiler/internal/Functions.js.map +1 -0
  111. package/dist/compiler/internal/Identifiers.d.ts +9 -0
  112. package/dist/compiler/internal/Identifiers.d.ts.map +1 -0
  113. package/dist/compiler/internal/Identifiers.js +106 -0
  114. package/dist/compiler/internal/Identifiers.js.map +1 -0
  115. package/dist/compiler/internal/Keyframes.d.ts +5 -0
  116. package/dist/compiler/internal/Keyframes.d.ts.map +1 -0
  117. package/dist/compiler/internal/Keyframes.js +51 -0
  118. package/dist/compiler/internal/Keyframes.js.map +1 -0
  119. package/dist/compiler/internal/Namespaces.d.ts +17 -0
  120. package/dist/compiler/internal/Namespaces.d.ts.map +1 -0
  121. package/dist/compiler/internal/Namespaces.js +265 -0
  122. package/dist/compiler/internal/Namespaces.js.map +1 -0
  123. package/dist/compiler/internal/NativeBindings.d.ts +74 -0
  124. package/dist/compiler/internal/NativeBindings.d.ts.map +1 -0
  125. package/dist/compiler/internal/NativeBindings.js +117 -0
  126. package/dist/compiler/internal/NativeBindings.js.map +1 -0
  127. package/dist/compiler/internal/PackedStyles.d.ts +35 -0
  128. package/dist/compiler/internal/PackedStyles.d.ts.map +1 -0
  129. package/dist/compiler/internal/PackedStyles.js +345 -0
  130. package/dist/compiler/internal/PackedStyles.js.map +1 -0
  131. package/dist/compiler/internal/Properties.d.ts +5 -0
  132. package/dist/compiler/internal/Properties.d.ts.map +1 -0
  133. package/dist/compiler/internal/Properties.js +82 -0
  134. package/dist/compiler/internal/Properties.js.map +1 -0
  135. package/dist/compiler/internal/RecipeConditions.d.ts +41 -0
  136. package/dist/compiler/internal/RecipeConditions.d.ts.map +1 -0
  137. package/dist/compiler/internal/RecipeConditions.js +82 -0
  138. package/dist/compiler/internal/RecipeConditions.js.map +1 -0
  139. package/dist/compiler/internal/RecipePayloads.d.ts +31 -0
  140. package/dist/compiler/internal/RecipePayloads.d.ts.map +1 -0
  141. package/dist/compiler/internal/RecipePayloads.js +99 -0
  142. package/dist/compiler/internal/RecipePayloads.js.map +1 -0
  143. package/dist/compiler/internal/Recipes.d.ts +32 -0
  144. package/dist/compiler/internal/Recipes.d.ts.map +1 -0
  145. package/dist/compiler/internal/Recipes.js +339 -0
  146. package/dist/compiler/internal/Recipes.js.map +1 -0
  147. package/dist/compiler/internal/Relative.d.ts +19 -0
  148. package/dist/compiler/internal/Relative.d.ts.map +1 -0
  149. package/dist/compiler/internal/Relative.js +62 -0
  150. package/dist/compiler/internal/Relative.js.map +1 -0
  151. package/dist/compiler/internal/Scope.d.ts +10 -0
  152. package/dist/compiler/internal/Scope.d.ts.map +1 -0
  153. package/dist/compiler/internal/Scope.js +28 -0
  154. package/dist/compiler/internal/Scope.js.map +1 -0
  155. package/dist/compiler/internal/Selectors.d.ts +12 -0
  156. package/dist/compiler/internal/Selectors.d.ts.map +1 -0
  157. package/dist/compiler/internal/Selectors.js +265 -0
  158. package/dist/compiler/internal/Selectors.js.map +1 -0
  159. package/dist/compiler/internal/Static.d.ts +39 -0
  160. package/dist/compiler/internal/Static.d.ts.map +1 -0
  161. package/dist/compiler/internal/Static.js +532 -0
  162. package/dist/compiler/internal/Static.js.map +1 -0
  163. package/dist/compiler/internal/Stylesheets.d.ts +47 -0
  164. package/dist/compiler/internal/Stylesheets.d.ts.map +1 -0
  165. package/dist/compiler/internal/Stylesheets.js +272 -0
  166. package/dist/compiler/internal/Stylesheets.js.map +1 -0
  167. package/dist/compiler/internal/Syntax.d.ts +17 -0
  168. package/dist/compiler/internal/Syntax.d.ts.map +1 -0
  169. package/dist/compiler/internal/Syntax.js +19 -0
  170. package/dist/compiler/internal/Syntax.js.map +1 -0
  171. package/dist/compiler/internal/Themes.d.ts +158 -0
  172. package/dist/compiler/internal/Themes.d.ts.map +1 -0
  173. package/dist/compiler/internal/Themes.js +1169 -0
  174. package/dist/compiler/internal/Themes.js.map +1 -0
  175. package/dist/compiler/internal/Variables.d.ts +31 -0
  176. package/dist/compiler/internal/Variables.d.ts.map +1 -0
  177. package/dist/compiler/internal/Variables.js +376 -0
  178. package/dist/compiler/internal/Variables.js.map +1 -0
  179. package/dist/compiler/internal/ViewTransitions.d.ts +3 -0
  180. package/dist/compiler/internal/ViewTransitions.d.ts.map +1 -0
  181. package/dist/compiler/internal/ViewTransitions.js +68 -0
  182. package/dist/compiler/internal/ViewTransitions.js.map +1 -0
  183. package/dist/cx.d.ts +18 -0
  184. package/dist/cx.d.ts.map +1 -0
  185. package/dist/cx.js +60 -0
  186. package/dist/cx.js.map +1 -0
  187. package/dist/default.d.ts +2008 -0
  188. package/dist/default.d.ts.map +1 -0
  189. package/dist/default.js +243 -0
  190. package/dist/default.js.map +7 -0
  191. package/dist/default.js.zyzz.json +1 -0
  192. package/dist/index.d.ts +21 -0
  193. package/dist/index.d.ts.map +1 -0
  194. package/dist/index.js +19 -0
  195. package/dist/index.js.map +1 -0
  196. package/dist/internal/Authoring.d.ts +26 -0
  197. package/dist/internal/Authoring.d.ts.map +1 -0
  198. package/dist/internal/Authoring.js +134 -0
  199. package/dist/internal/Authoring.js.map +1 -0
  200. package/dist/internal/Binding.d.ts +64 -0
  201. package/dist/internal/Binding.d.ts.map +1 -0
  202. package/dist/internal/Binding.js +27 -0
  203. package/dist/internal/Binding.js.map +1 -0
  204. package/dist/internal/BindingDomains.d.ts +11 -0
  205. package/dist/internal/BindingDomains.d.ts.map +1 -0
  206. package/dist/internal/BindingDomains.js +459 -0
  207. package/dist/internal/BindingDomains.js.map +1 -0
  208. package/dist/internal/Cascade.d.ts +45 -0
  209. package/dist/internal/Cascade.d.ts.map +1 -0
  210. package/dist/internal/Cascade.js +165 -0
  211. package/dist/internal/Cascade.js.map +1 -0
  212. package/dist/internal/Compound.d.ts +132 -0
  213. package/dist/internal/Compound.d.ts.map +1 -0
  214. package/dist/internal/Compound.js +2 -0
  215. package/dist/internal/Compound.js.map +1 -0
  216. package/dist/internal/Condition.d.ts +33 -0
  217. package/dist/internal/Condition.d.ts.map +1 -0
  218. package/dist/internal/Condition.js +180 -0
  219. package/dist/internal/Condition.js.map +1 -0
  220. package/dist/internal/Corner.d.ts +9 -0
  221. package/dist/internal/Corner.d.ts.map +1 -0
  222. package/dist/internal/Corner.js +14 -0
  223. package/dist/internal/Corner.js.map +1 -0
  224. package/dist/internal/FunctionSyntax.d.ts +27 -0
  225. package/dist/internal/FunctionSyntax.d.ts.map +1 -0
  226. package/dist/internal/FunctionSyntax.js +91 -0
  227. package/dist/internal/FunctionSyntax.js.map +1 -0
  228. package/dist/internal/FunctionValue.d.ts +19 -0
  229. package/dist/internal/FunctionValue.d.ts.map +1 -0
  230. package/dist/internal/FunctionValue.js +2 -0
  231. package/dist/internal/FunctionValue.js.map +1 -0
  232. package/dist/internal/Geometry.d.ts +8 -0
  233. package/dist/internal/Geometry.d.ts.map +1 -0
  234. package/dist/internal/Geometry.js +2 -0
  235. package/dist/internal/Geometry.js.map +1 -0
  236. package/dist/internal/Grid.d.ts +15 -0
  237. package/dist/internal/Grid.d.ts.map +1 -0
  238. package/dist/internal/Grid.js +2 -0
  239. package/dist/internal/Grid.js.map +1 -0
  240. package/dist/internal/Identifier.d.ts +15 -0
  241. package/dist/internal/Identifier.d.ts.map +1 -0
  242. package/dist/internal/Identifier.js +2 -0
  243. package/dist/internal/Identifier.js.map +1 -0
  244. package/dist/internal/Identity.d.ts +16 -0
  245. package/dist/internal/Identity.d.ts.map +1 -0
  246. package/dist/internal/Identity.js +78 -0
  247. package/dist/internal/Identity.js.map +1 -0
  248. package/dist/internal/Lexical.d.ts +89 -0
  249. package/dist/internal/Lexical.d.ts.map +1 -0
  250. package/dist/internal/Lexical.js +15 -0
  251. package/dist/internal/Lexical.js.map +1 -0
  252. package/dist/internal/Literal.d.ts +3459 -0
  253. package/dist/internal/Literal.d.ts.map +1 -0
  254. package/dist/internal/Literal.js +3371 -0
  255. package/dist/internal/Literal.js.map +1 -0
  256. package/dist/internal/NativeProperties.d.ts +596 -0
  257. package/dist/internal/NativeProperties.d.ts.map +1 -0
  258. package/dist/internal/NativeProperties.js +2 -0
  259. package/dist/internal/NativeProperties.js.map +1 -0
  260. package/dist/internal/Numeric.d.ts +23 -0
  261. package/dist/internal/Numeric.d.ts.map +1 -0
  262. package/dist/internal/Numeric.js +2 -0
  263. package/dist/internal/Numeric.js.map +1 -0
  264. package/dist/internal/Query.d.ts +15 -0
  265. package/dist/internal/Query.d.ts.map +1 -0
  266. package/dist/internal/Query.js +58 -0
  267. package/dist/internal/Query.js.map +1 -0
  268. package/dist/internal/Recipe.d.ts +17 -0
  269. package/dist/internal/Recipe.d.ts.map +1 -0
  270. package/dist/internal/Recipe.js +2 -0
  271. package/dist/internal/Recipe.js.map +1 -0
  272. package/dist/internal/RuleReference.d.ts +23 -0
  273. package/dist/internal/RuleReference.d.ts.map +1 -0
  274. package/dist/internal/RuleReference.js +65 -0
  275. package/dist/internal/RuleReference.js.map +1 -0
  276. package/dist/internal/Scheme.d.ts +12 -0
  277. package/dist/internal/Scheme.d.ts.map +1 -0
  278. package/dist/internal/Scheme.js +16 -0
  279. package/dist/internal/Scheme.js.map +1 -0
  280. package/dist/internal/Shorthands.d.ts +20 -0
  281. package/dist/internal/Shorthands.d.ts.map +1 -0
  282. package/dist/internal/Shorthands.js +49 -0
  283. package/dist/internal/Shorthands.js.map +1 -0
  284. package/dist/internal/Targets.d.ts +43 -0
  285. package/dist/internal/Targets.d.ts.map +1 -0
  286. package/dist/internal/Targets.js +60 -0
  287. package/dist/internal/Targets.js.map +1 -0
  288. package/dist/internal/Token.d.ts +104 -0
  289. package/dist/internal/Token.d.ts.map +1 -0
  290. package/dist/internal/Token.js +162 -0
  291. package/dist/internal/Token.js.map +1 -0
  292. package/dist/internal/Tuple.d.ts +23 -0
  293. package/dist/internal/Tuple.d.ts.map +1 -0
  294. package/dist/internal/Tuple.js +2 -0
  295. package/dist/internal/Tuple.js.map +1 -0
  296. package/dist/internal/Value.d.ts +74 -0
  297. package/dist/internal/Value.d.ts.map +1 -0
  298. package/dist/internal/Value.js +60 -0
  299. package/dist/internal/Value.js.map +1 -0
  300. package/dist/metro/Graph.d.ts +8 -0
  301. package/dist/metro/Graph.d.ts.map +1 -0
  302. package/dist/metro/Graph.js +63 -0
  303. package/dist/metro/Graph.js.map +1 -0
  304. package/dist/metro/Watch.d.ts +21 -0
  305. package/dist/metro/Watch.d.ts.map +1 -0
  306. package/dist/metro/Watch.js +51 -0
  307. package/dist/metro/Watch.js.map +1 -0
  308. package/dist/metro/index.d.ts +30 -0
  309. package/dist/metro/index.d.ts.map +1 -0
  310. package/dist/metro/index.js +52 -0
  311. package/dist/metro/index.js.map +1 -0
  312. package/dist/metro/transformer.d.ts +21 -0
  313. package/dist/metro/transformer.d.ts.map +1 -0
  314. package/dist/metro/transformer.js +71 -0
  315. package/dist/metro/transformer.js.map +1 -0
  316. package/dist/next/index.d.ts +18 -0
  317. package/dist/next/index.d.ts.map +1 -0
  318. package/dist/next/index.js +92 -0
  319. package/dist/next/index.js.map +1 -0
  320. package/dist/next/loader.d.ts +16 -0
  321. package/dist/next/loader.d.ts.map +1 -0
  322. package/dist/next/loader.js +282 -0
  323. package/dist/next/loader.js.map +1 -0
  324. package/dist/node/Host.d.ts +80 -0
  325. package/dist/node/Host.d.ts.map +1 -0
  326. package/dist/node/Host.js +882 -0
  327. package/dist/node/Host.js.map +1 -0
  328. package/dist/node/index.d.ts +7 -0
  329. package/dist/node/index.d.ts.map +1 -0
  330. package/dist/node/index.js +7 -0
  331. package/dist/node/index.js.map +1 -0
  332. package/dist/react-native/Host.d.ts +76 -0
  333. package/dist/react-native/Host.d.ts.map +1 -0
  334. package/dist/react-native/Host.js +209 -0
  335. package/dist/react-native/Host.js.map +1 -0
  336. package/dist/react-native/StyleSheet.d.ts +226 -0
  337. package/dist/react-native/StyleSheet.d.ts.map +1 -0
  338. package/dist/react-native/StyleSheet.js +606 -0
  339. package/dist/react-native/StyleSheet.js.map +1 -0
  340. package/dist/react-native/Variants.d.ts +38 -0
  341. package/dist/react-native/Variants.d.ts.map +1 -0
  342. package/dist/react-native/Variants.js +66 -0
  343. package/dist/react-native/Variants.js.map +1 -0
  344. package/dist/react-native/index.d.ts +8 -0
  345. package/dist/react-native/index.d.ts.map +1 -0
  346. package/dist/react-native/index.js +8 -0
  347. package/dist/react-native/index.js.map +1 -0
  348. package/dist/react-native/internal/Color.d.ts +7 -0
  349. package/dist/react-native/internal/Color.d.ts.map +1 -0
  350. package/dist/react-native/internal/Color.js +93 -0
  351. package/dist/react-native/internal/Color.js.map +1 -0
  352. package/dist/react-native/internal/NativeSchema.d.ts +5138 -0
  353. package/dist/react-native/internal/NativeSchema.d.ts.map +1 -0
  354. package/dist/react-native/internal/NativeSchema.js +3097 -0
  355. package/dist/react-native/internal/NativeSchema.js.map +1 -0
  356. package/dist/react-native/internal/Scalar.d.ts +95 -0
  357. package/dist/react-native/internal/Scalar.d.ts.map +1 -0
  358. package/dist/react-native/internal/Scalar.js +199 -0
  359. package/dist/react-native/internal/Scalar.js.map +1 -0
  360. package/dist/react-native/internal/Values.d.ts +5 -0
  361. package/dist/react-native/internal/Values.d.ts.map +1 -0
  362. package/dist/react-native/internal/Values.js +65 -0
  363. package/dist/react-native/internal/Values.js.map +1 -0
  364. package/dist/react-native/react.d.ts +22 -0
  365. package/dist/react-native/react.d.ts.map +1 -0
  366. package/dist/react-native/react.js +26 -0
  367. package/dist/react-native/react.js.map +1 -0
  368. package/dist/reset.css +244 -0
  369. package/dist/runtime/Appearance.d.ts +55 -0
  370. package/dist/runtime/Appearance.d.ts.map +1 -0
  371. package/dist/runtime/Appearance.js +84 -0
  372. package/dist/runtime/Appearance.js.map +1 -0
  373. package/dist/runtime/Composition.d.ts +46 -0
  374. package/dist/runtime/Composition.d.ts.map +1 -0
  375. package/dist/runtime/Composition.js +52 -0
  376. package/dist/runtime/Composition.js.map +1 -0
  377. package/dist/runtime/CompositionHtml.d.ts +15 -0
  378. package/dist/runtime/CompositionHtml.d.ts.map +1 -0
  379. package/dist/runtime/CompositionHtml.js +20 -0
  380. package/dist/runtime/CompositionHtml.js.map +1 -0
  381. package/dist/runtime/ConditionalRecipe.d.ts +30 -0
  382. package/dist/runtime/ConditionalRecipe.d.ts.map +1 -0
  383. package/dist/runtime/ConditionalRecipe.js +39 -0
  384. package/dist/runtime/ConditionalRecipe.js.map +1 -0
  385. package/dist/runtime/Dynamic.d.ts +19 -0
  386. package/dist/runtime/Dynamic.d.ts.map +1 -0
  387. package/dist/runtime/Dynamic.js +22 -0
  388. package/dist/runtime/Dynamic.js.map +1 -0
  389. package/dist/runtime/Html.d.ts +32 -0
  390. package/dist/runtime/Html.d.ts.map +1 -0
  391. package/dist/runtime/Html.js +63 -0
  392. package/dist/runtime/Html.js.map +1 -0
  393. package/dist/runtime/Native.d.ts +48 -0
  394. package/dist/runtime/Native.d.ts.map +1 -0
  395. package/dist/runtime/Native.js +78 -0
  396. package/dist/runtime/Native.js.map +1 -0
  397. package/dist/runtime/NativeContext.d.ts +17 -0
  398. package/dist/runtime/NativeContext.d.ts.map +1 -0
  399. package/dist/runtime/NativeContext.js +47 -0
  400. package/dist/runtime/NativeContext.js.map +1 -0
  401. package/dist/runtime/NativeDynamic.d.ts +47 -0
  402. package/dist/runtime/NativeDynamic.d.ts.map +1 -0
  403. package/dist/runtime/NativeDynamic.js +141 -0
  404. package/dist/runtime/NativeDynamic.js.map +1 -0
  405. package/dist/runtime/PayloadRecipe.d.ts +22 -0
  406. package/dist/runtime/PayloadRecipe.d.ts.map +1 -0
  407. package/dist/runtime/PayloadRecipe.js +59 -0
  408. package/dist/runtime/PayloadRecipe.js.map +1 -0
  409. package/dist/runtime/Props.d.ts +21 -0
  410. package/dist/runtime/Props.d.ts.map +1 -0
  411. package/dist/runtime/Props.js +17 -0
  412. package/dist/runtime/Props.js.map +1 -0
  413. package/dist/runtime/Recipe.d.ts +52 -0
  414. package/dist/runtime/Recipe.d.ts.map +1 -0
  415. package/dist/runtime/Recipe.js +30 -0
  416. package/dist/runtime/Recipe.js.map +1 -0
  417. package/dist/runtime/Selection.d.ts +31 -0
  418. package/dist/runtime/Selection.d.ts.map +1 -0
  419. package/dist/runtime/Selection.js +30 -0
  420. package/dist/runtime/Selection.js.map +1 -0
  421. package/dist/runtime/Variable.d.ts +6 -0
  422. package/dist/runtime/Variable.d.ts.map +1 -0
  423. package/dist/runtime/Variable.js +10 -0
  424. package/dist/runtime/Variable.js.map +1 -0
  425. package/dist/runtime/index.d.ts +33 -0
  426. package/dist/runtime/index.d.ts.map +1 -0
  427. package/dist/runtime/index.js +33 -0
  428. package/dist/runtime/index.js.map +1 -0
  429. package/dist/styleFunction.d.ts +72 -0
  430. package/dist/styleFunction.d.ts.map +1 -0
  431. package/dist/styleFunction.js +18 -0
  432. package/dist/styleFunction.js.map +1 -0
  433. package/dist/themes/LICENSE.tailwind +21 -0
  434. package/dist/variable.d.ts +50 -0
  435. package/dist/variable.d.ts.map +1 -0
  436. package/dist/variable.js +20 -0
  437. package/dist/variable.js.map +1 -0
  438. package/dist/variants.d.ts +84 -0
  439. package/dist/variants.d.ts.map +1 -0
  440. package/dist/variants.js +21 -0
  441. package/dist/variants.js.map +1 -0
  442. package/dist/vite/index.d.ts +24 -0
  443. package/dist/vite/index.d.ts.map +1 -0
  444. package/dist/vite/index.js +1089 -0
  445. package/dist/vite/index.js.map +1 -0
  446. package/dist/web/Css.d.ts +81 -0
  447. package/dist/web/Css.d.ts.map +1 -0
  448. package/dist/web/Css.js +593 -0
  449. package/dist/web/Css.js.map +1 -0
  450. package/dist/web/colorProfile.d.ts +28 -0
  451. package/dist/web/colorProfile.d.ts.map +1 -0
  452. package/dist/web/colorProfile.js +8 -0
  453. package/dist/web/colorProfile.js.map +1 -0
  454. package/dist/web/counterStyle.d.ts +48 -0
  455. package/dist/web/counterStyle.d.ts.map +1 -0
  456. package/dist/web/counterStyle.js +8 -0
  457. package/dist/web/counterStyle.js.map +1 -0
  458. package/dist/web/cssFunction.d.ts +80 -0
  459. package/dist/web/cssFunction.d.ts.map +1 -0
  460. package/dist/web/cssFunction.js +18 -0
  461. package/dist/web/cssFunction.js.map +1 -0
  462. package/dist/web/customMedia.d.ts +12 -0
  463. package/dist/web/customMedia.d.ts.map +1 -0
  464. package/dist/web/customMedia.js +7 -0
  465. package/dist/web/customMedia.js.map +1 -0
  466. package/dist/web/fontFace.d.ts +26 -0
  467. package/dist/web/fontFace.d.ts.map +1 -0
  468. package/dist/web/fontFace.js +7 -0
  469. package/dist/web/fontFace.js.map +1 -0
  470. package/dist/web/fontFeatureValues.d.ts +40 -0
  471. package/dist/web/fontFeatureValues.d.ts.map +1 -0
  472. package/dist/web/fontFeatureValues.js +7 -0
  473. package/dist/web/fontFeatureValues.js.map +1 -0
  474. package/dist/web/fontPaletteValues.d.ts +21 -0
  475. package/dist/web/fontPaletteValues.d.ts.map +1 -0
  476. package/dist/web/fontPaletteValues.js +9 -0
  477. package/dist/web/fontPaletteValues.js.map +1 -0
  478. package/dist/web/global.d.ts +19 -0
  479. package/dist/web/global.d.ts.map +1 -0
  480. package/dist/web/global.js +6 -0
  481. package/dist/web/global.js.map +1 -0
  482. package/dist/web/importCss.d.ts +18 -0
  483. package/dist/web/importCss.d.ts.map +1 -0
  484. package/dist/web/importCss.js +7 -0
  485. package/dist/web/importCss.js.map +1 -0
  486. package/dist/web/index.d.ts +22 -0
  487. package/dist/web/index.d.ts.map +1 -0
  488. package/dist/web/index.js +22 -0
  489. package/dist/web/index.js.map +1 -0
  490. package/dist/web/internal/Block.d.ts +18 -0
  491. package/dist/web/internal/Block.d.ts.map +1 -0
  492. package/dist/web/internal/Block.js +13 -0
  493. package/dist/web/internal/Block.js.map +1 -0
  494. package/dist/web/internal/ClassName.d.ts +19 -0
  495. package/dist/web/internal/ClassName.d.ts.map +1 -0
  496. package/dist/web/internal/ClassName.js +77 -0
  497. package/dist/web/internal/ClassName.js.map +1 -0
  498. package/dist/web/internal/Context.d.ts +11 -0
  499. package/dist/web/internal/Context.d.ts.map +1 -0
  500. package/dist/web/internal/Context.js +2 -0
  501. package/dist/web/internal/Context.js.map +1 -0
  502. package/dist/web/internal/Contributions.d.ts +70 -0
  503. package/dist/web/internal/Contributions.d.ts.map +1 -0
  504. package/dist/web/internal/Contributions.js +109 -0
  505. package/dist/web/internal/Contributions.js.map +1 -0
  506. package/dist/web/internal/Namespace.d.ts +13 -0
  507. package/dist/web/internal/Namespace.d.ts.map +1 -0
  508. package/dist/web/internal/Namespace.js +13 -0
  509. package/dist/web/internal/Namespace.js.map +1 -0
  510. package/dist/web/internal/Themes.d.ts +13 -0
  511. package/dist/web/internal/Themes.d.ts.map +1 -0
  512. package/dist/web/internal/Themes.js +96 -0
  513. package/dist/web/internal/Themes.js.map +1 -0
  514. package/dist/web/keyframes.d.ts +14 -0
  515. package/dist/web/keyframes.d.ts.map +1 -0
  516. package/dist/web/keyframes.js +8 -0
  517. package/dist/web/keyframes.js.map +1 -0
  518. package/dist/web/layers.d.ts +4 -0
  519. package/dist/web/layers.d.ts.map +1 -0
  520. package/dist/web/layers.js +7 -0
  521. package/dist/web/layers.js.map +1 -0
  522. package/dist/web/namespace.d.ts +14 -0
  523. package/dist/web/namespace.d.ts.map +1 -0
  524. package/dist/web/namespace.js +7 -0
  525. package/dist/web/namespace.js.map +1 -0
  526. package/dist/web/page.d.ts +38 -0
  527. package/dist/web/page.d.ts.map +1 -0
  528. package/dist/web/page.js +7 -0
  529. package/dist/web/page.js.map +1 -0
  530. package/dist/web/positionTry.d.ts +14 -0
  531. package/dist/web/positionTry.d.ts.map +1 -0
  532. package/dist/web/positionTry.js +9 -0
  533. package/dist/web/positionTry.js.map +1 -0
  534. package/dist/web/property.d.ts +24 -0
  535. package/dist/web/property.d.ts.map +1 -0
  536. package/dist/web/property.js +7 -0
  537. package/dist/web/property.js.map +1 -0
  538. package/dist/web/viewTransition.d.ts +29 -0
  539. package/dist/web/viewTransition.d.ts.map +1 -0
  540. package/dist/web/viewTransition.js +7 -0
  541. package/dist/web/viewTransition.js.map +1 -0
  542. package/package.json +136 -10
  543. package/src/Config.ts +690 -0
  544. package/src/Props.ts +8 -0
  545. package/src/Style.ts +748 -0
  546. package/src/Theme.ts +713 -0
  547. package/src/babel/NativeEdits.ts +273 -0
  548. package/src/babel/NativeJsx.ts +260 -0
  549. package/src/babel/index.ts +332 -0
  550. package/src/cli/index.ts +196 -0
  551. package/src/compiler/Graph.ts +1586 -0
  552. package/src/compiler/Native.ts +801 -0
  553. package/src/compiler/Source.ts +1550 -0
  554. package/src/compiler/Transform.ts +1235 -0
  555. package/src/compiler/index.ts +12 -0
  556. package/src/compiler/internal/Applications.ts +378 -0
  557. package/src/compiler/internal/AtRules.ts +202 -0
  558. package/src/compiler/internal/Catalogs.ts +114 -0
  559. package/src/compiler/internal/ColorProfiles.ts +93 -0
  560. package/src/compiler/internal/CompositionBindings.ts +120 -0
  561. package/src/compiler/internal/Compositions.ts +629 -0
  562. package/src/compiler/internal/Configurations.ts +244 -0
  563. package/src/compiler/internal/Contract.ts +846 -0
  564. package/src/compiler/internal/Contributions.ts +1507 -0
  565. package/src/compiler/internal/Descriptors.ts +238 -0
  566. package/src/compiler/internal/Dynamic.ts +266 -0
  567. package/src/compiler/internal/Edits.ts +13 -0
  568. package/src/compiler/internal/Expression.ts +135 -0
  569. package/src/compiler/internal/Functions.ts +206 -0
  570. package/src/compiler/internal/Identifiers.ts +124 -0
  571. package/src/compiler/internal/Keyframes.ts +62 -0
  572. package/src/compiler/internal/Namespaces.ts +296 -0
  573. package/src/compiler/internal/NativeBindings.ts +151 -0
  574. package/src/compiler/internal/PackedStyles.ts +464 -0
  575. package/src/compiler/internal/Properties.ts +121 -0
  576. package/src/compiler/internal/RecipeConditions.ts +139 -0
  577. package/src/compiler/internal/RecipePayloads.ts +132 -0
  578. package/src/compiler/internal/Recipes.ts +531 -0
  579. package/src/compiler/internal/Relative.ts +87 -0
  580. package/src/compiler/internal/Scope.ts +36 -0
  581. package/src/compiler/internal/Selectors.ts +334 -0
  582. package/src/compiler/internal/Static.ts +783 -0
  583. package/src/compiler/internal/Stylesheets.ts +361 -0
  584. package/src/compiler/internal/Syntax.ts +31 -0
  585. package/src/compiler/internal/Themes.ts +1794 -0
  586. package/src/compiler/internal/Variables.ts +497 -0
  587. package/src/compiler/internal/ViewTransitions.ts +82 -0
  588. package/src/cx.ts +98 -0
  589. package/src/default.ts +484 -0
  590. package/src/index.ts +20 -0
  591. package/src/internal/Authoring.ts +199 -0
  592. package/src/internal/Binding.ts +187 -0
  593. package/src/internal/BindingDomains.ts +458 -0
  594. package/src/internal/Cascade.ts +165 -0
  595. package/src/internal/Compound.ts +522 -0
  596. package/src/internal/Condition.ts +283 -0
  597. package/src/internal/Corner.ts +17 -0
  598. package/src/internal/FunctionSyntax.ts +271 -0
  599. package/src/internal/FunctionValue.ts +96 -0
  600. package/src/internal/Geometry.ts +30 -0
  601. package/src/internal/Grid.ts +67 -0
  602. package/src/internal/Identifier.ts +14 -0
  603. package/src/internal/Identity.ts +89 -0
  604. package/src/internal/Lexical.ts +202 -0
  605. package/src/internal/Literal.ts +3820 -0
  606. package/src/internal/NativeProperties.ts +936 -0
  607. package/src/internal/Numeric.ts +77 -0
  608. package/src/internal/Query.ts +87 -0
  609. package/src/internal/Recipe.ts +17 -0
  610. package/src/internal/RuleReference.ts +102 -0
  611. package/src/internal/Scheme.ts +20 -0
  612. package/src/internal/Shorthands.ts +120 -0
  613. package/src/internal/Targets.ts +162 -0
  614. package/src/internal/Token.ts +380 -0
  615. package/src/internal/Tuple.ts +29 -0
  616. package/src/internal/Value.ts +320 -0
  617. package/src/metro/Graph.ts +78 -0
  618. package/src/metro/Watch.ts +88 -0
  619. package/src/metro/index.ts +99 -0
  620. package/src/metro/transformer.ts +97 -0
  621. package/src/next/index.ts +114 -0
  622. package/src/next/loader.ts +369 -0
  623. package/src/node/Host.ts +1204 -0
  624. package/src/node/index.ts +6 -0
  625. package/src/react-native/Host.ts +289 -0
  626. package/src/react-native/StyleSheet.ts +1084 -0
  627. package/src/react-native/Variants.ts +122 -0
  628. package/src/react-native/index.ts +7 -0
  629. package/src/react-native/internal/Color.ts +110 -0
  630. package/src/react-native/internal/NativeSchema.ts +3096 -0
  631. package/src/react-native/internal/Scalar.ts +253 -0
  632. package/src/react-native/internal/Values.ts +87 -0
  633. package/src/react-native/react.ts +47 -0
  634. package/src/reset.css +244 -0
  635. package/src/runtime/Appearance.ts +155 -0
  636. package/src/runtime/Composition.ts +87 -0
  637. package/src/runtime/CompositionHtml.ts +38 -0
  638. package/src/runtime/ConditionalRecipe.ts +70 -0
  639. package/src/runtime/Dynamic.ts +51 -0
  640. package/src/runtime/Html.ts +91 -0
  641. package/src/runtime/Native.ts +144 -0
  642. package/src/runtime/NativeContext.ts +74 -0
  643. package/src/runtime/NativeDynamic.ts +246 -0
  644. package/src/runtime/PayloadRecipe.ts +96 -0
  645. package/src/runtime/Props.ts +33 -0
  646. package/src/runtime/Recipe.ts +74 -0
  647. package/src/runtime/Selection.ts +82 -0
  648. package/src/runtime/Variable.ts +15 -0
  649. package/src/runtime/index.ts +45 -0
  650. package/src/styleFunction.ts +138 -0
  651. package/src/themes/LICENSE.tailwind +21 -0
  652. package/src/variable.ts +105 -0
  653. package/src/variants.ts +218 -0
  654. package/src/vite/index.ts +1473 -0
  655. package/src/web/Css.ts +801 -0
  656. package/src/web/colorProfile.ts +60 -0
  657. package/src/web/counterStyle.ts +82 -0
  658. package/src/web/cssFunction.ts +181 -0
  659. package/src/web/customMedia.ts +16 -0
  660. package/src/web/fontFace.ts +41 -0
  661. package/src/web/fontFeatureValues.ts +79 -0
  662. package/src/web/fontPaletteValues.ts +42 -0
  663. package/src/web/global.ts +39 -0
  664. package/src/web/importCss.ts +23 -0
  665. package/src/web/index.ts +22 -0
  666. package/src/web/internal/Block.ts +29 -0
  667. package/src/web/internal/ClassName.ts +112 -0
  668. package/src/web/internal/Context.ts +16 -0
  669. package/src/web/internal/Contributions.ts +219 -0
  670. package/src/web/internal/Namespace.ts +21 -0
  671. package/src/web/internal/Themes.ts +133 -0
  672. package/src/web/keyframes.ts +43 -0
  673. package/src/web/layers.ts +6 -0
  674. package/src/web/namespace.ts +19 -0
  675. package/src/web/page.ts +140 -0
  676. package/src/web/positionTry.ts +71 -0
  677. package/src/web/property.ts +35 -0
  678. package/src/web/viewTransition.ts +89 -0
@@ -0,0 +1,1109 @@
1
+ /** Extracts module-level stylesheet effects without evaluating application code. @module */
2
+ import * as Identity from '../../internal/Identity.js';
3
+ import * as Condition from '../../internal/Condition.js';
4
+ import * as Descriptors from './Descriptors.js';
5
+ import * as Expression from './Expression.js';
6
+ import * as Functions from './Functions.js';
7
+ import * as FunctionSyntax from '../../internal/FunctionSyntax.js';
8
+ import * as Identifiers from './Identifiers.js';
9
+ import * as Keyframes from './Keyframes.js';
10
+ import * as Lexical from '../../internal/Lexical.js';
11
+ import * as Lightning from 'lightningcss';
12
+ import * as Literal from '../../internal/Literal.js';
13
+ import * as Properties from './Properties.js';
14
+ import * as RuleReference from '../../internal/RuleReference.js';
15
+ import * as Style from '../../Style.js';
16
+ import * as Theme from '../../Theme.js';
17
+ import * as Themes from './Themes.js';
18
+ import * as Walker from 'oxc-walker';
19
+ const named = [
20
+ 'cssFunction',
21
+ 'customMedia',
22
+ 'colorProfile',
23
+ 'counterStyle',
24
+ 'fontPaletteValues',
25
+ 'keyframes',
26
+ 'positionTry',
27
+ ];
28
+ /** Stylesheet factory exports recognized by source and graph linking. */
29
+ export const factories = [
30
+ 'importCss',
31
+ 'namespace',
32
+ 'fontFace',
33
+ 'fontFeatureValues',
34
+ 'global',
35
+ 'layers',
36
+ 'page',
37
+ 'property',
38
+ 'viewTransition',
39
+ ...named,
40
+ ];
41
+ /** Collects lexical macro calls and animation references. */
42
+ export function scan(program, scope, namespace, links = {}, factoryImports = {}) {
43
+ const imports = new Map();
44
+ for (const node of program.body)
45
+ if (node.type === 'ImportDeclaration' && node.importKind !== 'type')
46
+ for (const specifier of node.specifiers)
47
+ if (specifier.type === 'ImportSpecifier' &&
48
+ specifier.importKind !== 'type') {
49
+ const imported = specifier.imported.type === 'Identifier'
50
+ ? specifier.imported.name
51
+ : specifier.imported.value;
52
+ const name = node.source.value === 'zyzz/web'
53
+ ? imported
54
+ : factoryImports[specifier.local.name];
55
+ if (name && factories.includes(name))
56
+ imports.set(specifier.start, name);
57
+ }
58
+ const exported = Object.create(null);
59
+ const linkedNames = new Map();
60
+ const imported = new Map();
61
+ for (const node of program.body)
62
+ if (node.type === 'ImportDeclaration')
63
+ for (const specifier of node.specifiers) {
64
+ const link = links[specifier.local.name];
65
+ if (link?.kind === 'animation' || link?.kind === 'rule-reference') {
66
+ imported.set(specifier.start, link.call.name);
67
+ linkedNames.set(specifier.local.name, link);
68
+ }
69
+ }
70
+ const calls = [];
71
+ const functionInputs = [];
72
+ const bindings = new Map();
73
+ const references = new Map();
74
+ const queryKeys = new Map();
75
+ const used = new Set();
76
+ const undefinedValues = new Set();
77
+ const ancestors = [];
78
+ function kind(node) {
79
+ if (node.type === 'Identifier') {
80
+ const binding = scope.getDeclaration(node.name);
81
+ const name = binding?.type === 'Import' ? imports.get(binding.node.start) : undefined;
82
+ return name;
83
+ }
84
+ return undefined;
85
+ }
86
+ if (imports.size || imported.size)
87
+ Walker.walk(program, {
88
+ scopeTracker: scope,
89
+ enter(node, parent) {
90
+ ancestors.push(node);
91
+ if (node.type === 'Identifier' &&
92
+ node.name === 'undefined' &&
93
+ !scope.getDeclaration(node.name))
94
+ undefinedValues.add(node.start);
95
+ if (node.type === 'VariableDeclarator' &&
96
+ node.id.type === 'Identifier' &&
97
+ node.init &&
98
+ Expression.unwrap(node.init).type === 'Identifier') {
99
+ const init = Expression.unwrap(node.init);
100
+ const declaration = scope.getDeclaration(init.name);
101
+ const identity = declaration
102
+ ? imported.get(declaration.node.start)
103
+ : undefined;
104
+ const link = identity
105
+ ? [...linkedNames.values()].find((link) => link.call.name === identity)
106
+ : undefined;
107
+ if (link) {
108
+ if (parent?.type !== 'VariableDeclaration' ||
109
+ parent.kind !== 'const')
110
+ throw new Themes.InvalidError('Animation aliases require const bindings.', node);
111
+ imported.set(node.start, link.call.name);
112
+ if (ancestors.at(-3)?.type === 'Program' ||
113
+ ancestors.at(-3)?.type === 'ExportNamedDeclaration')
114
+ linkedNames.set(node.id.name, link);
115
+ if (ancestors.some((node) => node.type === 'ExportNamedDeclaration'))
116
+ exported[node.id.name] = link;
117
+ }
118
+ }
119
+ if (node.type !== 'CallExpression')
120
+ return;
121
+ const type = kind(node.callee);
122
+ if (!type)
123
+ return;
124
+ const variable = parent?.type === 'VariableDeclarator' && parent.init === node
125
+ ? parent
126
+ : undefined;
127
+ const statement = variable ? ancestors.at(-3) : parent;
128
+ if (node.optional ||
129
+ (node.arguments.length !== 1 &&
130
+ (![
131
+ 'fontFace',
132
+ 'fontFeatureValues',
133
+ 'page',
134
+ 'property',
135
+ 'viewTransition',
136
+ ...named,
137
+ ].includes(type) ||
138
+ node.arguments.length !== 2)) ||
139
+ (!variable && parent?.type !== 'ExpressionStatement') ||
140
+ ancestors
141
+ .slice(0, -1)
142
+ .some((ancestor) => ![
143
+ 'Program',
144
+ 'ExportNamedDeclaration',
145
+ 'VariableDeclaration',
146
+ 'VariableDeclarator',
147
+ 'ExpressionStatement',
148
+ ].includes(ancestor.type)) ||
149
+ (variable &&
150
+ (statement?.type !== 'VariableDeclaration' ||
151
+ statement.kind !== 'const' ||
152
+ variable.id.type !== 'Identifier')))
153
+ throw new Themes.InvalidError('Stylesheet contributions require direct module-level calls and constant named stylesheet bindings.', node);
154
+ if (named.includes(type) && !variable)
155
+ throw new Themes.InvalidError('Named stylesheet definitions require a module-level named constant.', node);
156
+ const context = node.arguments[1];
157
+ const idProperty = context?.type === 'ObjectExpression'
158
+ ? context.properties.find((property) => property.type === 'Property' &&
159
+ !property.computed &&
160
+ (property.key.type === 'Identifier'
161
+ ? property.key.name
162
+ : property.key.type === 'Literal'
163
+ ? property.key.value
164
+ : undefined) === 'id')
165
+ : undefined;
166
+ if (idProperty &&
167
+ (idProperty.type !== 'Property' ||
168
+ idProperty.value.type !== 'Literal' ||
169
+ typeof idProperty.value.value !== 'string' ||
170
+ !idProperty.value.value))
171
+ throw new Themes.InvalidError('Stylesheet ids must be nonempty string literals.', node);
172
+ const explicit = idProperty?.type === 'Property' &&
173
+ idProperty.value.type === 'Literal' &&
174
+ typeof idProperty.value.value === 'string'
175
+ ? idProperty.value.value
176
+ : undefined;
177
+ const name = explicit !== undefined
178
+ ? Identity.contribution(type, explicit)
179
+ : variable?.id.type === 'Identifier'
180
+ ? `${type === 'keyframes' ? 'z-k' : `${type === 'counterStyle' ? '' : '--'}z-${type.toLowerCase()}`}${namespace}-${Array.from(variable.id.name)
181
+ .map((value) => value.codePointAt(0).toString(16))
182
+ .join('-')}`
183
+ : undefined;
184
+ const call = {
185
+ kind: type,
186
+ start: node.start,
187
+ end: node.end,
188
+ argument: node.arguments[0],
189
+ context: node.arguments[1],
190
+ ...(type === 'cssFunction'
191
+ ? { function: { parameters: [], returns: '*' } }
192
+ : {}),
193
+ ...(named.includes(type)
194
+ ? {
195
+ name,
196
+ binding: variable.start,
197
+ exported: ancestors.some((node) => node.type === 'ExportNamedDeclaration'),
198
+ }
199
+ : {}),
200
+ };
201
+ calls.push(call);
202
+ if (named.includes(call.kind) && variable?.id.type === 'Identifier') {
203
+ const link = {
204
+ binding: call.name,
205
+ kind: call.kind === 'keyframes' ? 'animation' : 'rule-reference',
206
+ definition: Theme.define({}),
207
+ call: {
208
+ start: call.start,
209
+ end: call.end,
210
+ name: call.name,
211
+ tokenType: '{}',
212
+ ...(call.function ? { function: call.function } : {}),
213
+ ...(call.kind !== 'keyframes'
214
+ ? { reference: call.kind }
215
+ : {}),
216
+ },
217
+ };
218
+ imported.set(variable.start, call.name);
219
+ linkedNames.set(variable.id.name, link);
220
+ if (call.exported)
221
+ exported[variable.id.name] = link;
222
+ }
223
+ if (call.binding !== undefined)
224
+ bindings.set(call.binding, call);
225
+ },
226
+ leave() {
227
+ ancestors.pop();
228
+ },
229
+ });
230
+ function read(node, parent, binding) {
231
+ if ((binding?.type === 'Import' || binding?.type === 'Variable') &&
232
+ imported.has(binding.node.start)) {
233
+ const name = imported.get(binding.node.start);
234
+ const link = [...linkedNames.values()].find((link) => link.call.name === name);
235
+ const text = link?.call.reference === 'customMedia' ? `@media (${name})` : name;
236
+ references.set(node.start, name);
237
+ if (link?.call.reference === 'customMedia')
238
+ queryKeys.set(node.start, text);
239
+ if (link?.call.reference === 'cssFunction' &&
240
+ parent.type === 'CallExpression' &&
241
+ parent.callee === node) {
242
+ // A call and its callee share their start offset. Never keep the bare name
243
+ // when an argument cannot be serialized as a static CSS expression.
244
+ references.delete(node.start);
245
+ const args = parent.arguments.map((argument) => {
246
+ const input = Expression.unwrap(argument);
247
+ if (input.type === 'Literal' &&
248
+ (typeof input.value === 'string' || typeof input.value === 'number'))
249
+ return String(input.value);
250
+ if (input.type === 'UnaryExpression' &&
251
+ (input.operator === '-' || input.operator === '+') &&
252
+ input.argument.type === 'Literal' &&
253
+ typeof input.argument.value === 'number')
254
+ return String(input.operator === '-'
255
+ ? -input.argument.value
256
+ : input.argument.value);
257
+ return undefined;
258
+ });
259
+ if (link.call.function)
260
+ functionInputs.push({
261
+ name,
262
+ signature: link.call.function,
263
+ values: args,
264
+ node: parent,
265
+ });
266
+ if (args.every((value) => value !== undefined))
267
+ references.set(parent.start, `${name}(${args.map((value) => (typeof value === 'string' && value.includes(',') && !value.trimStart().startsWith('{') ? `{${value}}` : value)).join(',')})`);
268
+ }
269
+ used.add(imported.get(binding.node.start));
270
+ return;
271
+ }
272
+ if (binding?.type !== 'Variable')
273
+ return;
274
+ const call = bindings.get(binding.node.start);
275
+ if (!call?.name ||
276
+ (parent.type === 'VariableDeclarator' && parent.id === node))
277
+ return;
278
+ references.set(node.start, call.name);
279
+ used.add(call.name);
280
+ }
281
+ for (const statement of program.body) {
282
+ if (statement.type === 'ExportDefaultDeclaration') {
283
+ const declaration = Expression.unwrap(statement.declaration);
284
+ const link = declaration.type === 'Identifier'
285
+ ? linkedNames.get(declaration.name)
286
+ : undefined;
287
+ if (link) {
288
+ used.add(link.call.name);
289
+ exported.default = link;
290
+ }
291
+ }
292
+ if (statement.type === 'ExportNamedDeclaration' &&
293
+ statement.exportKind !== 'type' &&
294
+ !statement.source)
295
+ for (const specifier of statement.specifiers) {
296
+ if ('exportKind' in specifier && specifier.exportKind === 'type')
297
+ continue;
298
+ const name = specifier.local.type === 'Identifier'
299
+ ? specifier.local.name
300
+ : specifier.local.value;
301
+ const link = linkedNames.get(name);
302
+ if (link) {
303
+ used.add(link.call.name);
304
+ exported[specifier.exported.type === 'Identifier'
305
+ ? specifier.exported.name
306
+ : specifier.exported.value] = link;
307
+ }
308
+ }
309
+ }
310
+ const kinds = new Map([...linkedNames.values()].flatMap((link) => link.call.reference
311
+ ? [[link.call.name, link.call.reference]]
312
+ : []));
313
+ return {
314
+ functionInputs,
315
+ namespace,
316
+ queryKeys,
317
+ calls,
318
+ kinds,
319
+ references,
320
+ read,
321
+ used,
322
+ undefinedValues,
323
+ exports: exported,
324
+ };
325
+ }
326
+ /** Resolves nested static invocations after lexical reference discovery. */
327
+ export function resolve(scanned) {
328
+ for (const input of [...scanned.functionInputs].reverse()) {
329
+ input.values = input.values.map((value, index) => {
330
+ const node = Expression.unwrap(input.node.arguments[index]);
331
+ return (value ??
332
+ (node.type === 'CallExpression'
333
+ ? scanned.references.get(node.start)
334
+ : undefined));
335
+ });
336
+ if (input.values.every((value) => value !== undefined))
337
+ scanned.references.set(input.node.start, `${input.name}(${input.values.map((value) => (value.includes(',') && !value.trimStart().startsWith('{') ? `{${value}}` : value)).join(',')})`);
338
+ }
339
+ }
340
+ /** Builds ordered pure web data after lexical theme references are resolved. */
341
+ export function extract(scanned, tokens, starts) {
342
+ const result = [];
343
+ function value(node, property) {
344
+ const reference = tokens.get(node.start);
345
+ if (reference?.end === node.end)
346
+ return reference.reference;
347
+ node = Expression.unwrap(node);
348
+ const animation = scanned.references.get(node.start);
349
+ if (animation)
350
+ return animation;
351
+ node = Expression.unwrap(node);
352
+ if (scanned.undefinedValues.has(node.start))
353
+ return undefined;
354
+ if (node.type === 'UnaryExpression' &&
355
+ node.operator === 'void' &&
356
+ Expression.unwrap(node.argument).type === 'Literal')
357
+ return undefined;
358
+ if (node.type === 'Literal' &&
359
+ (typeof node.value === 'string' ||
360
+ typeof node.value === 'number' ||
361
+ typeof node.value === 'boolean')) {
362
+ return node.value;
363
+ }
364
+ if (node.type === 'UnaryExpression' &&
365
+ (node.operator === '-' || node.operator === '+') &&
366
+ node.argument.type === 'Literal' &&
367
+ typeof node.argument.value === 'number')
368
+ return node.operator === '-' ? -node.argument.value : node.argument.value;
369
+ if (node.type === 'TemplateLiteral') {
370
+ const template = Expression.template(node, 0, (expression, prefix) => {
371
+ const node = Expression.unwrap(expression);
372
+ const name = scanned.references.get(node.start);
373
+ const kind = name ? scanned.kinds.get(name) : undefined;
374
+ if (kind &&
375
+ property &&
376
+ !RuleReference.acceptsExpression(kind, property, prefix))
377
+ throw new Themes.InvalidError('Named stylesheet reference is incompatible with this descriptor.', node);
378
+ return name ?? tokens.get(node.start)?.reference;
379
+ });
380
+ if (template !== undefined)
381
+ return template;
382
+ }
383
+ if (node.type === 'ArrayExpression')
384
+ return node.elements.map((element) => {
385
+ if (!element || element.type === 'SpreadElement')
386
+ throw new Themes.InvalidError('Contribution arrays require dense literal entries.', node);
387
+ return value(element, property);
388
+ });
389
+ if (node.type !== 'ObjectExpression')
390
+ throw new Themes.InvalidError('Stylesheet contributions require literal data.', node);
391
+ const output = Object.create(null);
392
+ for (const property of node.properties) {
393
+ if (property.type !== 'Property' ||
394
+ (property.computed && !scanned.queryKeys.has(property.key.start)) ||
395
+ property.shorthand ||
396
+ property.method ||
397
+ property.kind !== 'init')
398
+ throw new Themes.InvalidError('Contribution objects require explicit literal properties.', property);
399
+ const key = scanned.queryKeys.get(property.key.start) ??
400
+ (property.key.type === 'Identifier'
401
+ ? property.key.name
402
+ : property.key.type === 'Literal' &&
403
+ typeof property.key.value === 'string'
404
+ ? property.key.value
405
+ : undefined);
406
+ if (key === undefined || Object.hasOwn(output, key))
407
+ throw new Themes.InvalidError('Contribution keys must be unique literal strings.', property);
408
+ const item = Expression.unwrap(property.value);
409
+ const name = scanned.references.get(item.start);
410
+ const kind = name ? scanned.kinds.get(name) : undefined;
411
+ if (kind && !RuleReference.accepts(kind, key))
412
+ throw new Themes.InvalidError('Named stylesheet reference is incompatible with this descriptor.', item);
413
+ output[key] = value(property.value, key);
414
+ }
415
+ return output;
416
+ }
417
+ function record(value) {
418
+ if (!value || typeof value !== 'object' || Array.isArray(value))
419
+ throw new Error('Expected a contribution object.');
420
+ return value;
421
+ }
422
+ function style(value) {
423
+ return Style.define({ contribution: record(value) }).styles[0];
424
+ }
425
+ function grouping(selector) {
426
+ if (!selector.startsWith('@'))
427
+ return false;
428
+ if (!Condition.is(selector))
429
+ throw new Error('Expected a selector or supported grouping rule.');
430
+ if (/^@container(?=[\t\n\r\f (/])/.test(selector) &&
431
+ !selector.includes('('))
432
+ throw new Error('Container rules require a query after the optional name.');
433
+ Condition.normalize(selector);
434
+ return true;
435
+ }
436
+ function global(input) {
437
+ return {
438
+ name: 'global',
439
+ declarations: [],
440
+ rules: Object.entries(record(input)).map(([selector, input]) => ({
441
+ condition: selector,
442
+ style: grouping(selector) ? global(input) : style(input),
443
+ })),
444
+ };
445
+ }
446
+ for (const call of scanned.calls) {
447
+ const before = result.length;
448
+ try {
449
+ const input = value(call.argument);
450
+ if (call.name && !call.exported && !scanned.used.has(call.name))
451
+ continue;
452
+ if (call.kind === 'importCss') {
453
+ const options = record(input);
454
+ if (Object.keys(options).some((key) => !['layer', 'media', 'supports', 'url'].includes(key)) ||
455
+ typeof options.url !== 'string' ||
456
+ Object.entries(options).some(([key, value]) => key !== 'url' &&
457
+ value !== undefined &&
458
+ typeof value !== 'string' &&
459
+ !(key === 'layer' && value === true)))
460
+ throw new Error('Expected a stylesheet URL and static import conditions.');
461
+ result.push({
462
+ kind: 'import',
463
+ url: options.url,
464
+ ...(options.layer !== undefined
465
+ ? { layer: options.layer }
466
+ : {}),
467
+ ...(options.supports !== undefined
468
+ ? { supports: options.supports }
469
+ : {}),
470
+ ...(options.media !== undefined
471
+ ? { media: options.media }
472
+ : {}),
473
+ });
474
+ }
475
+ else if (call.kind === 'namespace') {
476
+ const options = record(input);
477
+ if (Object.keys(options).some((key) => !['prefix', 'uri'].includes(key)) ||
478
+ typeof options.uri !== 'string' ||
479
+ (options.prefix !== undefined &&
480
+ (typeof options.prefix !== 'string' ||
481
+ Identifiers.read(options.prefix) === undefined)))
482
+ throw new Error('Expected a namespace URI and optional identifier prefix.');
483
+ result.push({
484
+ kind: 'namespace',
485
+ uri: options.uri,
486
+ ...(options.prefix !== undefined
487
+ ? { prefix: options.prefix }
488
+ : {}),
489
+ name: `z-n${scanned.namespace}-${call.start.toString(36)}`,
490
+ });
491
+ }
492
+ else if (call.kind === 'customMedia') {
493
+ if (typeof input !== 'string' && typeof input !== 'boolean')
494
+ throw new Error('Expected a media query or boolean.');
495
+ if (typeof input === 'string')
496
+ Descriptors.media(input);
497
+ result.push({ kind: 'custom-media', name: call.name, query: input });
498
+ }
499
+ else if (call.kind === 'cssFunction') {
500
+ const options = record(input);
501
+ if (Object.keys(options).some((key) => !['body', 'parameters', 'returns'].includes(key)) ||
502
+ !Array.isArray(options.parameters) ||
503
+ (options.returns !== undefined &&
504
+ (typeof options.returns !== 'string' ||
505
+ !FunctionSyntax.accepts(options.returns))))
506
+ throw new Error('Expected CSS function parameters, body, and optional return syntax.');
507
+ const names = new Set();
508
+ const parameters = options.parameters.map((input) => {
509
+ const parameter = record(input);
510
+ if (Object.keys(parameter).some((key) => !['default', 'name', 'syntax'].includes(key)) ||
511
+ typeof parameter.name !== 'string' ||
512
+ !dashed(parameter.name) ||
513
+ names.has(Identifiers.read(parameter.name)) ||
514
+ (parameter.syntax !== undefined &&
515
+ (typeof parameter.syntax !== 'string' ||
516
+ !FunctionSyntax.accepts(parameter.syntax))) ||
517
+ (parameter.default !== undefined &&
518
+ typeof parameter.default !== 'string' &&
519
+ typeof parameter.default !== 'number'))
520
+ throw new Error('Expected unique CSS parameters with supported syntaxes and scalar defaults.');
521
+ names.add(Identifiers.read(parameter.name));
522
+ if (parameter.default !== undefined)
523
+ Functions.value(String(parameter.syntax ?? '*'), String(parameter.default));
524
+ return `${parameter.name}${parameter.syntax ? ` ${parameter.syntax === '*' ? 'type(*)' : parameter.syntax}` : ''}${parameter.default !== undefined ? `: ${parameter.default}` : ''}`;
525
+ });
526
+ function body(input) {
527
+ return Object.entries(record(input)).flatMap(([key, value]) => {
528
+ if (value === undefined)
529
+ return [];
530
+ if (/^@(media|supports|container) /.test(key))
531
+ return [
532
+ {
533
+ kind: 'block',
534
+ header: Condition.normalize(key),
535
+ entries: body(value),
536
+ },
537
+ ];
538
+ if ((key !== 'result' && !dashed(key)) ||
539
+ (typeof value !== 'string' && typeof value !== 'number'))
540
+ throw new Error('CSS function bodies accept result, local variables, and conditional groups.');
541
+ Functions.value('*', String(value));
542
+ return [{ kind: 'descriptor', name: key, value }];
543
+ });
544
+ }
545
+ call.function.parameters =
546
+ options.parameters;
547
+ call.function.returns = (options.returns ?? '*');
548
+ result.push({
549
+ kind: 'block',
550
+ header: `@function ${call.name}(${parameters.join(',')})${options.returns ? ` returns ${options.returns === '*' ? 'type(*)' : options.returns}` : ''}`,
551
+ entries: body(options.body),
552
+ });
553
+ }
554
+ else if (call.kind === 'layers') {
555
+ if (!Array.isArray(input) ||
556
+ input.some((value) => typeof value !== 'string'))
557
+ throw new Error('Layers require a literal string list.');
558
+ result.push({ kind: 'layers', names: input });
559
+ }
560
+ else if (call.kind === 'global') {
561
+ for (const [selector, child] of Object.entries(record(input)))
562
+ result.push({
563
+ kind: 'rule',
564
+ selector,
565
+ style: grouping(selector) ? global(child) : style(child),
566
+ });
567
+ }
568
+ else if (call.kind === 'fontFace') {
569
+ const declarations = record(input);
570
+ for (const key of Object.keys(declarations))
571
+ if (declarations[key] === undefined &&
572
+ key !== 'fontFamily' &&
573
+ key !== 'src')
574
+ delete declarations[key];
575
+ const keys = [
576
+ 'fontFeatureSettings',
577
+ 'fontVariationSettings',
578
+ 'fontFamily',
579
+ 'src',
580
+ 'fontDisplay',
581
+ 'fontStyle',
582
+ 'fontWeight',
583
+ 'fontStretch',
584
+ 'unicodeRange',
585
+ 'sizeAdjust',
586
+ 'ascentOverride',
587
+ 'descentOverride',
588
+ 'lineGapOverride',
589
+ ];
590
+ if (typeof declarations.fontFamily !== 'string' ||
591
+ typeof declarations.src !== 'string' ||
592
+ Object.entries(declarations).some(([key, value]) => !keys.includes(key) ||
593
+ (typeof value !== 'string' && typeof value !== 'number')))
594
+ throw new Error('Font faces require family/source and scalar supported descriptors.');
595
+ for (const [name, value] of Object.entries(declarations))
596
+ Descriptors.check({ rule: 'font-face', name, value: String(value) });
597
+ result.push({
598
+ kind: 'font-face',
599
+ declarations: declarations,
600
+ });
601
+ }
602
+ else if (call.kind === 'property') {
603
+ const options = record(input);
604
+ const names = typeof options.name === 'string'
605
+ ? Identifiers.list(options.name, 'space')
606
+ : undefined;
607
+ if (Object.keys(options).some((key) => !['name', 'syntax', 'inherits', 'initialValue'].includes(key)) ||
608
+ names?.length !== 1 ||
609
+ !names[0].startsWith('--') ||
610
+ names[0].length <= 2 ||
611
+ typeof options.syntax !== 'string' ||
612
+ typeof options.inherits !== 'boolean' ||
613
+ (options.initialValue !== undefined &&
614
+ typeof options.initialValue !== 'string' &&
615
+ typeof options.initialValue !== 'number'))
616
+ throw new Error('Expected a native property registration with scalar descriptors.');
617
+ if (options.initialValue !== undefined)
618
+ Properties.initial(String(options.initialValue));
619
+ result.push({
620
+ kind: 'property',
621
+ name: options.name,
622
+ syntax: options.syntax,
623
+ inherits: options.inherits,
624
+ ...(options.initialValue !== undefined
625
+ ? { initialValue: options.initialValue }
626
+ : {}),
627
+ });
628
+ }
629
+ else if (call.kind === 'page') {
630
+ const options = record(input);
631
+ if (Object.keys(options).some((key) => !['descriptors', 'selector'].includes(key)) ||
632
+ (options.selector !== undefined &&
633
+ typeof options.selector !== 'string'))
634
+ throw new Error('Expected page descriptors and an optional selector.');
635
+ const margins = [
636
+ 'top-left-corner',
637
+ 'top-left',
638
+ 'top-center',
639
+ 'top-right',
640
+ 'top-right-corner',
641
+ 'bottom-left-corner',
642
+ 'bottom-left',
643
+ 'bottom-center',
644
+ 'bottom-right',
645
+ 'bottom-right-corner',
646
+ 'left-top',
647
+ 'left-middle',
648
+ 'left-bottom',
649
+ 'right-top',
650
+ 'right-middle',
651
+ 'right-bottom',
652
+ ].map((name) => `@${name}`);
653
+ const properties = /^(?!border(?:Collapse|Spacing)$)(?:background|border|font|margin|padding|outline)/;
654
+ const names = [
655
+ 'color',
656
+ 'counterIncrement',
657
+ 'counterReset',
658
+ 'direction',
659
+ 'height',
660
+ 'letterSpacing',
661
+ 'lineHeight',
662
+ 'maxHeight',
663
+ 'maxWidth',
664
+ 'minHeight',
665
+ 'minWidth',
666
+ 'quotes',
667
+ 'textAlign',
668
+ 'textDecoration',
669
+ 'textIndent',
670
+ 'textTransform',
671
+ 'visibility',
672
+ 'whiteSpace',
673
+ 'width',
674
+ 'wordSpacing',
675
+ ];
676
+ function body(input, margin = false) {
677
+ return Object.entries(record(input)).flatMap(([key, value]) => {
678
+ if (value === undefined)
679
+ return [];
680
+ if (!margin && margins.includes(key))
681
+ return [
682
+ { kind: 'block', header: key, entries: body(value, true) },
683
+ ];
684
+ if (!margin &&
685
+ ['bleed', 'marks', 'pageOrientation', 'size'].includes(key)) {
686
+ if (typeof value !== 'string' && typeof value !== 'number')
687
+ throw new Error('Expected a scalar page descriptor.');
688
+ Descriptors.check({
689
+ rule: 'page',
690
+ name: key,
691
+ value: String(value),
692
+ });
693
+ return [
694
+ {
695
+ kind: 'descriptor',
696
+ name: key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`),
697
+ value,
698
+ },
699
+ ];
700
+ }
701
+ if (!properties.test(key) &&
702
+ !names.includes(key) &&
703
+ !(margin &&
704
+ [
705
+ 'content',
706
+ 'overflow',
707
+ 'unicodeBidi',
708
+ 'verticalAlign',
709
+ 'zIndex',
710
+ ].includes(key)))
711
+ throw new Error('Unsupported page or page-margin declaration.');
712
+ return [{ kind: 'style', style: style({ [key]: value }) }];
713
+ });
714
+ }
715
+ result.push({
716
+ kind: 'block',
717
+ header: Condition.normalize(`@page${options.selector ? ` ${options.selector}` : ''}`),
718
+ entries: body(options.descriptors),
719
+ });
720
+ }
721
+ else if (call.kind === 'fontFeatureValues') {
722
+ const options = record(input);
723
+ if (Object.keys(options).some((key) => !['families', 'features', 'fontDisplay'].includes(key)))
724
+ throw new Error('Unknown font-feature-values option.');
725
+ const families = options.families;
726
+ if (typeof families !== 'string' &&
727
+ (!Array.isArray(families) ||
728
+ !families.length ||
729
+ families.some((value) => typeof value !== 'string')))
730
+ throw new Error('Expected a font family list.');
731
+ const familyList = Array.isArray(families)
732
+ ? families
733
+ .map((value) => '"' +
734
+ Array.from(value, (char) => {
735
+ const code = char.codePointAt(0);
736
+ return code < 32 ||
737
+ code === 127 ||
738
+ char === '"' ||
739
+ char === '\\'
740
+ ? `\\${code.toString(16)} `
741
+ : char;
742
+ }).join('') +
743
+ '"')
744
+ .join(',')
745
+ : families;
746
+ // Validate the native prelude before shielding newer body descriptors.
747
+ Lightning.transform({
748
+ filename: 'font-feature-values.css',
749
+ code: new TextEncoder().encode(`@font-feature-values ${familyList} {}`),
750
+ });
751
+ const entries = [];
752
+ for (const key of Object.keys(options)) {
753
+ if (key === 'fontDisplay' && options.fontDisplay !== undefined) {
754
+ if (typeof options.fontDisplay !== 'string' ||
755
+ !['auto', 'block', 'fallback', 'optional', 'swap'].includes(Identifiers.list(options.fontDisplay, 'space')
756
+ ?.join(' ')
757
+ .replace(/[A-Z]/g, (letter) => letter.toLowerCase()) ?? ''))
758
+ throw new Error('Invalid font display descriptor.');
759
+ entries.push({
760
+ kind: 'descriptor',
761
+ name: 'font-display',
762
+ value: options.fontDisplay,
763
+ });
764
+ }
765
+ if (key !== 'features')
766
+ continue;
767
+ for (const [header, input] of Object.entries(record(options.features))) {
768
+ if (input === undefined)
769
+ continue;
770
+ if (![
771
+ '@annotation',
772
+ '@character-variant',
773
+ '@ornaments',
774
+ '@styleset',
775
+ '@stylistic',
776
+ '@swash',
777
+ ].includes(header))
778
+ throw new Error('Unknown font feature block.');
779
+ const declarations = Object.entries(record(input)).map(([name, value]) => {
780
+ const values = Array.isArray(value) ? value : [value];
781
+ const maximum = header === '@styleset'
782
+ ? Infinity
783
+ : header === '@character-variant'
784
+ ? 2
785
+ : 1;
786
+ if (!identifier(name) ||
787
+ !values.length ||
788
+ values.length > maximum ||
789
+ values.some((value) => typeof value !== 'number' ||
790
+ !Number.isSafeInteger(value) ||
791
+ value < 0))
792
+ throw new Error('Expected feature aliases with nonnegative integer indices.');
793
+ return { kind: 'descriptor', name, value: values.join(' ') };
794
+ });
795
+ entries.push({ kind: 'block', header, entries: declarations });
796
+ }
797
+ }
798
+ result.push({
799
+ kind: 'block',
800
+ header: `@font-feature-values ${familyList}`,
801
+ entries,
802
+ });
803
+ }
804
+ else if (call.kind === 'viewTransition') {
805
+ const entries = Object.entries(record(input)).flatMap(([key, value]) => {
806
+ if (value === undefined)
807
+ return [];
808
+ if ((key !== 'navigation' && key !== 'types') ||
809
+ typeof value !== 'string' ||
810
+ (key === 'navigation' &&
811
+ !['auto', 'none'].includes(Identifiers.list(value, 'space')?.join(' ').toLowerCase() ??
812
+ '')))
813
+ throw new Error('Expected navigation or types view-transition descriptors.');
814
+ if (key === 'types') {
815
+ const names = Identifiers.list(value, 'space');
816
+ if (!names ||
817
+ names.some((name) => [
818
+ 'default',
819
+ 'inherit',
820
+ 'initial',
821
+ 'revert',
822
+ 'revert-layer',
823
+ 'unset',
824
+ ].includes(name.toLowerCase()) ||
825
+ (name.toLowerCase() === 'none' && names.length !== 1)))
826
+ throw new Error('Expected none or a list of view-transition custom identifiers.');
827
+ }
828
+ Functions.value('*', String(value));
829
+ return [{ kind: 'descriptor', name: key, value }];
830
+ });
831
+ result.push({ kind: 'block', header: '@view-transition', entries });
832
+ }
833
+ else if (call.kind === 'positionTry') {
834
+ const declarations = record(input);
835
+ const keys = [
836
+ 'alignSelf',
837
+ 'blockSize',
838
+ 'bottom',
839
+ 'height',
840
+ 'inlineSize',
841
+ 'inset',
842
+ 'insetBlock',
843
+ 'insetBlockEnd',
844
+ 'insetBlockStart',
845
+ 'insetInline',
846
+ 'insetInlineEnd',
847
+ 'insetInlineStart',
848
+ 'justifySelf',
849
+ 'left',
850
+ 'margin',
851
+ 'marginBlock',
852
+ 'marginBlockEnd',
853
+ 'marginBlockStart',
854
+ 'marginBottom',
855
+ 'marginInline',
856
+ 'marginInlineEnd',
857
+ 'marginInlineStart',
858
+ 'marginLeft',
859
+ 'marginRight',
860
+ 'marginTop',
861
+ 'maxBlockSize',
862
+ 'maxHeight',
863
+ 'maxInlineSize',
864
+ 'maxWidth',
865
+ 'minBlockSize',
866
+ 'minHeight',
867
+ 'minInlineSize',
868
+ 'minWidth',
869
+ 'placeSelf',
870
+ 'positionAnchor',
871
+ 'positionArea',
872
+ 'right',
873
+ 'top',
874
+ 'width',
875
+ ];
876
+ if (Object.keys(declarations).some((key) => !keys.includes(key)))
877
+ throw new Error('Unsupported position-try declaration.');
878
+ const block = style(declarations);
879
+ if (block.rules || block.declarations.some((value) => value.important))
880
+ throw new Error('Position-try forbids nested rules and important declarations.');
881
+ result.push({
882
+ kind: 'rule',
883
+ selector: `@position-try ${call.name}`,
884
+ style: block,
885
+ });
886
+ }
887
+ else if (call.kind === 'colorProfile' ||
888
+ call.kind === 'counterStyle' ||
889
+ call.kind === 'fontPaletteValues') {
890
+ const descriptors = {
891
+ colorProfile: {
892
+ rule: 'color-profile',
893
+ keys: ['components', 'renderingIntent', 'src'],
894
+ required: ['src'],
895
+ },
896
+ counterStyle: {
897
+ rule: 'counter-style',
898
+ keys: [
899
+ 'additiveSymbols',
900
+ 'fallback',
901
+ 'negative',
902
+ 'pad',
903
+ 'prefix',
904
+ 'range',
905
+ 'speakAs',
906
+ 'suffix',
907
+ 'symbols',
908
+ 'system',
909
+ ],
910
+ required: [],
911
+ },
912
+ fontPaletteValues: {
913
+ rule: 'font-palette-values',
914
+ keys: ['basePalette', 'fontFamily', 'overrideColors'],
915
+ required: ['fontFamily'],
916
+ },
917
+ };
918
+ const definition = descriptors[call.kind];
919
+ const declarations = record(input);
920
+ for (const key of Object.keys(declarations))
921
+ if (declarations[key] === undefined)
922
+ delete declarations[key];
923
+ if (definition.required.some((key) => typeof declarations[key] !== 'string') ||
924
+ Object.entries(declarations).some(([key, value]) => !definition.keys.includes(key) ||
925
+ (typeof value !== 'string' &&
926
+ !(key === 'basePalette' &&
927
+ typeof value === 'number' &&
928
+ Number.isSafeInteger(value) &&
929
+ value >= 0))))
930
+ throw new Error('Expected supported scalar descriptors and required fields.');
931
+ if (call.kind === 'colorProfile') {
932
+ if (!Identifiers.url(declarations.src))
933
+ throw new Error('Color-profile src requires one URL.');
934
+ if (typeof declarations.components === 'string') {
935
+ const names = Identifiers.list(declarations.components, 'comma');
936
+ if (!names || names.some((name) => name.toLowerCase() === 'none'))
937
+ throw new Error('Color-profile components require comma-separated identifiers other than none.');
938
+ }
939
+ if (typeof declarations.renderingIntent === 'string') {
940
+ const names = Identifiers.list(declarations.renderingIntent, 'space');
941
+ if (names?.length !== 1 ||
942
+ ![
943
+ 'absolute-colorimetric',
944
+ 'relative-colorimetric',
945
+ 'perceptual',
946
+ 'saturation',
947
+ ].includes(names[0].toLowerCase()))
948
+ throw new Error('Invalid color-profile rendering intent.');
949
+ }
950
+ }
951
+ if (call.kind === 'counterStyle') {
952
+ const system = typeof declarations.system === 'string'
953
+ ? Lexical.normalize(declarations.system)
954
+ .trim()
955
+ .replace(/[A-Z]/g, (letter) => letter.toLowerCase())
956
+ : 'symbolic';
957
+ try {
958
+ Descriptors.check({
959
+ rule: 'counter-style',
960
+ name: 'system',
961
+ value: typeof declarations.system === 'string'
962
+ ? declarations.system
963
+ : 'symbolic',
964
+ });
965
+ }
966
+ catch {
967
+ throw new Error('Expected a supported counter system, with an integer after fixed.');
968
+ }
969
+ const required = system === 'additive'
970
+ ? 'additiveSymbols'
971
+ : system.startsWith('extends ')
972
+ ? undefined
973
+ : 'symbols';
974
+ if (required &&
975
+ (typeof declarations[required] !== 'string' ||
976
+ !declarations[required].trim()))
977
+ throw new Error('The counter system requires symbols or additiveSymbols.');
978
+ }
979
+ if (call.kind !== 'colorProfile')
980
+ for (const [name, value] of Object.entries(declarations))
981
+ Descriptors.check({
982
+ rule: definition.rule,
983
+ name,
984
+ value: String(value),
985
+ });
986
+ result.push({
987
+ kind: 'descriptor',
988
+ rule: definition.rule,
989
+ name: call.name,
990
+ declarations: declarations,
991
+ });
992
+ }
993
+ else {
994
+ const frames = Object.entries(record(input)).map(([stop, input]) => {
995
+ if (!Keyframes.accepts(stop))
996
+ throw new Error('Keyframe stops require from, to, 0–100% offsets, or named timeline percentages.');
997
+ const frame = style(input);
998
+ if (frame.rules ||
999
+ frame.declarations.some((value) => value.important))
1000
+ throw new Error('Keyframes forbid nested rules and important declarations.');
1001
+ return { stop, style: frame };
1002
+ });
1003
+ if (call.exported || scanned.used.has(call.name))
1004
+ result.push({ kind: 'keyframes', name: call.name, frames });
1005
+ }
1006
+ const contextValue = call.context ? value(call.context) : undefined;
1007
+ if (contextValue !== undefined) {
1008
+ const context = record(contextValue);
1009
+ if (Object.keys(context).some((key) => !['id', 'within'].includes(key)))
1010
+ throw new Error('Unknown contribution context option.');
1011
+ if (call.kind === 'customMedia' && 'within' in context)
1012
+ throw new Error('Custom media definitions do not accept a within context.');
1013
+ const within = context.within ?? [];
1014
+ if (!Array.isArray(within) ||
1015
+ within.some((header) => typeof header !== 'string' ||
1016
+ !(header === '@layer' ||
1017
+ /^@(media|supports|container|layer)(?=[\t\n\r\f (/])/.test(header))))
1018
+ throw new Error('Expected enclosing conditional or layer headers.');
1019
+ const headers = within.map((header) => Condition.normalize(header));
1020
+ for (let index = before; index < result.length; index++)
1021
+ result[index] = { ...result[index], within: headers };
1022
+ }
1023
+ for (let index = before; index < result.length; index++)
1024
+ starts?.push(call.start);
1025
+ }
1026
+ catch (error) {
1027
+ throw new Themes.InvalidError(error.message, call);
1028
+ }
1029
+ }
1030
+ for (const input of scanned.functionInputs)
1031
+ if (input.values.some((value, index) => {
1032
+ const syntax = input.signature.parameters[index]?.syntax ?? '*';
1033
+ if (value === undefined || !FunctionSyntax.integerOnly(syntax))
1034
+ return false;
1035
+ const text = value.trim();
1036
+ // List contents retain their existing CSS-text contract; this diagnostic checks scalar tokens.
1037
+ if ((syntax.includes('+') && /\s/.test(text)) ||
1038
+ (syntax.includes('#') && text.includes(',')))
1039
+ return false;
1040
+ if (!/^[+-]?(?:\d|\.\d)/.test(text) || /^[+-]?\d+$/.test(text))
1041
+ return false;
1042
+ const suffix = /^[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]?\d+)?(.+)$/.exec(text)?.[1];
1043
+ const unit = suffix === '%'
1044
+ ? suffix
1045
+ : suffix && Identifiers.read(suffix)?.toLowerCase();
1046
+ const normalized = syntax.trim();
1047
+ const body = normalized.startsWith('type(')
1048
+ ? normalized.slice(5, -1)
1049
+ : normalized;
1050
+ const alternatives = body.split('|').map((part) => part.trim());
1051
+ return (!unit ||
1052
+ !alternatives.some((alternative) => {
1053
+ if (alternative === '<percentage>')
1054
+ return unit === '%';
1055
+ if (alternative === '<length-percentage>' && unit === '%')
1056
+ return true;
1057
+ if (alternative === '<length>' ||
1058
+ alternative === '<length-percentage>')
1059
+ return Literal.lengthUnits.includes(unit);
1060
+ if (alternative === '<angle>')
1061
+ return ['deg', 'grad', 'rad', 'turn'].includes(unit);
1062
+ if (alternative === '<time>')
1063
+ return ['s', 'ms'].includes(unit);
1064
+ if (alternative === '<resolution>')
1065
+ return ['dpi', 'dpcm', 'dppx', 'x'].includes(unit);
1066
+ return false;
1067
+ }));
1068
+ }))
1069
+ throw new Themes.InvalidError('CSS integer parameters require integer tokens.', input.node);
1070
+ for (const input of scanned.functionInputs) {
1071
+ const required = input.signature.parameters.findLastIndex((parameter) => parameter.default === undefined) + 1;
1072
+ if (input.values.length < required ||
1073
+ input.values.length > input.signature.parameters.length)
1074
+ throw new Themes.InvalidError('CSS function arguments must match the declared parameter count.', input.node);
1075
+ for (const [index, value] of input.values.entries()) {
1076
+ if (value === undefined)
1077
+ continue;
1078
+ try {
1079
+ Functions.value(input.signature.parameters[index]?.syntax ?? '*', value);
1080
+ }
1081
+ catch (error) {
1082
+ throw new Themes.InvalidError(error.message, input.node);
1083
+ }
1084
+ }
1085
+ }
1086
+ return result;
1087
+ }
1088
+ function dashed(value) {
1089
+ const name = Identifiers.read(value);
1090
+ return name !== undefined && name.startsWith('--') && name.length > 2;
1091
+ }
1092
+ // CSS identifiers allow non-ASCII code points and escaped identifier characters.
1093
+ function identifier(value) {
1094
+ const escape = String.raw `\\(?:[\da-fA-F]{1,6}(?:\r\n|[ \t\n\r\f])?|[^\n\r\f\da-fA-F])`;
1095
+ const start = `(?:[_a-zA-Z\\u0080-\\u{10FFFF}]|${escape})`;
1096
+ const rest = `(?:[_a-zA-Z0-9-\\u0080-\\u{10FFFF}]|${escape})`;
1097
+ if (!new RegExp(`^(?:--|-?${start})${rest}*$`, 'u').test(value))
1098
+ return false;
1099
+ const decoded = value.replace(/\\([\da-fA-F]{1,6})(?:\r\n|[ \t\n\r\f])?|\\([^\n\r\f])/g, (_, hex, char) => hex ? String.fromCodePoint(Math.min(parseInt(hex, 16), 0x10ffff)) : char);
1100
+ return ![
1101
+ 'default',
1102
+ 'inherit',
1103
+ 'initial',
1104
+ 'revert',
1105
+ 'revert-layer',
1106
+ 'unset',
1107
+ ].includes(decoded.toLowerCase());
1108
+ }
1109
+ //# sourceMappingURL=Contributions.js.map