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/Style.ts ADDED
@@ -0,0 +1,748 @@
1
+ /**
2
+ * Copies typed style declarations into immutable, ordered, target-independent data.
3
+ * @module
4
+ */
5
+ import * as Condition from './internal/Condition.js'
6
+ import * as Query from './internal/Query.js'
7
+ import * as Binding from './internal/Binding.js'
8
+ import type * as Literal from './internal/Literal.js'
9
+ import * as Token from './internal/Token.js'
10
+ import * as Value from './internal/Value.js'
11
+ import type * as Theme from './Theme.js'
12
+ import * as Targets from './internal/Targets.js'
13
+
14
+ /** Validates only authored keys, recursively retaining nested token inference. */
15
+ export type Accepted<
16
+ style,
17
+ tokens extends Theme.Tokens = {},
18
+ literal extends boolean = false,
19
+ targets extends boolean = true,
20
+ > = Record<
21
+ Exclude<
22
+ Keys<style>,
23
+ | keyof Literal.Properties
24
+ | Condition.Keys<tokens, Keys<style>>
25
+ | 'selectors'
26
+ | 'targets'
27
+ | 'variables'
28
+ >,
29
+ never
30
+ > &
31
+ (style extends unknown
32
+ ? {
33
+ [key in keyof style]: key extends 'targets'
34
+ ? targets extends true
35
+ ? AcceptedTargets<style[key], tokens, literal>
36
+ : never
37
+ : key extends 'selectors'
38
+ ? style[key] extends Record<string, unknown>
39
+ ? {
40
+ [selector in keyof style[key]]: style[key][selector] extends Record<
41
+ string,
42
+ unknown
43
+ >
44
+ ? Accepted<style[key][selector], tokens, literal, targets>
45
+ : never
46
+ }
47
+ : never
48
+ : key extends 'variables'
49
+ ? style[key] extends Record<string, unknown>
50
+ ? {
51
+ [name in keyof style[key]]: style[key][name] extends
52
+ | number
53
+ | string
54
+ ? Literal.Checked<style[key][name]>
55
+ : never
56
+ }
57
+ : never
58
+ : key extends keyof Literal.Properties
59
+ ? Value.Accepted<
60
+ Pick<style, key>,
61
+ literal extends true
62
+ ? LiteralDeclarations
63
+ : DeclarationProperties<tokens>
64
+ >[key] &
65
+ Value.Checked<Pick<style, key>, tokens>[key]
66
+ : key extends Condition.Keys<tokens, key>
67
+ ? [style[key]] extends [undefined]
68
+ ? never
69
+ : NonNullable<style[key]> extends Record<string, unknown>
70
+ ?
71
+ | Accepted<
72
+ NonNullable<style[key]>,
73
+ tokens,
74
+ literal,
75
+ targets
76
+ >
77
+ | Extract<style[key], undefined>
78
+ : never
79
+ : never
80
+ }
81
+ : never)
82
+
83
+ type AcceptedTargets<
84
+ input,
85
+ tokens extends Theme.Tokens,
86
+ literal extends boolean,
87
+ > = input extends undefined
88
+ ? undefined
89
+ : {
90
+ [key in keyof input]: key extends 'web'
91
+ ?
92
+ | Accepted<NonNullable<input[key]>, tokens, literal, false>
93
+ | Extract<input[key], undefined>
94
+ : key extends 'android' | 'ios' | 'native'
95
+ ? Targets.Declarations<input[key]>
96
+ : never
97
+ }
98
+
99
+ /** Explicit target declarations, applied after shared declarations. */
100
+ export type TargetBranches<tokens extends Theme.Tokens = {}> =
101
+ Targets.NativeBranches & {
102
+ /** Web declarations retain CSS semantics and conditions. */
103
+ readonly web?: Properties<tokens, false> | undefined
104
+ }
105
+
106
+ type Keys<value> = value extends unknown ? keyof value : never
107
+
108
+ type Exact<
109
+ styles extends Record<string, unknown>,
110
+ tokens extends Theme.Tokens,
111
+ > = {
112
+ [name in keyof styles]: Extract<
113
+ styles[name],
114
+ (...args: never[]) => unknown
115
+ > extends never
116
+ ? Properties<tokens> extends styles[name]
117
+ ? styles[name] extends Properties<tokens>
118
+ ? styles[name] &
119
+ Record<Exclude<Keys<styles[name]>, keyof Properties<tokens>>, never>
120
+ : never
121
+ : DeclarationProperties<tokens> extends styles[name]
122
+ ? styles[name] extends DeclarationProperties<tokens>
123
+ ? styles[name] &
124
+ Record<
125
+ Exclude<
126
+ Keys<styles[name]>,
127
+ keyof DeclarationProperties<tokens>
128
+ >,
129
+ never
130
+ >
131
+ : never
132
+ : Accepted<styles[name], tokens>
133
+ : never
134
+ }
135
+
136
+ const targetBranch = Symbol('zyzz.target.branch')
137
+ const nesting = Symbol('zyzz.style.nesting')
138
+
139
+ /** A typed declaration; order is significant for future cascade processing. */
140
+ export type Declaration = {
141
+ /** Whether this declaration overrides normal declarations in the cascade. */
142
+ readonly important?: boolean | undefined
143
+ /** Supported CSS property in camelCase. */
144
+ readonly property: keyof Literal.Properties
145
+ /** Validated primitive or immutable, domain-checked theme reference. */
146
+ readonly value:
147
+ | number
148
+ | string
149
+ | Token.Reference
150
+ | Token.Expression
151
+ | Binding.Reference
152
+ }
153
+
154
+ /**
155
+ * Copies named literal and token styles into deeply frozen ordered data.
156
+ * CSS values are checked by TypeScript only.
157
+ * Preserves names, values, and JavaScript own-property enumeration order. Never
158
+ * evaluates accessors, mutates input, generates CSS, or reads an environment.
159
+ * Empty maps and empty styles are valid. See the literal subset documentation.
160
+ * @param styles - Plain objects containing supported primitives or typed theme references.
161
+ * @param options - Optional theme for shorthand names and caller-owned diagnostic source spans.
162
+ * @returns Immutable definitions retaining the inferred style-name union.
163
+ * @throws {InvalidError} If the input structure cannot represent ordered declarations.
164
+ */
165
+ export function define<
166
+ const styles extends Record<string, unknown>,
167
+ const tokens extends Theme.Tokens,
168
+ >(
169
+ styles: styles &
170
+ NoInfer<Exact<styles, tokens>> & {
171
+ [key in keyof styles]: WithoutRelationships<styles[key]>
172
+ },
173
+ options: define.Options<tokens>,
174
+ ): Definition<
175
+ `${Extract<keyof styles, number | string>}`,
176
+ Targets.Domains<styles>
177
+ >
178
+ export function define<const styles extends Record<string, unknown>>(
179
+ styles: styles &
180
+ NoInfer<Exact<styles, {}>> & {
181
+ [key in keyof styles]: WithoutRelationships<styles[key]>
182
+ },
183
+ options?: define.Options,
184
+ ): Definition<
185
+ `${Extract<keyof styles, number | string>}`,
186
+ Targets.Domains<styles>
187
+ >
188
+ export function define(
189
+ styles: Record<string, unknown>,
190
+ options: define.Options = {},
191
+ ): Definition {
192
+ if ((options[nesting] ?? 0) > 128)
193
+ throw new InvalidError([
194
+ {
195
+ code: 'invalid_structure',
196
+ path: [],
197
+ message: 'Nested styles exceed the depth limit.',
198
+ },
199
+ ])
200
+
201
+ const diagnostics: Diagnostic[] = []
202
+ const output: NamedStyle[] = []
203
+ // One definition owns one theme; only validated references are reused within this call.
204
+ const references = new Map<
205
+ keyof Literal.Properties,
206
+ Map<string | number, Token.Reference>
207
+ >()
208
+
209
+ function report(
210
+ code: Diagnostic['code'],
211
+ path: readonly string[],
212
+ message: string,
213
+ ) {
214
+ const span = options.locations?.find(
215
+ (location) =>
216
+ location.path.length === path.length &&
217
+ location.path.every((part, i) => part === path[i]),
218
+ )
219
+
220
+ const location = span
221
+ ? Object.freeze({ ...span, path: Object.freeze([...span.path]) })
222
+ : undefined
223
+
224
+ diagnostics.push(
225
+ Object.freeze({
226
+ code,
227
+ message,
228
+ path: Object.freeze([...path]),
229
+ ...(location ? { location } : {}),
230
+ }),
231
+ )
232
+ }
233
+
234
+ function entries(
235
+ value: unknown,
236
+ path: readonly string[],
237
+ ): readonly (readonly [string, unknown])[] {
238
+ const prototype: object | null | undefined =
239
+ typeof value === 'object' && value !== null
240
+ ? Object.getPrototypeOf(value)
241
+ : undefined
242
+ // Compare the native Object constructor across realms without reading getters.
243
+ const constructor: unknown =
244
+ prototype &&
245
+ prototype !== Object.prototype &&
246
+ Object.getOwnPropertyDescriptor(prototype, 'constructor')?.value
247
+
248
+ if (
249
+ typeof value !== 'object' ||
250
+ value === null ||
251
+ (prototype !== null &&
252
+ prototype !== Object.prototype &&
253
+ (prototype === undefined ||
254
+ Object.getPrototypeOf(prototype) !== null ||
255
+ typeof constructor !== 'function' ||
256
+ Function.prototype.toString.call(constructor) !==
257
+ Function.prototype.toString.call(Object)))
258
+ ) {
259
+ report(
260
+ 'invalid_structure',
261
+ path,
262
+ 'Expected a plain object with enumerable data properties.',
263
+ )
264
+
265
+ return []
266
+ }
267
+
268
+ const result: [string, unknown][] = []
269
+
270
+ for (const key of Reflect.ownKeys(value)) {
271
+ const descriptor = Object.getOwnPropertyDescriptor(value, key)
272
+
273
+ if (
274
+ typeof key !== 'string' ||
275
+ !descriptor?.enumerable ||
276
+ !('value' in descriptor)
277
+ ) {
278
+ report(
279
+ 'invalid_structure',
280
+ typeof key === 'string' ? [...path, key] : path,
281
+ 'Only enumerable string-keyed data properties are supported; accessors and symbols are not evaluated.',
282
+ )
283
+ continue
284
+ }
285
+
286
+ result.push([key, descriptor.value])
287
+ }
288
+
289
+ return result
290
+ }
291
+
292
+ for (const [name, style] of entries(styles, [])) {
293
+ if (name.length === 0)
294
+ report('invalid_structure', [name], 'Style names must not be empty.')
295
+
296
+ const mappings = options.theme?.[Token.definition].contract.shorthands
297
+ const authored = entries(style, [name]).filter(
298
+ ([key, value]) => key !== 'targets' || value !== undefined,
299
+ )
300
+ const target = authored.find(([key]) => key === 'targets')
301
+ if (target) {
302
+ if (options[targetBranch]) {
303
+ report(
304
+ 'invalid_structure',
305
+ [name, 'targets'],
306
+ 'Target branches cannot contain nested target branches.',
307
+ )
308
+ continue
309
+ }
310
+ const targets: Record<string, unknown> = {}
311
+ try {
312
+ for (const [key, input] of entries(target[1], [name, 'targets'])) {
313
+ if (!['android', 'ios', 'native', 'web'].includes(key)) {
314
+ report(
315
+ 'invalid_structure',
316
+ [name, 'targets', key],
317
+ 'Unknown style target.',
318
+ )
319
+ continue
320
+ }
321
+ if (input === undefined) continue
322
+ if (key === 'web') {
323
+ try {
324
+ targets.web = define({ [name]: input } as never, {
325
+ ...options,
326
+ [nesting]: (options[nesting] ?? 0) + 1,
327
+ [targetBranch]: true,
328
+ }).styles[0]
329
+ } catch (error) {
330
+ if (!(error instanceof InvalidError)) throw error
331
+ for (const diagnostic of error.diagnostics)
332
+ report(
333
+ diagnostic.code,
334
+ [name, 'targets', 'web', ...diagnostic.path.slice(1)],
335
+ diagnostic.message,
336
+ )
337
+ }
338
+ } else {
339
+ entries(input, [name, 'targets', key])
340
+ targets[key] = Targets.copy(input, [name, 'targets', key])
341
+ }
342
+ }
343
+ const shared = define(
344
+ {
345
+ [name]: Object.fromEntries(
346
+ authored.filter(([key]) => key !== 'targets'),
347
+ ),
348
+ } as never,
349
+ { ...options, [nesting]: (options[nesting] ?? 0) + 1 },
350
+ ).styles[0]!
351
+ output.push(
352
+ Object.freeze({ ...shared, targets: Object.freeze(targets) }),
353
+ )
354
+ } catch (error) {
355
+ if (error instanceof InvalidError)
356
+ diagnostics.push(...error.diagnostics)
357
+ else
358
+ report(
359
+ 'invalid_structure',
360
+ [name, 'targets'],
361
+ (error as Error).message,
362
+ )
363
+ }
364
+ continue
365
+ }
366
+
367
+ const properties = authored.flatMap(([property, input]) =>
368
+ (mappings?.[property] ?? [property]).map(
369
+ (target) => [target, input, property] as const,
370
+ ),
371
+ )
372
+
373
+ if (properties.some(([key]) => Condition.is(key))) {
374
+ const rules: Rule[] = []
375
+
376
+ for (const [key, input] of authored) {
377
+ try {
378
+ const condition = Condition.is(key)
379
+ ? Query.resolve(
380
+ key,
381
+ options.theme?.[Token.definition].queries ?? {
382
+ breakpoints: {},
383
+ containers: {},
384
+ containerNames: [],
385
+ },
386
+ )
387
+ : undefined
388
+
389
+ if (condition !== undefined) Condition.normalize(condition)
390
+
391
+ const nested = (
392
+ define as (
393
+ styles: Record<string, unknown>,
394
+ options: define.Options,
395
+ ) => Definition
396
+ )(
397
+ { [name]: condition === undefined ? { [key]: input } : input },
398
+ {
399
+ ...options,
400
+ [nesting]: (options[nesting] ?? 0) + 1,
401
+ locations: options.locations
402
+ ?.filter(
403
+ (location) =>
404
+ condition === undefined || location.path[1] === key,
405
+ )
406
+ .map((location) =>
407
+ condition === undefined
408
+ ? location
409
+ : {
410
+ ...location,
411
+ path: location.path.filter((_, index) => index !== 1),
412
+ },
413
+ ),
414
+ },
415
+ )
416
+
417
+ rules.push(
418
+ Object.freeze({
419
+ ...(condition === undefined
420
+ ? {}
421
+ : {
422
+ condition: Condition.normalize(
423
+ condition.startsWith(':') && !Condition.nested(condition)
424
+ ? `&${condition}`
425
+ : condition,
426
+ ),
427
+ }),
428
+ style: nested.styles[0]!,
429
+ }),
430
+ )
431
+ } catch (error) {
432
+ if (error instanceof InvalidError)
433
+ diagnostics.push(
434
+ ...error.diagnostics.map((diagnostic) =>
435
+ Condition.is(key)
436
+ ? Object.freeze({
437
+ ...diagnostic,
438
+ path: Object.freeze([
439
+ name,
440
+ key,
441
+ ...diagnostic.path.slice(1),
442
+ ]),
443
+ ...(diagnostic.location
444
+ ? {
445
+ location: Object.freeze({
446
+ ...diagnostic.location,
447
+ path: Object.freeze([
448
+ name,
449
+ key,
450
+ ...diagnostic.location.path.slice(1),
451
+ ]),
452
+ }),
453
+ }
454
+ : {}),
455
+ })
456
+ : diagnostic,
457
+ ),
458
+ )
459
+ else
460
+ report('invalid_structure', [name, key], (error as Error).message)
461
+ }
462
+ }
463
+
464
+ output.push(
465
+ Object.freeze({
466
+ name,
467
+ declarations: Object.freeze([]),
468
+ rules: Object.freeze(rules),
469
+ }),
470
+ )
471
+ continue
472
+ }
473
+
474
+ const declarations: Declaration[] = []
475
+
476
+ for (const [property, input, authoredProperty] of properties) {
477
+ const key = property as keyof Literal.Properties
478
+ const inputs: unknown[] = []
479
+
480
+ if (Array.isArray(input)) {
481
+ if (!input.length) {
482
+ report(
483
+ 'invalid_value',
484
+ [name, authoredProperty],
485
+ 'Fallback arrays must be nonempty.',
486
+ )
487
+ continue
488
+ }
489
+
490
+ for (let index = 0; index < input.length; index++) {
491
+ const descriptor = Object.getOwnPropertyDescriptor(
492
+ input,
493
+ String(index),
494
+ )
495
+
496
+ if (!descriptor || !('value' in descriptor)) {
497
+ report(
498
+ 'invalid_structure',
499
+ [name, authoredProperty, String(index)],
500
+ 'Fallback arrays require dense data entries without accessors.',
501
+ )
502
+ continue
503
+ }
504
+
505
+ inputs.push(descriptor.value)
506
+ }
507
+
508
+ if (inputs.length !== input.length) continue
509
+ } else inputs.push(input)
510
+
511
+ for (const entry of inputs) {
512
+ if (
513
+ typeof entry === 'object' &&
514
+ entry !== null &&
515
+ Object.getOwnPropertyDescriptor(entry, 'variable')?.value === true &&
516
+ !Binding.is(entry)
517
+ ) {
518
+ report(
519
+ 'invalid_structure',
520
+ [name, authoredProperty],
521
+ 'Invalid compiler binding reference.',
522
+ )
523
+ continue
524
+ }
525
+
526
+ const parsed = Value.parse(entry, key)
527
+ if (parsed && 'invalid' in parsed) {
528
+ report(
529
+ 'invalid_value',
530
+ [name, authoredProperty],
531
+ 'Importance requires the suffix " !important".',
532
+ )
533
+ continue
534
+ }
535
+ const scalar = parsed ? parsed.value : entry
536
+
537
+ const resolved = (() => {
538
+ if (!options.theme) return scalar
539
+
540
+ if (typeof scalar !== 'string' && typeof scalar !== 'number')
541
+ return scalar
542
+
543
+ const cached = references.get(key)?.get(scalar)
544
+ if (cached) return cached
545
+
546
+ const resolved = Token.resolve(scalar, {
547
+ property: key,
548
+ theme: options.theme,
549
+ })
550
+
551
+ if (Token.is(resolved)) {
552
+ let values = references.get(key)
553
+
554
+ if (!values) references.set(key, (values = new Map()))
555
+
556
+ values.set(scalar, resolved)
557
+ }
558
+
559
+ return resolved
560
+ })()
561
+
562
+ const value = parsed && resolved === '0' ? 0 : resolved
563
+
564
+ declarations.push(
565
+ Object.freeze({
566
+ ...(parsed?.important ? { important: true } : {}),
567
+ property: key,
568
+ value: value as
569
+ | number
570
+ | string
571
+ | Token.Reference
572
+ | Token.Expression
573
+ | Binding.Reference,
574
+ }),
575
+ )
576
+ }
577
+ }
578
+
579
+ output.push(
580
+ Object.freeze({ declarations: Object.freeze(declarations), name }),
581
+ )
582
+ }
583
+
584
+ if (diagnostics.length) throw new InvalidError(diagnostics)
585
+
586
+ // Validated names are precisely the input's enumerable string keys.
587
+ return Object.freeze({
588
+ styles: Object.freeze(output),
589
+ })
590
+ }
591
+
592
+ /** Options for defining styles. */
593
+ export declare namespace define {
594
+ /** Source locations are optional; pure in-memory callers need no source text. */
595
+ type Options<tokens extends Theme.Tokens = never> = {
596
+ /** Internal recursion budget, propagated only by structured authoring. */
597
+ readonly [targetBranch]?: boolean | undefined
598
+ readonly [nesting]?: number | undefined
599
+ /** Caller-provided spans matched by complete diagnostic path. */
600
+ readonly locations?: readonly SourceLocation[] | undefined
601
+ } & ([tokens] extends [never]
602
+ ? {
603
+ /** Optional themes do not enable shorthand inference. */
604
+ readonly theme?: Theme.Definition | undefined
605
+ }
606
+ : {
607
+ /** Shorthand inference requires a defined token contract. */
608
+ readonly theme: Theme.Definition<tokens>
609
+ })
610
+ }
611
+
612
+ /** Immutable data passed from authoring to later target compilation. */
613
+ export type Definition<name extends string = string, input = unknown> = {
614
+ /** Type-only declarations used to retain native component compatibility. */
615
+ readonly [Targets.authored]?: input
616
+ /** Named styles in own enumerable property order. */
617
+ readonly styles: readonly NamedStyle<name>[]
618
+ }
619
+
620
+ /** A caller-visible validation failure at an exact input path. */
621
+ export type Diagnostic = {
622
+ /** Stable machine-readable category. */
623
+ readonly code: 'invalid_structure' | 'invalid_value'
624
+ /** Source span when a caller supplied an exact matching path. */
625
+ readonly location?: SourceLocation | undefined
626
+ /** Explanation of the supported input contract. */
627
+ readonly message: string
628
+ /** Path components, without ambiguous dot concatenation. */
629
+ readonly path: readonly string[]
630
+ }
631
+
632
+ /** Validation error containing all failures in deterministic input order. */
633
+ export class InvalidError extends Error {
634
+ /** Creates an error from caller-visible validation diagnostics. */
635
+ constructor(diagnostics: readonly Diagnostic[]) {
636
+ super(
637
+ diagnostics
638
+ .map((item) => `${JSON.stringify(item.path)}: ${item.message}`)
639
+ .join('\n'),
640
+ )
641
+ this.diagnostics = Object.freeze([...diagnostics])
642
+ }
643
+ /** Frozen diagnostics, ordered by style and declaration traversal. */
644
+ readonly diagnostics: readonly Diagnostic[]
645
+ /** Stable namespaced error identifier. */
646
+ override name = 'Style.InvalidError'
647
+ }
648
+
649
+ type LiteralAtoms = {
650
+ readonly [property in keyof Literal.Properties]-?: Value.Atom<
651
+ | Exclude<Literal.Properties[property], undefined>
652
+ | Binding.Reference<'*'>
653
+ | {
654
+ [kind in Binding.Kind]: property extends Binding.Property<
655
+ kind,
656
+ property
657
+ >
658
+ ? Binding.Reference<kind>
659
+ : never
660
+ }[Binding.Kind]
661
+ >
662
+ }
663
+
664
+ /** Supported primitive CSS declarations without theme references. */
665
+ export type LiteralDeclarations = {
666
+ readonly [property in keyof Literal.Properties]: Value.Fallbacks<
667
+ LiteralAtoms[property]
668
+ >
669
+ }
670
+
671
+ /** A named group of ordered declarations. */
672
+ export type NamedStyle<name extends string = string> = {
673
+ /** Compiler-owned web mode inherited from the defining configuration. */
674
+ readonly cssOutput?: 'atomic' | 'grouped' | undefined
675
+ /** Ordered nested blocks, when this style contains conditions. */
676
+ readonly rules?: readonly Rule[] | undefined
677
+ /** Declarations in own enumerable property order. */
678
+ readonly declarations: readonly Declaration[]
679
+ /** Authored style name, without generated target identifiers. */
680
+ readonly name: name
681
+ /** Target-neutral branches retained through source and packed compilation. */
682
+ readonly targets?:
683
+ | (Targets.NativeBranches & { readonly web?: NamedStyle | undefined })
684
+ | undefined
685
+ }
686
+
687
+ /** Supported literal and token declarations. Unknown properties and undefined values are rejected. */
688
+ export type DeclarationProperties<tokens extends Theme.Tokens = {}> = {
689
+ readonly [property in keyof Literal.Properties]: Value.Fallbacks<
690
+ | LiteralAtoms[property]
691
+ | Value.Atom<Token.Names<tokens, property>>
692
+ | {
693
+ [group in Token.Group]: property extends Token.Properties<group>
694
+ ? Token.Reference<group>
695
+ : never
696
+ }[Token.Group]
697
+ >
698
+ }
699
+
700
+ /** Recursive theme-aware declaration and condition authoring. */
701
+ export type Properties<
702
+ tokens extends Theme.Tokens = {},
703
+ targets extends boolean = true,
704
+ > = DeclarationProperties<tokens> & {
705
+ readonly [key in Condition.Keys<tokens>]?: Properties<tokens, targets>
706
+ } & {
707
+ readonly targets?:
708
+ | (targets extends true ? TargetBranches<tokens> : never)
709
+ | undefined
710
+ }
711
+
712
+ /** Nested literal declarations retain exact keys at every depth. */
713
+ export type LiteralProperties = LiteralDeclarations & {
714
+ readonly [key in Condition.Keys]?: LiteralProperties
715
+ }
716
+
717
+ /** Ordered nested blocks; an absent condition represents a declaration segment. */
718
+ export type Rule = {
719
+ /** Scoped selector or conditional at-rule; absent for a declaration segment. */
720
+ readonly condition?: string | undefined
721
+ /** Immutable nested declarations and ordered child rules. */
722
+ readonly style: NamedStyle
723
+ }
724
+
725
+ /** A source span optionally attached to a diagnostic by a caller. */
726
+ export type SourceLocation = {
727
+ /** Exclusive source offset. */
728
+ readonly end: number
729
+ /** Path from the style map root to the associated input. */
730
+ readonly path: readonly string[]
731
+ /** Caller-owned source identifier, independent of filesystem paths. */
732
+ readonly source: string
733
+ /** Inclusive source offset. */
734
+ readonly start: number
735
+ }
736
+
737
+ /** Core definitions exclude compiler-owned web relationship keys. */
738
+ type WithoutRelationships<value> = value extends readonly unknown[]
739
+ ? unknown
740
+ : value extends object
741
+ ? {
742
+ [key in keyof value]: key extends symbol | 'selectors' | 'variables'
743
+ ? never
744
+ : key extends keyof Literal.Properties
745
+ ? unknown
746
+ : WithoutRelationships<value[key]>
747
+ }
748
+ : unknown