@astryxdesign/cli 0.7.17 → 0.7.18-canary.g32556bb

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 (261) hide show
  1. package/README.md +1 -1
  2. package/api/discover/_adapter.d.mts +7 -5
  3. package/api/discover/_adapter.mjs +12 -11
  4. package/api/docs/_adapter.d.mts +19 -2
  5. package/api/docs/_adapter.mjs +66 -5
  6. package/api/doctor/_adapter.d.mts +11 -62
  7. package/api/doctor/_adapter.mjs +242 -472
  8. package/api/doctor/doctor.d.mts +1 -1
  9. package/api/doctor/doctor.mjs +3 -3
  10. package/api/doctor/theme-checks.mjs +37 -45
  11. package/api/error.d.mts +21 -0
  12. package/api/error.mjs +89 -0
  13. package/api/hook/list/list.d.mts +1 -1
  14. package/api/icon/_adapter.d.mts +8 -0
  15. package/api/icon/_adapter.mjs +17 -0
  16. package/api/icon/_authoring.mjs +6 -6
  17. package/api/icon/_default-look.mjs +16 -16
  18. package/api/icon/add/add.mjs +3 -3
  19. package/api/icon/exportIconIndex.doc.mjs +2 -2
  20. package/api/icon/icon.doc.mjs +2 -2
  21. package/api/icon/icon.type.d.mts +4 -0
  22. package/api/icon/icon.type.mjs +2 -1
  23. package/api/icon/search/icon-index.mjs +16 -3
  24. package/api/icon/search/search.d.mts +15 -5
  25. package/api/icon/search/search.mjs +74 -16
  26. package/api/icon/use/use.mjs +4 -4
  27. package/api/render/_adapter.mjs +233 -40
  28. package/api/render/render.type.d.mts +1 -1
  29. package/api/render/render.type.mjs +1 -1
  30. package/api/search/ORDERING.md +2 -2
  31. package/api/search/_adapter.mjs +4 -0
  32. package/api/search/_candidate-score.mjs +32 -8
  33. package/api/search/_cards.json +1 -1
  34. package/api/search/_compound.d.mts +0 -1
  35. package/api/search/_compound.mjs +93 -2
  36. package/api/search/_icons.d.mts +4 -2
  37. package/api/search/_icons.mjs +4 -2
  38. package/api/search/_lexical.mjs +177 -17
  39. package/api/search/_order.d.mts +3 -1
  40. package/api/search/_order.mjs +16 -5
  41. package/api/search/_result.d.mts +9 -0
  42. package/api/search/_result.mjs +10 -0
  43. package/api/search/_score.mjs +21 -3
  44. package/api/swizzle/_moduleGraph.d.mts +8 -0
  45. package/api/swizzle/_moduleGraph.mjs +61 -3
  46. package/api/template/copy/copy.mjs +5 -3
  47. package/api/template/template.type.d.mts +3 -3
  48. package/api/template/template.type.mjs +3 -3
  49. package/api/theme/_adapter.mjs +48 -12
  50. package/api/theme/build/build.d.mts +4 -0
  51. package/api/theme/build/build.mjs +69 -18
  52. package/api/theme/build/style-keys.mjs +4 -5
  53. package/api/theme/build/theme-object.mjs +5 -0
  54. package/api/theme/palette/generate/color.d.mts +47 -0
  55. package/api/theme/palette/generate/color.mjs +58 -1
  56. package/api/theme/palette/generate/derive-look.d.mts +293 -0
  57. package/api/theme/palette/generate/derive-look.mjs +1362 -0
  58. package/api/theme/palette/generate/editor-look.d.mts +62 -0
  59. package/api/theme/palette/generate/editor-look.mjs +550 -0
  60. package/api/theme/palette/generate/mapping.d.mts +94 -9
  61. package/api/theme/palette/generate/mapping.mjs +94 -22
  62. package/api/theme-edit/_adapter.mjs +13 -2
  63. package/api/theme-edit/_catalog.d.mts +13 -13
  64. package/api/theme-edit/_catalog.mjs +66 -28
  65. package/api/theme-edit/_check.d.mts +82 -6
  66. package/api/theme-edit/_check.mjs +1270 -238
  67. package/api/theme-edit/_color.d.mts +74 -0
  68. package/api/theme-edit/_color.mjs +168 -3
  69. package/api/theme-edit/_compiler.d.mts +3 -5
  70. package/api/theme-edit/_compiler.mjs +122 -23
  71. package/api/theme-edit/_context.d.mts +55 -12
  72. package/api/theme-edit/_context.mjs +114 -60
  73. package/api/theme-edit/_css.d.mts +11 -0
  74. package/api/theme-edit/_css.mjs +40 -0
  75. package/api/theme-edit/_edit.d.mts +15 -2
  76. package/api/theme-edit/_edit.mjs +1469 -133
  77. package/api/theme-edit/_how-commands.d.mts +116 -0
  78. package/api/theme-edit/_how-commands.mjs +227 -115
  79. package/api/theme-edit/_how-question.d.mts +74 -29
  80. package/api/theme-edit/_how-question.mjs +8514 -1256
  81. package/api/theme-edit/_how-sides.d.mts +22 -0
  82. package/api/theme-edit/_how-sides.mjs +173 -0
  83. package/api/theme-edit/_how-steps.d.mts +42 -0
  84. package/api/theme-edit/_how-steps.mjs +208 -0
  85. package/api/theme-edit/_how-values.d.mts +29 -0
  86. package/api/theme-edit/_how-values.mjs +111 -0
  87. package/api/theme-edit/_how-words.d.mts +15 -0
  88. package/api/theme-edit/_how-words.mjs +239 -0
  89. package/api/theme-edit/_how.d.mts +1 -1
  90. package/api/theme-edit/_how.mjs +422 -37
  91. package/api/theme-edit/_missed.d.mts +2 -1
  92. package/api/theme-edit/_missed.mjs +125 -13
  93. package/api/theme-edit/_normal.d.mts +5 -3
  94. package/api/theme-edit/_normal.mjs +54 -14
  95. package/api/theme-edit/_palette.d.mts +204 -4
  96. package/api/theme-edit/_palette.mjs +901 -25
  97. package/api/theme-edit/_part-pieces.d.mts +54 -0
  98. package/api/theme-edit/_part-pieces.mjs +179 -0
  99. package/api/theme-edit/_part-words.mjs +33 -5
  100. package/api/theme-edit/_parts.d.mts +133 -0
  101. package/api/theme-edit/_parts.mjs +599 -10
  102. package/api/theme-edit/_picture-traits.d.mts +259 -0
  103. package/api/theme-edit/_picture-traits.mjs +1030 -0
  104. package/api/theme-edit/_preview.d.mts +95 -4
  105. package/api/theme-edit/_preview.mjs +284 -31
  106. package/api/theme-edit/_project.d.mts +14 -4
  107. package/api/theme-edit/_project.mjs +95 -26
  108. package/api/theme-edit/_resolved.d.mts +46 -0
  109. package/api/theme-edit/_resolved.mjs +800 -0
  110. package/api/theme-edit/_set-line.d.mts +29 -0
  111. package/api/theme-edit/_set-line.mjs +100 -0
  112. package/api/theme-edit/_settings.d.mts +625 -28
  113. package/api/theme-edit/_settings.mjs +4867 -888
  114. package/api/theme-edit/_tables.d.mts +25 -1
  115. package/api/theme-edit/_tables.mjs +115 -11
  116. package/api/theme-edit/_text-looks.d.mts +78 -0
  117. package/api/theme-edit/_text-looks.mjs +376 -0
  118. package/api/theme-edit/_vet.d.mts +3 -26
  119. package/api/theme-edit/_vet.mjs +5 -89
  120. package/api/theme-edit/how/how.d.mts +1 -1
  121. package/api/theme-edit/how/how.mjs +1 -1
  122. package/api/theme-edit/show/show.d.mts +4 -3
  123. package/api/theme-edit/show/show.mjs +3 -2
  124. package/api/theme-edit/theme-edit.type.d.mts +117 -1
  125. package/api/theme-edit/theme-edit.type.mjs +46 -3
  126. package/api/theme-edit/themeEditHow.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditNew.doc.mjs +4 -0
  128. package/api/theme-edit/themeEditSet.doc.mjs +6 -2
  129. package/api/theme-edit/themeEditShow.doc.mjs +22 -3
  130. package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
  131. package/assets/component-list.generated.json +1 -1
  132. package/assets/docs/author-a-theme.doc.mjs +7 -4
  133. package/assets/docs/icons.doc.mjs +7 -6
  134. package/assets/docs/theme.doc.dense.mjs +10 -0
  135. package/assets/docs/theme.doc.mjs +10 -0
  136. package/assets/docs/theme.doc.zh.mjs +10 -0
  137. package/assets/docs/tree/export-pages.doc.mjs +1 -1
  138. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  139. package/assets/docs/use-a-theme.doc.mjs +89 -17
  140. package/assets/docs-routes.generated.json +1 -1
  141. package/assets/docs.generated.json +2 -2
  142. package/assets/icons/definitions/article.doc.mjs +9 -0
  143. package/assets/icons/template-icons.json +5 -0
  144. package/assets/search-catalog.generated.json +2 -2
  145. package/assets/self-audit.generated.json +1 -1
  146. package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
  147. package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
  148. package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
  149. package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
  150. package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
  151. package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
  152. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
  153. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
  154. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +9 -1
  155. package/assets/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonShowcase.doc.mjs +9 -2
  156. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.doc.mjs +3 -2
  157. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -1
  158. package/assets/templates/blocks/components/SideNavItem/SideNavItemShowcase.doc.mjs +3 -2
  159. package/assets/templates/blocks/components/SideNavSection/SideNavSectionShowcase.doc.mjs +2 -1
  160. package/assets/templates/components.generated.json +1 -1
  161. package/assets/templates/pages/ide/page.tsx +5 -10
  162. package/assets/templates/pages/payment-form/page.tsx +16 -60
  163. package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
  164. package/authoring/config/parse.mjs +1 -1
  165. package/authoring/debug/parse.d.mts +1 -1
  166. package/authoring/doctypes/_schema.d.mts +13 -13
  167. package/authoring/doctypes/icon-definition/parse.mjs +2 -2
  168. package/authoring/doctypes/icon-set/parse.mjs +1 -1
  169. package/authoring/doctypes/template/parse.mjs +1 -4
  170. package/authoring/gap-report/parse.d.mts +1 -1
  171. package/clients/cli/build-id.generated.json +1 -1
  172. package/clients/cli/commands/ensure-core-built.mjs +17 -10
  173. package/clients/cli/commands/experimental/icon.mjs +7 -7
  174. package/clients/cli/commands/experimental/theme.mjs +175 -13
  175. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  176. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  177. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
  178. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
  179. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
  180. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  181. package/clients/cli/commands/hook.mjs +7 -0
  182. package/clients/cli/commands/template.mjs +1 -1
  183. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  184. package/clients/cli/index.mjs +6 -2
  185. package/clients/cli/lib/hook-format.mjs +41 -1
  186. package/clients/cli/lib/json-shim.mjs +34 -14
  187. package/clients/cli/lib/other-cli-words.mjs +7 -0
  188. package/clients/cli/lib/unknown-command.mjs +345 -46
  189. package/clients/cli/manifest.generated.json +1 -1
  190. package/foundation/agent-docs/agent-docs.d.mts +11 -2
  191. package/foundation/agent-docs/agent-docs.mjs +51 -8
  192. package/foundation/config/project.d.mts +11 -1
  193. package/foundation/config/project.mjs +11 -2
  194. package/foundation/discovery/component-replacement.d.mts +5 -8
  195. package/foundation/discovery/component-replacement.mjs +12 -14
  196. package/foundation/discovery/core-augmentation-points.d.mts +35 -0
  197. package/foundation/discovery/core-augmentation-points.mjs +410 -9
  198. package/foundation/discovery/core-elements.d.mts +6 -0
  199. package/foundation/discovery/core-elements.mjs +10 -2
  200. package/foundation/discovery/core-prop-types.d.mts +5 -0
  201. package/foundation/discovery/core-prop-types.mjs +10 -3
  202. package/foundation/discovery/core-props.d.mts +8 -0
  203. package/foundation/discovery/core-props.mjs +29 -13
  204. package/foundation/discovery/icon-ranking.d.mts +5 -2
  205. package/foundation/discovery/icon-ranking.mjs +101 -18
  206. package/foundation/discovery/icon-set-checks.mjs +1 -1
  207. package/foundation/discovery/icon-set-writer.mjs +1 -1
  208. package/foundation/discovery/official-list.d.mts +17 -0
  209. package/foundation/discovery/official-list.mjs +77 -0
  210. package/foundation/discovery/template-icon-notes.mjs +3 -3
  211. package/foundation/discovery/template-icons.mjs +2 -2
  212. package/foundation/discovery/template-placeholders.mjs +1 -1
  213. package/foundation/discovery/unknown-core-props.d.mts +130 -0
  214. package/foundation/discovery/unknown-core-props.mjs +601 -0
  215. package/foundation/discovery/written-prop-values.d.mts +35 -0
  216. package/foundation/discovery/written-prop-values.mjs +258 -0
  217. package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
  218. package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
  219. package/foundation/fs/package-name.d.mts +10 -0
  220. package/foundation/fs/package-name.mjs +37 -0
  221. package/foundation/fs/project-source-files.d.mts +27 -0
  222. package/foundation/fs/project-source-files.mjs +115 -0
  223. package/foundation/fs/project-sources.d.mts +25 -0
  224. package/foundation/fs/project-sources.mjs +83 -0
  225. package/foundation/fs/read-record.d.mts +18 -0
  226. package/foundation/fs/read-record.mjs +36 -2
  227. package/foundation/integrations/integration-warnings.d.mts +39 -7
  228. package/foundation/integrations/integration-warnings.mjs +141 -19
  229. package/foundation/integrations/missing-dependency.d.mts +11 -0
  230. package/foundation/integrations/missing-dependency.mjs +20 -5
  231. package/foundation/release/folder-lock.d.mts +5 -2
  232. package/foundation/release/folder-lock.mjs +9 -3
  233. package/foundation/release/notices.mjs +2 -8
  234. package/foundation/render/cut-short.d.mts +8 -2
  235. package/foundation/render/cut-short.mjs +50 -5
  236. package/foundation/render/drawn-contrast.d.mts +40 -0
  237. package/foundation/render/drawn-contrast.mjs +355 -0
  238. package/foundation/render/file-header.mjs +4 -0
  239. package/foundation/render/layers.d.mts +2 -1
  240. package/foundation/render/layers.mjs +22 -1
  241. package/foundation/render/package-resolve-hooks.d.mts +38 -9
  242. package/foundation/render/package-resolve-hooks.mjs +124 -32
  243. package/foundation/render/page-worker.mjs +95 -23
  244. package/foundation/render/part-boxes.d.mts +27 -0
  245. package/foundation/render/part-boxes.mjs +45 -0
  246. package/foundation/render/picture-chrome.mjs +36 -4
  247. package/foundation/render/picture-playwright.mjs +26 -2
  248. package/foundation/render/picture-window.d.mts +29 -2
  249. package/foundation/render/picture-window.mjs +99 -1
  250. package/foundation/render/render-page.d.mts +39 -6
  251. package/foundation/render/render-page.mjs +26 -10
  252. package/foundation/render/ts-paths.mjs +2 -1
  253. package/foundation/response/error-codes.doc.mjs +1 -1
  254. package/foundation/response/error-codes.mjs +1 -1
  255. package/foundation/response/response-types.doc.mjs +9 -5
  256. package/foundation/suggest/other-command.mjs +25 -1
  257. package/foundation/text/icon-set-next.d.mts +1 -1
  258. package/foundation/text/icon-set-next.mjs +2 -2
  259. package/foundation/text/written-string.d.mts +4 -1
  260. package/foundation/text/written-string.mjs +4 -1
  261. package/package.json +8 -7
@@ -590,25 +590,38 @@ function changeBlocks(r) {
590
590
  (/** @type {string} */ n) =>
591
591
  n.startsWith('no change: ') && n.includes(' already draws '),
592
592
  );
593
+ // A dial step on a part (`corners large --on card`) says what it drew
594
+ // there, when that is a value or two: a part's own scale can give a step
595
+ // another size than the dial's help names for the whole theme.
596
+ const stepOn = d.action === 'set' && s.source === 'dial' ? s.on : null;
597
+ const drawnOn = stepOn
598
+ ? /** @type {string[]} */ (/** @type {any} */ (d).styled ?? [])
599
+ .filter(x => x.startsWith(`${stepOn}: `))
600
+ .map(x => x.slice(stepOn.length + 2))
601
+ : [];
602
+ const drawnAs = drawnOn.length <= 2 ? drawnOn : [];
593
603
  const done =
594
604
  unchanged && d.action === 'set'
595
605
  ? drawnAlready
596
606
  ? `[no change] ${d.theme}: ${describe(s)} already shows; nothing written`
597
- : `[ok] ${d.theme}: ${describe(s)} was already set; nothing changed`
607
+ : `[ok] ${d.theme}: ${d.asSides ? `${describe({...s, thing: d.asSides.thing, value: d.asSides.value})} (${d.asSides.sides.map(x => `${x.thing} ${x.value}`).join(', ')})` : describe(s)} was already set; nothing changed`
598
608
  : d.was != null
599
609
  ? `[ok] ${d.theme}: ${s.thing} ${d.was} -> ${s.value}`
600
- : `[ok] ${d.theme}: ${d.action === 'set' ? describe(s) : `removed ${describe(s)}${alsoRemovedText(d)}; now ${/** @type {any} */ (d).now ?? "the base theme's value"} applies`}`;
610
+ : `[ok] ${d.theme}: ${d.action === 'set' ? (d.asSides ? `${describe({...s, thing: d.asSides.thing, value: d.asSides.value})} (${d.asSides.sides.map(x => `${x.thing} ${x.value}`).join(', ')})` : `${describe(s)}${drawnAs.length ? ` (drawn as ${drawnAs.join(', ')})` : ''}`) : `removed ${describe(s)}${alsoRemovedText(d)}; now ${/** @type {any} */ (d).now ?? "the base theme's value"} applies`}`;
601
611
  // A problem the change made leads the result, right under the status
602
612
  // line, which counts them: a tail-cut or head-cut output still shows it.
603
613
  // What a whole-theme change leaves out comes next, with the lines that
604
614
  // reach it, before the rest a head-cut output drops.
605
615
  const {
606
616
  newProblems = [],
617
+ leftProblems = [],
607
618
  leftOut = [],
619
+ fontNotLoaded = [],
608
620
  missed: _missed,
609
621
  missedParts: _missedParts,
610
622
  missedOn: _missedOn,
611
623
  missedWhere: _missedWhere,
624
+ missedNew: _missedNew,
612
625
  ...rest
613
626
  } = /** @type {any} */ (d);
614
627
  const status = newProblems.length
@@ -619,6 +632,25 @@ function changeBlocks(r) {
619
632
  return [
620
633
  status,
621
634
  ...(newProblems.length ? problemList(newProblems) : []),
635
+ // Problems it moved but left failing: said under the new ones.
636
+ ...(leftProblems.length
637
+ ? [
638
+ `still failing after this change (${leftProblems.length}):`,
639
+ ...problemList(leftProblems),
640
+ ]
641
+ : []),
642
+ ...(fontNotLoaded.length
643
+ ? [
644
+ list(
645
+ fontNotLoaded.map(
646
+ (/** @type {{family: string, run: string[]}} */ x) => [
647
+ `${x.family} is not installed, so the pictures and the app draw the next font in the stack until it is`,
648
+ ...x.run,
649
+ ],
650
+ ),
651
+ ),
652
+ ]
653
+ : []),
622
654
  ...(leftOut.length
623
655
  ? [
624
656
  list(
@@ -639,15 +671,23 @@ function changeBlocks(r) {
639
671
  * named, near the top of a change or a new theme, so a head of the
640
672
  * output keeps it; show names the first ones with their lines, and show
641
673
  * --json lists each.
642
- * @param {{missed?: number, missedParts?: number, missedOn?: string[], missedWhere?: string[]}} d
674
+ * A change says them only when it brought some (`missedNew`): the ones it
675
+ * found are show's to list, not every change's to repeat.
676
+ * @param {{missed?: number, missedParts?: number, missedOn?: string[], missedWhere?: string[], missedNew?: number}} d
643
677
  */
644
678
  function missedLine(d) {
645
- const {missed = 0, missedParts = missed, missedOn = [], missedWhere = []} = d;
679
+ const {
680
+ missed = 0,
681
+ missedParts = missed,
682
+ missedOn = [],
683
+ missedWhere = [],
684
+ missedNew,
685
+ } = d;
646
686
  const named = missedWhere.length ? missedWhere : missedOn;
647
- if (!missed) return [];
687
+ if (!missed || missedNew === 0) return [];
648
688
  return [
649
689
  record({
650
- missed: `${missed} miss${missed > 1 ? 'es' : ''} on ${missedParts} part${missedParts > 1 ? 's' : ''} the theme's changes did not reach${named.length ? ` (${named.slice(0, 6).join(', ')}${named.length > 6 ? `, and ${named.length - 6} more` : ''})` : ''}: each still shows the base theme's own look there. Keep each one, or bring it in line with your changes: show lists the first misses with their lines, and show --json has every one`,
690
+ missed: `${missedNew ? `this change left ${missedNew} new miss${missedNew > 1 ? 'es' : ''}; ` : ''}${missed} miss${missed > 1 ? 'es' : ''} on ${missedParts} part${missedParts > 1 ? 's' : ''} the theme's changes did not reach${named.length ? ` (${named.slice(0, 6).join(', ')}${named.length > 6 ? `, and ${named.length - 6} more` : ''})` : ''}: each still shows the base theme's own look there. Keep each one, or bring it in line with your changes: show lists the first misses with their lines, and show --json has every one`,
651
691
  }),
652
692
  ];
653
693
  }
@@ -694,6 +734,96 @@ function changeFields(data) {
694
734
  ];
695
735
  }
696
736
 
737
+ /** How many variant lines the text of `show --on` gives before it counts the rest. */
738
+ const VARIANT_LINES = 4;
739
+
740
+ /**
741
+ * A part value's final value as one short text.
742
+ * @param {import('../../../../api/theme-edit/theme-edit.type.mjs').ThemeEditPartValue['value']} v
743
+ */
744
+ function valueText(v) {
745
+ if (v == null) return 'no value';
746
+ if (typeof v === 'string') return v;
747
+ // (A mode left out is not shown yet; a mode given as null has no value.)
748
+ return /** @type {const} */ (['light', 'dark'])
749
+ .filter(m => v[m] !== undefined)
750
+ .map(m => `${m} ${v[m] ?? 'no value'}`)
751
+ .join(', ');
752
+ }
753
+
754
+ /**
755
+ * The text of `show --on`: the part at rest, one line per property, then
756
+ * the variants' values that differ from rest, a few, counted; the JSON
757
+ * carries every value.
758
+ * @param {import('../../../../api/theme-edit/theme-edit.type.mjs').ThemeEditShowPartResponse['data']} d
759
+ */
760
+ function partValueBlocks(d) {
761
+ // (A token a rule sets on the part is in the JSON; the text gives the
762
+ // properties the part draws.)
763
+ const drawn = d.values.filter(v => !v.property.startsWith('--'));
764
+ const rest = drawn.filter(v => v.when == null && v.state == null);
765
+ const restOf = new Map(rest.map(v => [v.property, valueText(v.value)]));
766
+ const variants = drawn.filter(
767
+ v =>
768
+ (v.when != null || v.state != null) &&
769
+ valueText(v.value) !== restOf.get(v.property),
770
+ );
771
+ // A combined condition that draws what one of its conditions draws alone
772
+ // (`variant:blue+selected:true` as `variant:blue`) says nothing more.
773
+ const alone = new Set(
774
+ variants.map(
775
+ v => `${v.when}|${v.state}|${v.property}|${valueText(v.value)}`,
776
+ ),
777
+ );
778
+ // A condition set cannot name (two variants at once) that draws what
779
+ // one of its variants draws alone says nothing more either.
780
+ const wordsOf = (/** @type {any} */ v) =>
781
+ v.notSettable
782
+ ? (v.when ?? '')
783
+ .split(' ')
784
+ .map((/** @type {string} */ w) => w.replace('=', ':'))
785
+ : (v.when ?? '').split('+');
786
+ const shown = variants.filter(
787
+ v =>
788
+ !wordsOf(v).some(
789
+ (/** @type {string} */ w) =>
790
+ w !== v.when &&
791
+ alone.has(`${w}|${v.state}|${v.property}|${valueText(v.value)}`),
792
+ ),
793
+ );
794
+ /** @param {import('../../../../api/theme-edit/theme-edit.type.mjs').ThemeEditPartValue} v */
795
+ const row = v => ({
796
+ ...(v.when != null || v.state != null
797
+ ? {
798
+ when:
799
+ [v.when, v.state].filter(Boolean).join(' ') +
800
+ (v.notSettable ? ' (not settable)' : ''),
801
+ }
802
+ : {}),
803
+ property: v.property,
804
+ value: valueText(v.value),
805
+ tokens: (Array.isArray(v.tokens)
806
+ ? v.tokens
807
+ : [...new Set([...(v.tokens.light ?? []), ...(v.tokens.dark ?? [])])]
808
+ ).join(' '),
809
+ source: v.source,
810
+ });
811
+ return [
812
+ section(
813
+ `${d.part} in ${d.theme} (${d.kind} theme), at rest: ${rest.length} value${rest.length === 1 ? '' : 's'}`,
814
+ ),
815
+ records(rest.map(row), {layout: 'inline'}),
816
+ ...(shown.length
817
+ ? [
818
+ section(
819
+ `in variants: ${shown.length} value${shown.length === 1 ? '' : 's'} that differ${shown.length > VARIANT_LINES ? `, the first ${VARIANT_LINES} here (--json lists every value)` : ''}`,
820
+ ),
821
+ records(shown.slice(0, VARIANT_LINES).map(row), {layout: 'inline'}),
822
+ ]
823
+ : []),
824
+ ];
825
+ }
826
+
697
827
  /**
698
828
  * The text of `show`: the theme, then each color with its seed and the shade
699
829
  * each token uses, the notes on moved shades, and the generated files last.
@@ -1476,9 +1606,12 @@ function previewExtraWords(sub, doc, head) {
1476
1606
  * there is none.
1477
1607
  * @param {string} name
1478
1608
  * @param {unknown[]} rest the words after the theme
1479
- * @param {{png?: boolean, section?: string}} o the options read
1609
+ * @param {{png?: boolean, section?: string, on?: string}} o the options read
1480
1610
  */
1481
1611
  function showStray(name, rest, o) {
1612
+ // (Beside --on, the refusal offers no other show: a show without --on
1613
+ // writes the pages, and the lookup's own line is not offered yet.)
1614
+ const offer = (/** @type {string} */ line) => (o.on ? null : line);
1482
1615
  // The theme typed as an option (`show --theme t`), as set and undo read
1483
1616
  // it: the show on that theme, never its help alone.
1484
1617
  const asOption = /^--?(?:theme|name)$/i.test(String(name));
@@ -1492,7 +1625,9 @@ function showStray(name, rest, o) {
1492
1625
  option: String(name),
1493
1626
  note: "the theme is show's first word",
1494
1627
  },
1495
- `${EDITOR} show ${quoteCommandArgument(theme)}${o.section ? ` --section ${o.section}` : ''}${o.png ? ' --png' : ''}`,
1628
+ offer(
1629
+ `${EDITOR} show ${quoteCommandArgument(theme)}${o.section ? ` --section ${o.section}` : ''}${o.png ? ' --png' : ''}`,
1630
+ ),
1496
1631
  );
1497
1632
  }
1498
1633
  const stray = rest.map(String).find(w => w.startsWith('-'));
@@ -1505,7 +1640,9 @@ function showStray(name, rest, o) {
1505
1640
  showDoc,
1506
1641
  `${EDITOR} show`,
1507
1642
  {option: stray},
1508
- `${EDITOR} show ${name}${o.section ? ` --section ${o.section}` : ''}${o.png ? ' --png' : ''}`,
1643
+ offer(
1644
+ `${EDITOR} show ${name}${o.section ? ` --section ${o.section}` : ''}${o.png ? ' --png' : ''}`,
1645
+ ),
1509
1646
  );
1510
1647
  }
1511
1648
 
@@ -2377,13 +2514,34 @@ export function registerExperimentalTheme(group, program) {
2377
2514
  (new Set(flagValues('section')).size > 1
2378
2515
  ? cliError(
2379
2516
  `--section limits the sheet to one section, and was given ${flagValues('section').length} (${flagValues('section').join(', ')}); give one, or none for the whole sheet.`,
2517
+ {
2518
+ // (Beside --on no other show is offered: a show without
2519
+ // --on writes the pages.)
2520
+ suggestions: o.on
2521
+ ? []
2522
+ : [
2523
+ {
2524
+ // The first section given that `show` takes, else the
2525
+ // whole sheet.
2526
+ name: cmd(
2527
+ `${EDITOR} show ${name}${(sec => (sec ? ` --section ${sec}` : ''))(flagValues('section').find(v => showSections().includes(v)))}`,
2528
+ ),
2529
+ reason: 'do this instead',
2530
+ },
2531
+ ],
2532
+ code: ERROR_CODES.ERR_INVALID_ARGUMENT,
2533
+ },
2534
+ )
2535
+ : null) ??
2536
+ // One part's values: a lookup of one part.
2537
+ (new Set(flagValues('on')).size > 1
2538
+ ? cliError(
2539
+ `--on looks up one part, and was given ${flagValues('on').length} (${flagValues('on').join(', ')}); give one.`,
2380
2540
  {
2381
2541
  suggestions: [
2382
2542
  {
2383
- // The first section given that `show` takes, else the
2384
- // whole sheet.
2385
2543
  name: cmd(
2386
- `${EDITOR} show ${name}${(sec => (sec ? ` --section ${sec}` : ''))(flagValues('section').find(v => showSections().includes(v)))}`,
2544
+ `${EDITOR} show ${name} --on ${flagValues('on')[0]}`,
2387
2545
  ),
2388
2546
  reason: 'do this instead',
2389
2547
  },
@@ -2399,8 +2557,12 @@ export function registerExperimentalTheme(group, program) {
2399
2557
  cwd: process.cwd(),
2400
2558
  png: o.png ?? false,
2401
2559
  section: o.section,
2560
+ ...(o.on != null ? {on: o.on} : {}),
2402
2561
  }),
2403
- r => showBlocks(r.data),
2562
+ r =>
2563
+ r.type === 'themeEdit.showPart'
2564
+ ? partValueBlocks(r.data)
2565
+ : showBlocks(/** @type {any} */ (r).data),
2404
2566
  ),
2405
2567
  }),
2406
2568
  showDoc,
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary:
17
17
  'Find an icon by meaning, or build an icon set from a library (guide: astryx docs cli/experimental/icon-sets)',
18
18
  description:
19
- "Terminal front-end to icon(): searches every installed icon set's data file by meaning and prints each match's import line, in the look the project picks where the icon has it, and, when a definition names the icon, the import that names it by that meaning (`meaningImport`). With no set installed, it names the icon definitions that match, built-in ones first, and how to get a set. `<set>/<id>` reads one icon with every variant's import line; --list lists the installed sets and how many icon definitions each one maps. The subcommands author a set: `new-set` starts one in an integration package, `new-definition` adds the set's own icon definition, `add` registers an icon from a library, `map` points an icon definition at an icon, and `use` makes a set the project's. Start a set with `new-set <name> --from <library>`; the guide is `astryx docs cli/experimental/icon-sets`. Experimental: it may change or be removed in a patch release.",
19
+ "Terminal front-end to icon(): searches every installed icon set's data file by meaning and prints each match's import line, in the look the project picks where the icon has it, and, when a definition names the icon, the import that names it by that meaning (`meaningImport`). With no set installed, it names the icon definitions that match, built-in ones first, with the built-in that draws in place of a matching definition Core does not draw (unless a match ranked above it has none), and how to get a set. `<set>/<id>` reads one icon with every variant's import line; --list lists the installed sets and how many icon definitions each one maps. The subcommands author a set: `new-set` starts one in an integration package, `new-definition` adds the set's own icon definition, `add` registers an icon from a library, `map` points an icon definition at an icon, and `use` makes a set the project's. Start a set with `new-set <name> --from <library>`; the guide is `astryx docs cli/experimental/icon-sets`. Experimental: it may change or be removed in a patch release.",
20
20
  fn: 'icon',
21
21
  // `new-set` and `new-definition` start a set and its own definitions,
22
22
  // `add` registers an icon, `map` edits a map entry, and `use` picks the
@@ -45,7 +45,7 @@ export const doc = {
45
45
  flag: '--icons-specifier <specifier>',
46
46
  param: 'options.iconsSpecifier',
47
47
  description:
48
- "Override the icon-registry import in the generated JS module, for example ./icons.mjs (default: the specifier in the theme source's own import). With --family it applies to every member's icon import",
48
+ "Override the icon-registry import in the generated JS module, for example ./icons.mjs; the build then does not compile the registry (default: a TypeScript or JSX registry's compiled copy in <name>.modules/, or a plain JavaScript registry's own path). With --family it applies to every member's icon import",
49
49
  },
50
50
  {
51
51
  flag: '-w, --watch',
@@ -10,9 +10,9 @@ export const doc = {
10
10
  namespace: 'cli/commands',
11
11
  stability: 'experimental',
12
12
  summary:
13
- "Look up a part, group, setting or aspect; answer a question in plain words; read a picture's colors; or list what you can set",
13
+ "Look up a part, group, setting or aspect; answer a question in plain words; read a picture's colors and look; or list what you can set",
14
14
  description:
15
- 'One command for every question. With nothing named, it prints its usage and examples. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`, the first of them this help, whose examples labeled "Asks how understands" list the kinds of ask it answers. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
15
+ 'One command for every question. With nothing named, it prints its usage and examples. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. A result with `offer: true` is more than the ask (a colored variant changed too): it follows every other result and is never the answer itself, so running the first result\'s commands never runs one; where what the ask writes is in place already, the first result says so with no command. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`, the first of them this help, whose examples labeled "Asks how understands" list the kinds of ask it answers. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), and the look\'s traits measured from its pixels (control height, the checks\' box, corners, edge width, how panels sit, the accent fill, line spacing), each written as the line that sets it where enough boxes agree and otherwise listed as unsure, with the settings that would make it where one exists, or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
16
16
  fn: 'themeEditHow',
17
17
  args: [
18
18
  {
@@ -145,6 +145,14 @@ export const doc = {
145
145
  label: 'Asks how understands: removals',
146
146
  cli: 'astryx experimental theme editor how "remove the card background"',
147
147
  },
148
+ {
149
+ label: "Asks how understands: a part's own piece taken away",
150
+ cli: 'astryx experimental theme editor how "hide the code block copy button"',
151
+ },
152
+ {
153
+ label: 'Asks how understands: one variant made to look like another',
154
+ cli: 'astryx experimental theme editor how "ghost buttons look like the default button"',
155
+ },
148
156
  {
149
157
  label: 'Asks how understands: several changes in one ask',
150
158
  cli: 'astryx experimental theme editor how "cards: 8px radius; buttons: 4px"',
@@ -167,7 +175,7 @@ export const doc = {
167
175
  notes: [
168
176
  {
169
177
  type: 'prose',
170
- text: 'The examples labeled "Asks how understands" list the kinds of ask a question in plain words can be, each with examples it answers with commands: a dial for the whole theme, a part\'s property by an amount or a value, a direction (lighter, darker, bigger, smaller, with or without a reference), a comparison with another part, everything except some parts or keeping a part, a prohibition (never …), one mode (in dark mode), a removal (no shadow, remove …), several changes in one ask, and a question about a value. An ask of another kind may still be answered; one it cannot answer says so and points here.',
178
+ text: 'The examples labeled "Asks how understands" list the kinds of ask a question in plain words can be, each with examples it answers with commands: a dial for the whole theme, a part\'s property by an amount or a value, a direction (lighter, darker, bigger, smaller, with or without a reference), a comparison with another part, one variant made to look like another (ghost buttons look like the default button), everything except some parts or keeping a part, a prohibition (never …), one mode (in dark mode), a removal (no shadow, remove …, or a part\'s own piece such as a code block\'s copy button or an alert\'s icon, which is then not drawn), several changes in one ask, and a question about a value. An ask of another kind may still be answered; one it cannot answer says so and points here.',
171
179
  },
172
180
  {
173
181
  type: 'prose',
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  'Change one thing in a theme: checked against what the components read, built, previewed',
14
14
  description:
15
- "Changes one thing. The thing is a dial (corners, spacing, accent, neutral, success, warning, danger, info, vibrancy, font, headings, surfaces, buttons, type, text-size, base, mode: big moves with named rungs; `more`/`less` step a rung), a design token by name (--color-background-body; `how --list tokens`), or a CSS property on a part (background --on card; needs --on). Every change is CHECKED first against the installed Core: the part, the --when variant and value, the --state, the token's type (color, size, number, font, shadow; only colors may differ by mode; a shadow is one value for both), and whether the part, or a part inside it, actually reads the token for what you mean. A change that cannot take effect is REFUSED: exit 1, an error code, nothing written, and the suggestions lead with the command that works (the token the part really reads, or the property that sets it directly). Groups: --on <group> (inputs, checks, containers, menus) styles every member; styling one member of an always-alike group (inputs, checks) styles the whole group unless --only. A setting on a part beats a whole-theme dial, and a dial never overwrites one. After building, a plain part setting that a more specific base-theme rule would beat (such as a heading level) is repeated on those variant keys, and the result says so. The result lists resolved token changes, part styles written, contrast problems this theme caused versus its base (text below 4.5:1), notes (the shade a color's main token uses, any shade moved so text reads, and the generated color files; font loading: the exact install line when the font package is missing), and writes themes/<theme>/preview.html. Values with spaces go in quotes: gradients, several shadows, font stacks. Dials: corners square|small|medium|large|round|pill|more|less|<size>; spacing tight|compact|medium|roomy|spacious|more|less; accent, neutral, success, warning, danger, info <color> (a color: the editor generates its light and dark shades from the one color, with the same generator as `theme palette generate`, and points the color tokens at them; a token moves to a nearby shade when it must read: text at 4.5:1, the focus ring at 3:1; the whole theme only, no --on or --mode; `how colors` explains it and the Colors preview page shows every shade); vibrancy 0-100|more|less (how saturated the generated colors are; 50 is the default; needs a color); font <preset, open font, family or stack>; headings light|regular|medium|semibold|bold|heavy or tight|tighter|normal|wide; surfaces flat|outlined|raised|glass; buttons solid|outline|soft|caps; type compact|standard|editorial|display; text-size small|medium|large|larger|more|less|<number of pixels, 10 to 32>; base <built-in theme>|none; mode both|light-only|dark-only. `astryx experimental theme editor how --list dials` explains each. An exact token always wins over the generated colors: `set <theme> --color-accent <color>` (with --on or --mode if you need them) is the escape hatch, whatever order the settings were made in. Experimental: it may change or be removed in a patch release.",
15
+ "Changes one thing. The thing is a dial (corners, spacing, accent, neutral, success, warning, danger, info, vibrancy, font, headings, surfaces, buttons, badges, type, text-size, base, mode: big moves with named rungs; `more`/`less` step a rung), a design token by name (--color-background-body; `how --list tokens`), or a CSS property on a part (background --on card; needs --on). Every change is CHECKED first against the installed Core: the part, the --when variant and value, the --state, the token's type (color, size, number, font, shadow; only colors may differ by mode; a shadow is one value for both), and whether the part, or a part inside it, actually reads the token for what you mean. A change that cannot take effect is REFUSED: exit 1, an error code, nothing written, and the suggestions lead with the command that works (the token the part really reads, or the property that sets it directly). A text size on a part whose text is drawn by elements inside it that each read a text size token goes into the token its main text reads, the largest (a top nav heading's title, not its supporting line), on that part; the setting is saved as typed and the result names the token. A text size said of a heading's title piece (`top-nav-heading-title` or `side-nav-heading-title`, also `-heading`) goes on that heading, the same way. A text size token said for a part that reads none, where the parts it holds read one size token (a tab list's tabs), goes into that one on the part; the setting is saved as typed and the result names the token. Groups: --on <group> (inputs, checks, containers, menus) styles every member; styling one member of an always-alike group (inputs, checks) styles the whole group unless --only (a height follows the control-height rule below). A height on a control (a button, an input, a selector, an input group, or a group of them) is every control's height at its size: it is written as that size's token (--size-element-sm, -md or -lg; the size --when names, md without one) on controls, and it replaces the other control heights at that size; with --only it stays on its one control; a height written as a size token must be a length (auto is refused there; a height for another variant or a state stays a plain height); a height on a part that is not a control (a text area, which sizes itself by its rows, or a complex selector) stays on that part. A control whose content is taller (a typeahead, a tokenizer) keeps its content's height, and a complex selector keeps its own. A control that grows with its content (a selector, a typeahead, a tokenizer) keeps Core's top and bottom padding, so a padding reaches it at its sides only and never makes it taller than the other controls. A file input's field does too; its drop zone (mode dropzone) pads itself, so a top or bottom padding set for the drop zone reaches it. A height or vertical padding on a bar (the app's header) reaches the one row of items drawn once across it (the top nav; never a menu's or side nav's items, a divider, a trigger or an avatar): the row fills the bar and gives up its own vertical padding, so its items sit in the middle; a value set on the row stays, and a part in the row taller than the bar is a problem with its fixing line. A row that sits in more than one bar takes the reach in every bar that holds it, and none when those bars leave it different heights (different heights, or the same height padded differently, as the app's header pads a safe area). A setting on a part beats a whole-theme dial, and a dial never overwrites one. After building, a plain part setting that a more specific base-theme rule would beat (such as a heading level) is repeated on those variant keys, and the result says so. The result lists resolved token changes, part styles written, contrast problems this theme caused versus its base (text below 4.5:1), notes (the shade a color's main token uses, any shade moved so text reads, and the generated color files; font loading: the exact install line when the font package is missing), and writes themes/<theme>/preview.html. Values with spaces go in quotes: gradients, several shadows, font stacks. Dials: corners square|small|medium|large|round|pill|more|less|<size>; spacing tight|compact|medium|roomy|spacious|more|less; accent, neutral, success, warning, danger, info <color> (a color: the editor generates its light and dark shades from the one color, with the same generator as `theme palette generate`, and points the color tokens at them; a token moves to a nearby shade when it must read: text at 4.5:1, the focus ring at 3:1; the whole theme only, no --on or --mode; `how colors` explains it and the Colors preview page shows every shade); vibrancy 0-100|more|less (how saturated the generated colors are; 50 is the default; needs a color); font <preset, open font, family or stack>; headings light|regular|medium|semibold|bold|heavy or tight|tighter|normal|wide; surfaces flat|outlined|raised|glass; buttons solid|outline|soft|caps; badges solid|soft|outline; type compact|standard|editorial|display; text-size small|medium|large|larger|more|less|<number of pixels, 10 to 32>; base <built-in theme>|none; mode both|light-only|dark-only. `astryx experimental theme editor how --list dials` explains each. An exact token always wins over the generated colors: `set <theme> --color-accent <color>` (with --on or --mode if you need them) is the escape hatch, whatever order the settings were made in. Experimental: it may change or be removed in a patch release.",
16
16
  fn: 'themeEditSet',
17
17
  args: [
18
18
  {
@@ -37,7 +37,7 @@ export const doc = {
37
37
  flag: '--on <where>',
38
38
  param: 'options.on',
39
39
  description:
40
- 'Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a group (inputs, containers, checks, menus; how --list groups), or for font a role (body, heading, code)',
40
+ "Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a group (inputs, containers, checks, menus, or a family the census reads from each part's structure: button-like, overlays, option-rows, selected-items, accent-fills, inset-fields, status-surfaces, overlay-headers, controls; how --list groups), or for font a role (body, heading, code)",
41
41
  },
42
42
  {
43
43
  flag: '--when <prop:value>',
@@ -132,7 +132,7 @@ export const doc = {
132
132
  },
133
133
  {
134
134
  code: 1,
135
- when: 'an unknown option, a refused change (an unknown part, variant, state, token or thing; a value of the wrong type; --mode on something that has no mode; a token the part never reads for that; corners on a part that shows no edge), a theme that does not exist, or a build failure, or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED); nothing is written',
135
+ when: 'an unknown option, a refused change (an unknown part, variant, state, token or thing; a value of the wrong type; --mode on something that has no mode; a token the part never reads for that, unless it is a text size token and the parts it holds read one; corners on a part that shows no edge), a theme that does not exist, or a build failure, or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED); nothing is written',
136
136
  },
137
137
  ],
138
138
  related: ['experimental theme editor', 'experimental theme compile'],
@@ -10,9 +10,9 @@ export const doc = {
10
10
  namespace: 'cli/commands',
11
11
  stability: 'experimental',
12
12
  summary:
13
- 'Every setting, key values, problems the theme caused, and the theme-building page with every component',
13
+ "Every setting, key values, problems the theme caused, and the theme-building page with every component; with --on, one part's resolved values for any theme",
14
14
  description:
15
- "Lists every setting with where it applies and its source (dial, token or property), the resolved value of key tokens in each mode, the colors (the vibrancy; each color with its seed and the shade each token uses in light and dark, marked when an exact token setting wins; any shade moved so text reads), contrast problems this theme caused versus its base, font notes, and last the generated color files. Writes two self-contained HTML files: preview.html (the sample app page) and sheet.html (the theme-building page: every component grouped, each variant side by side, overlays open, and real template pages, with an auto/light/dark switch); a file of yours at a page's name (one without the editor's stamp, a link, a folder) is left alone, and the result names it. A theme with no build is built first, and an in-app preview (`preview add`) of the theme has its route and Colors page rewritten. --section limits the sheet to one section. An own change to <theme>.theme.ts since the last build is built first, and the colors mark where it wins over a generated shade; a theme source that no longer builds, or a token in it that is not text, is refused (ERR_THEME_INVALID, exit 1) and the folder stays as it was. Experimental: it may change or be removed in a patch release. The result ends with `wiring`: `astryx theme add <theme>` for the app copy of the theme (src/themes/<theme>/, a standard local theme every build writes), the `mode` of a one-mode theme for the `<Theme>`, and what builds it; only when a folder of yours holds src/themes/<theme>/ does it give the imports in the root file and the `<Theme>` by hand. When show builds the theme again (its build does not match the settings, say after a hand edit), the pictures --png took of the theme as it was are removed, and the result names them.",
15
+ "With `--on` set to a part, a lookup that writes nothing: what one part of any theme the project builds shows, each property's final value with its tokens and who sets it. An editor theme is read from its saved settings: what its theme file adds by hand below them is not shown yet. Without it, lists every setting with where it applies and its source (dial, token or property), the resolved value of key tokens in each mode, the colors (the vibrancy; each color with its seed and the shade each token uses in light and dark, marked when an exact token setting wins; any shade moved so text reads), contrast problems this theme caused versus its base, font notes, and last the generated color files. Writes two self-contained HTML files: preview.html (the sample app page) and sheet.html (the theme-building page: every component grouped, each variant side by side, overlays open, and real template pages, with an auto/light/dark switch); a file of yours at a page's name (one without the editor's stamp, a link, a folder) is left alone, and the result names it. A theme with no build is built first, and an in-app preview (`preview add`) of the theme has its route and Colors page rewritten. --section limits the sheet to one section. An own change to <theme>.theme.ts since the last build is built first, and the colors mark where it wins over a generated shade; a theme source that no longer builds, or a token in it that is not text, is refused (ERR_THEME_INVALID, exit 1) and the folder stays as it was. Experimental: it may change or be removed in a patch release. The result ends with `wiring`: `astryx theme add <theme>` for the app copy of the theme (src/themes/<theme>/, a standard local theme every build writes), the `mode` of a one-mode theme for the `<Theme>`, and what builds it; only when a folder of yours holds src/themes/<theme>/ does it give the imports in the root file and the `<Theme>` by hand. When show builds the theme again (its build does not match the settings, say after a hand edit), the pictures --png took of the theme as it was are removed, and the result names them.",
16
16
  fn: 'themeEditShow',
17
17
  args: [
18
18
  {
@@ -22,6 +22,12 @@ export const doc = {
22
22
  },
23
23
  ],
24
24
  options: [
25
+ {
26
+ flag: '--on <part>',
27
+ param: 'options.on',
28
+ description:
29
+ "Only what one part shows, as a lookup that writes nothing: each CSS property the part reads, at rest and in each variant, with its final value (per mode when the modes differ), the declaration that gives it, the tokens it reads, and who decides it (`source`: core, the base theme it extends, or the theme's own file; which setting gives it is not shown yet). The theme may be any theme the project builds: an editor theme, a local theme or an installed theme package (a slug two packages provide is the one the app records). The text lists the part at rest and the first four variant values that differ from it, with how many there are; --json carries every value. An editor theme is read from its saved settings: what its theme file adds by hand below them is not shown yet.",
30
+ },
25
31
  {
26
32
  flag: '--section <name>',
27
33
  param: 'options.section',
@@ -32,7 +38,7 @@ export const doc = {
32
38
  flag: '--png',
33
39
  param: 'options.png',
34
40
  description:
35
- "Also take PNG pictures of the previews (light and dark): preview.png, the sample page, and sheet-overlays.png, each control at rest, hovered, focused and pressed at its top, then every menu, tooltip, popover and list drawn open (from sheet-overlays.html, which it writes too; a file of yours by that name is left alone and the picture not taken) (show adds a picture of each family of components the theme sets a part of with --on, or of the buttons when it sets none: sheet-<family>.png, from the sheet-<family>.html it writes beside the full sheet; the families are actions, inputs, selection, navigation, feedback, data and containers, and a family taller than 1600px is cut into pictures of at most that height, in order (sheet-<family>-1.png, -2 …), so each reads whole. With --section, that section's picture is taken in their place, so --section <family> --png pictures any other family. sheet.html, every component, is written but not pictured; the open states are taken with a section too), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds, plus 20 seconds for each picture after the first, is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet-overlays.png) is never written over: no picture is taken, and the result names the file. Taking pictures changes nothing in the app, except that show first brings the app copy (src/themes/<theme>/) and an in-app preview up to date after a hand edit to <theme>.theme.ts",
41
+ "Also take PNG pictures of the previews (light and dark): preview.png, the sample page, and sheet-overlays.png, each control at rest, hovered, focused and pressed at its top, then every menu, tooltip, popover and list drawn open (from sheet-overlays.html, which it writes too; a file of yours by that name is left alone and the picture not taken) (show adds a picture of each family of components the theme sets a part of with --on, or of the buttons when it sets none: sheet-<family>.png, from the sheet-<family>.html it writes beside the full sheet; the families are actions, inputs, selection, navigation, feedback, data and containers, and a family taller than 1600px is cut between rows of parts into pictures of about that height (a row taller than that is a picture of its own), in order (sheet-<family>-1.png, -2 …), so each reads whole. With --section, that section's picture is taken in their place (the pages section, the sample app and each page template, is cut between pages the same way: sheet-pages-1.png, -2 …), so --section <family> --png pictures any other family. sheet.html, every component, is written but not pictured; the open states are taken with a section too), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds, plus 20 seconds for each picture after the first, is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet-overlays.png) is never written over: no picture is taken, and the result names the file. Taking pictures changes nothing in the app, except that show first brings the app copy (src/themes/<theme>/) and an in-app preview up to date after a hand edit to <theme>.theme.ts",
36
42
  },
37
43
  ],
38
44
  examples: [
@@ -44,6 +50,10 @@ export const doc = {
44
50
  label: 'With pictures',
45
51
  cli: 'astryx experimental theme editor show brand --png',
46
52
  },
53
+ {
54
+ label: "One part's resolved values, for any theme",
55
+ cli: 'astryx experimental theme editor show neutral --on card',
56
+ },
47
57
  ],
48
58
  outsideProject: 'refuse',
49
59
  requires: ['themes.compile'],
@@ -56,11 +66,11 @@ export const doc = {
56
66
  exitCodes: [
57
67
  {
58
68
  code: 0,
59
- when: 'the settings are listed and both pages are written',
69
+ when: "the settings are listed and both pages are written, or, with --on, the part's values are listed",
60
70
  },
61
71
  {
62
72
  code: 1,
63
- when: 'the theme does not exist or its base theme package is not installed (ERR_UNKNOWN_THEME), an unknown --section (ERR_INVALID_ARGUMENT), a theme source that does not build or parse or a token in it that is not text (ERR_THEME_INVALID), a folder where a built file goes (ERR_FILE_EXISTS), a built file that cannot be read or written (ERR_WRITE_FAILED), another command changing the theme (ERR_THEME_BUSY), a page that does not render (ERR_RENDER_FAILED), or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
73
+ when: 'the theme does not exist or its base theme package is not installed (ERR_UNKNOWN_THEME), an unknown --section, an --on that names no part or a group, --on given two different parts, or --on with --png or --section (ERR_INVALID_ARGUMENT), with --on, a theme slug two packages provide that the app records none of (ERR_AMBIGUOUS_THEME; the suggestions add one to the app), a theme source that does not build or parse or a token in it that is not text (ERR_THEME_INVALID), a folder where a built file goes (ERR_FILE_EXISTS), a built file that cannot be read or written (ERR_WRITE_FAILED), another command changing the theme (ERR_THEME_BUSY), a page that does not render (ERR_RENDER_FAILED), or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
64
74
  },
65
75
  ],
66
76
  related: ['experimental theme editor', 'experimental theme compile'],
@@ -36,7 +36,7 @@ export const doc = {
36
36
  flag: '--on <where>',
37
37
  param: 'options.on',
38
38
  description:
39
- 'Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a group (inputs, containers, checks, menus; how --list groups), or for font a role (body, heading, code)',
39
+ "Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a group (inputs, containers, checks, menus, or a family the census reads from each part's structure: button-like, overlays, option-rows, selected-items, accent-fills, inset-fields, status-surfaces, overlay-headers, controls; how --list groups), or for font a role (body, heading, code)",
40
40
  },
41
41
  {
42
42
  flag: '--when <prop:value>',
@@ -166,6 +166,10 @@ export function registerHook(program) {
166
166
  ? formatHookCompact(
167
167
  result.data,
168
168
  result.data.importPath || '@astryxdesign/core/hooks',
169
+ {
170
+ propsCommand: `component ${result.data.name} --props`,
171
+ fullCommand: `hook ${result.data.name} --detail full`,
172
+ },
169
173
  )
170
174
  : formatHookFull(result.data);
171
175
 
@@ -174,6 +178,9 @@ export function registerHook(program) {
174
178
  const related = result.data.relatedComponents ?? [];
175
179
  emit(
176
180
  record({package: result.package}),
181
+ // A hook documented with a component names it.
182
+ 'subComponentOf' in result.data &&
183
+ record(result.data, {fields: ['subComponentOf']}),
177
184
  code(doc),
178
185
  related.length > 0 &&
179
186
  text(
@@ -94,7 +94,7 @@ function iconLines(icons) {
94
94
  `icons: mapped ${each.source.export} (${each.source.module}) -> ${each.target.export} (${each.target.module}) by ${each.by}` +
95
95
  (icons.order ? ` from ${each.target.package}/${each.target.set}` : '') +
96
96
  (each.variant
97
- ? `; ${each.variant.asked} look not in the set, drew ${each.variant.used ?? 'its default look'}`
97
+ ? `; ${each.variant.asked} variant not in the set, drew ${each.variant.used ?? 'its default variant'}`
98
98
  : '') +
99
99
  (each.dropped && each.dropped.length > 0
100
100
  ? `; dropped ${each.dropped.join(', ')} (size comes from CSS)`
@@ -59,7 +59,7 @@ export const doc = {
59
59
  flag: '--icons-specifier <specifier>',
60
60
  param: 'options.iconsSpecifier',
61
61
  description:
62
- "Override the icon-registry import in the generated JS module, for example ./icons.mjs (default: the specifier in the theme source's own import). With --family it applies to every member's icon import",
62
+ "Override the icon-registry import in the generated JS module, for example ./icons.mjs; the build then does not compile the registry (default: a TypeScript or JSX registry's compiled copy in <name>.modules/, or a plain JavaScript registry's own path). With --family it applies to every member's icon import",
63
63
  },
64
64
  {
65
65
  flag: '-w, --watch',
@@ -720,8 +720,12 @@ export async function createProgram({argv} = {}) {
720
720
  // none of the registered subcommands matched.
721
721
  const extras = (cmd && cmd.args) || [];
722
722
  if (extras.length > 0) {
723
- const {findEntry, unknownCommandAnswer} = await import('./lib/unknown-command.mjs');
724
- const answer = await unknownCommandAnswer(program, process.argv.slice(2), {findEntry});
723
+ const {findEntry, iconFeaturesOn, projectScript, unknownCommandAnswer} = await import('./lib/unknown-command.mjs');
724
+ const answer = await unknownCommandAnswer(program, process.argv.slice(2), {
725
+ findEntry,
726
+ iconFeatures: iconFeaturesOn,
727
+ projectScript,
728
+ });
725
729
  const unknown = String(extras[0]);
726
730
  cliError(answer?.message ?? `unknown command '${unknown}'`, {
727
731
  suggestions: answer?.suggestions,
@@ -17,9 +17,25 @@ import {loadDocs} from '../../../foundation/discovery/component-loader.mjs';
17
17
  import {
18
18
  formatAccessibility,
19
19
  formatBestPractices,
20
+ formatBrief,
21
+ formatCompact,
22
+ formatFull,
20
23
  mdCell,
21
24
  } from './component-format.mjs';
22
25
 
26
+ /**
27
+ * Whether a hook doc documents its options as `props`, as a component doc
28
+ * does, with no `params` or `returns`. A read of such a doc prints it the
29
+ * way a component read does, so its description, props and examples show.
30
+ * @param {any} docs
31
+ * @returns {boolean}
32
+ */
33
+ function isPropsShaped(docs) {
34
+ return (
35
+ Array.isArray(docs.props) && !('params' in docs) && !('returns' in docs)
36
+ );
37
+ }
38
+
23
39
  /**
24
40
  * Build a signature string from hook docs.
25
41
  * e.g. 'useFocusTrap(options: UseFocusTrapOptions): { containerRef, focusFirst }'
@@ -124,6 +140,22 @@ export function formatHookReturns(docs) {
124
140
  * @returns {string}
125
141
  */
126
142
  export function formatHookFull(docs) {
143
+ if (isPropsShaped(docs)) {
144
+ // The component read prints the usage text in place of the description;
145
+ // the whole hook read prints both, description first.
146
+ const usage = docs.usage?.description;
147
+ const both =
148
+ usage && docs.description && usage !== docs.description
149
+ ? {
150
+ ...docs,
151
+ usage: {
152
+ ...docs.usage,
153
+ description: `${docs.description}\n\n${usage}`,
154
+ },
155
+ }
156
+ : docs;
157
+ return formatFull(both);
158
+ }
127
159
  /** @type {string[]} */
128
160
  const sections = [];
129
161
 
@@ -150,9 +182,16 @@ export function formatHookFull(docs) {
150
182
  * # Name, description, ## Import, ## Best Practices, ## Parameters, ## Returns
151
183
  * @param {any} docs
152
184
  * @param {string} [importPath]
185
+ * @param {{propsCommand?: string | null, fullCommand?: string | null}} [options]
186
+ * - for a hook documented with props: the commands its short answer names,
187
+ * as a component read's does
153
188
  * @returns {string}
154
189
  */
155
- export function formatHookCompact(docs, importPath) {
190
+ export function formatHookCompact(docs, importPath, options = {}) {
191
+ // The caller's fallback import names the hooks entry point, which a hook
192
+ // documented with a component (useTableSelection) is not exported from.
193
+ if (isPropsShaped(docs))
194
+ return formatCompact(docs, docs.name, docs.importPath, options);
156
195
  /** @type {string[]} */
157
196
  const sections = [];
158
197
 
@@ -208,6 +247,7 @@ export function formatHookCompact(docs, importPath) {
208
247
  * @returns {string}
209
248
  */
210
249
  export function formatHookBrief(docs) {
250
+ if (isPropsShaped(docs)) return formatBrief(docs, docs.name, docs.importPath);
211
251
  /** @type {string[]} */
212
252
  const output = [];
213
253