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
package/src/Config.ts ADDED
@@ -0,0 +1,690 @@
1
+ /**
2
+ * Normalizes explicit configuration into isolated typed authoring contracts.
3
+ * @module
4
+ */
5
+ import * as Appearance from './runtime/Appearance.js'
6
+ import * as Authoring from './internal/Authoring.js'
7
+ import * as Html from './runtime/CompositionHtml.js'
8
+ import * as Identity from './internal/Identity.js'
9
+ import type * as Binding from './internal/Binding.js'
10
+ import type * as Condition from './internal/Condition.js'
11
+ import type * as Literal from './internal/Literal.js'
12
+ import type { style } from './styleFunction.js'
13
+ import { variants } from './variants.js'
14
+ import * as Scheme from './internal/Scheme.js'
15
+ import * as Shorthands from './internal/Shorthands.js'
16
+ import type * as Style from './Style.js'
17
+ import * as Theme from './Theme.js'
18
+ import * as Token from './internal/Token.js'
19
+
20
+ /** Creates token-free authoring without a configuration file or global state. */
21
+ export function create(): create.ReturnType<{}>
22
+ /**
23
+ * Binds inline or reusable themes to an isolated configuration contract.
24
+ * Named themes require an explicit default and identical token paths/domains.
25
+ * Bound helpers reference extracted CSS; this factory emits no CSS rules.
26
+ * @throws {InvalidError} If options, themes, defaults, or layer names are invalid.
27
+ */
28
+ export function create<const options extends create.Options>(
29
+ options: options & NoInfer<Validated<options>>,
30
+ ): create.ReturnType<options>
31
+ export function create(options: create.Options = {}): unknown {
32
+ const input = record(options)
33
+
34
+ for (const key of Object.keys(input))
35
+ if (
36
+ ![
37
+ 'cssOutput',
38
+ 'id',
39
+ 'defaultTheme',
40
+ 'layers',
41
+ 'output',
42
+ 'shorthands',
43
+ 'storageKey',
44
+ 'theme',
45
+ 'themes',
46
+ ].includes(key)
47
+ )
48
+ throw new InvalidError(`Unknown configuration option: ${key}`)
49
+
50
+ if (
51
+ input.storageKey !== undefined &&
52
+ (typeof input.storageKey !== 'string' || !input.storageKey)
53
+ )
54
+ throw new InvalidError('storageKey must be a nonempty string.')
55
+
56
+ // Validated above; the record type erases the literal narrowing.
57
+ const storageKey = input.storageKey as string | undefined
58
+
59
+ if (
60
+ input.output !== undefined &&
61
+ input.output !== 'html' &&
62
+ input.output !== 'react'
63
+ )
64
+ throw new InvalidError('output must be html or react.')
65
+
66
+ if (
67
+ input.cssOutput !== undefined &&
68
+ input.cssOutput !== 'atomic' &&
69
+ input.cssOutput !== 'grouped'
70
+ )
71
+ throw new InvalidError('cssOutput must be atomic or grouped.')
72
+
73
+ if (input.theme !== undefined && input.themes !== undefined)
74
+ throw new InvalidError('Use either theme or themes, not both.')
75
+
76
+ if (input.layers !== undefined) {
77
+ if (!Array.isArray(input.layers))
78
+ throw new InvalidError('layers must be an array.')
79
+
80
+ const seen = new Set<string>()
81
+
82
+ for (const layer of input.layers) {
83
+ if (
84
+ typeof layer !== 'string' ||
85
+ !/^(?:--|-?[_a-zA-Z])[\w-]*(?:\.(?:--|-?[_a-zA-Z])[\w-]*)*$/.test(
86
+ layer,
87
+ ) ||
88
+ layer
89
+ .split('.')
90
+ .some((part) =>
91
+ [
92
+ 'default',
93
+ 'inherit',
94
+ 'initial',
95
+ 'revert',
96
+ 'revert-layer',
97
+ 'unset',
98
+ ].includes(part.toLowerCase()),
99
+ )
100
+ )
101
+ throw new InvalidError(
102
+ 'Layer names must be plain CSS identifiers, optionally dotted.',
103
+ )
104
+
105
+ if (seen.has(layer)) throw new InvalidError(`Duplicate layer: ${layer}`)
106
+
107
+ seen.add(layer)
108
+ }
109
+ }
110
+
111
+ const shorthands = (() => {
112
+ if (input.shorthands === undefined) return undefined
113
+
114
+ try {
115
+ return Shorthands.read(input.shorthands)
116
+ } catch (error) {
117
+ throw new InvalidError((error as Error).message)
118
+ }
119
+ })()
120
+
121
+ const contract = Object.freeze({
122
+ cssOutput:
123
+ (input.cssOutput as 'atomic' | 'grouped' | undefined) ?? 'atomic',
124
+ ...(shorthands ? { shorthands } : {}),
125
+ ...(typeof input.id === 'string'
126
+ ? {
127
+ [Token.identity]: Identity.requireId(input.id, 'Config.create'),
128
+ [Token.complete]: true,
129
+ }
130
+ : {}),
131
+ })
132
+ function boundStyle(theme?: Theme.Definition) {
133
+ return (styles?: unknown, options: style.DefinitionOptions = {}) => {
134
+ if (
135
+ theme &&
136
+ Object.keys(theme[Token.definition].values).length &&
137
+ !contract[Token.identity]
138
+ )
139
+ Identity.requireId(undefined, 'Config.create')
140
+ return Authoring.create(styles, {
141
+ ...options,
142
+ theme,
143
+ output: input.output as style.Output | undefined,
144
+ })
145
+ }
146
+ }
147
+ function boundVariants(
148
+ definition: Record<string, unknown>,
149
+ options: style.DefinitionOptions = {},
150
+ ) {
151
+ return Authoring.variants(definition, {
152
+ ...options,
153
+ output: input.output as style.Output | undefined,
154
+ })
155
+ }
156
+ function handle(theme: Theme.Definition, name: string) {
157
+ const original = Token.bind(theme, contract)
158
+ const className = () =>
159
+ `z_theme-${Identity.requireId(typeof input.id === 'string' ? input.id : undefined, 'Config.create')}-${name.replace(/[^a-zA-Z0-9-]/g, (character) => `_${character.charCodeAt(0).toString(16)}_`)}`
160
+ const select = (options: { colorScheme?: string } = {}) => {
161
+ const scheme = options.colorScheme
162
+ const selection =
163
+ scheme !== undefined && Object.hasOwn(Scheme.classes, scheme)
164
+ ? ` ${Scheme.classes[scheme as Scheme.Name]}`
165
+ : ''
166
+ const result = {
167
+ className: `${className()}${selection}`,
168
+ ...(scheme ? { style: { colorScheme: scheme } } : {}),
169
+ }
170
+ return input.output === 'html' ? Html.from(result) : result
171
+ }
172
+ const descriptors = Object.getOwnPropertyDescriptors(original)
173
+ delete (descriptors as Record<string, unknown>).className
174
+ delete (descriptors as Record<string, unknown>).style
175
+ delete (descriptors as Record<string, unknown>).variants
176
+ Object.defineProperties(select, descriptors)
177
+ Object.defineProperty(select, 'className', {
178
+ get: className,
179
+ configurable: true,
180
+ })
181
+ Object.assign(select, {
182
+ style: boundStyle(original),
183
+ variants: boundVariants,
184
+ })
185
+ return select
186
+ }
187
+
188
+ if (input.themes !== undefined) {
189
+ const catalog = record(input.themes)
190
+ if (
191
+ typeof input.defaultTheme !== 'string' ||
192
+ !Object.hasOwn(catalog, input.defaultTheme)
193
+ )
194
+ throw new InvalidError('defaultTheme must name a theme in the catalog.')
195
+
196
+ const defaultTheme = input.defaultTheme
197
+ const definitions = Object.fromEntries(
198
+ Object.entries(catalog).map(([name, value]) => {
199
+ if (!name) throw new InvalidError('Theme names must be nonempty.')
200
+
201
+ return [name, definition(value)]
202
+ }),
203
+ )
204
+
205
+ const base = definitions[input.defaultTheme]!
206
+ const paths = Object.keys(base[Token.definition].values).sort()
207
+
208
+ function queries(theme: Theme.Definition) {
209
+ const data = theme[Token.definition].queries
210
+
211
+ return JSON.stringify({
212
+ breakpoints: Object.keys(data?.breakpoints ?? {}).sort(),
213
+ containers: Object.keys(data?.containers ?? {}).sort(),
214
+ containerNames: [...(data?.containerNames ?? [])].sort(),
215
+ })
216
+ }
217
+
218
+ for (const [name, value] of Object.entries(definitions)) {
219
+ const candidate = Object.keys(value[Token.definition].values).sort()
220
+ if (
221
+ queries(base) !== queries(value) ||
222
+ paths.length !== candidate.length ||
223
+ paths.some((path, index) => path !== candidate[index])
224
+ )
225
+ throw new InvalidError(
226
+ `Theme ${JSON.stringify(name)} must have the default theme's complete token paths and domains.`,
227
+ )
228
+ }
229
+
230
+ const bound = Object.fromEntries(
231
+ Object.entries(definitions).map(([name, value]) => [
232
+ name,
233
+ handle(value, name),
234
+ ]),
235
+ )
236
+
237
+ const select = (options: { theme: string; colorScheme?: string }) =>
238
+ (bound[options.theme] as (options: { colorScheme?: string }) => unknown)(
239
+ options,
240
+ )
241
+
242
+ Object.defineProperties(select, Object.getOwnPropertyDescriptors(bound))
243
+
244
+ const entries = () =>
245
+ Object.entries(bound).map(([name, value]): readonly [string, string] => [
246
+ name,
247
+ (value as unknown as Theme.Definition).className,
248
+ ])
249
+
250
+ // Class names require an identity, so the compiler's collection pass must
251
+ // not read them; root controls resolve their entries on first use.
252
+ const appearance = ((): Appearance.Root<string> => {
253
+ let root: Appearance.Root<string> | undefined
254
+ const resolve = () =>
255
+ (root ??= Appearance.root(entries(), { defaultTheme, storageKey }))
256
+
257
+ return {
258
+ get: () => resolve().get(),
259
+ set: (selection) => resolve().set(selection),
260
+ }
261
+ })()
262
+
263
+ return Object.freeze({
264
+ appearance,
265
+ script: () => Appearance.create(entries(), { storageKey })(),
266
+ style: boundStyle(
267
+ bound[input.defaultTheme] as unknown as Theme.Definition,
268
+ ),
269
+ theme: bound[input.defaultTheme],
270
+ themes: Object.freeze(select),
271
+ variants: boundVariants,
272
+ })
273
+ }
274
+
275
+ if (input.defaultTheme !== undefined)
276
+ throw new InvalidError('defaultTheme requires a named themes catalog.')
277
+
278
+ if (input.theme !== undefined) {
279
+ const theme = handle(definition(input.theme), 'theme')
280
+ return Object.freeze({
281
+ appearance: Appearance.root([], { storageKey }),
282
+ script: Appearance.create([], { storageKey }),
283
+ style: boundStyle(theme as unknown as Theme.Definition),
284
+ theme,
285
+ variants: boundVariants,
286
+ })
287
+ }
288
+
289
+ const theme = shorthands ? Token.bind(Theme.define({}), contract) : undefined
290
+ return Object.freeze({
291
+ appearance: Appearance.root([], { storageKey }),
292
+ script: Appearance.create([], { storageKey }),
293
+ style: boundStyle(theme),
294
+ variants: boundVariants,
295
+ })
296
+ }
297
+
298
+ /** Configuration inputs and inferred results. */
299
+ export declare namespace create {
300
+ /** Optional layer names and mutually exclusive theme modes. */
301
+ type Options = {
302
+ /** CSS representation inherited by bound helpers; atomic by default. */
303
+ readonly cssOutput?: 'atomic' | 'grouped' | undefined
304
+ /** Stable theme identity required without source rewriting. */
305
+ readonly id?: string | undefined
306
+ /** Explicit ordered property aliases; none are installed by default. */
307
+ readonly shorthands?: Shorthands.Map | undefined
308
+ /** Renderer props format; React is the default. */
309
+ readonly output?: style.Output | undefined
310
+ /** Ordered plain or dotted CSS layer names; emission follows source integration. */
311
+ readonly layers?: readonly string[] | undefined
312
+ /** localStorage key shared by `script()` and `appearance`; zyzz by default. */
313
+ readonly storageKey?: string | undefined
314
+ } & (
315
+ | {
316
+ /** Single inline or reusable theme. */ readonly theme: Input
317
+ /** Named mode is excluded. */ readonly themes?: never
318
+ /** Only named catalogs use defaults. */ readonly defaultTheme?: never
319
+ }
320
+ | {
321
+ /** Explicit catalog key. */ readonly defaultTheme: string
322
+ /** Single mode is excluded. */ readonly theme?: never
323
+ /** Complete named theme alternatives. */ readonly themes: Readonly<
324
+ Record<string, Input>
325
+ >
326
+ }
327
+ | {
328
+ /** Only named catalogs use defaults. */ readonly defaultTheme?: never
329
+ /** Omit themes for token-free authoring. */ readonly theme?: never
330
+ /** Omit themes for token-free authoring. */ readonly themes?: never
331
+ }
332
+ )
333
+
334
+ /** Bound authoring and the handles corresponding to the selected theme mode. */
335
+ type ReturnType<options extends Options = Options> = {
336
+ /** Reads and persists the root theme and scheme selection on the document element. */
337
+ readonly appearance: Appearance.Root<
338
+ options extends { themes: infer catalog } ? keyof catalog & string : never
339
+ >
340
+ /** Generates synchronous HTML-safe root preference restoration. */
341
+ readonly script: () => string
342
+ /** Inferred callable authoring; execution requires a source transform. */
343
+ readonly style: StyleFactory<
344
+ Tokens<options>,
345
+ options extends { layers: readonly (infer name extends string)[] }
346
+ ? name
347
+ : never,
348
+ options extends { output: infer output extends style.Output }
349
+ ? output
350
+ : 'react',
351
+ Mappings<options>
352
+ >
353
+ /** Theme-, layer-, and mapping-aware recipe authoring. */
354
+ readonly variants: variants.Bound<
355
+ Tokens<options>,
356
+ options extends { output: infer output extends style.Output }
357
+ ? output
358
+ : 'react',
359
+ options extends { layers: readonly (infer name extends string)[] }
360
+ ? name
361
+ : never,
362
+ Mappings<options>
363
+ >
364
+ } & (options extends { theme: infer input }
365
+ ? {
366
+ /** Isolated single-theme contract. */ readonly theme: Handle<
367
+ ExtractTokens<input>,
368
+ Mappings<options>,
369
+ options extends { output: infer output extends style.Output }
370
+ ? output
371
+ : 'react'
372
+ >
373
+ }
374
+ : options extends { themes: infer catalog }
375
+ ? {
376
+ /** Shared default token and variable contract. */ readonly theme: Handle<
377
+ Tokens<options>,
378
+ Mappings<options>,
379
+ options extends { output: infer output extends style.Output }
380
+ ? output
381
+ : 'react'
382
+ >
383
+ /** Selects a compiled named scope; catalog members retain compatibility. */ readonly themes: (<
384
+ const selection extends {
385
+ readonly colorScheme?: 'dark' | 'light' | 'light dark' | undefined
386
+ readonly theme: keyof catalog & string
387
+ },
388
+ >(
389
+ options: selection &
390
+ Record<Exclude<keyof selection, 'theme' | 'colorScheme'>, never>,
391
+ ) => style.Props<
392
+ options extends { output: infer output extends style.Output }
393
+ ? output
394
+ : 'react'
395
+ >) & {
396
+ readonly [name in keyof catalog]: Handle<
397
+ ExtractTokens<catalog[name]>,
398
+ Mappings<options>,
399
+ options extends { output: infer output extends style.Output }
400
+ ? output
401
+ : 'react'
402
+ >
403
+ }
404
+ }
405
+ : {})
406
+ }
407
+
408
+ type Mappings<options> = options extends {
409
+ shorthands: infer map extends Shorthands.Map
410
+ }
411
+ ? string extends keyof map
412
+ ? {}
413
+ : map
414
+ : {}
415
+
416
+ /** Theme handle retaining configured shorthands and renderer output in emitted declarations. */
417
+ export type Handle<
418
+ tokens extends Theme.Tokens,
419
+ mappings extends Shorthands.Map,
420
+ output extends style.Output,
421
+ > = Omit<Theme.Definition<tokens>, 'style' | 'variants'> & {
422
+ /** Style factory bound to this handle. */
423
+ readonly style: StyleFactory<tokens, never, output, mappings>
424
+ /** Variant factory bound to this handle. */
425
+ readonly variants: variants.Bound<tokens, output, never, mappings>
426
+ }
427
+
428
+ /** Configured style factory with a portable name for library declaration emission. */
429
+ export type StyleFactory<
430
+ tokens extends Theme.Tokens,
431
+ layers extends string,
432
+ output extends style.Output,
433
+ mappings extends Shorthands.Map,
434
+ > = {
435
+ (): style.ReturnType<output>
436
+ <
437
+ const values extends Record<string, string | number>,
438
+ const styles extends Record<string, unknown>,
439
+ const callback extends (...args: never[]) => unknown,
440
+ >(
441
+ styles: callback &
442
+ ((
443
+ values: values,
444
+ ) => styles &
445
+ NoInfer<
446
+ Body<styles, tokens, layers, mappings> & Binding.Checked<styles>
447
+ >) &
448
+ CompletionProperties<tokens, NoInfer<styles>>,
449
+ ...options: Parameters<callback> extends [Record<string, string | number>]
450
+ ? values extends Binding.Inputs<values>
451
+ ? [options?: style.DefinitionOptions]
452
+ : [invalid: never, unavailable: never]
453
+ : [invalid: never, unavailable: never]
454
+ ): style.Dynamic<values, output>
455
+ <const styles extends Record<string, unknown>>(
456
+ styles: styles &
457
+ NoInfer<Body<styles, tokens, layers, mappings>> &
458
+ CompletionProperties<tokens>,
459
+ options?: style.DefinitionOptions,
460
+ ): style.ReturnType<output>
461
+ }
462
+
463
+ type Keys<styles> = styles extends unknown ? keyof styles : never
464
+
465
+ /** Keeps completion hints separate from inferred declaration validation. */
466
+ type CompletionProperties<tokens, styles = Record<string, unknown>> = {
467
+ readonly [property in keyof Literal.Properties & keyof styles]?:
468
+ | (string extends Literal.Properties[property]
469
+ ? never
470
+ : Literal.Properties[property])
471
+ | Token.Names<tokens, property>
472
+ | (string & {})
473
+ | number
474
+ | object
475
+ }
476
+
477
+ /** Checked declaration body shared by configured styles and recipe choices. */
478
+ export type Body<
479
+ styles,
480
+ tokens extends Theme.Tokens,
481
+ layers extends string,
482
+ mappings extends Shorthands.Map,
483
+ targets extends boolean = true,
484
+ > = Record<
485
+ Exclude<
486
+ Keys<styles>,
487
+ | keyof mappings
488
+ | 'selectors'
489
+ | 'targets'
490
+ | 'variables'
491
+ | keyof Style.DeclarationProperties
492
+ | Exclude<Condition.Keys<tokens, Keys<styles>>, `@layer${string}`>
493
+ | '@layer'
494
+ | `@layer ${layers}`
495
+ >,
496
+ never
497
+ > &
498
+ (styles extends unknown
499
+ ? {
500
+ [key in keyof styles]: key extends 'targets'
501
+ ? targets extends false
502
+ ? never
503
+ : styles[key] extends undefined
504
+ ? undefined
505
+ : {
506
+ [target in keyof styles[key]]: target extends 'web'
507
+ ?
508
+ | Body<
509
+ NonNullable<styles[key][target]>,
510
+ tokens,
511
+ layers,
512
+ mappings,
513
+ false
514
+ >
515
+ | Extract<styles[key][target], undefined>
516
+ : Style.Accepted<
517
+ { targets: Pick<styles[key], target> },
518
+ tokens
519
+ >['targets'][target]
520
+ }
521
+ : key extends 'selectors'
522
+ ? styles[key] extends Record<string, unknown>
523
+ ? {
524
+ [selector in keyof styles[key]]: styles[key][selector] extends Record<
525
+ string,
526
+ unknown
527
+ >
528
+ ? Body<
529
+ styles[key][selector],
530
+ tokens,
531
+ layers,
532
+ mappings,
533
+ targets
534
+ >
535
+ : never
536
+ }
537
+ : never
538
+ : key extends
539
+ | Exclude<Condition.Keys<tokens, key>, `@layer${string}`>
540
+ | '@layer'
541
+ | `@layer ${layers}`
542
+ ? styles[key] extends Record<string, unknown>
543
+ ? Body<styles[key], tokens, layers, mappings, targets>
544
+ : never
545
+ : key extends keyof mappings
546
+ ? {
547
+ [target in mappings[key][number]]: styles[key] extends Style.Accepted<
548
+ Record<target, styles[key]>,
549
+ tokens
550
+ >[target] &
551
+ Binding.Checked<Record<target, styles[key]>>[target]
552
+ ? never
553
+ : target
554
+ }[mappings[key][number]] extends never
555
+ ? styles[key]
556
+ : never
557
+ : Style.Accepted<Pick<styles, key>, tokens>[key]
558
+ }
559
+ : never)
560
+
561
+ function definition(value: unknown): Theme.Definition {
562
+ try {
563
+ if (
564
+ value &&
565
+ typeof value === 'object' &&
566
+ Object.getOwnPropertyDescriptor(value, Token.definition)?.value
567
+ )
568
+ return value as Theme.Definition
569
+
570
+ return Theme.define(record(value) as Theme.Tokens)
571
+ } catch (error) {
572
+ if (error instanceof InvalidError) throw error
573
+
574
+ throw new InvalidError((error as Error).message)
575
+ }
576
+ }
577
+
578
+ type ExtractTokens<input> =
579
+ input extends Theme.Definition<infer tokens>
580
+ ? tokens
581
+ : input extends Theme.Tokens
582
+ ? input
583
+ : never
584
+
585
+ type Input = Theme.Definition | Theme.Tokens
586
+
587
+ /** Invalid options or incompatible named themes. */
588
+ export class InvalidError extends Error {
589
+ /** Creates a configuration diagnostic without generating styles. */
590
+ constructor(message: string) {
591
+ super(message)
592
+ }
593
+ /** Stable namespaced error identifier. */
594
+ override name = 'Config.InvalidError'
595
+ }
596
+
597
+ function record(value: unknown): Record<string, unknown> {
598
+ if (
599
+ !value ||
600
+ typeof value !== 'object' ||
601
+ Array.isArray(value) ||
602
+ ![null, Object.prototype].includes(Object.getPrototypeOf(value))
603
+ )
604
+ throw new InvalidError('Expected a plain configuration record.')
605
+
606
+ const result: Record<string, unknown> = Object.create(null)
607
+
608
+ for (const [key, descriptor] of Object.entries(
609
+ Object.getOwnPropertyDescriptors(value),
610
+ )) {
611
+ if (!('value' in descriptor))
612
+ throw new InvalidError('Configuration records cannot contain accessors.')
613
+
614
+ result[key] = descriptor.value
615
+ }
616
+
617
+ return result
618
+ }
619
+
620
+ type Tokens<options> = options extends { theme: infer input }
621
+ ? ExtractTokens<input>
622
+ : options extends { themes: infer catalog; defaultTheme: infer key }
623
+ ? key extends keyof catalog
624
+ ? ExtractTokens<catalog[key]>
625
+ : never
626
+ : {}
627
+
628
+ type ValidInput<input> = input extends Theme.Definition
629
+ ? input
630
+ : input extends Theme.Tokens
631
+ ? Parameters<typeof Theme.define<input>>[0]
632
+ : never
633
+
634
+ type Match<input, base> = base extends
635
+ | string
636
+ | number
637
+ | { light: string; dark: string }
638
+ ? input
639
+ : {
640
+ [key in keyof input | keyof base]: key extends keyof input
641
+ ? key extends keyof base
642
+ ? key extends 'containerNames'
643
+ ? input[key] extends readonly string[]
644
+ ? base[key] extends readonly string[]
645
+ ?
646
+ | Exclude<input[key][number], base[key][number]>
647
+ | Exclude<
648
+ base[key][number],
649
+ input[key][number]
650
+ > extends never
651
+ ? input[key]
652
+ : never
653
+ : never
654
+ : never
655
+ : Match<input[key], base[key]>
656
+ : never
657
+ : never
658
+ }
659
+
660
+ type Validated<options> = Record<
661
+ Exclude<keyof options, keyof create.Options>,
662
+ never
663
+ > &
664
+ (options extends { shorthands: infer mappings extends Shorthands.Map }
665
+ ? { shorthands: Shorthands.Validated<mappings> }
666
+ : {}) &
667
+ (options extends { theme: infer input }
668
+ ? { theme: ValidInput<input> }
669
+ : options extends { themes: infer catalog; defaultTheme: infer key }
670
+ ? {
671
+ defaultTheme: keyof catalog
672
+ themes: {
673
+ [name in keyof catalog]: ValidInput<catalog[name]> &
674
+ (key extends keyof catalog
675
+ ? catalog[name] extends Theme.Definition
676
+ ? Theme.Definition<
677
+ ExtractTokens<catalog[name]> &
678
+ Match<
679
+ ExtractTokens<catalog[name]>,
680
+ ExtractTokens<catalog[key]>
681
+ >
682
+ >
683
+ : Match<
684
+ ExtractTokens<catalog[name]>,
685
+ ExtractTokens<catalog[key]>
686
+ >
687
+ : never)
688
+ }
689
+ }
690
+ : {})
package/src/Props.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** Infers component inputs from callable style definitions. @module */
2
+
3
+ /**
4
+ * Extracts variant selections and styling overrides, excluding null and undefined.
5
+ * Preserves optional selections, conditions, and dynamic choice payloads.
6
+ */
7
+ export type Variants<definition extends (...args: never[]) => unknown> =
8
+ NonNullable<Parameters<definition>[0]>