@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8

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 (380) hide show
  1. package/README.md +76 -86
  2. package/api/build/_adapter.d.mts +12 -0
  3. package/api/build/_adapter.mjs +51 -34
  4. package/api/build/blocks/blocks.d.mts +7 -5
  5. package/api/build/blocks/blocks.mjs +113 -26
  6. package/api/build/build.doc.mjs +4 -3
  7. package/api/build/build.type.d.mts +2 -2
  8. package/api/build/build.type.mjs +3 -3
  9. package/api/build/kit/kind.d.mts +2 -1
  10. package/api/build/kit/kind.mjs +199 -10
  11. package/api/build/kit/kit.mjs +6 -4
  12. package/api/build/kit/rank.d.mts +4 -2
  13. package/api/build/kit/rank.mjs +125 -24
  14. package/api/build/kit/start.d.mts +5 -4
  15. package/api/build/kit/start.mjs +12 -8
  16. package/api/build/kit/weights.d.mts +39 -3
  17. package/api/build/kit/weights.json +1 -1
  18. package/api/build/kit/weights.mjs +340 -43
  19. package/api/build/kit/word-model.d.mts +23 -0
  20. package/api/build/kit/word-model.mjs +46 -0
  21. package/api/build/kit/words.d.mts +48 -0
  22. package/api/build/kit/words.mjs +90 -1
  23. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  24. package/api/component/list/list.d.mts +1 -1
  25. package/api/component/list/list.mjs +48 -6
  26. package/api/discover/_adapter.d.mts +1 -1
  27. package/api/discover/search/search.mjs +3 -2
  28. package/api/docs/_adapter.d.mts +28 -2
  29. package/api/docs/_adapter.mjs +249 -10
  30. package/api/docs/docs.d.mts +3 -0
  31. package/api/docs/docs.doc.mjs +7 -1
  32. package/api/docs/docs.mjs +12 -0
  33. package/api/docs/docs.type.d.mts +5 -0
  34. package/api/docs/docs.type.mjs +2 -0
  35. package/api/docs/node/node.mjs +1 -1
  36. package/api/doctor/_adapter.d.mts +27 -5
  37. package/api/doctor/_adapter.mjs +83 -10
  38. package/api/doctor/built-checks.mjs +40 -14
  39. package/api/doctor/doctor.d.mts +4 -3
  40. package/api/doctor/doctor.mjs +14 -7
  41. package/api/doctor/theme-checks.mjs +121 -17
  42. package/api/icon/_records.mjs +2 -1
  43. package/api/index.d.mts +2 -0
  44. package/api/index.mjs +2 -0
  45. package/api/integration/_adapter.d.mts +44 -0
  46. package/api/integration/_adapter.mjs +77 -1
  47. package/api/integration/authoring-checks.mjs +6 -6
  48. package/api/integration/example-scope.d.mts +14 -0
  49. package/api/integration/example-scope.mjs +44 -0
  50. package/api/integration/example-scope.type.d.mts +29 -0
  51. package/api/integration/example-scope.type.mjs +25 -0
  52. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  53. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  54. package/api/integration/validate-integration.mjs +19 -1
  55. package/api/integration/validate-integration.type.d.mts +9 -0
  56. package/api/integration/validate-integration.type.mjs +1 -1
  57. package/api/integration/validateIntegration.doc.mjs +1 -1
  58. package/api/render/_adapter.mjs +591 -195
  59. package/api/render/render.doc.mjs +11 -3
  60. package/api/render/render.type.d.mts +52 -0
  61. package/api/render/render.type.mjs +31 -1
  62. package/api/search/ORDERING.md +1 -1
  63. package/api/search/_adapter.d.mts +9 -0
  64. package/api/search/_adapter.mjs +85 -0
  65. package/api/search/_candidate-score.mjs +51 -32
  66. package/api/search/_fit-order.mjs +3 -3
  67. package/api/search/_gather-components.d.mts +3 -2
  68. package/api/search/_gather-components.mjs +12 -3
  69. package/api/search/_lexical.d.mts +5 -0
  70. package/api/search/_lexical.mjs +8 -2
  71. package/api/search/_result.d.mts +11 -9
  72. package/api/search/_result.mjs +4 -4
  73. package/api/search/_score.d.mts +6 -1
  74. package/api/search/_score.mjs +15 -3
  75. package/api/search/search-index.mjs +7 -1
  76. package/api/search/search.d.mts +1 -1
  77. package/api/theme/_adapter.mjs +12 -1
  78. package/api/theme/build/build.d.mts +132 -1
  79. package/api/theme/build/build.mjs +482 -157
  80. package/api/theme/build/core-interception.d.mts +10 -0
  81. package/api/theme/build/core-interception.mjs +10 -0
  82. package/api/theme/build/font-warning.d.mts +44 -5
  83. package/api/theme/build/font-warning.mjs +118 -10
  84. package/api/theme/build/icon-imports.mjs +51 -9
  85. package/api/theme/theme.type.d.mts +10 -0
  86. package/api/theme/theme.type.mjs +7 -1
  87. package/api/theme-edit/_adapter.d.mts +115 -4
  88. package/api/theme-edit/_adapter.mjs +997 -83
  89. package/api/theme-edit/_catalog.d.mts +20 -2
  90. package/api/theme-edit/_catalog.mjs +50 -10
  91. package/api/theme-edit/_check.d.mts +75 -24
  92. package/api/theme-edit/_check.mjs +2672 -422
  93. package/api/theme-edit/_color.d.mts +10 -0
  94. package/api/theme-edit/_color.mjs +54 -1
  95. package/api/theme-edit/_compiler.d.mts +1 -0
  96. package/api/theme-edit/_compiler.mjs +133 -15
  97. package/api/theme-edit/_context.d.mts +14 -3
  98. package/api/theme-edit/_context.mjs +225 -65
  99. package/api/theme-edit/_css.d.mts +14 -0
  100. package/api/theme-edit/_css.mjs +46 -1
  101. package/api/theme-edit/_edit.d.mts +54 -4
  102. package/api/theme-edit/_edit.mjs +2966 -286
  103. package/api/theme-edit/_how-commands.d.mts +72 -1
  104. package/api/theme-edit/_how-commands.mjs +770 -9
  105. package/api/theme-edit/_how-question.d.mts +82 -5
  106. package/api/theme-edit/_how-question.mjs +6983 -701
  107. package/api/theme-edit/_how.d.mts +2 -1
  108. package/api/theme-edit/_how.mjs +237 -41
  109. package/api/theme-edit/_importers.d.mts +38 -0
  110. package/api/theme-edit/_importers.mjs +188 -0
  111. package/api/theme-edit/_marks.d.mts +31 -5
  112. package/api/theme-edit/_marks.mjs +57 -5
  113. package/api/theme-edit/_name-rule.d.mts +11 -0
  114. package/api/theme-edit/_name-rule.mjs +12 -0
  115. package/api/theme-edit/_normal.d.mts +303 -0
  116. package/api/theme-edit/_normal.mjs +1517 -0
  117. package/api/theme-edit/_palette.d.mts +12 -0
  118. package/api/theme-edit/_palette.mjs +37 -4
  119. package/api/theme-edit/_part-words.d.mts +31 -0
  120. package/api/theme-edit/_part-words.mjs +126 -0
  121. package/api/theme-edit/_parts.d.mts +28 -2
  122. package/api/theme-edit/_parts.mjs +267 -31
  123. package/api/theme-edit/_preview-app.d.mts +7 -13
  124. package/api/theme-edit/_preview-app.mjs +814 -406
  125. package/api/theme-edit/_preview.d.mts +116 -16
  126. package/api/theme-edit/_preview.mjs +649 -152
  127. package/api/theme-edit/_project.d.mts +22 -1
  128. package/api/theme-edit/_project.mjs +83 -3
  129. package/api/theme-edit/_settings.d.mts +467 -42
  130. package/api/theme-edit/_settings.mjs +3527 -468
  131. package/api/theme-edit/_tables.d.mts +21 -0
  132. package/api/theme-edit/_tables.mjs +97 -3
  133. package/api/theme-edit/_vet.d.mts +31 -0
  134. package/api/theme-edit/_vet.mjs +114 -8
  135. package/api/theme-edit/theme-edit.type.d.mts +16 -2
  136. package/api/theme-edit/theme-edit.type.mjs +6 -3
  137. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  138. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  139. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  140. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  141. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  142. package/api/upgrade/run/run.mjs +4 -3
  143. package/assets/codemods/integration-discovery.mjs +2 -1
  144. package/assets/codemods/run-codemod.mjs +87 -7
  145. package/assets/codemods/transforms/next/index.mjs +11 -1
  146. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  147. package/assets/component-list.generated.json +1 -0
  148. package/assets/docs/author-a-theme.doc.mjs +1 -0
  149. package/assets/docs/theme.doc.dense.mjs +2 -2
  150. package/assets/docs/theme.doc.mjs +1 -1
  151. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  152. package/assets/docs/tree/checks.doc.mjs +1 -1
  153. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  154. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  155. package/assets/docs/tree/share-a-page.doc.mjs +157 -0
  156. package/assets/docs/tree/single-component.doc.mjs +4 -0
  157. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  158. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  159. package/assets/docs/use-a-theme.doc.mjs +1 -1
  160. package/assets/docs.generated.json +2 -2
  161. package/assets/search-catalog.generated.json +2 -0
  162. package/assets/self-audit.generated.json +1 -1
  163. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  164. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  165. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  166. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  167. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  168. package/assets/templates/components.generated.json +1 -1
  169. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  170. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
  171. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  172. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  173. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  174. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  175. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  176. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  177. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  178. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  179. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  180. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  181. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  182. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  183. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  184. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  185. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  186. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  187. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  188. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  189. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  190. package/assets/templates/pages/ide/page.tsx +24 -2
  191. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  192. package/assets/templates/pages/library/template.doc.mjs +4 -1
  193. package/assets/templates/pages/login/template.doc.mjs +2 -1
  194. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  195. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  196. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  197. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  198. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  199. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  200. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  201. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  202. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  203. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  204. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  205. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  206. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  207. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  208. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  209. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  210. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  211. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  212. package/assets/theme.template.ts +6 -0
  213. package/authoring/debug/parse.d.mts +3 -3
  214. package/authoring/doctypes/_schema.d.mts +3 -3
  215. package/authoring/doctypes/command/command.doc.mjs +1 -1
  216. package/authoring/doctypes/component/categories.d.mts +37 -0
  217. package/authoring/doctypes/component/categories.mjs +54 -0
  218. package/authoring/doctypes/template/template.doc.mjs +1 -1
  219. package/authoring/doctypes/template/type.ts +9 -0
  220. package/authoring/example/example.doc.d.mts +12 -0
  221. package/authoring/example/example.doc.mjs +69 -0
  222. package/authoring/example/preview.d.mts +92 -0
  223. package/authoring/example/preview.mjs +994 -0
  224. package/authoring/example/type.ts +102 -0
  225. package/authoring/index.d.mts +1 -0
  226. package/authoring/index.d.ts +12 -0
  227. package/authoring/index.mjs +3 -1
  228. package/clients/cli/bin/astryx.mjs +6 -9
  229. package/clients/cli/build-id.generated.json +1 -1
  230. package/clients/cli/commands/component.doc.mjs +1 -1
  231. package/clients/cli/commands/component.mjs +22 -3
  232. package/clients/cli/commands/docs.doc.mjs +7 -1
  233. package/clients/cli/commands/docs.mjs +3 -1
  234. package/clients/cli/commands/doctor.mjs +32 -14
  235. package/clients/cli/commands/experimental/render.mjs +42 -1
  236. package/clients/cli/commands/experimental/theme.mjs +573 -119
  237. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  238. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  239. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  240. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  241. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  242. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
  243. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  244. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  245. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  246. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  247. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  248. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  249. package/clients/cli/commands/search.doc.mjs +2 -1
  250. package/clients/cli/commands/search.mjs +6 -1
  251. package/clients/cli/commands/template.mjs +4 -2
  252. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  253. package/clients/cli/commands/theme.doc.mjs +1 -1
  254. package/clients/cli/commands/theme.mjs +718 -438
  255. package/clients/cli/commands/upgrade.mjs +42 -7
  256. package/clients/cli/index.mjs +1 -1
  257. package/clients/cli/lib/cli-error.mjs +2 -1
  258. package/clients/cli/lib/component-format.mjs +205 -98
  259. package/clients/cli/lib/hook-format.mjs +9 -19
  260. package/clients/cli/lib/json-shim.mjs +132 -24
  261. package/clients/cli/lib/manifest.mjs +3 -2
  262. package/clients/cli/manifest.generated.json +1 -1
  263. package/foundation/agent-docs/agent-docs.mjs +1 -1
  264. package/foundation/config/theme-state.d.mts +13 -1
  265. package/foundation/config/theme-state.mjs +47 -7
  266. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  267. package/foundation/discovery/component-discovery.d.mts +11 -0
  268. package/foundation/discovery/component-discovery.mjs +56 -8
  269. package/foundation/discovery/component-replacement.mjs +130 -1
  270. package/foundation/discovery/copied-passages.mjs +2 -1
  271. package/foundation/discovery/core-component-docs.d.mts +29 -0
  272. package/foundation/discovery/core-component-docs.mjs +83 -0
  273. package/foundation/discovery/doc-types.mjs +4 -3
  274. package/foundation/discovery/entry-name-files.d.mts +43 -0
  275. package/foundation/discovery/entry-name-files.mjs +264 -0
  276. package/foundation/discovery/hook-discovery.d.mts +8 -2
  277. package/foundation/discovery/hook-discovery.mjs +22 -8
  278. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  279. package/foundation/discovery/icon-set-checks.mjs +2 -1
  280. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  281. package/foundation/discovery/integration-doc-files.mjs +2 -1
  282. package/foundation/discovery/package-exports.d.mts +10 -0
  283. package/foundation/discovery/package-exports.mjs +56 -3
  284. package/foundation/discovery/prop-drift.mjs +9 -9
  285. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  286. package/foundation/discovery/runner-allowlist.mjs +2 -0
  287. package/foundation/discovery/stored-component-list.d.mts +43 -0
  288. package/foundation/discovery/stored-component-list.mjs +90 -0
  289. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  290. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  291. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  292. package/foundation/discovery/stored-self-audit.mjs +38 -18
  293. package/foundation/discovery/template-adapter.d.mts +53 -1
  294. package/foundation/discovery/template-adapter.mjs +176 -12
  295. package/foundation/discovery/template-icons.mjs +2 -1
  296. package/foundation/discovery/theme-discovery.mjs +31 -4
  297. package/foundation/discovery/theme-imports.d.mts +14 -0
  298. package/foundation/discovery/theme-imports.mjs +43 -1
  299. package/foundation/discovery/theming-targets.d.mts +6 -5
  300. package/foundation/discovery/theming-targets.mjs +31 -47
  301. package/foundation/doc-compiler/import.mjs +7 -1
  302. package/foundation/doc-compiler/inputs.mjs +3 -2
  303. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  304. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  305. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  306. package/foundation/env/semver.mjs +3 -1
  307. package/foundation/fonts/font-stylesheet.d.mts +38 -0
  308. package/foundation/fonts/font-stylesheet.mjs +141 -0
  309. package/foundation/fs/cache-eviction.d.mts +21 -0
  310. package/foundation/fs/cache-eviction.mjs +73 -0
  311. package/foundation/fs/exact-codec.d.mts +12 -2
  312. package/foundation/fs/exact-codec.mjs +23 -6
  313. package/foundation/fs/file-protection.mjs +4 -3
  314. package/foundation/fs/gather-cache.d.mts +62 -4
  315. package/foundation/fs/gather-cache.mjs +517 -91
  316. package/foundation/fs/jiti-cache.d.mts +19 -1
  317. package/foundation/fs/jiti-cache.mjs +130 -6
  318. package/foundation/fs/kept-tree.d.mts +60 -0
  319. package/foundation/fs/kept-tree.mjs +154 -0
  320. package/foundation/fs/listing-cache.d.mts +7 -0
  321. package/foundation/fs/listing-cache.mjs +10 -0
  322. package/foundation/fs/module-loader.d.mts +24 -2
  323. package/foundation/fs/module-loader.mjs +94 -21
  324. package/foundation/fs/paths.d.mts +18 -0
  325. package/foundation/fs/paths.mjs +15 -2
  326. package/foundation/fs/read-record.d.mts +9 -0
  327. package/foundation/fs/read-record.mjs +19 -11
  328. package/foundation/fs/stop-cleanup.d.mts +12 -0
  329. package/foundation/fs/stop-cleanup.mjs +66 -0
  330. package/foundation/identity/provider-identity.d.mts +6 -0
  331. package/foundation/identity/provider-identity.mjs +10 -1
  332. package/foundation/integrations/contribution-inventory.mjs +4 -3
  333. package/foundation/integrations/example-code.d.mts +63 -0
  334. package/foundation/integrations/example-code.mjs +416 -0
  335. package/foundation/integrations/public-imports.d.mts +9 -0
  336. package/foundation/integrations/public-imports.mjs +3 -2
  337. package/foundation/integrations/validate-contributions.mjs +17 -45
  338. package/foundation/render/embedded-files.d.mts +6 -0
  339. package/foundation/render/embedded-files.mjs +25 -5
  340. package/foundation/render/embedded-imports.d.mts +39 -7
  341. package/foundation/render/embedded-imports.mjs +66 -27
  342. package/foundation/render/file-header.d.mts +66 -0
  343. package/foundation/render/file-header.mjs +118 -0
  344. package/foundation/render/host-answer.d.mts +18 -0
  345. package/foundation/render/host-answer.mjs +46 -0
  346. package/foundation/render/host-exit.d.mts +1 -0
  347. package/foundation/render/host-exit.mjs +6 -1
  348. package/foundation/render/html-reader.d.mts +55 -2
  349. package/foundation/render/html-reader.mjs +145 -26
  350. package/foundation/render/markup-edits.d.mts +57 -0
  351. package/foundation/render/markup-edits.mjs +182 -0
  352. package/foundation/render/page-host.mjs +29 -12
  353. package/foundation/render/page-worker.mjs +121 -13
  354. package/foundation/render/picture-chrome.d.mts +4 -0
  355. package/foundation/render/picture-chrome.mjs +185 -0
  356. package/foundation/render/picture-playwright.d.mts +4 -0
  357. package/foundation/render/picture-playwright.mjs +34 -0
  358. package/foundation/render/rebuild.mjs +2 -1
  359. package/foundation/render/render-page.d.mts +35 -3
  360. package/foundation/render/render-page.mjs +641 -96
  361. package/foundation/render/source-block.d.mts +85 -6
  362. package/foundation/render/source-block.mjs +211 -20
  363. package/foundation/render/ts-paths.d.mts +69 -6
  364. package/foundation/render/ts-paths.mjs +326 -40
  365. package/foundation/response/error-codes.d.mts +3 -1
  366. package/foundation/response/error-codes.d.ts +1 -0
  367. package/foundation/response/error-codes.doc.mjs +12 -1
  368. package/foundation/response/error-codes.mjs +11 -1
  369. package/foundation/response/response-types.doc.mjs +2 -2
  370. package/foundation/text/compare-text.d.mts +14 -0
  371. package/foundation/text/compare-text.mjs +68 -0
  372. package/foundation/text/css-escape.d.mts +18 -0
  373. package/foundation/text/css-escape.mjs +35 -0
  374. package/foundation/text/string-utils.d.mts +3 -2
  375. package/foundation/text/string-utils.mjs +18 -4
  376. package/foundation/text/suggest-order.d.mts +9 -0
  377. package/foundation/text/suggest-order.mjs +15 -1
  378. package/foundation/xle/expand.mjs +2 -1
  379. package/host/index.mjs +8 -6
  380. package/package.json +7 -6
@@ -57,6 +57,16 @@ export type CoreInterception = {
57
57
  * - Exact authored `extends` value.
58
58
  */
59
59
  parentOf: (theme: any) => any;
60
+ /**
61
+ * - The raw `defineTheme()` argument
62
+ * that produced a theme, or undefined.
63
+ */
64
+ inputOf: (theme: any) => any;
65
+ /**
66
+ * - Every `defineTheme()` argument in call order,
67
+ * recorded before Core reads it, so an input Core refuses is seen too.
68
+ */
69
+ inputs: any[];
60
70
  /**
61
71
  * - Every raw input that fed a
62
72
  * theme, following its own `extends` chain and spread provenance.
@@ -95,6 +95,10 @@ const retainedLineageByReference = new WeakMap();
95
95
  * @property {(theme: any) => boolean} observed - Whether authored input was captured.
96
96
  * @property {(theme: any) => void} retain - Retain capture before stripping.
97
97
  * @property {(theme: any) => any} parentOf - Exact authored `extends` value.
98
+ * @property {(theme: any) => any} inputOf - The raw `defineTheme()` argument
99
+ * that produced a theme, or undefined.
100
+ * @property {any[]} inputs - Every `defineTheme()` argument in call order,
101
+ * recorded before Core reads it, so an input Core refuses is seen too.
98
102
  * @property {(theme: any) => any[]} lineageOf - Every raw input that fed a
99
103
  * theme, following its own `extends` chain and spread provenance.
100
104
  * @property {(theme: any) => any[]} unobservedIn - Lineage members this
@@ -243,6 +247,8 @@ function mergeGenerativeAxes(inherited, own) {
243
247
  export function interceptCore(coreThemeModule, coreRootModule) {
244
248
  /** @type {WeakMap<object, ThemeLineage>} */
245
249
  const byReference = new WeakMap();
250
+ /** @type {any[]} */
251
+ const inputs = [];
246
252
 
247
253
  /** @param {any} value @param {ThemeLineage} lineage */
248
254
  const mark = (value, lineage) => {
@@ -281,6 +287,7 @@ export function interceptCore(coreThemeModule, coreRootModule) {
281
287
  ...namespace,
282
288
  /** @param {any} input */
283
289
  defineTheme(input) {
290
+ inputs.push(input);
284
291
  const result = real.call(namespace, input);
285
292
  mark(result, {input, result});
286
293
  return result;
@@ -317,6 +324,9 @@ export function interceptCore(coreThemeModule, coreRootModule) {
317
324
 
318
325
  return {
319
326
  modules,
327
+ inputs,
328
+ // prettier-ignore
329
+ inputOf(theme) { return lineageFor(theme)?.input; },
320
330
 
321
331
  // prettier-ignore
322
332
  observed(theme) { return wasObserved(theme, byReference); },
@@ -1,17 +1,49 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The font families a CSS font-family value names, without generics,
6
+ * CSS-wide keywords or `var()` references (system families included).
7
+ * @param {string} value
8
+ * @returns {string[]}
9
+ */
10
+ export function namedFontFamilies(value: string): string[];
11
+ /**
12
+ * The family list of a CSS `font` shorthand: what follows its size (and
13
+ * line height), as the shorthand's grammar puts it last. A system font
14
+ * keyword (`caption`, `menu`, ...) or a value with no size names none.
15
+ * @param {string} value
16
+ * @returns {string}
17
+ */
18
+ export function fontShorthandFamilyList(value: string): string;
19
+ /**
20
+ * A font value with each `var(--x, ...)` it reads replaced by the values
21
+ * `lookup` gives for `--x` (each of them, when several places set it): the
22
+ * family lists the theme's own values make it show. A `var()` the theme
23
+ * gives no value reads as nothing, its fallback included (the property may
24
+ * come from the app, so the fallback is not a family this theme declares).
25
+ * @param {string} value
26
+ * @param {(name: string) => string[]} lookup
27
+ * @param {number} [depth]
28
+ * @returns {string[]}
29
+ */
30
+ export function expandFontVars(value: string, lookup: (name: string) => string[], depth?: number): string[];
4
31
  /**
5
32
  * Collect the font families a resolved theme names but does not load —
6
- * every `--font-family-*` token plus every component-override `fontFamily`,
7
- * minus generics, CSS-wide keywords, `var()` references, and known system
33
+ * every `--font-family-*` token plus every component-override `fontFamily`
34
+ * and the families of a `font` shorthand, each `var()` of the theme's own
35
+ * properties read as their values,
36
+ * minus generics, CSS-wide keywords, other `var()` references, and known system
8
37
  * families. Source order, first-seen casing, deduped case-insensitively.
9
38
  *
10
- * @param {{tokens?: Record<string, string>, components?: object, typography?: {body?: {family?: string, fallbacks?: string}, heading?: {family?: string, fallbacks?: string}, code?: {family?: string, fallbacks?: string}}}} resolvedTheme
39
+ * @param {{tokens?: Record<string, string>, localTokens?: Record<string, string>, components?: object, typography?: {body?: {family?: string, fallbacks?: string}, heading?: {family?: string, fallbacks?: string}, code?: {family?: string, fallbacks?: string}}}} resolvedTheme
40
+ * @param {{tokens?: Record<string, string>, localTokens?: Record<string, string>}} [outer]
41
+ * the theme a rule's values sit in, whose own properties they read too
11
42
  * @returns {string[]}
12
43
  */
13
44
  export function collectUnloadedFonts(resolvedTheme: {
14
45
  tokens?: Record<string, string>;
46
+ localTokens?: Record<string, string>;
15
47
  components?: object;
16
48
  typography?: {
17
49
  body?: {
@@ -27,6 +59,9 @@ export function collectUnloadedFonts(resolvedTheme: {
27
59
  fallbacks?: string;
28
60
  };
29
61
  };
62
+ }, outer?: {
63
+ tokens?: Record<string, string>;
64
+ localTokens?: Record<string, string>;
30
65
  }): string[];
31
66
  /**
32
67
  * Render the human fix printed after the install instructions: which fonts
@@ -35,17 +70,21 @@ export function collectUnloadedFonts(resolvedTheme: {
35
70
  *
36
71
  * @param {string} themeName
37
72
  * @param {string[]} families
73
+ * @param {(families: string[]) => string} [recipe] the caller's own way to
74
+ * load them, in place of the generic recipe
38
75
  * @returns {string}
39
76
  */
40
- export function formatFontLoadingHelp(themeName: string, families: string[]): string;
77
+ export function formatFontLoadingHelp(themeName: string, families: string[], recipe?: (families: string[]) => string): string;
41
78
  /**
42
79
  * The same fix once for a batch build: each family the built themes name but
43
80
  * do not load, with the themes that name it, then one recipe for all of them.
44
81
  *
45
82
  * @param {Array<{family: string, themes: string[]}>} entries
83
+ * @param {(families: string[]) => string} [recipe] the caller's own way to
84
+ * load them, in place of the generic recipe
46
85
  * @returns {string}
47
86
  */
48
87
  export function formatBatchFontLoadingHelp(entries: Array<{
49
88
  family: string;
50
89
  themes: string[];
51
- }>): string;
90
+ }>, recipe?: (families: string[]) => string): string;
@@ -25,6 +25,7 @@
25
25
  * beyond the CLI invocation the human help names (formatCliCommand), so the
26
26
  * `--json` receipt and the human output share one source of truth.
27
27
  */
28
+ import {cssUnescape} from '../../../foundation/text/css-escape.mjs';
28
29
  import {formatCliCommand} from '../../../foundation/env/package-manager.mjs';
29
30
 
30
31
  // font-family values that never need loading: CSS generic families, the ui-*
@@ -60,6 +61,11 @@ const SYSTEM_FAMILIES = new Set([
60
61
  'segoe ui',
61
62
  'segoe ui emoji',
62
63
  'segoe ui symbol',
64
+ // The weights Windows ships as families of their own.
65
+ 'segoe ui light',
66
+ 'segoe ui semilight',
67
+ 'segoe ui semibold',
68
+ 'segoe ui black',
63
69
  'roboto',
64
70
  'helvetica',
65
71
  'helvetica neue',
@@ -122,31 +128,119 @@ function splitFamilies(value) {
122
128
  // /s: a quoted name may span lines (template-literal theme sources).
123
129
  const quoted = /^(["']).*\1$/s.test(name);
124
130
  if (quoted) name = name.slice(1, -1);
125
- name = name.trim().replace(/\s+/g, ' ');
131
+ // The name as CSS reads it (`Gill\ Sans` is Gill Sans).
132
+ name = cssUnescape(name).trim().replace(/\s+/g, ' ');
126
133
  if (!name || (!quoted && /[()]/.test(name))) continue;
127
134
  families.push(name);
128
135
  }
129
136
  return families;
130
137
  }
131
138
 
139
+ /**
140
+ * The font families a CSS font-family value names, without generics,
141
+ * CSS-wide keywords or `var()` references (system families included).
142
+ * @param {string} value
143
+ * @returns {string[]}
144
+ */
145
+ export function namedFontFamilies(value) {
146
+ return splitFamilies(value).filter(
147
+ family => !GENERIC_KEYWORDS.has(family.toLowerCase()),
148
+ );
149
+ }
150
+
151
+ /**
152
+ * The family list of a CSS `font` shorthand: what follows its size (and
153
+ * line height), as the shorthand's grammar puts it last. A system font
154
+ * keyword (`caption`, `menu`, ...) or a value with no size names none.
155
+ * @param {string} value
156
+ * @returns {string}
157
+ */
158
+ export function fontShorthandFamilyList(value) {
159
+ // A size has a unit (a bare number is a weight); a line height may
160
+ // follow it after a slash.
161
+ const size =
162
+ /(?<=^|\s)(?:[+-]?(?:\d+\.?\d*|\.\d+)(?:[a-z]+|%)|xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller|(?:calc|clamp|min|max|var)\([^)]*\))(?:\s*\/\s*\S+)?\s+(?=\S)/i;
163
+ // The first size: a family name after it may hold anything.
164
+ const m = size.exec(String(value));
165
+ return m ? String(value).slice(m.index + m[0].length) : '';
166
+ }
167
+
168
+ /**
169
+ * A font value with each `var(--x, ...)` it reads replaced by the values
170
+ * `lookup` gives for `--x` (each of them, when several places set it): the
171
+ * family lists the theme's own values make it show. A `var()` the theme
172
+ * gives no value reads as nothing, its fallback included (the property may
173
+ * come from the app, so the fallback is not a family this theme declares).
174
+ * @param {string} value
175
+ * @param {(name: string) => string[]} lookup
176
+ * @param {number} [depth]
177
+ * @returns {string[]}
178
+ */
179
+ export function expandFontVars(value, lookup, depth = 0) {
180
+ const text = String(value);
181
+ const at = text.search(/var\(\s*--/i);
182
+ if (at < 0 || depth > 8) return [text];
183
+ // The var() call, to its matching parenthesis.
184
+ let level = 0;
185
+ let end = -1;
186
+ for (let i = at + 3; i < text.length; i++) {
187
+ if (text[i] === '(') level++;
188
+ else if (text[i] === ')' && --level === 0) {
189
+ end = i;
190
+ break;
191
+ }
192
+ }
193
+ if (end < 0) return [text];
194
+ const inner = text.slice(at + 4, end);
195
+ const comma = inner.indexOf(',');
196
+ const name = (comma < 0 ? inner : inner.slice(0, comma)).trim();
197
+ // A fallback is not a family this theme declares: the property may come
198
+ // from the app.
199
+ const given = lookup(name);
200
+ const choices = given.length > 0 ? given : [''];
201
+ return choices
202
+ .flatMap(choice =>
203
+ expandFontVars(
204
+ text.slice(0, at) + choice + text.slice(end + 1),
205
+ lookup,
206
+ depth + 1,
207
+ ),
208
+ )
209
+ .slice(0, 32);
210
+ }
211
+
132
212
  /**
133
213
  * Collect the font families a resolved theme names but does not load —
134
- * every `--font-family-*` token plus every component-override `fontFamily`,
135
- * minus generics, CSS-wide keywords, `var()` references, and known system
214
+ * every `--font-family-*` token plus every component-override `fontFamily`
215
+ * and the families of a `font` shorthand, each `var()` of the theme's own
216
+ * properties read as their values,
217
+ * minus generics, CSS-wide keywords, other `var()` references, and known system
136
218
  * families. Source order, first-seen casing, deduped case-insensitively.
137
219
  *
138
- * @param {{tokens?: Record<string, string>, components?: object, typography?: {body?: {family?: string, fallbacks?: string}, heading?: {family?: string, fallbacks?: string}, code?: {family?: string, fallbacks?: string}}}} resolvedTheme
220
+ * @param {{tokens?: Record<string, string>, localTokens?: Record<string, string>, components?: object, typography?: {body?: {family?: string, fallbacks?: string}, heading?: {family?: string, fallbacks?: string}, code?: {family?: string, fallbacks?: string}}}} resolvedTheme
221
+ * @param {{tokens?: Record<string, string>, localTokens?: Record<string, string>}} [outer]
222
+ * the theme a rule's values sit in, whose own properties they read too
139
223
  * @returns {string[]}
140
224
  */
141
- export function collectUnloadedFonts(resolvedTheme) {
225
+ export function collectUnloadedFonts(resolvedTheme, outer = undefined) {
142
226
  const seen = new Set();
143
227
  /** @type {string[]} */
144
228
  const unloaded = [];
229
+ // A family the theme holds in one of its own properties, read by var(),
230
+ // is a family it names.
231
+ /** @param {string} name @returns {string[]} */
232
+ const lookup = name =>
233
+ [resolvedTheme, outer].flatMap(at =>
234
+ [at?.tokens?.[name], at?.localTokens?.[name]].filter(
235
+ v => typeof v === 'string',
236
+ ),
237
+ );
145
238
 
146
239
  /** @param {unknown} value */
147
240
  const consider = value => {
148
241
  if (typeof value !== 'string') return;
149
- for (const family of splitFamilies(value)) {
242
+ const families = expandFontVars(value, lookup).flatMap(splitFamilies);
243
+ for (const family of families) {
150
244
  const key = family.toLowerCase();
151
245
  if (GENERIC_KEYWORDS.has(key) || SYSTEM_FAMILIES.has(key)) continue;
152
246
  if (seen.has(key)) continue;
@@ -185,6 +279,9 @@ export function collectUnloadedFonts(resolvedTheme) {
185
279
  if (!node || typeof node !== 'object') return;
186
280
  for (const [key, value] of Object.entries(node)) {
187
281
  if (key === 'fontFamily') consider(value);
282
+ // A `font` shorthand names its families last.
283
+ else if (key === 'font' && typeof value === 'string')
284
+ consider(fontShorthandFamilyList(value));
188
285
  else walk(value);
189
286
  }
190
287
  };
@@ -200,13 +297,19 @@ export function collectUnloadedFonts(resolvedTheme) {
200
297
  *
201
298
  * @param {string} themeName
202
299
  * @param {string[]} families
300
+ * @param {(families: string[]) => string} [recipe] the caller's own way to
301
+ * load them, in place of the generic recipe
203
302
  * @returns {string}
204
303
  */
205
- export function formatFontLoadingHelp(themeName, families) {
304
+ export function formatFontLoadingHelp(
305
+ themeName,
306
+ families,
307
+ recipe = fontLoadingRecipe,
308
+ ) {
206
309
  const named = families.map(f => `"${f}"`).join(', ');
207
310
  return `
208
311
  [note] Theme "${themeName}" names fonts it does not load: ${named}
209
- ${fontLoadingRecipe(families)}`;
312
+ ${recipe(families)}`;
210
313
  }
211
314
 
212
315
  /**
@@ -214,16 +317,21 @@ ${fontLoadingRecipe(families)}`;
214
317
  * do not load, with the themes that name it, then one recipe for all of them.
215
318
  *
216
319
  * @param {Array<{family: string, themes: string[]}>} entries
320
+ * @param {(families: string[]) => string} [recipe] the caller's own way to
321
+ * load them, in place of the generic recipe
217
322
  * @returns {string}
218
323
  */
219
- export function formatBatchFontLoadingHelp(entries) {
324
+ export function formatBatchFontLoadingHelp(
325
+ entries,
326
+ recipe = fontLoadingRecipe,
327
+ ) {
220
328
  const named = entries
221
329
  .map(({family, themes}) => ` "${family}" (${themes.join(', ')})`)
222
330
  .join('\n');
223
331
  return `
224
332
  [note] The built themes name fonts they do not load:
225
333
  ${named}
226
- ${fontLoadingRecipe(entries.map(entry => entry.family))}`;
334
+ ${recipe(entries.map(entry => entry.family))}`;
227
335
  }
228
336
 
229
337
  /**
@@ -160,6 +160,19 @@ export async function resolveIconImports(
160
160
  const defaultName = staticSlots ? 'themeComponentIcons' : 'themeIcons';
161
161
  /** @param {string} [name] @param {string} [reason] @returns {never} */
162
162
  const invalidRegistry = (name, reason) => registryError(name, reason, field);
163
+ /**
164
+ * A theme written as an expression the build does not follow (a call to
165
+ * a helper, a conditional): where its icons come from cannot be read.
166
+ * @param {any} node
167
+ * @returns {never}
168
+ */
169
+ const untraceableTheme = node => {
170
+ throw new AstryxError(
171
+ `The build carries a theme's ${field === 'icons' ? 'icon registry' : 'componentIcons'} from the source that writes it, and follows a theme only through its name, an import of it, or defineTheme({...}); here a theme is written as ${node?.type === 'CallExpression' ? 'a call to a helper' : node?.type === 'ConditionalExpression' ? 'a conditional' : 'an expression'}, which it cannot follow. Write each theme as defineTheme({...}), and the theme it extends by its name (extends: neutralTheme).`,
172
+ undefined,
173
+ ERROR_CODES.ERR_THEME_INVALID,
174
+ );
175
+ };
163
176
 
164
177
  if (exportName === undefined) {
165
178
  if (!hasIcons) return null;
@@ -281,8 +294,14 @@ export async function resolveIconImports(
281
294
  module.aliases.set(name, original);
282
295
  }
283
296
  if (item.id.type !== 'Identifier') continue;
297
+ // A `let` or `var` given a value and never assigned again holds
298
+ // that value as a `const` does (an assignment marks it mutated,
299
+ // below); one declared without a value is not followed.
284
300
  module.bindings.set(item.id.name, {
285
- kind: declaration.kind === 'const' ? 'const' : 'unsupported',
301
+ kind:
302
+ declaration.kind === 'const' || item.init
303
+ ? 'const'
304
+ : 'unsupported',
286
305
  node: item.init,
287
306
  });
288
307
  if (statement.type === 'ExportNamedDeclaration') {
@@ -355,14 +374,27 @@ export async function resolveIconImports(
355
374
  return module;
356
375
  }
357
376
 
358
- /** @param {any} module @param {string} name */
359
- function checkedBinding(module, name) {
360
- if (module.mutated.has(name))
377
+ /**
378
+ * @param {any} module
379
+ * @param {string} name
380
+ * @param {'registry' | 'theme'} [role] what the name stands for: a theme
381
+ * is refused as a theme the build cannot follow, never as a registry
382
+ * the theme sets
383
+ */
384
+ function checkedBinding(module, name, role = 'registry') {
385
+ const binding = module.bindings.get(name);
386
+ const mutated = module.mutated.has(name);
387
+ if (role === 'theme' && (mutated || binding?.kind === 'unsupported'))
388
+ throw new AstryxError(
389
+ `The build carries a theme's ${field === 'icons' ? 'icon registry' : 'componentIcons'} from the source that writes it, and follows a theme through a binding only while it keeps the value it was declared with; ${name} ${mutated ? 'is assigned again, or passed to code that may change it' : 'is declared without a value'}. Declare it once with its theme (export const ${name} = defineTheme({...})).`,
390
+ undefined,
391
+ ERROR_CODES.ERR_THEME_INVALID,
392
+ );
393
+ if (mutated)
361
394
  invalidRegistry(
362
395
  name,
363
396
  'The referenced binding is mutated or passed to unsupported code.',
364
397
  );
365
- const binding = module.bindings.get(name);
366
398
  if (!binding || binding.kind === 'unsupported') invalidRegistry(name);
367
399
  return binding;
368
400
  }
@@ -723,7 +755,7 @@ export async function resolveIconImports(
723
755
  node = unwrap(node);
724
756
  if (node?.type === 'Identifier') {
725
757
  return guarded(`${module.filename}:fields:${node.name}`, async () => {
726
- const binding = checkedBinding(module, node.name);
758
+ const binding = checkedBinding(module, node.name, 'theme');
727
759
  if (binding.kind === 'const') return fields(module, binding.node);
728
760
  return referenceFields(importedReference(module, binding));
729
761
  });
@@ -786,7 +818,7 @@ export async function resolveIconImports(
786
818
  node = unwrap(node);
787
819
  if (node?.type === 'Identifier') {
788
820
  return guarded(`${module.filename}:theme:${node.name}`, async () => {
789
- const binding = checkedBinding(module, node.name);
821
+ const binding = checkedBinding(module, node.name, 'theme');
790
822
  return binding.kind === 'const'
791
823
  ? theme(module, binding.node, rejectOpaque)
792
824
  : themeReference(importedReference(module, binding), rejectOpaque);
@@ -797,10 +829,20 @@ export async function resolveIconImports(
797
829
  if (ref) return themeReference(ref, rejectOpaque);
798
830
  }
799
831
  if (node?.type === 'CallExpression') {
800
- if (!isDefineTheme(module, node.callee) || node.arguments.length !== 1)
801
- invalidRegistry();
832
+ if (!isDefineTheme(module, node.callee)) untraceableTheme(node);
833
+ if (node.arguments.length !== 1) invalidRegistry();
802
834
  node = unwrap(node.arguments[0]);
803
835
  }
836
+ // Any other expression (a helper's call, a conditional) is a theme the
837
+ // build cannot read from the source: it does not say the theme sets a
838
+ // registry, only that it cannot be followed.
839
+ if (
840
+ node &&
841
+ node.type !== 'ObjectExpression' &&
842
+ node.type !== 'Identifier' &&
843
+ node.type !== 'MemberExpression'
844
+ )
845
+ untraceableTheme(node);
804
846
  const config = await fields(module, node);
805
847
  const baseField = config.get('extends');
806
848
  // A built module keeps its functions in `__icons` (or `__componentIcons`)
@@ -137,6 +137,12 @@ export type ThemeAppEntry = {
137
137
  */
138
138
  fontStylesheet?: string | undefined;
139
139
  source: "bundled" | "package" | "local";
140
+ /**
141
+ * the one color mode the theme has, when its
142
+ * built module exports one (`colorModes`); the generated module then lists
143
+ * it in `themeModes`. Absent for a theme with both modes.
144
+ */
145
+ mode?: "light" | "dark" | undefined;
140
146
  };
141
147
  /**
142
148
  * astryx --json theme add <slug> [--import] / remove / use
@@ -149,6 +155,9 @@ export type ThemeAppResponse = {
149
155
  * `notes` is present only when the command did more than its change says:
150
156
  * it chose between a local and a package theme with one slug, replaced a
151
157
  * recorded owner, or dropped a recorded theme whose source is gone.
158
+ * `change.wireModes` is present when the module lists a theme's one color
159
+ * mode (`themeModes`) for the first time after the app was wired: the app's
160
+ * `Theme` then takes `mode={themeModes[defaultThemeSlug] ?? 'system'}`.
152
161
  */
153
162
  package?: string | undefined;
154
163
  data: {
@@ -160,6 +169,7 @@ export type ThemeAppResponse = {
160
169
  slug: string;
161
170
  changed: boolean;
162
171
  firstAdd: boolean;
172
+ wireModes?: true;
163
173
  };
164
174
  notes?: string[];
165
175
  };
@@ -92,6 +92,9 @@
92
92
  * @property {string} stylesheet production stylesheet import
93
93
  * @property {string} [fontStylesheet] package-owned font stylesheet import
94
94
  * @property {'bundled'|'package'|'local'} source
95
+ * @property {'light'|'dark'} [mode] the one color mode the theme has, when its
96
+ * built module exports one (`colorModes`); the generated module then lists
97
+ * it in `themeModes`. Absent for a theme with both modes.
95
98
  */
96
99
 
97
100
  /**
@@ -103,7 +106,10 @@
103
106
  * `notes` is present only when the command did more than its change says:
104
107
  * it chose between a local and a package theme with one slug, replaced a
105
108
  * recorded owner, or dropped a recorded theme whose source is gone.
106
- * @property {{themes: ThemeAppEntry[], default: string, modulePath: string, change: {action: 'add'|'remove'|'use', slug: string, changed: boolean, firstAdd: boolean}, notes?: string[]}} data
109
+ * `change.wireModes` is present when the module lists a theme's one color
110
+ * mode (`themeModes`) for the first time after the app was wired: the app's
111
+ * `Theme` then takes `mode={themeModes[defaultThemeSlug] ?? 'system'}`.
112
+ * @property {{themes: ThemeAppEntry[], default: string, modulePath: string, change: {action: 'add'|'remove'|'use', slug: string, changed: boolean, firstAdd: boolean, wireModes?: true}, notes?: string[]}} data
107
113
  */
108
114
 
109
115
  /**
@@ -21,6 +21,16 @@ export function themeEditHow(subject: string, options?: import("./theme-edit.typ
21
21
  * @param {string} cwd
22
22
  */
23
23
  export function projectRoot(cwd: string): string;
24
+ /**
25
+ * The preview commands in a line, rebased from the project root onto the
26
+ * folder the command ran in: each `--path` and each `preview app` folder,
27
+ * so a pointer works where it is printed (in a refusal, a `see` line, a
28
+ * note). A folder that comes out starting with `-` goes after `--`.
29
+ * @param {string} line
30
+ * @param {string} root
31
+ * @param {string} from
32
+ */
33
+ export function previewCommandsFrom(line: string, root: string, from: string): string;
24
34
  /**
25
35
  * A clearer refusal for a theme the editor made, named to list, add, use,
26
36
  * remove or eject: those commands work on package themes, and the editor
@@ -30,6 +40,25 @@ export function projectRoot(cwd: string): string;
30
40
  * @returns {AstryxError | null}
31
41
  */
32
42
  export function editorThemeRefusal(err: AstryxError, cwd: string): AstryxError | null;
43
+ /**
44
+ * The editor themes of the app the folder `cwd` is in, by name; none when
45
+ * the folder is in no app or its themes cannot be read.
46
+ * @param {string} cwd
47
+ * @returns {string[]}
48
+ */
49
+ export function editorThemesAt(cwd: string): string[];
50
+ /**
51
+ * A refused compile whose first suggestion is another compile: that compile
52
+ * is run through compile's own checks before it is offered (in memory,
53
+ * nothing built), and each repair a refusal of it offers is folded into the
54
+ * one line. An --out outside the working folder is dropped, and the reason
55
+ * says why; when the rest cannot be repaired, the reason says so. A line
56
+ * that starts with `cd` runs elsewhere, so it is not checked from here.
57
+ * @param {AstryxError} err
58
+ * @param {string} cwd
59
+ * @returns {Promise<AstryxError>}
60
+ */
61
+ export function editorFollowCompile(err: AstryxError, cwd: string): Promise<AstryxError>;
33
62
  /**
34
63
  * A refusal before `compile` runs on an editor theme's files, or null: the
35
64
  * editor's generated settings are not a theme source, `--family` does not
@@ -48,17 +77,98 @@ export function editorCompileProblem(files: string[], { cwd, check, family, icon
48
77
  iconsSpecifier?: string;
49
78
  out?: string;
50
79
  }): Promise<AstryxError | null>;
80
+ /**
81
+ * For `compile`, once its outputs are written: write each held editor
82
+ * theme's app copy now, and say per file what the write did (`appCopy` on
83
+ * a first write, `appCopyStale` when something keeps the copy behind), so
84
+ * the JSON result carries what the text says.
85
+ * @param {string[]} files
86
+ * @param {string} cwd
87
+ * @returns {Promise<Record<string, Record<string, unknown>>>}
88
+ */
89
+ export function editorAfterBuild(files: string[], cwd: string): Promise<Record<string, Record<string, unknown>>>;
51
90
  /**
52
91
  * Hold the theme lock of every editor theme among the files while
53
92
  * `compile` builds or checks them, so it never reads a change half
54
93
  * written. Resolves to the release.
55
94
  * @param {string[]} files
56
- * @param {{cwd: string}} options
95
+ * @param {{cwd: string, check?: boolean, out?: string}} options
57
96
  * @returns {Promise<() => Promise<void>>}
58
97
  */
59
- export function editorThemeHold(files: string[], { cwd }: {
98
+ export function editorThemeHold(files: string[], { cwd, check, out }: {
60
99
  cwd: string;
100
+ check?: boolean;
101
+ out?: string;
61
102
  }): Promise<() => Promise<void>>;
103
+ /**
104
+ * For `compile` of an editor theme's own source: how the app takes the
105
+ * theme, in place of importing the build's own outputs. The app takes its
106
+ * app copy (src/themes/<t>/, written after every build, with the font
107
+ * stylesheet that loads the theme's fonts), which `theme add` wires in.
108
+ * Null for any other file.
109
+ * @param {string} file the path as given
110
+ * @param {string} cwd
111
+ * @returns {string | null}
112
+ */
113
+ export function editorInstall(file: string, cwd: string): string | null;
114
+ /**
115
+ * For `compile` of an editor theme's own source: how to load a family the
116
+ * build names, as the editor says it (the app copy imports a family's
117
+ * installed Fontsource package); null for any other file.
118
+ * @param {string} file the path as given
119
+ * @param {string} cwd
120
+ * @returns {import('../theme/build/build.mjs').FontHelp | null}
121
+ */
122
+ export function editorFontHelp(file: string, cwd: string): import("../theme/build/build.mjs").FontHelp | null;
123
+ /**
124
+ * For `compile`: the path an editor theme's own file builds under when it
125
+ * was named through a link (its real path, which every output's header
126
+ * names and `--check` compares); null for any other file.
127
+ * @param {string} file the path as given
128
+ * @param {string} cwd
129
+ * @returns {string | null}
130
+ */
131
+ export function editorSourcePath(file: string, cwd: string): string | null;
132
+ /**
133
+ * For `compile` of an editor theme: `appCopyStale` for its result data when
134
+ * the app copy is behind (the same line set and show give), or
135
+ * `appCopySkipped` when --out builds elsewhere (neither themes/<theme>/ nor
136
+ * the copy is written or checked); null for any other file or a current
137
+ * copy.
138
+ * @param {string} file the path as given
139
+ * @param {string} cwd
140
+ * @param {{check: boolean, upToDate?: boolean, out?: string, iconsSpecifier?: string}} opts
141
+ * `upToDate`: the check's own verdict on the theme's outputs
142
+ * @returns {Promise<Record<string, unknown> | null>}
143
+ */
144
+ export function editorBuildExtra(file: string, cwd: string, opts: {
145
+ check: boolean;
146
+ upToDate?: boolean;
147
+ out?: string;
148
+ iconsSpecifier?: string;
149
+ }): Promise<Record<string, unknown> | null>;
150
+ /**
151
+ * For `compile` of an editor theme's own source (themes/<t>/<t>.theme.ts):
152
+ * the one color mode a light-only or dark-only theme has, which its source
153
+ * cannot say, for the build to write into the built module. Null for any
154
+ * other file (the app copy's source re-exports it from its build).
155
+ * @param {string} file the path as given
156
+ * @param {string} cwd
157
+ * @returns {['light'] | ['dark'] | null}
158
+ */
159
+ export function editorColorModes(file: string, cwd: string): ["light"] | ["dark"] | null;
160
+ /**
161
+ * For `compile` of an editor theme (themes/<t>/ or its app copy's source):
162
+ * whether a font family is loaded by the app copy's font stylesheet as
163
+ * this compile writes it (src/themes/<t>/<t>.fonts.css, from the fonts the
164
+ * theme loads now: an @fontsource package by its name, a stylesheet by the
165
+ * `family=` it requests), so the build's "named but not loaded" notice
166
+ * leaves it out. Null for any other file.
167
+ * @param {string} file the path as given
168
+ * @param {string} cwd
169
+ * @returns {Promise<((family: string) => boolean) | null>}
170
+ */
171
+ export function editorLoadedFonts(file: string, cwd: string): Promise<((family: string) => boolean) | null>;
62
172
  /**
63
173
  * For `compile` of a file that is not there: when it is an editor theme's
64
174
  * own source (`themes/<t>/<t>.theme.ts` beside its settings), the command
@@ -83,11 +193,9 @@ export function editorThemeTemplate(options: {
83
193
  cwd?: string;
84
194
  }): import("../theme/theme.type.mjs").ThemeTemplateResponse;
85
195
  export { parsePoints } from "./_how.mjs";
86
- export { newFlagList } from "./_edit.mjs";
87
196
  export function builtInThemes(): string[];
88
197
  export function editorBaseIn(slug: string | null | undefined, cwd: string): string;
89
198
  export function showSections(): string[];
90
- export { dialValueFits } from "./_settings.mjs";
91
199
  /** @type {typeof edit.themeEditNew} */
92
200
  export const themeEditNew: typeof edit.themeEditNew;
93
201
  /** @type {typeof edit.themeEditSet} */
@@ -112,3 +220,6 @@ export const themeEditPreviewRemove: typeof preview.themeEditPreviewRemove;
112
220
  import { AstryxError } from '../error.mjs';
113
221
  import * as edit from './_edit.mjs';
114
222
  import * as preview from './_preview-app.mjs';
223
+ export { newFlagList, checkedChangeLine as editorCheckedLine, checkedNewLines as editorCheckedNewLines } from "./_edit.mjs";
224
+ export { dialValueFits, usableNewName as editorFreeName } from "./_settings.mjs";
225
+ export { booleanWord, typoNear, typoOf } from "./_normal.mjs";