zyzz 0.0.0 → 0.0.3

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 (683) 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 +170 -0
  12. package/dist/Style.d.ts.map +1 -0
  13. package/dist/Style.js +325 -0
  14. package/dist/Style.js.map +1 -0
  15. package/dist/Theme.d.ts +157 -0
  16. package/dist/Theme.d.ts.map +1 -0
  17. package/dist/Theme.js +273 -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 +167 -0
  44. package/dist/compiler/Source.d.ts.map +1 -0
  45. package/dist/compiler/Source.js +1012 -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 +886 -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 +607 -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 +3225 -0
  188. package/dist/default.d.ts.map +1 -0
  189. package/dist/default.js +547 -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 +50 -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/Typography.d.ts +23 -0
  297. package/dist/internal/Typography.d.ts.map +1 -0
  298. package/dist/internal/Typography.js +18 -0
  299. package/dist/internal/Typography.js.map +1 -0
  300. package/dist/internal/Value.d.ts +74 -0
  301. package/dist/internal/Value.d.ts.map +1 -0
  302. package/dist/internal/Value.js +60 -0
  303. package/dist/internal/Value.js.map +1 -0
  304. package/dist/metro/Graph.d.ts +8 -0
  305. package/dist/metro/Graph.d.ts.map +1 -0
  306. package/dist/metro/Graph.js +63 -0
  307. package/dist/metro/Graph.js.map +1 -0
  308. package/dist/metro/Watch.d.ts +21 -0
  309. package/dist/metro/Watch.d.ts.map +1 -0
  310. package/dist/metro/Watch.js +51 -0
  311. package/dist/metro/Watch.js.map +1 -0
  312. package/dist/metro/index.d.ts +30 -0
  313. package/dist/metro/index.d.ts.map +1 -0
  314. package/dist/metro/index.js +52 -0
  315. package/dist/metro/index.js.map +1 -0
  316. package/dist/metro/transformer.d.ts +21 -0
  317. package/dist/metro/transformer.d.ts.map +1 -0
  318. package/dist/metro/transformer.js +71 -0
  319. package/dist/metro/transformer.js.map +1 -0
  320. package/dist/next/index.d.ts +18 -0
  321. package/dist/next/index.d.ts.map +1 -0
  322. package/dist/next/index.js +92 -0
  323. package/dist/next/index.js.map +1 -0
  324. package/dist/next/loader.d.ts +16 -0
  325. package/dist/next/loader.d.ts.map +1 -0
  326. package/dist/next/loader.js +282 -0
  327. package/dist/next/loader.js.map +1 -0
  328. package/dist/node/Host.d.ts +80 -0
  329. package/dist/node/Host.d.ts.map +1 -0
  330. package/dist/node/Host.js +882 -0
  331. package/dist/node/Host.js.map +1 -0
  332. package/dist/node/index.d.ts +7 -0
  333. package/dist/node/index.d.ts.map +1 -0
  334. package/dist/node/index.js +7 -0
  335. package/dist/node/index.js.map +1 -0
  336. package/dist/react-native/Host.d.ts +76 -0
  337. package/dist/react-native/Host.d.ts.map +1 -0
  338. package/dist/react-native/Host.js +209 -0
  339. package/dist/react-native/Host.js.map +1 -0
  340. package/dist/react-native/StyleSheet.d.ts +226 -0
  341. package/dist/react-native/StyleSheet.d.ts.map +1 -0
  342. package/dist/react-native/StyleSheet.js +606 -0
  343. package/dist/react-native/StyleSheet.js.map +1 -0
  344. package/dist/react-native/Variants.d.ts +38 -0
  345. package/dist/react-native/Variants.d.ts.map +1 -0
  346. package/dist/react-native/Variants.js +66 -0
  347. package/dist/react-native/Variants.js.map +1 -0
  348. package/dist/react-native/index.d.ts +8 -0
  349. package/dist/react-native/index.d.ts.map +1 -0
  350. package/dist/react-native/index.js +8 -0
  351. package/dist/react-native/index.js.map +1 -0
  352. package/dist/react-native/internal/Color.d.ts +7 -0
  353. package/dist/react-native/internal/Color.d.ts.map +1 -0
  354. package/dist/react-native/internal/Color.js +93 -0
  355. package/dist/react-native/internal/Color.js.map +1 -0
  356. package/dist/react-native/internal/NativeSchema.d.ts +5138 -0
  357. package/dist/react-native/internal/NativeSchema.d.ts.map +1 -0
  358. package/dist/react-native/internal/NativeSchema.js +3097 -0
  359. package/dist/react-native/internal/NativeSchema.js.map +1 -0
  360. package/dist/react-native/internal/Scalar.d.ts +95 -0
  361. package/dist/react-native/internal/Scalar.d.ts.map +1 -0
  362. package/dist/react-native/internal/Scalar.js +199 -0
  363. package/dist/react-native/internal/Scalar.js.map +1 -0
  364. package/dist/react-native/internal/Values.d.ts +5 -0
  365. package/dist/react-native/internal/Values.d.ts.map +1 -0
  366. package/dist/react-native/internal/Values.js +65 -0
  367. package/dist/react-native/internal/Values.js.map +1 -0
  368. package/dist/react-native/react.d.ts +22 -0
  369. package/dist/react-native/react.d.ts.map +1 -0
  370. package/dist/react-native/react.js +26 -0
  371. package/dist/react-native/react.js.map +1 -0
  372. package/dist/reset.css +244 -0
  373. package/dist/runtime/Appearance.d.ts +55 -0
  374. package/dist/runtime/Appearance.d.ts.map +1 -0
  375. package/dist/runtime/Appearance.js +84 -0
  376. package/dist/runtime/Appearance.js.map +1 -0
  377. package/dist/runtime/Composition.d.ts +46 -0
  378. package/dist/runtime/Composition.d.ts.map +1 -0
  379. package/dist/runtime/Composition.js +52 -0
  380. package/dist/runtime/Composition.js.map +1 -0
  381. package/dist/runtime/CompositionHtml.d.ts +15 -0
  382. package/dist/runtime/CompositionHtml.d.ts.map +1 -0
  383. package/dist/runtime/CompositionHtml.js +20 -0
  384. package/dist/runtime/CompositionHtml.js.map +1 -0
  385. package/dist/runtime/ConditionalRecipe.d.ts +30 -0
  386. package/dist/runtime/ConditionalRecipe.d.ts.map +1 -0
  387. package/dist/runtime/ConditionalRecipe.js +39 -0
  388. package/dist/runtime/ConditionalRecipe.js.map +1 -0
  389. package/dist/runtime/Dynamic.d.ts +19 -0
  390. package/dist/runtime/Dynamic.d.ts.map +1 -0
  391. package/dist/runtime/Dynamic.js +22 -0
  392. package/dist/runtime/Dynamic.js.map +1 -0
  393. package/dist/runtime/Html.d.ts +32 -0
  394. package/dist/runtime/Html.d.ts.map +1 -0
  395. package/dist/runtime/Html.js +63 -0
  396. package/dist/runtime/Html.js.map +1 -0
  397. package/dist/runtime/Native.d.ts +48 -0
  398. package/dist/runtime/Native.d.ts.map +1 -0
  399. package/dist/runtime/Native.js +78 -0
  400. package/dist/runtime/Native.js.map +1 -0
  401. package/dist/runtime/NativeContext.d.ts +17 -0
  402. package/dist/runtime/NativeContext.d.ts.map +1 -0
  403. package/dist/runtime/NativeContext.js +47 -0
  404. package/dist/runtime/NativeContext.js.map +1 -0
  405. package/dist/runtime/NativeDynamic.d.ts +47 -0
  406. package/dist/runtime/NativeDynamic.d.ts.map +1 -0
  407. package/dist/runtime/NativeDynamic.js +141 -0
  408. package/dist/runtime/NativeDynamic.js.map +1 -0
  409. package/dist/runtime/PayloadRecipe.d.ts +22 -0
  410. package/dist/runtime/PayloadRecipe.d.ts.map +1 -0
  411. package/dist/runtime/PayloadRecipe.js +59 -0
  412. package/dist/runtime/PayloadRecipe.js.map +1 -0
  413. package/dist/runtime/Props.d.ts +21 -0
  414. package/dist/runtime/Props.d.ts.map +1 -0
  415. package/dist/runtime/Props.js +17 -0
  416. package/dist/runtime/Props.js.map +1 -0
  417. package/dist/runtime/Recipe.d.ts +52 -0
  418. package/dist/runtime/Recipe.d.ts.map +1 -0
  419. package/dist/runtime/Recipe.js +30 -0
  420. package/dist/runtime/Recipe.js.map +1 -0
  421. package/dist/runtime/Selection.d.ts +31 -0
  422. package/dist/runtime/Selection.d.ts.map +1 -0
  423. package/dist/runtime/Selection.js +30 -0
  424. package/dist/runtime/Selection.js.map +1 -0
  425. package/dist/runtime/Variable.d.ts +6 -0
  426. package/dist/runtime/Variable.d.ts.map +1 -0
  427. package/dist/runtime/Variable.js +10 -0
  428. package/dist/runtime/Variable.js.map +1 -0
  429. package/dist/runtime/index.d.ts +33 -0
  430. package/dist/runtime/index.d.ts.map +1 -0
  431. package/dist/runtime/index.js +33 -0
  432. package/dist/runtime/index.js.map +1 -0
  433. package/dist/styleFunction.d.ts +72 -0
  434. package/dist/styleFunction.d.ts.map +1 -0
  435. package/dist/styleFunction.js +18 -0
  436. package/dist/styleFunction.js.map +1 -0
  437. package/dist/themes/LICENSE.tailwind +21 -0
  438. package/dist/variable.d.ts +50 -0
  439. package/dist/variable.d.ts.map +1 -0
  440. package/dist/variable.js +20 -0
  441. package/dist/variable.js.map +1 -0
  442. package/dist/variants.d.ts +84 -0
  443. package/dist/variants.d.ts.map +1 -0
  444. package/dist/variants.js +21 -0
  445. package/dist/variants.js.map +1 -0
  446. package/dist/vite/index.d.ts +24 -0
  447. package/dist/vite/index.d.ts.map +1 -0
  448. package/dist/vite/index.js +1089 -0
  449. package/dist/vite/index.js.map +1 -0
  450. package/dist/web/Css.d.ts +81 -0
  451. package/dist/web/Css.d.ts.map +1 -0
  452. package/dist/web/Css.js +593 -0
  453. package/dist/web/Css.js.map +1 -0
  454. package/dist/web/colorProfile.d.ts +28 -0
  455. package/dist/web/colorProfile.d.ts.map +1 -0
  456. package/dist/web/colorProfile.js +8 -0
  457. package/dist/web/colorProfile.js.map +1 -0
  458. package/dist/web/counterStyle.d.ts +48 -0
  459. package/dist/web/counterStyle.d.ts.map +1 -0
  460. package/dist/web/counterStyle.js +8 -0
  461. package/dist/web/counterStyle.js.map +1 -0
  462. package/dist/web/cssFunction.d.ts +80 -0
  463. package/dist/web/cssFunction.d.ts.map +1 -0
  464. package/dist/web/cssFunction.js +18 -0
  465. package/dist/web/cssFunction.js.map +1 -0
  466. package/dist/web/customMedia.d.ts +12 -0
  467. package/dist/web/customMedia.d.ts.map +1 -0
  468. package/dist/web/customMedia.js +7 -0
  469. package/dist/web/customMedia.js.map +1 -0
  470. package/dist/web/fontFace.d.ts +26 -0
  471. package/dist/web/fontFace.d.ts.map +1 -0
  472. package/dist/web/fontFace.js +7 -0
  473. package/dist/web/fontFace.js.map +1 -0
  474. package/dist/web/fontFeatureValues.d.ts +40 -0
  475. package/dist/web/fontFeatureValues.d.ts.map +1 -0
  476. package/dist/web/fontFeatureValues.js +7 -0
  477. package/dist/web/fontFeatureValues.js.map +1 -0
  478. package/dist/web/fontPaletteValues.d.ts +21 -0
  479. package/dist/web/fontPaletteValues.d.ts.map +1 -0
  480. package/dist/web/fontPaletteValues.js +9 -0
  481. package/dist/web/fontPaletteValues.js.map +1 -0
  482. package/dist/web/global.d.ts +19 -0
  483. package/dist/web/global.d.ts.map +1 -0
  484. package/dist/web/global.js +6 -0
  485. package/dist/web/global.js.map +1 -0
  486. package/dist/web/importCss.d.ts +18 -0
  487. package/dist/web/importCss.d.ts.map +1 -0
  488. package/dist/web/importCss.js +7 -0
  489. package/dist/web/importCss.js.map +1 -0
  490. package/dist/web/index.d.ts +22 -0
  491. package/dist/web/index.d.ts.map +1 -0
  492. package/dist/web/index.js +22 -0
  493. package/dist/web/index.js.map +1 -0
  494. package/dist/web/internal/Block.d.ts +18 -0
  495. package/dist/web/internal/Block.d.ts.map +1 -0
  496. package/dist/web/internal/Block.js +13 -0
  497. package/dist/web/internal/Block.js.map +1 -0
  498. package/dist/web/internal/ClassName.d.ts +19 -0
  499. package/dist/web/internal/ClassName.d.ts.map +1 -0
  500. package/dist/web/internal/ClassName.js +77 -0
  501. package/dist/web/internal/ClassName.js.map +1 -0
  502. package/dist/web/internal/Context.d.ts +11 -0
  503. package/dist/web/internal/Context.d.ts.map +1 -0
  504. package/dist/web/internal/Context.js +2 -0
  505. package/dist/web/internal/Context.js.map +1 -0
  506. package/dist/web/internal/Contributions.d.ts +70 -0
  507. package/dist/web/internal/Contributions.d.ts.map +1 -0
  508. package/dist/web/internal/Contributions.js +109 -0
  509. package/dist/web/internal/Contributions.js.map +1 -0
  510. package/dist/web/internal/Namespace.d.ts +13 -0
  511. package/dist/web/internal/Namespace.d.ts.map +1 -0
  512. package/dist/web/internal/Namespace.js +13 -0
  513. package/dist/web/internal/Namespace.js.map +1 -0
  514. package/dist/web/internal/Themes.d.ts +13 -0
  515. package/dist/web/internal/Themes.d.ts.map +1 -0
  516. package/dist/web/internal/Themes.js +96 -0
  517. package/dist/web/internal/Themes.js.map +1 -0
  518. package/dist/web/keyframes.d.ts +14 -0
  519. package/dist/web/keyframes.d.ts.map +1 -0
  520. package/dist/web/keyframes.js +8 -0
  521. package/dist/web/keyframes.js.map +1 -0
  522. package/dist/web/layers.d.ts +4 -0
  523. package/dist/web/layers.d.ts.map +1 -0
  524. package/dist/web/layers.js +7 -0
  525. package/dist/web/layers.js.map +1 -0
  526. package/dist/web/namespace.d.ts +14 -0
  527. package/dist/web/namespace.d.ts.map +1 -0
  528. package/dist/web/namespace.js +7 -0
  529. package/dist/web/namespace.js.map +1 -0
  530. package/dist/web/page.d.ts +38 -0
  531. package/dist/web/page.d.ts.map +1 -0
  532. package/dist/web/page.js +7 -0
  533. package/dist/web/page.js.map +1 -0
  534. package/dist/web/positionTry.d.ts +14 -0
  535. package/dist/web/positionTry.d.ts.map +1 -0
  536. package/dist/web/positionTry.js +9 -0
  537. package/dist/web/positionTry.js.map +1 -0
  538. package/dist/web/property.d.ts +24 -0
  539. package/dist/web/property.d.ts.map +1 -0
  540. package/dist/web/property.js +7 -0
  541. package/dist/web/property.js.map +1 -0
  542. package/dist/web/viewTransition.d.ts +29 -0
  543. package/dist/web/viewTransition.d.ts.map +1 -0
  544. package/dist/web/viewTransition.js +7 -0
  545. package/dist/web/viewTransition.js.map +1 -0
  546. package/package.json +136 -10
  547. package/src/Config.ts +691 -0
  548. package/src/Props.ts +8 -0
  549. package/src/Style.ts +812 -0
  550. package/src/Theme.ts +784 -0
  551. package/src/babel/NativeEdits.ts +273 -0
  552. package/src/babel/NativeJsx.ts +260 -0
  553. package/src/babel/index.ts +332 -0
  554. package/src/cli/index.ts +196 -0
  555. package/src/compiler/Graph.ts +1586 -0
  556. package/src/compiler/Native.ts +801 -0
  557. package/src/compiler/Source.ts +1579 -0
  558. package/src/compiler/Transform.ts +1241 -0
  559. package/src/compiler/index.ts +12 -0
  560. package/src/compiler/internal/Applications.ts +378 -0
  561. package/src/compiler/internal/AtRules.ts +202 -0
  562. package/src/compiler/internal/Catalogs.ts +114 -0
  563. package/src/compiler/internal/ColorProfiles.ts +93 -0
  564. package/src/compiler/internal/CompositionBindings.ts +120 -0
  565. package/src/compiler/internal/Compositions.ts +629 -0
  566. package/src/compiler/internal/Configurations.ts +244 -0
  567. package/src/compiler/internal/Contract.ts +860 -0
  568. package/src/compiler/internal/Contributions.ts +1507 -0
  569. package/src/compiler/internal/Descriptors.ts +238 -0
  570. package/src/compiler/internal/Dynamic.ts +266 -0
  571. package/src/compiler/internal/Edits.ts +13 -0
  572. package/src/compiler/internal/Expression.ts +135 -0
  573. package/src/compiler/internal/Functions.ts +206 -0
  574. package/src/compiler/internal/Identifiers.ts +124 -0
  575. package/src/compiler/internal/Keyframes.ts +62 -0
  576. package/src/compiler/internal/Namespaces.ts +296 -0
  577. package/src/compiler/internal/NativeBindings.ts +151 -0
  578. package/src/compiler/internal/PackedStyles.ts +464 -0
  579. package/src/compiler/internal/Properties.ts +121 -0
  580. package/src/compiler/internal/RecipeConditions.ts +139 -0
  581. package/src/compiler/internal/RecipePayloads.ts +132 -0
  582. package/src/compiler/internal/Recipes.ts +531 -0
  583. package/src/compiler/internal/Relative.ts +87 -0
  584. package/src/compiler/internal/Scope.ts +36 -0
  585. package/src/compiler/internal/Selectors.ts +334 -0
  586. package/src/compiler/internal/Static.ts +783 -0
  587. package/src/compiler/internal/Stylesheets.ts +361 -0
  588. package/src/compiler/internal/Syntax.ts +31 -0
  589. package/src/compiler/internal/Themes.ts +1794 -0
  590. package/src/compiler/internal/Variables.ts +497 -0
  591. package/src/compiler/internal/ViewTransitions.ts +82 -0
  592. package/src/cx.ts +98 -0
  593. package/src/default.ts +1177 -0
  594. package/src/index.ts +20 -0
  595. package/src/internal/Authoring.ts +199 -0
  596. package/src/internal/Binding.ts +187 -0
  597. package/src/internal/BindingDomains.ts +458 -0
  598. package/src/internal/Cascade.ts +165 -0
  599. package/src/internal/Compound.ts +522 -0
  600. package/src/internal/Condition.ts +283 -0
  601. package/src/internal/Corner.ts +17 -0
  602. package/src/internal/FunctionSyntax.ts +271 -0
  603. package/src/internal/FunctionValue.ts +96 -0
  604. package/src/internal/Geometry.ts +30 -0
  605. package/src/internal/Grid.ts +67 -0
  606. package/src/internal/Identifier.ts +14 -0
  607. package/src/internal/Identity.ts +89 -0
  608. package/src/internal/Lexical.ts +202 -0
  609. package/src/internal/Literal.ts +3820 -0
  610. package/src/internal/NativeProperties.ts +936 -0
  611. package/src/internal/Numeric.ts +77 -0
  612. package/src/internal/Query.ts +87 -0
  613. package/src/internal/Recipe.ts +17 -0
  614. package/src/internal/RuleReference.ts +102 -0
  615. package/src/internal/Scheme.ts +20 -0
  616. package/src/internal/Shorthands.ts +122 -0
  617. package/src/internal/Targets.ts +162 -0
  618. package/src/internal/Token.ts +380 -0
  619. package/src/internal/Tuple.ts +29 -0
  620. package/src/internal/Typography.ts +51 -0
  621. package/src/internal/Value.ts +320 -0
  622. package/src/metro/Graph.ts +78 -0
  623. package/src/metro/Watch.ts +88 -0
  624. package/src/metro/index.ts +99 -0
  625. package/src/metro/transformer.ts +97 -0
  626. package/src/next/index.ts +114 -0
  627. package/src/next/loader.ts +369 -0
  628. package/src/node/Host.ts +1204 -0
  629. package/src/node/index.ts +6 -0
  630. package/src/react-native/Host.ts +289 -0
  631. package/src/react-native/StyleSheet.ts +1084 -0
  632. package/src/react-native/Variants.ts +122 -0
  633. package/src/react-native/index.ts +7 -0
  634. package/src/react-native/internal/Color.ts +110 -0
  635. package/src/react-native/internal/NativeSchema.ts +3096 -0
  636. package/src/react-native/internal/Scalar.ts +253 -0
  637. package/src/react-native/internal/Values.ts +87 -0
  638. package/src/react-native/react.ts +47 -0
  639. package/src/reset.css +244 -0
  640. package/src/runtime/Appearance.ts +155 -0
  641. package/src/runtime/Composition.ts +87 -0
  642. package/src/runtime/CompositionHtml.ts +38 -0
  643. package/src/runtime/ConditionalRecipe.ts +70 -0
  644. package/src/runtime/Dynamic.ts +51 -0
  645. package/src/runtime/Html.ts +91 -0
  646. package/src/runtime/Native.ts +144 -0
  647. package/src/runtime/NativeContext.ts +74 -0
  648. package/src/runtime/NativeDynamic.ts +246 -0
  649. package/src/runtime/PayloadRecipe.ts +96 -0
  650. package/src/runtime/Props.ts +33 -0
  651. package/src/runtime/Recipe.ts +74 -0
  652. package/src/runtime/Selection.ts +82 -0
  653. package/src/runtime/Variable.ts +15 -0
  654. package/src/runtime/index.ts +45 -0
  655. package/src/styleFunction.ts +138 -0
  656. package/src/themes/LICENSE.tailwind +21 -0
  657. package/src/variable.ts +105 -0
  658. package/src/variants.ts +218 -0
  659. package/src/vite/index.ts +1473 -0
  660. package/src/web/Css.ts +801 -0
  661. package/src/web/colorProfile.ts +60 -0
  662. package/src/web/counterStyle.ts +82 -0
  663. package/src/web/cssFunction.ts +181 -0
  664. package/src/web/customMedia.ts +16 -0
  665. package/src/web/fontFace.ts +41 -0
  666. package/src/web/fontFeatureValues.ts +79 -0
  667. package/src/web/fontPaletteValues.ts +42 -0
  668. package/src/web/global.ts +39 -0
  669. package/src/web/importCss.ts +23 -0
  670. package/src/web/index.ts +22 -0
  671. package/src/web/internal/Block.ts +29 -0
  672. package/src/web/internal/ClassName.ts +112 -0
  673. package/src/web/internal/Context.ts +16 -0
  674. package/src/web/internal/Contributions.ts +219 -0
  675. package/src/web/internal/Namespace.ts +21 -0
  676. package/src/web/internal/Themes.ts +133 -0
  677. package/src/web/keyframes.ts +43 -0
  678. package/src/web/layers.ts +6 -0
  679. package/src/web/namespace.ts +19 -0
  680. package/src/web/page.ts +140 -0
  681. package/src/web/positionTry.ts +71 -0
  682. package/src/web/property.ts +35 -0
  683. package/src/web/viewTransition.ts +89 -0
@@ -0,0 +1,860 @@
1
+ /**
2
+ * Serializes validated theme authoring data for independently compiled libraries.
3
+ * @module
4
+ */
5
+ import type * as Binding from '../../internal/Binding.js'
6
+ import * as Config from '../../Config.js'
7
+ import * as Configurations from './Configurations.js'
8
+ import * as FunctionSyntax from '../../internal/FunctionSyntax.js'
9
+ import * as Identifiers from './Identifiers.js'
10
+ import * as PackedStyles from './PackedStyles.js'
11
+ import * as Shorthands from '../../internal/Shorthands.js'
12
+ import * as Stylesheets from './Stylesheets.js'
13
+ import * as Theme from '../../Theme.js'
14
+ import type * as Themes from './Themes.js'
15
+ import * as Token from '../../internal/Token.js'
16
+
17
+ /** Reads versioned JSON as validated data; never evaluates package code. */
18
+ export function read(
19
+ source: string,
20
+ identities: Map<string, Token.Contract>,
21
+ moduleId = '',
22
+ ) {
23
+ const data = record(JSON.parse(source))
24
+ if (
25
+ ![
26
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
27
+ 22, 23, 24,
28
+ ].includes(data.version as number)
29
+ )
30
+ throw new Error('Unsupported Zyzz contract version.')
31
+
32
+ // Root controls arrived with version 18; older readers must treat them as absent.
33
+ const rootControls = (data.version as number) >= 18
34
+ const legacyModes = new Map<string, 'atomic' | 'grouped'>()
35
+ if ((data.version as number) < 17) {
36
+ function collect(value: unknown) {
37
+ const entry = record(value)
38
+ if (entry.options !== undefined && entry.theme !== undefined) {
39
+ const options = record(entry.options)
40
+ if (options.cssOutput !== undefined) {
41
+ if (options.cssOutput !== 'atomic' && options.cssOutput !== 'grouped')
42
+ throw new Error('Invalid packed CSS output mode.')
43
+ const theme = record(record(data.themes)[string(entry.theme)])
44
+ const identity = string(theme.identity)
45
+ const previous = legacyModes.get(identity)
46
+ if (previous !== undefined && previous !== options.cssOutput)
47
+ throw new Error(
48
+ 'Conflicting packed CSS output modes for one theme identity.',
49
+ )
50
+ legacyModes.set(identity, options.cssOutput)
51
+ }
52
+ }
53
+ for (const member of Object.values(record(entry.members ?? {})))
54
+ collect(member)
55
+ }
56
+ for (const entry of Object.values(record(data.exports))) collect(entry)
57
+ }
58
+
59
+ const themes: Record<string, Theme.Definition> = Object.create(null)
60
+ const types: Record<string, string> = Object.create(null)
61
+
62
+ for (const [name, value] of Object.entries(record(data.themes))) {
63
+ const entry = record(value)
64
+ const identity = string(entry.identity)
65
+ if (
66
+ entry.cssOutput !== undefined &&
67
+ entry.cssOutput !== 'atomic' &&
68
+ entry.cssOutput !== 'grouped'
69
+ )
70
+ throw new Error('Invalid packed CSS output mode.')
71
+ const cssOutput = (entry.cssOutput ?? legacyModes.get(identity)) as
72
+ | 'atomic'
73
+ | 'grouped'
74
+ | undefined
75
+
76
+ const shorthands =
77
+ entry.shorthands !== undefined
78
+ ? Shorthands.read(entry.shorthands)
79
+ : undefined
80
+ let contract = identities.get(identity)
81
+ if (
82
+ contract &&
83
+ Shorthands.signature(contract.shorthands) !==
84
+ Shorthands.signature(shorthands)
85
+ )
86
+ throw new Error(
87
+ 'Conflicting packed shorthand mappings for one theme identity.',
88
+ )
89
+
90
+ if (
91
+ contract &&
92
+ (contract.cssOutput ?? 'atomic') !== (cssOutput ?? 'atomic')
93
+ )
94
+ throw new Error(
95
+ 'Conflicting packed CSS output modes for one theme identity.',
96
+ )
97
+
98
+ if (!contract) {
99
+ contract = Object.freeze({
100
+ ...(entry.shorthands !== undefined
101
+ ? { shorthands: Shorthands.read(entry.shorthands) }
102
+ : {}),
103
+ ...(cssOutput ? { cssOutput } : {}),
104
+ [Token.complete]: true,
105
+ [Token.identity]: identity,
106
+ })
107
+ identities.set(identity, contract)
108
+ }
109
+
110
+ const definition = Theme.define(record(entry.tokens) as Theme.Tokens)
111
+ if (
112
+ (data.version as number) < 24 &&
113
+ Object.hasOwn(definition.tokens, 'typography')
114
+ )
115
+ throw new Error(
116
+ 'Packed typography sets require contract version 24 or later.',
117
+ )
118
+
119
+ themes[name] = Token.bind(definition, contract)
120
+ types[name] = type(input(definition))
121
+ }
122
+
123
+ function link(value: unknown): Themes.Link {
124
+ const raw = record(value)
125
+ // Contracts before version 19 record style authoring exports as `css`.
126
+ const entry =
127
+ raw.kind === 'css' && (data.version as number) < 19
128
+ ? { ...raw, kind: 'style' }
129
+ : raw
130
+
131
+ if (entry.kind === 'variables') {
132
+ if ((data.version as number) < 14)
133
+ throw new Error(
134
+ 'Legacy variable contracts require recompilation with variable().',
135
+ )
136
+ const names = new Set<string>()
137
+
138
+ const slots = Object.fromEntries(
139
+ Object.entries(record(entry.variables)).map(([key, value]) => {
140
+ const slot = record(value)
141
+ if (
142
+ key === 'set' ||
143
+ key === '__proto__' ||
144
+ names.has(string(slot.name)) ||
145
+ !/^--z-v[a-z0-9-]+$/.test(string(slot.name)) ||
146
+ ![
147
+ '*',
148
+ 'color',
149
+ 'length',
150
+ 'number',
151
+ 'percentage',
152
+ 'signedLength',
153
+ 'signedPercentage',
154
+ ].includes(String(slot.type))
155
+ )
156
+ throw new Error('Invalid packed variable contract.')
157
+
158
+ names.add(string(slot.name))
159
+
160
+ return [
161
+ key,
162
+ Object.freeze({
163
+ name: slot.name as `--${string}`,
164
+ type: slot.type as Binding.Domain,
165
+ variable: true as const,
166
+ }),
167
+ ]
168
+ }),
169
+ )
170
+
171
+ const binding = string(entry.binding)
172
+
173
+ return {
174
+ binding,
175
+ kind: 'variables',
176
+ ...(entry.members
177
+ ? {
178
+ members: Object.fromEntries(
179
+ Object.entries(record(entry.members)).map(([name, value]) => [
180
+ name,
181
+ link(value),
182
+ ]),
183
+ ),
184
+ }
185
+ : {}),
186
+ definition: Theme.define({}),
187
+ call: {
188
+ start: -1,
189
+ end: -1,
190
+ name: binding,
191
+ tokenType: '{}',
192
+ variables: Object.freeze(slots),
193
+ ...(entry.source !== undefined
194
+ ? {
195
+ variableOwner: Stylesheets.resolve(
196
+ moduleId,
197
+ string(entry.source),
198
+ ),
199
+ }
200
+ : {}),
201
+ },
202
+ }
203
+ }
204
+ if (entry.kind === 'rule-reference') {
205
+ const name = string(entry.name)
206
+ const reference = string(entry.reference)
207
+ if (
208
+ ![
209
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
210
+ ].includes(data.version as number) ||
211
+ ![
212
+ 'cssFunction',
213
+ 'customMedia',
214
+ 'colorProfile',
215
+ 'counterStyle',
216
+ 'fontPaletteValues',
217
+ 'positionTry',
218
+ ].includes(reference) ||
219
+ !/^(?:--)?z-[a-z0-9-]+$/.test(name) ||
220
+ !name.startsWith(
221
+ `${reference === 'counterStyle' ? '' : '--'}z-${reference.toLowerCase()}`,
222
+ ) ||
223
+ entry.binding !== name
224
+ )
225
+ throw new Error('Invalid named stylesheet identity.')
226
+ return {
227
+ binding: string(entry.binding),
228
+ kind: 'rule-reference',
229
+ definition: Theme.define({}),
230
+ call: {
231
+ start: -1,
232
+ end: -1,
233
+ name,
234
+ tokenType: '{}',
235
+ reference: reference as NonNullable<Themes.Call['reference']>,
236
+ ...(reference === 'cssFunction'
237
+ ? { function: signature(entry.function, data.version as number) }
238
+ : {}),
239
+ },
240
+ }
241
+ }
242
+
243
+ if (entry.kind === 'animation') {
244
+ const name = string(entry.name)
245
+ if (!/^z-k[a-z0-9-]+$/.test(name))
246
+ throw new Error('Invalid animation identity.')
247
+
248
+ return {
249
+ binding: string(entry.binding),
250
+ kind: 'animation',
251
+ definition: Theme.define({}),
252
+ call: { start: -1, end: -1, name, tokenType: '{}' },
253
+ }
254
+ }
255
+
256
+ if (entry.kind === 'style-reference') {
257
+ if (
258
+ entry.style !== undefined &&
259
+ ![16, 17, 18, 19, 20, 21, 22, 23, 24].includes(data.version as number)
260
+ )
261
+ throw new Error(
262
+ 'Packed callable styles require contract version 16 or later.',
263
+ )
264
+ const binding = string(entry.binding)
265
+ if (!/^z-style-[a-z0-9_-]+$/.test(binding))
266
+ throw new Error('Invalid style reference identity.')
267
+ const members =
268
+ entry.members === undefined
269
+ ? undefined
270
+ : Object.fromEntries(
271
+ Object.entries(record(entry.members)).map(([key, value]) => {
272
+ const member = link(value)
273
+ if (
274
+ member.kind !== 'style-reference' ||
275
+ (member.members && (data.version as number) < 22)
276
+ )
277
+ throw new Error('Invalid style reference member.')
278
+ return [key, member]
279
+ }),
280
+ )
281
+ return {
282
+ binding,
283
+ call: {
284
+ start: -1,
285
+ end: -1,
286
+ name: members ? '' : binding,
287
+ tokenType: '{}',
288
+ },
289
+ definition: Theme.define({}),
290
+ kind: 'style-reference',
291
+ ...(entry.style === undefined
292
+ ? {}
293
+ : {
294
+ style: PackedStyles.read(
295
+ entry.style,
296
+ themes,
297
+ data.version as number,
298
+ ),
299
+ }),
300
+ ...(members ? { members } : {}),
301
+ }
302
+ }
303
+
304
+ if (entry.output !== undefined && entry.output !== 'html')
305
+ throw new Error('Invalid theme output.')
306
+
307
+ if (
308
+ entry.recipe !== undefined &&
309
+ (entry.recipe !== true ||
310
+ (data.version as number) < 15 ||
311
+ entry.kind !== 'style')
312
+ )
313
+ throw new Error('Invalid bound recipe contract.')
314
+
315
+ const theme = string(entry.theme)
316
+ const definition = themes[theme]
317
+ if (
318
+ !definition ||
319
+ !['config', 'style', 'theme'].includes(String(entry.kind))
320
+ )
321
+ throw new Error('Invalid Zyzz contract export.')
322
+
323
+ const members =
324
+ entry.kind === 'config'
325
+ ? Object.fromEntries(
326
+ Object.entries(record(entry.members)).map(([key, value]) => [
327
+ key,
328
+ link(value),
329
+ ]),
330
+ )
331
+ : undefined
332
+
333
+ const options =
334
+ entry.options === undefined ? undefined : record(entry.options)
335
+
336
+ if (options) {
337
+ Config.create(options as Config.create.Options)
338
+ if (
339
+ (data.version as number) >= 17 &&
340
+ (options.cssOutput ?? 'atomic') !==
341
+ (definition[Token.definition].contract.cssOutput ?? 'atomic')
342
+ )
343
+ throw new Error(
344
+ 'Configuration CSS output disagrees with linked theme metadata.',
345
+ )
346
+
347
+ if (
348
+ Shorthands.signature(options.shorthands) !==
349
+ Shorthands.signature(definition[Token.definition].contract.shorthands)
350
+ )
351
+ throw new Error(
352
+ 'Configuration mappings disagree with linked theme metadata.',
353
+ )
354
+ }
355
+
356
+ const catalogOnly =
357
+ !!options?.themes &&
358
+ ((data.version as number) < 4 || entry.catalogOnly === true)
359
+ const fullConfigType = options
360
+ ? `import('zyzz').Config.create.ReturnType<${Configurations.type(options)}>`
361
+ : ''
362
+ // Helpers a legacy library did not compile are hidden from its consumers' types.
363
+ const hidden = [
364
+ ...(rootControls && entry.appearance === true ? [] : ["'appearance'"]),
365
+ ...(entry.script === true ? [] : ["'script'"]),
366
+ ]
367
+ const configType = hidden.length
368
+ ? `{readonly [key in keyof ${fullConfigType} as key extends ${hidden.join(' | ')} ? never : key]:${fullConfigType}[key]}`
369
+ : fullConfigType
370
+ const outputType = catalogOnly
371
+ ? `({readonly [key in keyof ${configType} as key extends 'themes' ? never : key]:${configType}[key]} & {readonly themes:{readonly [key in keyof ${configType}['themes']]:${configType}['themes'][key]}})`
372
+ : configType
373
+ if (entry.kind === 'config' && !options)
374
+ throw new Error('Missing configuration options.')
375
+
376
+ return {
377
+ binding: string(entry.binding),
378
+ call: {
379
+ ...(entry.recipe === true ? { recipe: true } : {}),
380
+ ...(entry.output === 'html' ? { output: 'html' as const } : {}),
381
+ ...(catalogOnly ? { catalogOnly: true } : {}),
382
+ ...(entry.script === true ? { script: true } : {}),
383
+ ...(rootControls && entry.appearance === true
384
+ ? { appearance: true }
385
+ : {}),
386
+ ...(rootControls && entry.root === true ? { root: true } : {}),
387
+ end: -1,
388
+ name: theme,
389
+ start: -1,
390
+ tokenType: types[theme]!,
391
+ ...(definition[Token.definition].contract.shorthands ||
392
+ entry.output === 'html'
393
+ ? {
394
+ type: `import('zyzz').Config.create.ReturnType<{theme:${types[theme]!};${entry.output === 'html' ? "output:'html';" : ''}shorthands:${Configurations.type(definition[Token.definition].contract.shorthands ?? {})}}>['theme']`,
395
+ }
396
+ : {}),
397
+ ...(entry.selection === true ? { selection: true } : {}),
398
+ ...(entry.initialization === true ? { initialization: true } : {}),
399
+ ...(options
400
+ ? {
401
+ options,
402
+ type: `${outputType}${entry.initialization === true ? "['script']" : entry.root === true ? "['appearance']" : entry.selection === true ? "['themes']" : ''}`,
403
+ }
404
+ : {}),
405
+ ...(members
406
+ ? {
407
+ members: Object.fromEntries(
408
+ Object.entries(members).map(([key, member]) => [
409
+ key,
410
+ member.call.name,
411
+ ]),
412
+ ),
413
+ }
414
+ : {}),
415
+ },
416
+ definition,
417
+ kind: entry.kind as Themes.Link['kind'],
418
+ ...(members ? { members } : {}),
419
+ }
420
+ }
421
+
422
+ const links = Object.fromEntries(
423
+ Object.entries(record(data.exports)).map(([name, value]) => [
424
+ name,
425
+ link(value),
426
+ ]),
427
+ )
428
+
429
+ return { links, themes, stylesheets: Stylesheets.read(data.stylesheets) }
430
+ }
431
+
432
+ function record(value: unknown): Record<string, unknown> {
433
+ if (!value || typeof value !== 'object' || Array.isArray(value))
434
+ throw new Error('Expected a Zyzz contract record.')
435
+
436
+ return value as Record<string, unknown>
437
+ }
438
+
439
+ function string(value: unknown): string {
440
+ if (typeof value !== 'string' || !value)
441
+ throw new Error('Expected a nonempty Zyzz contract identity.')
442
+
443
+ return value
444
+ }
445
+
446
+ function input(theme: Theme.Definition) {
447
+ return { ...tokens(theme.tokens), ...theme[Token.definition].queries }
448
+ }
449
+
450
+ function tokens(tree: Theme.References<Theme.Tokens>): Record<string, unknown> {
451
+ return Object.fromEntries(
452
+ Object.entries(tree).map(([name, value]) => [
453
+ name,
454
+ Token.is(value)
455
+ ? value.value
456
+ : tokens(value as Theme.References<Theme.Tokens>),
457
+ ]),
458
+ )
459
+ }
460
+
461
+ function type(value: unknown): string {
462
+ if (Array.isArray(value)) return `readonly [${value.map(type).join(',')}]`
463
+ if (!value || typeof value !== 'object') return JSON.stringify(value)
464
+
465
+ return `{${Object.entries(value)
466
+ .map(([key, value]) => `readonly ${JSON.stringify(key)}:${type(value)}`)
467
+ .join(';')}}`
468
+ }
469
+
470
+ /** Emits compiler-only metadata without adding it to the runtime module. */
471
+ export function write(
472
+ links: Readonly<Record<string, Themes.Link>>,
473
+ themes: Readonly<Record<string, Theme.Definition>>,
474
+ stylesheets: readonly Stylesheets.Section[] = [],
475
+ moduleId = '',
476
+ configurations: readonly write.Configuration[] = [],
477
+ ): string {
478
+ function entry(link: Themes.Link): Record<string, unknown> {
479
+ if (link.kind === 'variables')
480
+ return {
481
+ binding: link.binding,
482
+ kind: link.kind,
483
+ variables: link.call.variables,
484
+ ...(link.members
485
+ ? {
486
+ members: Object.fromEntries(
487
+ Object.entries(link.members).map(([name, member]) => [
488
+ name,
489
+ entry(member),
490
+ ]),
491
+ ),
492
+ }
493
+ : {}),
494
+ ...(link.call.variableOwner
495
+ ? { source: Stylesheets.relative(moduleId, link.call.variableOwner) }
496
+ : {}),
497
+ }
498
+ if (link.kind === 'rule-reference')
499
+ return {
500
+ binding: link.binding,
501
+ kind: link.kind,
502
+ name: link.call.name,
503
+ reference: link.call.reference,
504
+ ...(link.call.function ? { function: link.call.function } : {}),
505
+ }
506
+
507
+ if (link.kind === 'animation')
508
+ return { binding: link.binding, kind: link.kind, name: link.call.name }
509
+
510
+ if (link.kind === 'style-reference')
511
+ return {
512
+ binding: link.binding,
513
+ kind: link.kind,
514
+ ...(link.style ? { style: PackedStyles.write(link.style) } : {}),
515
+ ...(link.members
516
+ ? {
517
+ members: Object.fromEntries(
518
+ Object.entries(link.members).map(([name, value]) => [
519
+ name,
520
+ entry(value),
521
+ ]),
522
+ ),
523
+ }
524
+ : {}),
525
+ }
526
+
527
+ return {
528
+ ...(link.call.recipe ? { recipe: true } : {}),
529
+ ...(link.call.output ? { output: link.call.output } : {}),
530
+ ...(link.call.script &&
531
+ (link.kind === 'config' || link.call.initialization)
532
+ ? { script: true }
533
+ : {}),
534
+ ...(link.call.appearance && (link.kind === 'config' || link.call.root)
535
+ ? { appearance: true }
536
+ : {}),
537
+ binding: link.binding,
538
+ kind: link.kind,
539
+ theme: link.call.name,
540
+ ...(link.call.catalogOnly ? { catalogOnly: true } : {}),
541
+ ...(link.call.selection ? { selection: true } : {}),
542
+ ...(link.call.initialization ? { initialization: true } : {}),
543
+ ...(link.call.root ? { root: true } : {}),
544
+ ...(link.call.options ? { options: link.call.options } : {}),
545
+ ...(link.members
546
+ ? {
547
+ members: Object.fromEntries(
548
+ Object.entries(link.members).map(([key, link]) => [
549
+ key,
550
+ entry(link),
551
+ ]),
552
+ ),
553
+ }
554
+ : {}),
555
+ }
556
+ }
557
+
558
+ return JSON.stringify({
559
+ ...(stylesheets.length
560
+ ? { stylesheets: Stylesheets.write(stylesheets) }
561
+ : {}),
562
+ // Local configurations publish their catalogs so documents restore
563
+ // selections for modules that export styles but not the configuration.
564
+ ...(configurations.length ? { configurations } : {}),
565
+ exports: Object.fromEntries(
566
+ Object.entries(links).map(([name, link]) => [name, entry(link)]),
567
+ ),
568
+ themes: Object.fromEntries(
569
+ Object.entries(themes).map(([name, theme]) => [
570
+ name,
571
+ {
572
+ ...(theme[Token.definition].contract.shorthands
573
+ ? { shorthands: theme[Token.definition].contract.shorthands }
574
+ : {}),
575
+ ...(theme[Token.definition].contract.cssOutput
576
+ ? { cssOutput: theme[Token.definition].contract.cssOutput }
577
+ : {}),
578
+ identity: theme[Token.definition].contract[Token.identity],
579
+ tokens: input(theme),
580
+ },
581
+ ]),
582
+ ),
583
+ version: (() => {
584
+ if (
585
+ Object.values(themes).some((theme) =>
586
+ Object.hasOwn(theme.tokens, 'typography'),
587
+ )
588
+ )
589
+ return 24
590
+
591
+ function callable(link: Themes.Link): boolean {
592
+ return !!link.style || Object.values(link.members ?? {}).some(callable)
593
+ }
594
+ function styled(link: Themes.Link): boolean {
595
+ return (
596
+ link.kind === 'style' ||
597
+ Object.values(link.members ?? {}).some(styled)
598
+ )
599
+ }
600
+ function branches(style: import('../../Style.js').NamedStyle): boolean {
601
+ return (
602
+ !!style.targets || !!style.rules?.some((rule) => branches(rule.style))
603
+ )
604
+ }
605
+ function targeted(link: Themes.Link): boolean {
606
+ return (
607
+ (link.style && branches(link.style.style)) ||
608
+ Object.values(link.members ?? {}).some(targeted)
609
+ )
610
+ }
611
+ function staticRecipe(link: Themes.Link): boolean {
612
+ return (
613
+ !!link.style?.staticRecipe ||
614
+ Object.values(link.members ?? {}).some(staticRecipe)
615
+ )
616
+ }
617
+ function nested(link: Themes.Link): boolean {
618
+ return Object.values(link.members ?? {}).some(
619
+ (member) =>
620
+ (link.kind === 'style-reference' && !!member.members) ||
621
+ nested(member),
622
+ )
623
+ }
624
+ function dynamic(link: Themes.Link): boolean {
625
+ return (
626
+ !!link.style?.dynamic ||
627
+ Object.values(link.members ?? {}).some(dynamic)
628
+ )
629
+ }
630
+ if (Object.values(links).some(dynamic)) return 23
631
+ if (Object.values(links).some(nested)) return 22
632
+ if (Object.values(links).some(staticRecipe)) return 21
633
+ if (Object.values(links).some(targeted)) return 20
634
+ // Style authoring exports serialize as `style`; older readers only know `css`.
635
+ if (Object.values(links).some(styled)) return 19
636
+ // Root controls call a runtime helper older releases lack, and older
637
+ // readers reject the storageKey option, so both require readers to opt in.
638
+ // Local configurations emit the same helper without an exported binding.
639
+ if (
640
+ configurations.length ||
641
+ Object.values(links).some(
642
+ (link) =>
643
+ (link.call.appearance &&
644
+ (link.kind === 'config' || link.call.root)) ||
645
+ link.call.options?.storageKey !== undefined,
646
+ )
647
+ )
648
+ return 18
649
+ if (
650
+ Object.values(links).some(callable) ||
651
+ Object.values(themes).some(
652
+ (theme) => theme[Token.definition].contract.cssOutput,
653
+ )
654
+ )
655
+ return 17
656
+ if (Object.values(links).some((link) => link.call.recipe)) return 15
657
+ if (Object.values(links).some((link) => link.kind === 'variables'))
658
+ return 14
659
+ if (Object.values(links).some((link) => link.kind === 'style-reference'))
660
+ return 13
661
+
662
+ if (
663
+ Object.values(links).some(
664
+ (link) => link.call.function && extended(link.call.function),
665
+ )
666
+ )
667
+ return 12
668
+
669
+ if (
670
+ stylesheets.some((section) => section.namespaces?.length) ||
671
+ Object.values(links).some(
672
+ (link) =>
673
+ link.call.function &&
674
+ [
675
+ link.call.function.returns,
676
+ ...link.call.function.parameters.map(
677
+ (parameter) => parameter.syntax ?? '*',
678
+ ),
679
+ ].some(
680
+ (syntax) =>
681
+ // Version 10 readers accepted this fixed scalar subset.
682
+ !(
683
+ [
684
+ '*',
685
+ '<angle>',
686
+ '<color>',
687
+ '<integer>',
688
+ '<length>',
689
+ '<length-percentage>',
690
+ '<number>',
691
+ '<percentage>',
692
+ '<time>',
693
+ ] as readonly string[]
694
+ ).includes(syntax),
695
+ ),
696
+ )
697
+ )
698
+ return 11
699
+
700
+ if (
701
+ Object.values(links).some(
702
+ (link) =>
703
+ link.call.reference === 'cssFunction' ||
704
+ link.call.reference === 'customMedia',
705
+ )
706
+ )
707
+ return 10
708
+
709
+ if (Object.values(links).some((link) => link.kind === 'rule-reference'))
710
+ return 9
711
+
712
+ if (Object.values(links).some((link) => link.kind === 'variables'))
713
+ return 8
714
+
715
+ if (
716
+ stylesheets.length ||
717
+ Object.values(links).some((link) => link.kind === 'animation')
718
+ )
719
+ return 7
720
+
721
+ if (
722
+ Object.values(themes).some(
723
+ (theme) =>
724
+ theme[Token.definition].contract.shorthands ||
725
+ Object.hasOwn(theme.tokens, 'margin') ||
726
+ Object.hasOwn(theme.tokens, 'padding'),
727
+ ) ||
728
+ Object.values(links).some(
729
+ (link) =>
730
+ link.call.output === 'html' ||
731
+ Object.values(link.members ?? {}).some(
732
+ (member) => member.call.output === 'html',
733
+ ),
734
+ )
735
+ )
736
+ return 5
737
+
738
+ if (
739
+ stylesheets.length ||
740
+ Object.values(links).some(
741
+ (link) =>
742
+ link.call.selection ||
743
+ (link.kind === 'config' && !!link.call.options?.themes) ||
744
+ link.call.initialization ||
745
+ (link.kind === 'config' && link.call.script) ||
746
+ link.kind === 'animation' ||
747
+ link.kind === 'variables',
748
+ )
749
+ )
750
+ return 4
751
+
752
+ if (
753
+ Object.values(themes).some(
754
+ (theme) =>
755
+ theme[Token.definition].queries ||
756
+ Object.keys(theme.tokens).some((group) =>
757
+ [
758
+ 'fontFamily',
759
+ 'fontSize',
760
+ 'fontWeight',
761
+ 'lineHeight',
762
+ 'letterSpacing',
763
+ ].includes(group),
764
+ ),
765
+ )
766
+ )
767
+ return 3
768
+
769
+ if (
770
+ Object.values(links).some(
771
+ (link) => link.kind === 'config' || link.call.type,
772
+ )
773
+ )
774
+ return 2
775
+
776
+ return 1
777
+ })(),
778
+ })
779
+ }
780
+
781
+ /** Contract writer contracts. */
782
+ export declare namespace write {
783
+ /** Catalog of one configuration call, published whether or not the call is exported. */
784
+ type Configuration = {
785
+ /** Configuration identity that prefixes every theme scope key. */
786
+ readonly identity: string
787
+ /** localStorage key the configuration's script and root controls share. */
788
+ readonly storageKey?: string | undefined
789
+ /** Named theme keys of the configuration's catalog. */
790
+ readonly themes: readonly string[]
791
+ }
792
+ }
793
+
794
+ function signature(
795
+ input: unknown,
796
+ version: number,
797
+ ): NonNullable<Themes.Call['function']> {
798
+ const value = record(input)
799
+ if (
800
+ !FunctionSyntax.accepts(string(value.returns)) ||
801
+ !Array.isArray(value.parameters)
802
+ )
803
+ throw new Error('Invalid packed CSS function signature.')
804
+ if (
805
+ version < 12 &&
806
+ (/[\\\u0080-\uffff]/.test(String(value.returns)) ||
807
+ value.parameters.some((input) => {
808
+ const parameter = record(input)
809
+ return /[\\\u0080-\uffff]/.test(
810
+ string(parameter.name) + string(parameter.syntax ?? '*'),
811
+ )
812
+ }))
813
+ )
814
+ throw new Error(
815
+ 'Extended CSS function signatures require contract version 12.',
816
+ )
817
+ const names = new Set<string>()
818
+ const parameters = value.parameters.map((input: unknown) => {
819
+ const parameter = record(input)
820
+ const name = string(parameter.name)
821
+ if (
822
+ !Identifiers.read(name)?.startsWith('--') ||
823
+ Identifiers.read(name) === '--' ||
824
+ names.has(Identifiers.read(name)!) ||
825
+ (parameter.syntax !== undefined &&
826
+ !FunctionSyntax.accepts(string(parameter.syntax))) ||
827
+ (parameter.default !== undefined &&
828
+ typeof parameter.default !== 'number' &&
829
+ typeof parameter.default !== 'string')
830
+ )
831
+ throw new Error('Invalid packed CSS function parameter.')
832
+ names.add(Identifiers.read(name)!)
833
+ return {
834
+ name: name as `--${string}`,
835
+ ...(parameter.syntax !== undefined
836
+ ? {
837
+ syntax: parameter.syntax as NonNullable<
838
+ Themes.Call['function']
839
+ >['returns'],
840
+ }
841
+ : {}),
842
+ ...(parameter.default !== undefined
843
+ ? { default: parameter.default as string | number }
844
+ : {}),
845
+ }
846
+ })
847
+ return {
848
+ parameters,
849
+ returns: value.returns as NonNullable<Themes.Call['function']>['returns'],
850
+ }
851
+ }
852
+
853
+ function extended(signature: NonNullable<Themes.Call['function']>): boolean {
854
+ return (
855
+ /[\\\u0080-\uffff]/.test(signature.returns) ||
856
+ signature.parameters.some((parameter) =>
857
+ /[\\\u0080-\uffff]/.test(parameter.name + (parameter.syntax ?? '*')),
858
+ )
859
+ )
860
+ }