@astryxdesign/cli 0.6.6 → 0.6.7-canary.7ec9564

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 (396) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +84 -82
  3. package/api/build/_adapter.d.mts +20 -0
  4. package/api/build/_adapter.mjs +24 -0
  5. package/api/build/build.doc.mjs +1 -1
  6. package/api/build/build.test.mjs +1 -1
  7. package/api/build/build.type.d.mts +12 -0
  8. package/api/build/build.type.mjs +3 -0
  9. package/api/build/help/help.mjs +1 -1
  10. package/api/build/kit/kit.mjs +13 -1
  11. package/api/component/_adapter.d.mts +19 -0
  12. package/api/component/_adapter.mjs +33 -0
  13. package/api/component/component-replacement.test.mjs +615 -0
  14. package/api/component/component.doc.mjs +5 -2
  15. package/api/component/component.mjs +49 -15
  16. package/api/component/component.test.mjs +32 -0
  17. package/api/component/component.type.d.mts +33 -3
  18. package/api/component/component.type.mjs +10 -3
  19. package/api/component/detail/blocks/blocks.d.mts +2 -1
  20. package/api/component/detail/blocks/blocks.mjs +5 -2
  21. package/api/component/detail/detail.mjs +5 -1
  22. package/api/component/detail/props/props.d.mts +2 -1
  23. package/api/component/detail/props/props.mjs +3 -2
  24. package/api/component/detail/showcase/showcase.d.mts +3 -1
  25. package/api/component/detail/showcase/showcase.mjs +3 -1
  26. package/api/component/detail/source/source.d.mts +3 -2
  27. package/api/component/detail/source/source.mjs +7 -3
  28. package/api/component/list/list.mjs +128 -10
  29. package/api/docs/_adapter.d.mts +11 -0
  30. package/api/docs/_adapter.mjs +73 -1
  31. package/api/docs/compiled-topics.test.mjs +1 -1
  32. package/api/docs/detail/detail.mjs +19 -3
  33. package/api/docs/detail/section/section.d.mts +44 -0
  34. package/api/docs/detail/section/section.mjs +171 -14
  35. package/api/docs/detail/section/section.test.mjs +4 -4
  36. package/api/docs/docOverlays.test.mjs +38 -23
  37. package/api/docs/docs.depth.test.mjs +2 -0
  38. package/api/docs/docs.doc.mjs +3 -3
  39. package/api/docs/docs.mjs +13 -16
  40. package/api/docs/docs.test.mjs +9 -10
  41. package/api/docs/docs.type.d.mts +43 -3
  42. package/api/docs/docs.type.mjs +23 -3
  43. package/api/docs/index/index.mjs +11 -2
  44. package/api/docs/index/index.test.mjs +7 -2
  45. package/api/docs/integration-tree.test.mjs +26 -26
  46. package/api/docs/integrationDocs.test.mjs +8 -7
  47. package/api/docs/namespace-section.test.mjs +260 -0
  48. package/api/docs/node/node.mjs +3 -0
  49. package/api/docs/token-tables.test.mjs +93 -0
  50. package/api/doctor/_adapter.d.mts +50 -0
  51. package/api/doctor/_adapter.mjs +190 -0
  52. package/api/doctor/doctor.d.mts +6 -10
  53. package/api/doctor/doctor.doc.mjs +1 -3
  54. package/api/doctor/doctor.mjs +144 -150
  55. package/api/doctor/doctor.test.mjs +104 -0
  56. package/api/doctor/theme-checks.d.mts +24 -0
  57. package/api/doctor/theme-checks.mjs +1231 -0
  58. package/api/doctor/theme-checks.test.mjs +667 -0
  59. package/api/gap-report/gap-report.doc.mjs +2 -1
  60. package/api/gap-report/gap-report.mjs +15 -1
  61. package/api/hook/_adapter.d.mts +1 -0
  62. package/api/hook/_adapter.mjs +3 -0
  63. package/api/hook/detail/detail.mjs +2 -2
  64. package/api/hook/detail/params/params.mjs +2 -2
  65. package/api/hook/hook.type.d.mts +12 -0
  66. package/api/hook/hook.type.mjs +3 -0
  67. package/api/hook/list/list.mjs +8 -8
  68. package/api/index.d.mts +1 -1
  69. package/api/index.mjs +4 -0
  70. package/api/init/run/run.d.mts +3 -5
  71. package/api/init/run/run.mjs +11 -11
  72. package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
  73. package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
  74. package/api/integration/add-helpers.d.mts +26 -5
  75. package/api/integration/add-helpers.mjs +50 -5
  76. package/api/integration/add-theme.mjs +16 -2
  77. package/api/integration/add-theme.test.mjs +66 -15
  78. package/api/integration/authoring-checks.mjs +21 -1
  79. package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
  80. package/api/integration/pack-check.component-replaces.test.mjs +126 -0
  81. package/api/integration/pack-check.d.mts +10 -0
  82. package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
  83. package/api/integration/pack-check.mjs +483 -1
  84. package/api/integration/pack-check.test.mjs +568 -8
  85. package/api/integration/validate-integration.mjs +20 -4
  86. package/api/integration/validate-integration.test.mjs +73 -0
  87. package/api/layout/check/check.d.mts +1 -0
  88. package/api/layout/check/check.mjs +1 -0
  89. package/api/layout/expand/expand.d.mts +1 -0
  90. package/api/layout/expand/expand.mjs +1 -0
  91. package/api/layout/grammar/grammar.d.mts +1 -0
  92. package/api/layout/grammar/grammar.mjs +1 -0
  93. package/api/layout/layoutCheck.doc.mjs +1 -1
  94. package/api/layout/layoutExpand.doc.mjs +1 -1
  95. package/api/layout/layoutGrammar.doc.mjs +1 -1
  96. package/api/search/search.d.mts +47 -3
  97. package/api/search/search.doc.mjs +1 -1
  98. package/api/search/search.domain-priority.test.mjs +261 -0
  99. package/api/search/search.mjs +247 -43
  100. package/api/search/search.test.mjs +5 -1
  101. package/api/search/search.type.d.mts +3 -3
  102. package/api/search/search.type.mjs +2 -2
  103. package/api/swizzle/_adapter.d.mts +10 -0
  104. package/api/swizzle/_adapter.mjs +23 -0
  105. package/api/swizzle/copy/copy.d.mts +5 -6
  106. package/api/swizzle/copy/copy.mjs +29 -10
  107. package/api/swizzle/list/list.mjs +2 -2
  108. package/api/swizzle/swizzle.doc.mjs +5 -2
  109. package/api/swizzle/swizzle.test.mjs +55 -5
  110. package/api/swizzle/swizzle.type.d.mts +8 -0
  111. package/api/swizzle/swizzle.type.mjs +2 -0
  112. package/api/template/copy/copy.mjs +14 -1
  113. package/api/template/show/show.mjs +2 -0
  114. package/api/template/skeleton/skeleton.mjs +2 -1
  115. package/api/template/template.d.mts +1 -1
  116. package/api/template/template.doc.mjs +1 -1
  117. package/api/template/template.mjs +1 -0
  118. package/api/template/template.type.d.mts +15 -0
  119. package/api/template/template.type.mjs +6 -0
  120. package/api/theme/_adapter.d.mts +106 -6
  121. package/api/theme/_adapter.mjs +687 -18
  122. package/api/theme/add/add.binary.test.mjs +76 -3
  123. package/api/theme/add/add.d.mts +5 -9
  124. package/api/theme/add/add.mjs +87 -64
  125. package/api/theme/add/add.rollback.test.mjs +9 -9
  126. package/api/theme/add/add.staging.test.mjs +9 -9
  127. package/api/theme/add/add.test.mjs +461 -55
  128. package/api/theme/add/add.types.test.mjs +151 -0
  129. package/api/theme/build/build.d.mts +96 -2
  130. package/api/theme/build/build.family.test.mjs +13 -4
  131. package/api/theme/build/build.mjs +286 -118
  132. package/api/theme/build/build.test.mjs +30 -0
  133. package/api/theme/build/font-warning.d.mts +11 -0
  134. package/api/theme/build/font-warning.mjs +28 -3
  135. package/api/theme/eject/eject.binary.test.mjs +90 -0
  136. package/api/theme/eject/eject.d.mts +17 -0
  137. package/api/theme/eject/eject.mjs +65 -0
  138. package/api/theme/eject/eject.rollback.test.mjs +158 -0
  139. package/api/theme/eject/eject.staging.test.mjs +83 -0
  140. package/api/theme/eject/eject.test.mjs +160 -0
  141. package/api/theme/integration-themes.test.mjs +30 -6
  142. package/api/theme/list/list.d.mts +10 -0
  143. package/api/theme/list/list.mjs +75 -7
  144. package/api/theme/list/list.test.mjs +155 -4
  145. package/api/theme/remove/remove.d.mts +12 -0
  146. package/api/theme/remove/remove.mjs +15 -0
  147. package/api/theme/remove/remove.test.mjs +94 -0
  148. package/api/theme/template/template.mjs +3 -4
  149. package/api/theme/theme.d.mts +5 -2
  150. package/api/theme/theme.mjs +13 -8
  151. package/api/theme/theme.type.d.mts +106 -2
  152. package/api/theme/theme.type.mjs +54 -5
  153. package/api/theme/themeAdd.doc.d.mts +1 -3
  154. package/api/theme/themeAdd.doc.mjs +35 -22
  155. package/api/theme/themeBuild.doc.mjs +1 -1
  156. package/api/theme/themeEject.doc.d.mts +8 -0
  157. package/api/theme/themeEject.doc.mjs +89 -0
  158. package/api/theme/themeListAvailable.doc.mjs +4 -4
  159. package/api/theme/themeListCopySources.doc.d.mts +8 -0
  160. package/api/theme/themeListCopySources.doc.mjs +60 -0
  161. package/api/theme/themeRemove.doc.d.mts +6 -0
  162. package/api/theme/themeRemove.doc.mjs +50 -0
  163. package/api/theme/themeTemplate.doc.mjs +4 -3
  164. package/api/theme/themeUse.doc.d.mts +6 -0
  165. package/api/theme/themeUse.doc.mjs +47 -0
  166. package/api/theme/use/use.d.mts +12 -0
  167. package/api/theme/use/use.mjs +15 -0
  168. package/api/theme/use/use.test.mjs +98 -0
  169. package/api/upgrade/_adapter.d.mts +1 -0
  170. package/api/upgrade/_adapter.mjs +3 -0
  171. package/api/upgrade/list/list.mjs +9 -3
  172. package/api/upgrade/upgrade.type.d.mts +4 -0
  173. package/api/upgrade/upgrade.type.mjs +1 -0
  174. package/assets/codemods/__tests__/registry.test.mjs +1 -0
  175. package/assets/codemods/integration-discovery.mjs +1 -1
  176. package/assets/codemods/integration-discovery.test.mjs +64 -0
  177. package/assets/codemods/registry.mjs +1 -0
  178. package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
  179. package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
  180. package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
  181. package/assets/docs/author-a-theme.doc.mjs +166 -0
  182. package/assets/docs/getting-started.doc.mjs +61 -17
  183. package/assets/docs/principles.doc.dense.mjs +4 -4
  184. package/assets/docs/principles.doc.mjs +6 -6
  185. package/assets/docs/principles.doc.zh.mjs +4 -4
  186. package/assets/docs/styling-overview.doc.mjs +211 -0
  187. package/assets/docs/theme.doc.dense.mjs +10 -198
  188. package/assets/docs/theme.doc.mjs +13 -771
  189. package/assets/docs/theme.doc.zh.mjs +31 -12
  190. package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
  191. package/assets/docs/tree/checks.doc.mjs +5 -4
  192. package/assets/docs/tree/component-migration.doc.mjs +107 -0
  193. package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
  194. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  195. package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
  196. package/assets/docs/tree/font-setup.doc.mjs +122 -0
  197. package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
  198. package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
  199. package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
  200. package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
  201. package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
  202. package/assets/docs/tree/internationalization.doc.mjs +29 -0
  203. package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
  204. package/assets/docs/tree/layout.doc.mjs +55 -0
  205. package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
  206. package/assets/docs/tree/migration-verification.doc.mjs +67 -0
  207. package/assets/docs/tree/migration.doc.mjs +28 -0
  208. package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
  209. package/assets/docs/tree/other-libraries.doc.mjs +218 -0
  210. package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
  211. package/assets/docs/tree/responsive.doc.mjs +98 -0
  212. package/assets/docs/tree/scaffold.doc.mjs +140 -0
  213. package/assets/docs/tree/side-panels.doc.mjs +81 -0
  214. package/assets/docs/tree/structure.doc.mjs +140 -0
  215. package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
  216. package/assets/docs/tree/styling-basics.doc.mjs +181 -0
  217. package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
  218. package/assets/docs/tree/styling.doc.mjs +29 -0
  219. package/assets/docs/tree/tailwind.doc.mjs +65 -0
  220. package/assets/docs/tree/themes.doc.mjs +2 -2
  221. package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
  222. package/assets/docs/tree/tokens-border.doc.mjs +46 -0
  223. package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
  224. package/assets/docs/tree/tokens-color.doc.mjs +438 -0
  225. package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
  226. package/assets/docs/tree/tokens-data.doc.mjs +323 -0
  227. package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
  228. package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
  229. package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
  230. package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
  231. package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
  232. package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
  233. package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
  234. package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
  235. package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
  236. package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
  237. package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
  238. package/assets/docs/tree/tokens-size.doc.mjs +54 -0
  239. package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
  240. package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
  241. package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
  242. package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
  243. package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
  244. package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
  245. package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
  246. package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
  247. package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
  248. package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
  249. package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
  250. package/assets/docs/tree/tokens.doc.mjs +28 -0
  251. package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
  252. package/assets/docs/tree/type-scale.doc.mjs +147 -0
  253. package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
  254. package/assets/docs/tree/typography.doc.mjs +29 -0
  255. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
  256. package/assets/docs/tree/versioning.doc.mjs +4 -1
  257. package/assets/docs/use-a-theme.doc.mjs +212 -0
  258. package/assets/templates/pages/incident-console/page.tsx +1 -1
  259. package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
  260. package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
  261. package/assets/templates/pages/table-comparison/page.tsx +1449 -0
  262. package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
  263. package/assets/theme.template.ts +4 -3
  264. package/authoring/doctypes/command/command.doc.mjs +5 -0
  265. package/authoring/doctypes/command/type.ts +2 -0
  266. package/authoring/doctypes/component/component.doc.mjs +1 -1
  267. package/authoring/doctypes/component/type.ts +8 -4
  268. package/authoring/doctypes/template/type.ts +1 -0
  269. package/authoring/integration/integration.doc.mjs +1 -1
  270. package/clients/cli/commands/blog.mjs +3 -3
  271. package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
  272. package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
  273. package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
  274. package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
  275. package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
  276. package/clients/cli/commands/build-theme.mjs +338 -45
  277. package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
  278. package/clients/cli/commands/build.mjs +8 -6
  279. package/clients/cli/commands/build.text-fields.test.mjs +1 -1
  280. package/clients/cli/commands/component/index.mjs +91 -12
  281. package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
  282. package/clients/cli/commands/component.doc.mjs +9 -2
  283. package/clients/cli/commands/docs.doc.mjs +2 -1
  284. package/clients/cli/commands/docs.mjs +63 -23
  285. package/clients/cli/commands/docs.test.mjs +17 -15
  286. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  287. package/clients/cli/commands/doctor.doc.mjs +1 -1
  288. package/clients/cli/commands/doctor.test.mjs +59 -52
  289. package/clients/cli/commands/gap-report.doc.mjs +2 -2
  290. package/clients/cli/commands/hook/index.mjs +7 -2
  291. package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
  292. package/clients/cli/commands/init.next-steps.test.mjs +18 -23
  293. package/clients/cli/commands/integration-real-world.test.mjs +61 -12
  294. package/clients/cli/commands/layout-check.doc.mjs +2 -0
  295. package/clients/cli/commands/layout-expand.doc.mjs +2 -0
  296. package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
  297. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
  298. package/clients/cli/commands/layout.doc.mjs +2 -0
  299. package/clients/cli/commands/layout.mjs +40 -4
  300. package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
  301. package/clients/cli/commands/search.test.mjs +10 -4
  302. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  303. package/clients/cli/commands/swizzle.mjs +2 -1
  304. package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
  305. package/clients/cli/commands/template.mjs +56 -5
  306. package/clients/cli/commands/text-json-parity.test.mjs +40 -0
  307. package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
  308. package/clients/cli/commands/theme-add.doc.mjs +19 -19
  309. package/clients/cli/commands/theme-build.doc.mjs +3 -1
  310. package/clients/cli/commands/theme-eject.doc.mjs +47 -0
  311. package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
  312. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  313. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
  314. package/clients/cli/commands/theme-remove.doc.mjs +22 -0
  315. package/clients/cli/commands/theme-template.doc.mjs +4 -3
  316. package/clients/cli/commands/theme-use.doc.mjs +22 -0
  317. package/clients/cli/commands/theme.doc.mjs +21 -16
  318. package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
  319. package/clients/cli/commands/upgrade.mjs +1 -1
  320. package/clients/cli/index.mjs +5 -2
  321. package/clients/cli/lib/component-format.mjs +29 -2
  322. package/clients/cli/lib/component-format.test.mjs +1 -1
  323. package/clients/cli/lib/define-command.mjs +4 -0
  324. package/clients/cli/lib/resolve-theme.mjs +80 -78
  325. package/clients/cli/lib/resolve-theme.test.mjs +523 -27
  326. package/foundation/agent-docs/agent-docs.mjs +48 -30
  327. package/foundation/agent-docs/agent-docs.test.mjs +47 -34
  328. package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
  329. package/foundation/config/project.d.mts +20 -5
  330. package/foundation/config/project.mjs +43 -6
  331. package/foundation/config/project.test.mjs +1 -1
  332. package/foundation/config/theme-private-vars.d.mts +12 -0
  333. package/foundation/config/theme-private-vars.mjs +107 -0
  334. package/foundation/config/theme-private-vars.test.mjs +55 -0
  335. package/foundation/config/theme-state.d.mts +145 -0
  336. package/foundation/config/theme-state.mjs +417 -0
  337. package/foundation/config/theme-state.test.mjs +182 -0
  338. package/foundation/discovery/component-discovery.d.mts +5 -2
  339. package/foundation/discovery/component-discovery.mjs +12 -6
  340. package/foundation/discovery/component-replacement.d.mts +91 -0
  341. package/foundation/discovery/component-replacement.mjs +417 -0
  342. package/foundation/discovery/component-replacement.test.mjs +480 -0
  343. package/foundation/discovery/docs-discovery.test.mjs +1 -1
  344. package/foundation/discovery/docs-output-budget.d.mts +6 -2
  345. package/foundation/discovery/docs-output-budget.mjs +2 -1
  346. package/foundation/discovery/docs-section-key.d.mts +4 -2
  347. package/foundation/discovery/docs-section-key.mjs +1 -1
  348. package/foundation/discovery/module-exports.d.mts +10 -0
  349. package/foundation/discovery/module-exports.mjs +146 -0
  350. package/foundation/discovery/package-exports.d.mts +29 -0
  351. package/foundation/discovery/package-exports.mjs +200 -0
  352. package/foundation/discovery/template-needs.d.mts +31 -0
  353. package/foundation/discovery/template-needs.mjs +156 -0
  354. package/foundation/discovery/template-needs.test.mjs +203 -0
  355. package/foundation/discovery/theme-discovery.d.mts +72 -5
  356. package/foundation/discovery/theme-discovery.mjs +134 -18
  357. package/foundation/discovery/theme-discovery.test.mjs +9 -3
  358. package/foundation/discovery/theme-imports.d.mts +15 -0
  359. package/foundation/discovery/theme-imports.mjs +217 -0
  360. package/foundation/discovery/theme-imports.test.mjs +173 -0
  361. package/foundation/doc-compiler/bundle.mjs +52 -1
  362. package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
  363. package/foundation/doc-compiler/inputs.mjs +2 -1
  364. package/foundation/doc-compiler/lenses.d.mts +4 -2
  365. package/foundation/doc-compiler/lenses.mjs +1 -1
  366. package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
  367. package/foundation/doc-compiler/tree.d.mts +10 -0
  368. package/foundation/doc-compiler/tree.mjs +22 -0
  369. package/foundation/doc-compiler/tree.test.mjs +3 -2
  370. package/foundation/env/package-manager.d.mts +31 -8
  371. package/foundation/env/package-manager.mjs +120 -13
  372. package/foundation/env/package-manager.test.mjs +174 -1
  373. package/foundation/fs/module-loader.d.mts +9 -0
  374. package/foundation/fs/module-loader.mjs +71 -2
  375. package/foundation/integrations/cli-requirement.d.mts +22 -0
  376. package/foundation/integrations/cli-requirement.mjs +31 -0
  377. package/foundation/integrations/cli-requirement.test.mjs +70 -0
  378. package/foundation/integrations/contribution-inventory.mjs +3 -3
  379. package/foundation/integrations/validate-contributions.d.mts +16 -0
  380. package/foundation/integrations/validate-contributions.mjs +56 -8
  381. package/foundation/response/base.d.ts +9 -3
  382. package/foundation/response/json.d.mts +7 -4
  383. package/foundation/response/json.mjs +10 -6
  384. package/foundation/response/response-types.doc.mjs +41 -26
  385. package/foundation/response/response.doc.mjs +18 -4
  386. package/foundation/text/copyright-header.mjs +1 -1
  387. package/foundation/text/copyright-header.test.mjs +1 -1
  388. package/package.json +9 -9
  389. package/assets/docs/layout.doc.dense.mjs +0 -388
  390. package/assets/docs/layout.doc.mjs +0 -550
  391. package/assets/docs/styling-libraries.doc.mjs +0 -469
  392. package/assets/docs/styling.doc.mjs +0 -412
  393. package/assets/docs/tokens.doc.dense.mjs +0 -15
  394. package/assets/docs/tokens.doc.mjs +0 -1491
  395. package/assets/docs/tokens.doc.zh.mjs +0 -15
  396. package/assets/docs/typography.doc.mjs +0 -286
@@ -3,18 +3,37 @@
3
3
  /** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
4
4
 
5
5
  export const docsZh = {
6
- description: 'Theme 提供者、自定义主题、生产/SSR 主题构建、亮/暗模式和组件样式覆盖。',
6
+ description: '如何使用和创建主题:请参阅"使用主题"了解如何应用主题,参阅"创作主题"了解如何创建和自定义主题。',
7
7
  sections: [
8
- { section: 'Wrap your app in a theme', title: '用主题包裹应用', content: [null, null, null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
9
- { section: 'Available Themes', title: '可用主题', content: [null, null, { type: 'prose', text: '已发布主题:neutral(推荐起点)、butter、chocolate、gothic(仅暗色)、matcha、stone、y2k。@astryxdesign/theme-{name} = 源码版(运行时注入)。@astryxdesign/theme-{name}/built = 优化版(配合 theme.css)。' }] },
10
- { section: 'Theme Props', title: 'Theme 属性', content: [{ type: 'prose', text: "`<Theme>` 接受 `theme`(必填)、`mode`(默认 `'system'`,也可以是 `'light'` 或 `'dark'`)和 `children`。运行 `astryx component Theme` 查看全部属性。" }] },
11
- { section: 'Custom themes', title: '自定义主题', content: [{ type: 'prose', text: '用 `theme list` + `theme add <slug>` 从内置主题或已安装集成提供的主题开始;重名时传 `--package`。也可以用 defineTheme 从零编写。只覆盖与默认值不同的令牌。' }, null, { type: 'prose', text: '`astryx theme template` 会写入 theme.template.ts:带注释的完整参考,涵盖每个 defineTheme 字段、令牌族和覆盖语法,并标明打印各自参考的 CLI 命令。' }] },
12
- { section: 'defineTheme', title: 'defineTheme', content: [{ type: 'prose', text: '支持比例配置(color、typography、radius、motion)+ 显式令牌覆盖 + 组件覆盖。color 通过 HCT 从 accent 派生完整调色板;accent 接受单个十六进制值或 [light, dark] 元组(每个模式使用各自的种子色)。tokens 覆盖按令牌逐个生效;--color-on-accent 始终由 color.accent 计算得出,因此优先使用元组 accent 而不是覆盖 --color-accent。' }, null, null] },
13
- { section: 'Build a theme', title: '构建主题', content: [{ type: 'prose', text: 'astryx theme build 将 defineTheme 编译为静态 CSS。输出 .css + .js(__built:true)+ .d.ts。' }] },
14
- { section: 'Built themes with an icon registry', title: '带图标注册表的构建主题', content: [{ type: 'prose', text: '当前 theme build 仅在检测到 icons: 字段使用的具名导入时,才在生成的模块中导入图标注册表;它不会编译注册表模块。defineTheme 在运行时接受的内联注册表(包括本地常量)目前会在构建产物中被省略。使用此构建流程时,请把注册表移到独立模块并使用具名导入。以下示例适用于使用 React 和 lucide-react 的注册表。' }, null, { type: 'prose', text: '上例中生成的主题从 dist 导入 ./icons.mjs。如果跳过第二条命令,theme build 仍可能成功,但加载或打包生成的模块都会因缺少 dist/icons.mjs 而失败。--icons-specifier 只更改生成的导入,不会创建或验证目标文件。路径应相对于生成的 JS 文件可解析。将 react 和图标库标记为 external,避免在注册表中重复打包这些依赖。' }, { type: 'prose', text: '不传 --icons-specifier 时,会原样保留检测到的源码导入路径。默认不传 --out 时,打包器可以把无扩展名的 ./icons 解析为旁边的 icons.tsx;Node ESM 不执行这种查找,会报 ERR_MODULE_NOT_FOUND。用 --out 移动输出位置也会改变相对导入的解析位置;使用打包器并不意味着它能自动找到原来的源码。' }] },
15
- { section: 'Runtime vs Built Themes', title: '运行时 vs 构建', content: [{ type: 'prose', text: '运行时:useInsertionEffect 在客户端注入样式。构建:静态 CSS 在首次渲染时就存在。SSR 应用请使用 /built + theme.css。' }, null, null, null] },
16
- { section: 'Dark mode', title: '亮/暗模式', content: [{ type: 'prose', text: "令牌值使用 [light, dark] 元组实现自动模式切换。Theme 上 mode='system'(默认)跟随系统偏好。" }, null, null] },
17
- { section: 'Nested themes', title: '嵌套主题', content: [{ type: 'prose', text: '将不同部分包裹在独立的 <Theme> 提供者中。' }, null] },
18
- { section: 'useTheme Hook', title: 'useTheme 钩子', content: [null, null, { type: 'prose', text: '普通样式优先使用 CSS 变量、StyleX 令牌导入、xstyle 或 className。useTheme() 是只读的:要更改主题或模式,在应用层管理状态并传递给 <Theme>。' }] },
8
+ {
9
+ section: 'Wrap your app in a theme',
10
+ title: '为应用添加主题',
11
+ content: [
12
+ {
13
+ type: 'prose',
14
+ text: "安装主题包,用 `<Theme>`(`import {Theme} from '@astryxdesign/core'`)包裹应用,选择浅色或深色模式。完整指南——可用主题、集成主题、深色模式、嵌套主题和生产构建——请参阅 {@link generic:use-a-theme}。",
15
+ },
16
+ ],
17
+ },
18
+ {
19
+ section: 'Create a custom theme',
20
+ title: '创建自定义主题',
21
+ content: [
22
+ {
23
+ type: 'prose',
24
+ text: '使用 `defineTheme` 进行令牌覆盖、比例配置和组件样式覆盖。完整指南——调色板生成、主题扩展、自适应、自定义变体和生产构建——请参阅 {@link generic:author-a-theme}。',
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ section: 'Dark mode',
30
+ title: '深色模式',
31
+ content: [
32
+ {
33
+ type: 'prose',
34
+ text: '在令牌值中使用 [浅色, 深色] 元组来自动切换模式。在 Theme 上使用 mode=\'system\'(默认)来跟随操作系统偏好。完整指南:{@link generic:use-a-theme}。',
35
+ },
36
+ ],
37
+ },
19
38
  ],
20
39
  };
@@ -44,11 +44,11 @@ Declare theme root ./themes in astryx.integration.mjs.
44
44
  },
45
45
  {
46
46
  type: 'prose',
47
- text: "`oceanTheme.ts` exports `oceanTheme`, a `defineTheme` source. `oceanTheme.doc.mjs` describes it with `type: 'theme'`, `name`, `displayName`, `description`, and `maintained`; `theme list` shows its `name`, `description`, and `maintained`. Every field is in {@link generic:authoring}.",
47
+ text: "`oceanTheme.ts` exports `oceanTheme`, a `defineTheme` source. `oceanTheme.doc.mjs` describes it with `type: 'theme'`, `name`, `displayName`, `description`, and `maintained`; `theme list` shows its `name`, `description`, and `maintained`. The command also declares `./themes/ocean` and `./themes/ocean.css` package exports. Every descriptor field is in {@link generic:authoring}.",
48
48
  },
49
49
  {
50
50
  type: 'prose',
51
- text: 'The source ships in your package. An app installs the package and applies the theme — it is not copied; see {@link generic:use-a-theme-in-an-app}.',
51
+ text: 'The source and built outputs ship in your package. Build the source with `theme build`, then run `integration verify` before publishing. An app runs `theme add --import` to record and import the built module and stylesheets; plain `theme add` still copies source while that default is deprecated. See {@link generic:use-a-theme-in-an-app}.',
52
52
  },
53
53
  ],
54
54
  },
@@ -36,9 +36,9 @@ export const docs = {
36
36
  ],
37
37
  [
38
38
  '`npx astryx doctor integration components`',
39
- 'No component name clashes with a Core component',
40
- 'Core is not installed (`core_not_found`)',
41
- 'A name clashes with Core',
39
+ 'No component name clashes with a Core component, and each `replaces` names one Core component',
40
+ 'Core is not installed (`core_not_found`). In a package that declares the CLI range that turns replacement on, a `replaces` target is missing (`missing_component_replacement_target`) or invalid (`invalid_component_replacement`), or two components replace one Core component (`ambiguous_component_replacement`)',
41
+ 'A name clashes with Core, or a component sets `replaces` in a package without that range (`inactive_component_replacement`, plus any missing, invalid, or duplicate `replaces` reported as a warning)',
42
42
  ],
43
43
  [
44
44
  '`npx astryx doctor integration templates`',
@@ -56,7 +56,7 @@ export const docs = {
56
56
  '`npx astryx integration verify`',
57
57
  'The packed package holds every file, shows the same contributions, resolves every public import, and declares the CLI it needs',
58
58
  'Anything `validate` fails on, no manifest, a file left out of the `.tgz` file, an import that does not resolve, or a missing CLI peer',
59
- 'Anything `validate` warns about',
59
+ 'Anything `validate` warns about, or a component sets `replaces` and the package does not declare the CLI range that turns it on (`component_replaces_needs_cli`)',
60
60
  ],
61
61
  ],
62
62
  },
@@ -106,6 +106,7 @@ export const docs = {
106
106
  'It checks that every contribution file is in the `.tgz` file. A root missing from `files` fails with `Add "templates" to "files" in package.json.`',
107
107
  'It lists the components, templates, themes, docs, and codemods the temporary app sees, and compares them with your source.',
108
108
  "It resolves each component's `import`, and each template's public import, the way Node does, and checks that the module exports the component, or a default export for a template.",
109
+ 'For each theme, it rebuilds the source, compares the built module and production CSS with the authored outputs, and proves the module, CSS, and optional font CSS exports resolve from the packed package.',
109
110
  'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.7.0` for a template that sets `replaces` or `keywords`, and `>=0.6.4` for a docs section, a placed guide, a doc section with an `id`, or a theme.',
110
111
  ],
111
112
  },
@@ -0,0 +1,107 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs migration/component-migration`: migrate the app frame,
5
+ * map shadcn/Radix primitives, and wire up command palette, settings, and
6
+ * theme controls.
7
+ */
8
+
9
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
10
+
11
+ export const docs = {
12
+ type: 'generic',
13
+ name: 'component-migration',
14
+ title: 'Component Migration',
15
+ placement: {parent: 'namespace:migration', slot: 'guides', order: 20},
16
+ category: 'guide',
17
+ description:
18
+ 'Move the app frame first, map shadcn and Radix primitives to components, and wire up command palette, settings, and theme controls.',
19
+ keywords: [
20
+ 'Button',
21
+ 'TextInput',
22
+ 'CommandPalette',
23
+ ],
24
+
25
+ sections: [
26
+ {
27
+ title: 'Move the App Frame First',
28
+ content: [
29
+ {
30
+ type: 'prose',
31
+ text: 'Start with AppShell so page migration happens inside the final navigation, spacing, surface, and responsive frame. This also exposes theme and color issues early because every route shares the same shell.',
32
+ },
33
+ {
34
+ type: 'table',
35
+ headers: ['Legacy surface', 'Component', 'Notes'],
36
+ rows: [
37
+ ['Header', 'TopNav', 'Use for product identity, global actions, account entry, and command/search trigger.'],
38
+ ['Sidebar', 'SideNav', 'Use sections and nested nav items for route groups. Keep selection state driven by the router.'],
39
+ ['Main page wrapper', 'AppShell + Layout', 'Let the shell own persistent structure; let route components own page content.'],
40
+ ['Mobile drawer nav', 'MobileNav or AppShell mobile behavior', 'Verify focus, close behavior, and route changes on narrow viewports.'],
41
+ ['Settings menu', 'Popover + Layout + Switch', 'Use as the home for theme mode and app preferences.'],
42
+ ],
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ title: 'Map shadcn and Radix Primitives',
48
+ content: [
49
+ {
50
+ type: 'prose',
51
+ text: 'Do not wrap old shadcn components in design system styles. Replace the primitive with the component that owns the behavior, accessibility, state classes, and token usage.',
52
+ },
53
+ {
54
+ type: 'table',
55
+ headers: ['Existing primitive', 'Component', 'Migration note'],
56
+ rows: [
57
+ ['button / shadcn Button', 'Button or IconButton', 'Use Button for labeled commands and IconButton for icon-only toolbar actions.'],
58
+ ['input', 'TextInput', 'Keep validation state in status props rather than ad hoc border classes.'],
59
+ ['textarea', 'TextArea', 'Use when multiline editing is the primary action.'],
60
+ ['switch', 'Switch', 'Use for persisted boolean settings, including theme mode when represented as a binary choice.'],
61
+ ['checkbox', 'CheckboxInput or CheckboxList', 'Use list variants for grouped selection.'],
62
+ ['radio group', 'RadioList', 'Use when one option must be selected from a visible set.'],
63
+ ['select / combobox', 'Selector or Typeahead', 'Use Selector for bounded options and Typeahead for searchable async options.'],
64
+ ['tabs used as page nav', 'TabList', 'Use route state or current page state as the source of truth.'],
65
+ ['command dialog', 'CommandPalette', 'Keep app-specific search sources outside the shell and feed searchable items.'],
66
+ ['dropdown action menu', 'DropdownMenu or MoreMenu', 'Use MoreMenu for compact overflow actions.'],
67
+ ['alert / callout', 'Banner or Toast', 'Use Banner for page or section messages and Toast for transient feedback.'],
68
+ ['dialog', 'Dialog or AlertDialog', 'Use AlertDialog for destructive confirmation and Dialog for task flows.'],
69
+ ['card-like list row', 'ListItem', 'Prefer ListItem for selectable rows instead of styling Button as a row.'],
70
+ ],
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ id: 'command-palette',
76
+ title: 'Command Palette, Settings, and Theme',
77
+ content: [
78
+ {
79
+ type: 'prose',
80
+ text: 'Move global search to CommandPalette once the shell exists. Treat the palette as a view over app commands: routes, contextual actions, create actions, filters, recent items, and entity results. Keep data normalization in app code so search sources always return arrays of searchable items.',
81
+ },
82
+ {
83
+ type: 'prose',
84
+ text: 'Put light and dark mode controls in the settings popover or account menu. The switch or selector should update the mode passed to Theme, not toggle isolated body classes.',
85
+ },
86
+ {
87
+ type: 'code',
88
+ lang: 'tsx',
89
+ label: 'Settings popover theme control',
90
+ code: `function ThemeModeSwitch() {
91
+ const {mode, setMode} = useSettings();
92
+ const isDark = mode === 'dark';
93
+
94
+ return (
95
+ <Switch
96
+ label="Dark mode"
97
+ description="Use the dark color theme"
98
+ value={isDark}
99
+ onChange={next => setMode(next ? 'dark' : 'light')}
100
+ />
101
+ );
102
+ }`,
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ };
@@ -0,0 +1,150 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs styling-libraries/css-and-stylex`: core integration
5
+ * principle, plain CSS / CSS Modules, and StyleX typed-token imports.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
9
+
10
+ export const docs = {
11
+ type: 'generic',
12
+ name: 'css-and-stylex',
13
+ title: 'CSS & StyleX',
14
+ placement: {parent: 'namespace:styling-libraries', slot: 'guides', order: 10},
15
+ category: 'guide',
16
+ description:
17
+ 'Core integration principle, plain CSS / CSS Modules, and StyleX typed-token imports.',
18
+
19
+ sections: [
20
+ {
21
+ title: 'Core Principle',
22
+ content: [
23
+ {
24
+ type: 'prose',
25
+ text: 'Keep the system as the source of truth for theme values. Components read design tokens from CSS custom properties such as `--color-text-primary`, `--color-background-surface`, `--spacing-4`, and `--radius-container`. Other styling libraries should map their own semantic tokens, utility names, or theme objects to those system CSS variables whenever possible.',
26
+ },
27
+ {
28
+ type: 'prose',
29
+ text: 'Use CSS variables for ordinary DOM styling because they inherit through the tree, follow `data-theme` color mode, respect nested `data-astryx-theme` scopes, and update when themes switch. Use token resolver APIs only for non-CSS consumers such as SVG attribute values, canvas, chart configuration, color calculations, or static config generation.',
30
+ },
31
+ {
32
+ type: 'prose',
33
+ text: 'For available token names and values, run {@link namespace:tokens}. Focused references are also available with {@link generic:color}, {@link generic:spacing}, {@link generic:shape}, {@link namespace:typography}, {@link generic:elevation}, and {@link generic:motion}.',
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ title: 'Choose an Integration Path',
39
+ content: [
40
+ {
41
+ type: 'prose',
42
+ text: 'Choose the narrowest integration path that fits the styling library. Most DOM styling should stay on the CSS-variable path; JavaScript token resolution is for APIs that cannot consume CSS custom properties.',
43
+ },
44
+ {
45
+ type: 'table',
46
+ headers: ['Path', 'Use when', 'Value shape'],
47
+ rows: [
48
+ [
49
+ 'CSS variable aliases',
50
+ 'The library ultimately writes CSS and accepts string values',
51
+ '`var(--color-text-primary)`',
52
+ ],
53
+ [
54
+ 'StyleX token imports',
55
+ 'You are writing StyleX styles in application code',
56
+ "`colorVars['--color-text-primary']`",
57
+ ],
58
+ [
59
+ 'Tailwind bridge',
60
+ 'You want utility classes backed by active system tokens',
61
+ '`@astryxdesign/core/tailwind-theme.css`',
62
+ ],
63
+ [
64
+ 'Design token resolver APIs',
65
+ 'JavaScript needs token values for charts, canvas, SVG, or config objects',
66
+ "`resolveThemeToken(theme, '--color-data-categorical-blue', {mode})`",
67
+ ],
68
+ ],
69
+ },
70
+ ],
71
+ },
72
+ {
73
+ title: 'Best Practices',
74
+ content: [
75
+ {
76
+ type: 'list',
77
+ style: 'do',
78
+ items: [
79
+ 'Map by semantic intent: text, surface, border, accent, status, radius, spacing, typography.',
80
+ 'Let the system own color mode. The root Theme syncs `data-theme="light|dark"` and `data-astryx-theme` to `<html>` for portals and first-level theme scope.',
81
+ 'Prefer CSS variables for runtime theme switching and nested themes.',
82
+ ],
83
+ },
84
+ {
85
+ type: 'list',
86
+ style: 'dont',
87
+ items: [
88
+ 'Copy raw hex/px values into a second theme object when a `var(...)` reference would work.',
89
+ 'Run a second unsynchronized dark-mode provider that disagrees with Theme.',
90
+ 'Make another library\'s CSS variables the source of truth for the system. Some consumers need token values outside the DOM.',
91
+ ],
92
+ },
93
+ ],
94
+ },
95
+ {
96
+ title: 'Plain CSS and CSS Modules',
97
+ content: [
98
+ {
99
+ type: 'prose',
100
+ text: 'The simplest integration is direct CSS variable usage. CSS Modules scope class names, but system token variables are global/inherited values supplied by package CSS and the active theme.',
101
+ },
102
+ {
103
+ type: 'code',
104
+ lang: 'css',
105
+ label: 'Card.module.css',
106
+ code: `.card {
107
+ background: var(--color-background-surface);
108
+ color: var(--color-text-primary);
109
+ border: 1px solid var(--color-border);
110
+ border-radius: var(--radius-container);
111
+ padding: var(--spacing-4);
112
+ }`,
113
+ },
114
+ {
115
+ type: 'prose',
116
+ text: 'Sass variables are compile-time only. They are useful for generating static CSS, but they do not update when the system switches theme or color mode. Use native CSS custom properties for themeable values.',
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ title: 'StyleX',
122
+ content: [
123
+ {
124
+ type: 'prose',
125
+ text: 'For StyleX styles, prefer the typed token exports from `@astryxdesign/core/theme/tokens.stylex`. They provide autocomplete and catch token-name typos while still resolving through the same system CSS variables at runtime.',
126
+ },
127
+ {
128
+ type: 'code',
129
+ lang: 'tsx',
130
+ label: 'Typed token imports',
131
+ code: `import * as stylex from '@stylexjs/stylex';
132
+ import {colorVars, spacingVars, radiusVars} from '@astryxdesign/core/theme/tokens.stylex';
133
+
134
+ const styles = stylex.create({
135
+ panel: {
136
+ backgroundColor: colorVars['--color-background-surface'],
137
+ color: colorVars['--color-text-primary'],
138
+ padding: spacingVars['--spacing-4'],
139
+ borderRadius: radiusVars['--radius-container'],
140
+ },
141
+ });`,
142
+ },
143
+ {
144
+ type: 'prose',
145
+ text: 'Use `xstyle` for component overrides and `stylex.props()` for your own DOM nodes. Use `className` when integrating a non-StyleX styling library.',
146
+ },
147
+ ],
148
+ },
149
+ ],
150
+ };
@@ -45,7 +45,7 @@ export const oceanTheme = defineTheme({
45
45
  },
46
46
  {
47
47
  type: 'prose',
48
- text: 'Local imports must stay inside the theme folder. One that leaves it, such as `../../shared/colors`, fails with `invalid_theme`, and the theme disappears from `theme list`. `npx astryx theme template` writes a file that explains every `defineTheme` field. For the full token set, scope selectors, and component theming, read {@link generic:theme}.',
48
+ text: 'Local imports must stay inside the theme folder. One that leaves it, such as `../../shared/colors`, fails with `invalid_theme`, and the theme disappears from `theme list`. `npx astryx theme template` writes a file that explains every `defineTheme` field. For the full token set, scope selectors, and component theming, read {@link generic:author-a-theme}.',
49
49
  },
50
50
  ],
51
51
  },
@@ -21,7 +21,7 @@ export const docs = {
21
21
  content: [
22
22
  {
23
23
  type: 'prose',
24
- text: 'Give your theme a doc topic that extends the core `theme` topic, so an app that lists your package sees your theme at the end of `astryx docs theme`. Add it with `extends: \'theme\'` ({@link generic:extend-or-replace}).',
24
+ text: "Give your theme a doc topic that extends the core `theme` topic, so an app that lists your package sees your theme at the end of `astryx docs theme`. Add it with `extends: 'theme'` ({@link generic:extend-or-replace}).",
25
25
  },
26
26
  {
27
27
  type: 'code',
@@ -41,7 +41,7 @@ export default {
41
41
  content: [
42
42
  {
43
43
  type: 'prose',
44
- text: "Add \`@acme/astryx-widgets\` to the app's dependencies and apply the Ocean theme with \`<Theme theme={oceanTheme}>\`.",
44
+ text: 'Install @acme/astryx-widgets, then run astryx theme add ocean --import --package @acme/astryx-widgets and apply it from the generated app theme module.',
45
45
  },
46
46
  ],
47
47
  },
@@ -50,7 +50,7 @@ export default {
50
50
  },
51
51
  {
52
52
  type: 'prose',
53
- text: 'Keep the section short: how to add the package, apply the theme ({@link generic:use-a-theme-in-an-app}), and — if the theme uses a custom font — which fonts the app must load ({@link generic:fonts-and-assets}). Extend `theme` rather than a topic another package replaces, or an app that lists that package first drops your section.',
53
+ text: 'Keep the section short: how to install the package, run `theme add --import`, apply the generated module ({@link generic:use-a-theme-in-an-app}), and customize with `extends`. When the theme uses a custom font, name the families and the optional exported font stylesheet that `theme add --import` imports ({@link generic:fonts-and-assets}). Extend `theme` rather than a topic another package replaces, or an app that lists that package first drops your section.',
54
54
  },
55
55
  ],
56
56
  },
@@ -60,7 +60,7 @@ export default {
60
60
  content: [
61
61
  {
62
62
  type: 'prose',
63
- text: 'Do not put theme usage in `agentDocs`. Agent lines land in every app\'s agent file and are for guidance needed every session; a theme\'s install-and-use steps belong in a doc topic that people and agents read on demand. See {@link generic:agent-guidance}.',
63
+ text: "Do not put theme usage in `agentDocs`. Agent lines land in every app's agent file and are for guidance needed every session; a theme's install-and-use steps belong in a doc topic that people and agents read on demand. See {@link generic:agent-guidance}.",
64
64
  },
65
65
  ],
66
66
  },
@@ -0,0 +1,122 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs typography/font-setup`: font families, custom fonts,
5
+ * font sizes, and font weights.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
9
+
10
+ export const docs = {
11
+ type: 'generic',
12
+ name: 'font-setup',
13
+ title: 'Font Setup',
14
+ placement: {parent: 'namespace:typography', slot: 'guides', order: 10},
15
+ category: 'foundations',
16
+ description:
17
+ 'Font families, custom font loading, geometric font sizes, and semantic font weights.',
18
+ keywords: [
19
+ 'font family',
20
+ 'custom fonts',
21
+ 'webfont',
22
+ 'Google Fonts',
23
+ 'font-face',
24
+ 'font size',
25
+ 'font weight',
26
+ 'geometric scale',
27
+ ],
28
+
29
+ sections: [
30
+ {
31
+ title: 'Overview',
32
+ content: [
33
+ {
34
+ type: 'prose',
35
+ text: 'Typography is built on a geometric type scale: base size × ratio^step, with 14px and 1.2 as defaults. Every text style is a semantic token that composes font size, weight, and line-height, so components express intent (heading, body, label) rather than raw values.',
36
+ },
37
+ {
38
+ type: 'prose',
39
+ text: 'Two layers work together: raw size tokens (--font-size-xs ... --font-size-5xl) form the geometric scale, and semantic type scale tokens (--text-heading-1-size, --text-body-leading, etc.) reference them by var(). Themes override the entire scale by adjusting base and ratio in defineTheme; all semantic tokens recompute automatically.',
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ title: 'Font Families',
45
+ content: [
46
+ {
47
+ type: 'prose',
48
+ text: 'Three font roles: body (UI text), heading (titles and headings), and code (monospace). By default, body and heading share the same system font stack; code uses a monospace stack. Custom themes can assign different families per role; heading inherits from body when not explicitly set.',
49
+ },
50
+ {
51
+ type: 'token-ref',
52
+ topic: 'tokens',
53
+ section: 'Font Family Tokens',
54
+ },
55
+ ],
56
+ },
57
+ {
58
+ id: 'loading-custom-fonts',
59
+ title: 'Custom fonts',
60
+ content: [
61
+ {
62
+ type: 'prose',
63
+ text: 'Astryx never loads font files. defineTheme and the built CSS only set font-family: naming a webfont (Fraunces, JetBrains Mono, and so on) makes every browser look for it, and quietly fall back when the app has not loaded it. `astryx theme build` warns when a theme names families that are neither CSS generics nor common system fonts and prints the snippet to add; loading the font is always the app\'s job.',
64
+ },
65
+ {
66
+ type: 'code',
67
+ lang: 'html',
68
+ label: 'Google Fonts: add to your document <head>',
69
+ code: `<link rel="preconnect" href="https://fonts.googleapis.com" />
70
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
71
+ <link
72
+ rel="stylesheet"
73
+ href="https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;700&family=JetBrains+Mono&display=swap"
74
+ />`,
75
+ },
76
+ {
77
+ type: 'code',
78
+ lang: 'css',
79
+ label: 'Self-hosted: one @font-face per family and weight',
80
+ code: `@font-face {
81
+ font-family: 'Fraunces';
82
+ src: url('/fonts/fraunces.woff2') format('woff2');
83
+ font-weight: 400 700; /* variable-font range, or one weight per file */
84
+ font-display: swap; /* fallback text stays visible while the font loads */
85
+ }`,
86
+ },
87
+ {
88
+ type: 'prose',
89
+ text: "Always pair a webfont with a real fallback stack (metric-similar system fonts plus a generic) so text stays readable before the font loads and wherever it never does: defineTheme({typography: {heading: {family: 'Fraunces', fallbacks: 'Georgia, serif'}}}).",
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ title: 'Font Sizes',
95
+ content: [
96
+ {
97
+ type: 'prose',
98
+ text: 'Geometric scale: round(base × ratio^step), expressed in rem. The default scale is 14px × 1.2, producing 12 steps from 4xs (6px) to 5xl (42px). Adjusting base and ratio in defineTheme regenerates every size token while preserving proportional relationships.',
99
+ },
100
+ {
101
+ type: 'token-ref',
102
+ topic: 'tokens',
103
+ section: 'Font Size Tokens',
104
+ },
105
+ ],
106
+ },
107
+ {
108
+ title: 'Font Weights',
109
+ content: [
110
+ {
111
+ type: 'prose',
112
+ text: 'Four semantic weights: normal (400, body/code), medium (500, labels/data), semibold (600, headings/titles), bold (700, strong emphasis). Type scale tokens reference these by var() so themes can remap numeric values.',
113
+ },
114
+ {
115
+ type: 'token-ref',
116
+ topic: 'tokens',
117
+ section: 'Font Weight Tokens',
118
+ },
119
+ ],
120
+ },
121
+ ],
122
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @file `astryx docs cli/integrations/building-blocks/themes/fonts-and-assets`:
5
- * name a theme's fonts, and have the app load them (Astryx never loads a font).
5
+ * ship a theme's optional font loader beside its built module and CSS.
6
6
  */
7
7
 
8
8
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
@@ -10,10 +10,10 @@ export const docs = {
10
10
  type: 'generic',
11
11
  name: 'fonts-and-assets',
12
12
  placement: {parent: 'namespace:themes', slot: 'guides', order: 35},
13
- title: 'Fonts',
13
+ title: 'Fonts and assets',
14
14
  category: 'guide',
15
15
  description:
16
- 'Name your theme\'s fonts in its tokens, then have the app load them — Astryx never loads a font file.',
16
+ 'Name the fonts in the theme, then export an optional font stylesheet that `theme add --import` imports with the built theme.',
17
17
  sections: [
18
18
  {
19
19
  id: 'name-the-font',
@@ -38,33 +38,38 @@ export const oceanTheme = defineTheme({
38
38
  },
39
39
  {
40
40
  type: 'prose',
41
- text: 'The full type scale and font roles are in {@link generic:theme}.',
41
+ text: 'The full type scale and font roles are in {@link generic:author-a-theme}.',
42
42
  },
43
43
  ],
44
44
  },
45
45
  {
46
- id: 'load-the-font-in-the-app',
47
- title: 'Load the font in the app',
46
+ id: 'ship-the-font-loader',
47
+ title: 'Ship the font loader',
48
48
  content: [
49
49
  {
50
50
  type: 'prose',
51
- text: 'Naming a family does not load it — Astryx never downloads a font file. The app that uses your theme loads the font itself, so your job is to tell your users which families and weights to load, in your theme\'s docs ({@link generic:document-the-theme}). An app loads a font one of two ways:',
51
+ text: 'Naming a family does not load it. When the theme uses non-system fonts, add `<slug>.fonts.css` beside the built module and production CSS, then export it as `./themes/<slug>.fonts.css`. `theme add --import` imports that stylesheet with the built theme.',
52
52
  },
53
53
  {
54
- type: 'list',
55
- style: 'unordered',
56
- items: [
57
- 'Link a hosted stylesheet in the app\'s `<head>` — for example a Google Fonts `<link>` covering every weight the UI uses.',
58
- 'Self-host: serve the font files and add an `@font-face` for each weight and style to the app\'s global CSS.',
59
- ],
54
+ type: 'code',
55
+ lang: 'json',
56
+ code: `"exports": {
57
+ "./themes/ocean": "./themes/ocean/ocean.js",
58
+ "./themes/ocean.css": "./themes/ocean/ocean.css",
59
+ "./themes/ocean.fonts.css": "./themes/ocean/ocean.fonts.css"
60
+ }`,
61
+ },
62
+ {
63
+ type: 'prose',
64
+ text: 'The stylesheet can contain self-hosted `@font-face` rules or import a hosted stylesheet. A hosted `@import` is simple, but it delays loading compared with a preconnected `<link>`; choose that trade-off deliberately. If the app loads the same family outside the generated module, Doctor warns because it cannot prove the loader, but the warning does not fail the app.',
60
65
  },
61
66
  {
62
67
  type: 'code',
63
68
  lang: 'css',
64
- code: `/* In the app's global CSS, when self-hosting */
69
+ code: `/* themes/ocean/ocean.fonts.css */
65
70
  @font-face {
66
71
  font-family: 'Acme Sans';
67
- src: url('/fonts/acme-sans.woff2') format('woff2');
72
+ src: url('./fonts/acme-sans.woff2') format('woff2');
68
73
  font-weight: 100 900;
69
74
  font-style: normal;
70
75
  font-display: swap;
@@ -75,10 +80,10 @@ export const oceanTheme = defineTheme({
75
80
  type: 'list',
76
81
  style: 'unordered',
77
82
  items: [
78
- 'Load every weight and style the theme uses. Do not let the browser synthesize bold or italic — include the italic face, with the same `unicode-range`s as the roman.',
79
- 'Set a `unicode-range` per face so the browser downloads only the subsets it needs.',
80
- 'Use `font-display: swap` unless a measured need justifies another value.',
81
- 'Serve WOFF2; add another format only when a target browser needs it.',
83
+ 'Load every weight and style the theme uses. Do not let the browser synthesize bold or italic.',
84
+ 'Include self-hosted font files and their licenses in the packed package.',
85
+ 'Keep CSS and font assets side-effectful so a bundler does not remove the loader.',
86
+ 'Run `integration verify`; it fails when an exported font stylesheet or one of its packed files cannot resolve.',
82
87
  ],
83
88
  },
84
89
  ],
@@ -89,7 +94,7 @@ export const oceanTheme = defineTheme({
89
94
  content: [
90
95
  {
91
96
  type: 'prose',
92
- text: 'Before publishing, install the package in a clean app, apply the theme, load the fonts, and open it in a browser. The source and the applied result are not the same thing until you look.',
97
+ text: 'Before publishing, run `integration verify`. Then install the package in a clean app, run `theme add --import`, apply the generated theme, and open it in a browser. The source, packed exports, and applied result form one chain; check the last step too.',
93
98
  },
94
99
  {
95
100
  type: 'list',