@astryxdesign/cli 0.7.11 → 0.7.12-canary.0085c0f

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 (169) hide show
  1. package/api/build/blocks/blocks.d.mts +41 -0
  2. package/api/build/blocks/blocks.mjs +118 -68
  3. package/api/build/kit/rank.mjs +21 -4
  4. package/api/build/kit/words.d.mts +1 -0
  5. package/api/build/kit/words.mjs +1 -1
  6. package/api/component/__fixtures__/resolutions/modules.txt +5 -5
  7. package/api/docs/_adapter.d.mts +22 -0
  8. package/api/docs/_adapter.mjs +81 -3
  9. package/api/docs/docs.doc.mjs +5 -5
  10. package/api/docs/docs.type.d.mts +21 -0
  11. package/api/docs/docs.type.mjs +11 -0
  12. package/api/docs/list/list.d.mts +5 -1
  13. package/api/docs/list/list.mjs +72 -6
  14. package/api/docs/node/node.mjs +2 -40
  15. package/api/doctor/doctor.d.mts +4 -4
  16. package/api/doctor/doctor.mjs +248 -78
  17. package/api/icon/_adapter.d.mts +3 -2
  18. package/api/icon/_adapter.mjs +8 -2
  19. package/api/icon/_authoring.d.mts +1 -0
  20. package/api/icon/_authoring.mjs +594 -67
  21. package/api/icon/_default-look.d.mts +155 -0
  22. package/api/icon/_default-look.mjs +474 -0
  23. package/api/icon/_records.d.mts +1 -1
  24. package/api/icon/_records.mjs +1 -0
  25. package/api/icon/add/add.mjs +269 -43
  26. package/api/icon/icon.type.d.mts +46 -2
  27. package/api/icon/icon.type.mjs +12 -2
  28. package/api/icon/iconAdd.doc.mjs +2 -2
  29. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  30. package/api/icon/iconNewSet.doc.mjs +4 -4
  31. package/api/icon/map/map.mjs +11 -4
  32. package/api/icon/search/search.mjs +10 -9
  33. package/api/index.d.mts +1 -0
  34. package/api/index.mjs +1 -0
  35. package/api/integration/add-helpers.d.mts +15 -1
  36. package/api/integration/add-helpers.mjs +5 -2
  37. package/api/integration/authoring-checks.d.mts +0 -2
  38. package/api/integration/authoring-checks.mjs +1 -6
  39. package/api/logger.mjs +2 -1
  40. package/api/render/_adapter.mjs +9 -0
  41. package/api/render/render.doc.mjs +3 -3
  42. package/api/render/render.type.d.mts +1 -1
  43. package/api/render/render.type.mjs +1 -1
  44. package/api/search/ORDERING.md +3 -0
  45. package/api/search/_adapter.d.mts +32 -3
  46. package/api/search/_adapter.mjs +50 -22
  47. package/api/search/_fit-order.d.mts +47 -0
  48. package/api/search/_fit-order.mjs +257 -0
  49. package/api/search/_main-searcher.mjs +15 -5
  50. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  51. package/api/search/exportSearchIndex.doc.mjs +58 -0
  52. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  53. package/api/search/rankSearchIndex.doc.mjs +79 -0
  54. package/api/search/search-index.d.mts +44 -0
  55. package/api/search/search-index.mjs +270 -0
  56. package/api/search/search.type.d.mts +28 -0
  57. package/api/search/search.type.mjs +17 -0
  58. package/api/swizzle/_adapter.d.mts +1 -0
  59. package/api/swizzle/_adapter.mjs +4 -1
  60. package/api/swizzle/_moduleGraph.d.mts +178 -0
  61. package/api/swizzle/_moduleGraph.mjs +903 -0
  62. package/api/swizzle/copy/copy.d.mts +2 -43
  63. package/api/swizzle/copy/copy.mjs +287 -315
  64. package/api/swizzle/swizzle.d.mts +0 -2
  65. package/api/swizzle/swizzle.doc.mjs +13 -4
  66. package/api/swizzle/swizzle.mjs +3 -7
  67. package/api/swizzle/swizzle.type.d.mts +7 -1
  68. package/api/swizzle/swizzle.type.mjs +4 -2
  69. package/api/template/skeleton/skeleton.mjs +1 -1
  70. package/api/template/template.mjs +1 -0
  71. package/assets/codemods/transforms/v0.1.0/drop-xds-prefix-imports.mjs +1 -1
  72. package/assets/codemods/transforms/v0.1.0/index.mjs +1 -1
  73. package/assets/discover/official-packages.json +40 -0
  74. package/assets/docs/browser-support.doc.mjs +2 -2
  75. package/assets/docs/styling-overview.doc.mjs +6 -2
  76. package/assets/docs/tree/icon-sets.doc.mjs +13 -7
  77. package/assets/docs/tree/render-pages.doc.mjs +3 -3
  78. package/assets/docs/tree/tailwind.doc.mjs +41 -1
  79. package/assets/docs/tree/type-scale.doc.mjs +19 -2
  80. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  82. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  83. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  84. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  85. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
  86. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
  87. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
  88. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
  89. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
  90. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
  91. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
  92. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
  93. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
  94. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +41 -0
  95. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  96. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  97. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
  98. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
  99. package/assets/templates/pages/course-detail/page.tsx +699 -0
  100. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  101. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  102. package/assets/templates/pages/table-filter/page.tsx +15 -23
  103. package/assets/templates/pages/table-grouped/page.tsx +190 -262
  104. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  105. package/assets/templates/pages/table-inbox/page.tsx +3 -6
  106. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  107. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  108. package/assets/templates/themes/butter/butterTheme.ts +2 -2
  109. package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
  110. package/assets/templates/themes/matcha/matchaTheme.ts +1 -1
  111. package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
  112. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  113. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  114. package/assets/templates/themes/y2k/y2kTheme.ts +2 -2
  115. package/authoring/doctypes/template/type.ts +1 -0
  116. package/clients/cli/commands/docs.doc.mjs +5 -1
  117. package/clients/cli/commands/docs.mjs +30 -2
  118. package/clients/cli/commands/experimental/icon.mjs +56 -14
  119. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  120. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  121. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  122. package/clients/cli/commands/experimental-render.doc.mjs +1 -1
  123. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  124. package/clients/cli/commands/swizzle.mjs +33 -9
  125. package/clients/cli/commands/template.mjs +204 -181
  126. package/clients/cli/lib/resolve-theme.mjs +16 -7
  127. package/foundation/discovery/component-discovery.mjs +1 -1
  128. package/foundation/discovery/component-loader.d.mts +1 -1
  129. package/foundation/discovery/doc-types.mjs +9 -2
  130. package/foundation/discovery/hook-discovery.mjs +31 -8
  131. package/foundation/discovery/icon-ranking.d.mts +27 -3
  132. package/foundation/discovery/icon-ranking.mjs +125 -8
  133. package/foundation/discovery/icon-set-checks.mjs +44 -35
  134. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  135. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  136. package/foundation/discovery/icon-set-writer.d.mts +258 -20
  137. package/foundation/discovery/icon-set-writer.mjs +785 -87
  138. package/foundation/discovery/module-exports.d.mts +3 -2
  139. package/foundation/discovery/module-exports.mjs +167 -37
  140. package/foundation/discovery/template-adapter.mjs +2 -2
  141. package/foundation/doc-compiler/import.d.mts +5 -1
  142. package/foundation/doc-compiler/import.mjs +40 -6
  143. package/foundation/fs/import-url.d.mts +20 -0
  144. package/foundation/fs/import-url.mjs +22 -0
  145. package/foundation/fs/module-loader.d.mts +24 -3
  146. package/foundation/fs/module-loader.mjs +69 -47
  147. package/foundation/fs/paths.d.mts +2 -1
  148. package/foundation/fs/paths.mjs +3 -4
  149. package/foundation/render/charts.d.mts +59 -0
  150. package/foundation/render/charts.mjs +216 -0
  151. package/foundation/render/embedded-imports.d.mts +7 -7
  152. package/foundation/render/embedded-imports.mjs +63 -54
  153. package/foundation/render/page-host.d.mts +4 -0
  154. package/foundation/render/page-host.mjs +45 -0
  155. package/foundation/render/page-worker.mjs +350 -57
  156. package/foundation/render/render-page.d.mts +11 -6
  157. package/foundation/render/render-page.mjs +164 -54
  158. package/foundation/render/ts-paths.d.mts +63 -0
  159. package/foundation/render/ts-paths.mjs +138 -0
  160. package/foundation/response/error-codes.doc.mjs +3 -3
  161. package/foundation/response/error-codes.mjs +3 -2
  162. package/foundation/text/levenshtein.d.mts +6 -1
  163. package/foundation/text/levenshtein.mjs +25 -9
  164. package/foundation/text/shell-arg.d.mts +14 -0
  165. package/foundation/text/shell-arg.mjs +17 -0
  166. package/foundation/text/suggest-order.d.mts +8 -1
  167. package/foundation/text/suggest-order.mjs +72 -6
  168. package/foundation/xle/registry-core.mjs +1 -1
  169. package/package.json +7 -6
@@ -6,7 +6,8 @@ export const doc = {
6
6
  name: 'Theme Showcase',
7
7
  displayName: 'Theme Showcase',
8
8
  description:
9
- 'Several unrelated product surfaces rendered together on one canvas so a token change can be judged across contexts at once. A comparison harness rather than a layout to ship.',
9
+ 'Multi-surface comparison shell: preview palettes, typography, icons and control states across a storefront, checkout, chat and inventory on one responsive canvas. A theme preview and design-system showcase, with an embeddable content view for an existing app shell.',
10
+ category: 'Shell - Top Nav',
10
11
  keywords: [
11
12
  'theme',
12
13
  'tokens',
@@ -16,10 +17,8 @@ export const doc = {
16
17
  'design system preview',
17
18
  ],
18
19
  isReady: true,
19
- // Surfaced via the Themes page "Open in Playground" action, not the
20
- // Templates gallery, so keep it out of the overview + playground menu.
21
- // No `category` — it's hidden from the overview gallery (the only consumer
22
- // of `category`), and 'Showcase' isn't part of the TemplateCategory taxonomy.
20
+ // The standalone entry demonstrates an application shell; the named preview
21
+ // composes into its host without nesting AppShell. Keep it out of the gallery.
23
22
  isHiddenFromOverview: true,
24
23
  icons: {
25
24
  Banknote: 'money',
@@ -260,7 +260,7 @@ export const butterTheme = defineTheme({
260
260
  '--color-tint-hover': [neutral.light[0], neutral.dark[100]],
261
261
 
262
262
  // Typography override
263
- '--text-supporting-size': '12px',
263
+ '--text-supporting-size': '0.75rem', // 12px at the default root size
264
264
 
265
265
  // Element sizes — slightly taller defaults so the new input padding
266
266
  // (--spacing-2 block) has room to breathe.
@@ -394,8 +394,8 @@ export const butterTheme = defineTheme({
394
394
  // Radius intentionally not pinned, so buttons keep core's
395
395
  // `var(--_button-radius, --radius-element)`: standalone buttons stay 8px,
396
396
  // while the chat composer (which sets --_button-radius) rounds them fully.
397
+ // Inline padding only. Button sets its own block padding and height.
397
398
  base: {
398
- paddingBlock: 'var(--spacing-3)',
399
399
  paddingInline: 'var(--spacing-4)',
400
400
  },
401
401
  'variant:secondary': SECONDARY_BUTTON,
@@ -395,6 +395,22 @@ export const gothicTheme = defineTheme({
395
395
  },
396
396
  },
397
397
 
398
+ // Gothic's accent text and icons are one light color. On a media surface
399
+ // they follow that surface's accent, so a dark surface inside a light one
400
+ // gets its light accent back.
401
+ onDark: {
402
+ tokens: {
403
+ '--color-text-accent': 'var(--color-accent)',
404
+ '--color-icon-accent': 'var(--color-accent)',
405
+ },
406
+ },
407
+ onLight: {
408
+ tokens: {
409
+ '--color-text-accent': 'var(--color-accent)',
410
+ '--color-icon-accent': 'var(--color-accent)',
411
+ },
412
+ },
413
+
398
414
  icons: gothicIconRegistry,
399
415
  });
400
416
 
@@ -97,7 +97,7 @@ export const matchaTheme = defineTheme({
97
97
 
98
98
  // Text
99
99
  '--color-text-primary': [neutral.light[20], neutral.dark[75]],
100
- '--color-text-secondary': [neutral.light[40], neutral.dark[60]],
100
+ '--color-text-secondary': [neutral.light[30], neutral.dark[60]],
101
101
  '--color-text-disabled': [neutral.light[75], neutral.dark[30]],
102
102
  '--color-text-accent': [neutral.light[20], neutral.dark[75]],
103
103
  '--color-on-dark': neutral.light[100],
@@ -361,7 +361,13 @@ export const neutralTheme = defineTheme({
361
361
  padding: 'var(--spacing-1)',
362
362
  },
363
363
  },
364
+ // An unselected label sits on the translucent track, which lifts the
365
+ // page under it. In dark mode secondary text falls under 4.5:1 on the
366
+ // track over the surface, so it takes the same next stop.
364
367
  'segmented-control-item': {
368
+ base: {
369
+ '--color-text-secondary': `light-dark(${neutral.light[30]}, ${neutral.dark[80]})`,
370
+ },
365
371
  'size:sm': {
366
372
  height: 'calc(var(--size-element-sm) - 8px)',
367
373
  },
@@ -240,7 +240,7 @@ export const stoneTheme = defineTheme({
240
240
  '--color-tint-hover': [neutral.light[0], neutral.dark[100]],
241
241
 
242
242
  // Typography override
243
- '--text-supporting-size': '12px',
243
+ '--text-supporting-size': '0.75rem', // 12px at the default root size
244
244
 
245
245
  // Categorical
246
246
  // Light mode pairs pastel stop 90 surfaces with stop 30 foregrounds.
@@ -15,7 +15,7 @@ export const y2kPaletteRefs = {
15
15
  dark: {20: '#2a3600', 65: '#95b041', 75: '#b5d263', 80: '#c5e17a'},
16
16
  },
17
17
  neutral: {
18
- light: {15: '#2d241b', 20: '#382e24', 30: '#4f453b', 40: '#675d52', 80: '#d1c5b8', 85: '#dfd5c9', 90: '#f1e6db', 95: '#fff6ed', 100: '#ffffff'},
18
+ light: {15: '#2d241b', 20: '#382e24', 30: '#4f453b', 35: '#5a5146', 40: '#675d52', 80: '#d1c5b8', 85: '#dfd5c9', 90: '#f1e6db', 95: '#fff6ed', 100: '#ffffff'},
19
19
  dark: {0: '#000000', 5: '#0e0f1a', 10: '#16182b', 20: '#1f2238', 25: '#2c3048', 35: '#4a4f6b', 45: '#636889', 70: '#a6acd6', 85: '#d0d4eb', 90: '#dfe2f3', 95: '#edeffc'},
20
20
  },
21
21
  orange: {
@@ -182,7 +182,7 @@ export const y2kTheme = defineTheme({
182
182
 
183
183
  // Text
184
184
  '--color-text-primary': [neutral.light[15], neutral.dark[95]],
185
- '--color-text-secondary': [neutral.light[40], neutral.dark[70]],
185
+ '--color-text-secondary': [neutral.light[35], neutral.dark[70]],
186
186
  '--color-text-disabled': [neutral.light[80], neutral.dark[35]],
187
187
  '--color-text-accent': [neutral.light[15], neutral.dark[95]],
188
188
  '--color-on-dark': neutral.light[100],
@@ -236,7 +236,7 @@ export const y2kTheme = defineTheme({
236
236
  '--color-tint-hover': [neutral.light[15], neutral.dark[95]],
237
237
 
238
238
  // Typography override
239
- '--text-supporting-size': '12px',
239
+ '--text-supporting-size': '0.75rem', // 12px at the default root size
240
240
 
241
241
  // Categorical colors
242
242
  '--color-background-green': [green.light[80], green.dark[80]],
@@ -186,6 +186,7 @@ export type TemplateCategory =
186
186
  | 'Content - Order Detail'
187
187
  | 'Content - Product Detail'
188
188
  | 'Content - Work Item Detail'
189
+ | 'Content - Course Detail'
189
190
  | 'Content - Product List'
190
191
  | 'Content - Documentation Catalog'
191
192
  | 'Content - Documentation Design'
@@ -46,7 +46,7 @@ export const doc = {
46
46
  flag: '--depth <levels>',
47
47
  param: 'options.depth',
48
48
  description:
49
- 'How many levels of the docs tree to read below a namespace: 0 for the namespace alone, 1 for its children (what a read without --depth shows), all for everything below it. With it, --detail sets how much of each doc below shows: brief (one line each, the default), compact (with its sections), or full',
49
+ 'How many levels of the docs tree to read below a namespace: 0 for the namespace alone, 1 for its children (what a read without --depth shows), all for everything below it. On the topic list, where a namespace otherwise lists alone, it names the docs below each one by the route that opens them, one line each. With it on a namespace read, --detail sets how much of each doc below shows: brief (one line each, the default), compact (with its sections), or full; the topic list is one line per doc whatever the detail',
50
50
  },
51
51
  ],
52
52
  examples: [
@@ -56,6 +56,10 @@ export const doc = {
56
56
  {label: 'One section', cli: 'astryx docs theme quick-start'},
57
57
  {label: 'The CLI docs tree', cli: 'astryx docs cli'},
58
58
  {label: 'Every CLI doc, one line each', cli: 'astryx docs cli --depth all'},
59
+ {
60
+ label: 'Every route in the docs tree, one line each',
61
+ cli: 'astryx docs --depth all',
62
+ },
59
63
  {
60
64
  label: 'The integration guides as one read',
61
65
  cli: 'astryx docs authoring --depth all --detail full',
@@ -615,6 +615,32 @@ function summarize(result) {
615
615
 
616
616
  // ─── Command ─────────────────────────────────────────────────────────────────
617
617
 
618
+ /**
619
+ * Every namespace of the list and, where a `--depth` read carried them, the
620
+ * docs below it, in reading order and in one flat list: each row's `topic` is
621
+ * the route that opens it, so the depth of a row never changes how a reader
622
+ * uses it, and each names the package that owns it.
623
+ * @param {Array<import('../../../api/docs/docs.type.mjs').DocsListNamespace | import('../../../api/docs/docs.type.mjs').DocsListChild>} rows
624
+ * @returns {Array<{topic: string, description: string, package: string}>}
625
+ */
626
+ function flattenNamespaces(rows) {
627
+ return rows.flatMap(row => [
628
+ {
629
+ topic: row.topic,
630
+ // An experimental doc is marked here as it is wherever else it is
631
+ // listed, so a reader cannot take a row of this list for a stable doc.
632
+ description:
633
+ 'stability' in row &&
634
+ row.stability === 'experimental' &&
635
+ !/^experimental\b/iu.test(row.description)
636
+ ? `[experimental] ${row.description}`
637
+ : row.description,
638
+ package: row.package,
639
+ },
640
+ ...flattenNamespaces(row.children ?? []),
641
+ ]);
642
+ }
643
+
618
644
  /**
619
645
  * @param {import('commander').Command} program
620
646
  */
@@ -703,8 +729,10 @@ export function registerDocs(program) {
703
729
  // The text view mirrors the JSON list, with the docs tree's
704
730
  // namespaces (`meta.namespaces`) first under their own heading: that
705
731
  // is where the CLI's own docs start, and a namespace reads
706
- // differently from a topic.
707
- const namespaces = result.meta?.namespaces ?? [];
732
+ // differently from a topic. With --depth each branch is flattened
733
+ // into the same list, so every line is a route a reader can pass
734
+ // straight back to `docs`.
735
+ const namespaces = flattenNamespaces(result.meta?.namespaces ?? []);
708
736
  const topics = result.data;
709
737
  emit(
710
738
  ...(namespaces.length > 0
@@ -20,6 +20,7 @@ import {
20
20
  getCliInvocation,
21
21
  } from '../../../../foundation/env/package-manager.mjs';
22
22
  import {jsonOut} from '../../../../foundation/response/json.mjs';
23
+ import {logger} from '../../../../api/logger.mjs';
23
24
  import {resultSet} from '../../../../foundation/debug/index.mjs';
24
25
  import {
25
26
  emit,
@@ -58,6 +59,20 @@ const defaultVariantText = value =>
58
59
  /** @param {unknown} value */
59
60
  const variantsText = value => (Array.isArray(value) ? value.join('/') : '');
60
61
 
62
+ /**
63
+ * The receipt line for a data file whose `module` the command rewrote after
64
+ * a package rename.
65
+ * @param {{moduleUpdate?: {previous: string, module: string}, dryRun?: boolean}} data
66
+ */
67
+ const moduleUpdateLines = data =>
68
+ data.moduleUpdate
69
+ ? [
70
+ text(
71
+ `${data.dryRun ? '[plan] Would update' : '[ok] Updated'} module to "${data.moduleUpdate.module}" (was "${data.moduleUpdate.previous}"), from the package name in package.json.`,
72
+ ),
73
+ ]
74
+ : [];
75
+
61
76
  /**
62
77
  * Register `icon` and its subcommands under the `experimental` group.
63
78
  * @param {import('commander').Command} group the `experimental` command
@@ -140,7 +155,7 @@ export function registerExperimentalIcon(group, program) {
140
155
  ),
141
156
  ),
142
157
  text(
143
- `Built-in definitions are the ones every set maps. Map one: ${run} experimental icon map <definition> <icon id>`,
158
+ `Built-in definitions are the ones every set maps. Map one: ${run} experimental icon map <definition> <icon id> --set <set>`,
144
159
  ),
145
160
  );
146
161
  return answered;
@@ -157,7 +172,9 @@ export function registerExperimentalIcon(group, program) {
157
172
  `${each.id}: ${each.words.join(', ')}${each.definitions.length > 0 ? ` = ${each.definitions.join(', ')}` : ''}`,
158
173
  ),
159
174
  ),
160
- text(`Map one: ${run} experimental icon map <definition> <id>`),
175
+ text(
176
+ `Map one: ${run} experimental icon map <definition> <id> --set ${set}`,
177
+ ),
161
178
  );
162
179
  return answered;
163
180
  }
@@ -308,6 +325,9 @@ export function registerExperimentalIcon(group, program) {
308
325
  * @param {(result: any) => void} print
309
326
  */
310
327
  const run = async (call, print) => {
328
+ // Reading a large library reports its progress through the shared
329
+ // logger: on stderr in text mode, never under --json.
330
+ logger.setSilent(Boolean(program.opts().json));
311
331
  let result;
312
332
  try {
313
333
  result = await call();
@@ -370,20 +390,24 @@ export function registerExperimentalIcon(group, program) {
370
390
  (
371
391
  /** @type {{definition: string, icon: string, previous: string | null}} */ each,
372
392
  ) =>
373
- `${each.definition} = "${each.icon}"${each.previous && each.previous !== each.icon ? ` (was "${each.previous}")` : ''}`,
393
+ `${each.definition} = "${each.icon}"${each.previous === each.icon ? ' (unchanged)' : each.previous ? ` (was "${each.previous}")` : ' (was not mapped)'}`,
374
394
  ),
375
395
  ),
396
+ ...moduleUpdateLines(data),
376
397
  )
377
398
  : emit(
399
+ // The entry line reads `previous` and `icon`: a write can
400
+ // come from a package rename alone.
378
401
  text(
379
402
  data.icon == null
380
- ? data.changed
403
+ ? data.previous != null
381
404
  ? `[ok] Removed map.${data.definition} (was "${data.previous}") from ${data.file}.`
382
405
  : `[ok] ${data.file} has no map.${data.definition}.`
383
- : data.changed
406
+ : data.previous !== data.icon
384
407
  ? `[ok] map.${data.definition} = "${data.icon}" in ${data.file}${data.previous ? ` (was "${data.previous}")` : ''}.`
385
408
  : `[ok] map.${data.definition} is already "${data.icon}".`,
386
409
  ),
410
+ ...moduleUpdateLines(data),
387
411
  ),
388
412
  ),
389
413
  });
@@ -424,6 +448,7 @@ export function registerExperimentalIcon(group, program) {
424
448
  text(
425
449
  `[ok] ${data.variant}: ${data.added} icons gained it${data.already > 0 ? `, ${data.already} already had it` : ''}, read from ${data.from}.`,
426
450
  ),
451
+ ...moduleUpdateLines(data),
427
452
  ...(data.files.length > 0 ? [list(data.files)] : []),
428
453
  ...(data.missing.length > 0
429
454
  ? [
@@ -436,7 +461,7 @@ export function registerExperimentalIcon(group, program) {
436
461
  return;
437
462
  }
438
463
  if (result.type === 'icon.definitionMatches') {
439
- const {matches, newDefinition} = result.data;
464
+ const {matches, newDefinition, variant} = result.data;
440
465
  emit(
441
466
  section(
442
467
  `Icon definitions for ${result.data.export} (${matches.length})`,
@@ -466,6 +491,13 @@ export function registerExperimentalIcon(group, program) {
466
491
  ),
467
492
  ]
468
493
  : []),
494
+ ...(variant
495
+ ? [
496
+ text(
497
+ `The set already has this glyph in another look. Add this one as its variant: ${formatCliCommand(variant)}`,
498
+ ),
499
+ ]
500
+ : []),
469
501
  text(
470
502
  `All icon definitions: ${cli} docs cli/experimental/icon-definitions`,
471
503
  ),
@@ -475,10 +507,11 @@ export function registerExperimentalIcon(group, program) {
475
507
  const {data} = result;
476
508
  emit(
477
509
  text(
478
- data.changed
510
+ data.added
479
511
  ? `[ok] Added ${data.icon.export} as "${data.icon.id}"${data.variant ? ` (variant ${data.variant})` : ''}${data.definition ? `, map.${data.definition} = "${data.icon.id}"` : ''}.`
480
512
  : `[ok] ${data.icon.export} is already "${data.icon.id}"${data.definition ? ` and map.${data.definition} names it` : ''}.`,
481
513
  ),
514
+ ...moduleUpdateLines(data),
482
515
  ...(data.files.length > 0 ? [list(data.files)] : []),
483
516
  ...(data.note ? [text(`[next] ${data.note}`)] : []),
484
517
  );
@@ -500,17 +533,25 @@ export function registerExperimentalIcon(group, program) {
500
533
  const {root, manifest, files, written, dryRun} = data;
501
534
  const state = dryRun ? 'plan' : written ? 'ok' : 'unchanged';
502
535
  const refreshed = data.refreshed === true;
536
+ const updated = data.updated === true;
537
+ const What = `${what[0].toUpperCase()}${what.slice(1)}`;
503
538
  emit(
504
539
  section(
505
540
  refreshed
506
541
  ? dryRun
507
542
  ? `Refresh ${what} plan`
508
- : `${what[0].toUpperCase()}${what.slice(1)} refreshed`
509
- : dryRun
510
- ? `New ${what} plan`
511
- : written
512
- ? `New ${what} added`
513
- : `New ${what} unchanged`,
543
+ : `${What} refreshed`
544
+ : updated
545
+ ? dryRun
546
+ ? `${What} update plan`
547
+ : written && files.length > 0
548
+ ? `${What} updated`
549
+ : `${What} unchanged`
550
+ : dryRun
551
+ ? `New ${what} plan`
552
+ : written
553
+ ? `New ${what} added`
554
+ : `New ${what} unchanged`,
514
555
  ),
515
556
  text(`[${state}] ${data.name}`),
516
557
  // What the command did (or, in a dry run, would do): never a step
@@ -522,6 +563,7 @@ export function registerExperimentalIcon(group, program) {
522
563
  : `The experimental.iconSets root ${root.path} in ${manifest} is unchanged.`
523
564
  : `${dryRun ? 'Would update' : 'Updated'} ${manifest}.`,
524
565
  ),
566
+ ...moduleUpdateLines(data),
525
567
  ...(files.length > 0 ? [list(files)] : []),
526
568
  // What to do next comes before the long lists, so it never scrolls
527
569
  // away.
@@ -542,7 +584,7 @@ export function registerExperimentalIcon(group, program) {
542
584
  list(
543
585
  data.suggestions.map(
544
586
  each =>
545
- `${each.definition} -> ${each.icon} (${each.word}): ${formatCliCommand(`astryx experimental icon map ${each.definition} ${each.icon}`)}`,
587
+ `${each.definition} -> ${each.icon} (${each.word}): ${formatCliCommand(`astryx experimental icon map ${each.definition} ${each.icon} --set ${data.name}`)}`,
546
588
  ),
547
589
  ),
548
590
  ]
@@ -30,7 +30,7 @@ export const doc = {
30
30
  flag: '--new-definition <name>',
31
31
  param: 'options.newDefinition',
32
32
  description:
33
- "Add your set's own definition, then map the icon to it; needs --description and --words",
33
+ "Add your set's own definition, named in camelCase (aiHelper) or kebab-case (ai-helper), then map the icon to it; needs --description and --words",
34
34
  },
35
35
  {
36
36
  flag: '--description <text>',
@@ -18,7 +18,8 @@ export const doc = {
18
18
  name: 'name',
19
19
  param: 'name',
20
20
  required: true,
21
- description: 'The definition name, in camelCase (rocketLaunch)',
21
+ description:
22
+ 'The definition name, in camelCase (rocketLaunch) or kebab-case (rocket-launch)',
22
23
  },
23
24
  ],
24
25
  options: [
@@ -11,7 +11,7 @@ export const doc = {
11
11
  stability: 'experimental',
12
12
  summary: 'Start an icon set in your integration package',
13
13
  description:
14
- "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. Run it again to refresh. --variants and --default-variant declare the set's variants. Experimental: it may change or be removed in a patch release.",
14
+ "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. A library whose export names end in looks (XOutline24WGHT500Icon) gives one icon per glyph, by its glyph id (x), in the look the default variant names, else the library's usual default. Run it again with --from to refresh. --variants and --default-variant declare the set's variants; over an existing set without --from, they, --display-name and --description update the set in place and leave its icons as they are; a set with icons changes its default variant only with --from, and only in a library whose export names encode looks. Experimental: it may change or be removed in a patch release.",
15
15
  fn: 'iconNewSet',
16
16
  args: [
17
17
  {
@@ -49,7 +49,7 @@ export const doc = {
49
49
  flag: '--default-variant <variant>',
50
50
  param: 'options.defaultVariant',
51
51
  description:
52
- "With --variants: the variant each icon's own export draws (the first variant when omitted)",
52
+ "With --variants: the variant each icon's own export draws. When omitted: in a library whose export names encode looks, the look the icons draw (the library's usual default for a new set), which --variants must list; otherwise the set's current default, which --variants must list when the set has icons, else, on a set without icons, the first variant. A set with icons changes it only with --from, and only in a library whose export names encode looks",
53
53
  },
54
54
  {
55
55
  flag: '--display-name <text>',
@@ -53,7 +53,7 @@ export const doc = {
53
53
  {code: 0, when: 'the file was written (warnings included)'},
54
54
  {
55
55
  code: 1,
56
- when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, or HTML that is not an Astryx page',
56
+ when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, crashes Node, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, or HTML that is not an Astryx page',
57
57
  },
58
58
  ],
59
59
  related: ['template', 'build'],
@@ -16,8 +16,17 @@ export const doc = {
16
16
  summary: 'Copy component source for customization',
17
17
  description:
18
18
  "Ejects a component's source from the resolved @astryxdesign/core (or its owning " +
19
- 'integration) into your project for deep customization, rewriting imports that ' +
20
- 'escape the component directory. With no name it lists the swizzlable components. ' +
19
+ 'integration) into your project for deep customization. Every import in the copy ' +
20
+ 'names a file the copy holds or a path the package exports: names the package ' +
21
+ 'exports come from the package, and every internal module the component needs ' +
22
+ "is copied beside it in the package's folder layout. " +
23
+ 'Tests, stories and docs are not copied. It lists the npm packages the copy imports, ' +
24
+ 'with the ranges the owner package declares, to install if your project lacks them. ' +
25
+ 'An output folder swizzle owns (one the copy ' +
26
+ 'creates, an empty one, or one it marked before) gets an astryx-swizzle.json marker naming ' +
27
+ "each package its copies came from, so @astryxdesign/build's Babel, PostCSS and Vite " +
28
+ 'integrations, and withAstryx() under webpack, compile the copy below your theme. ' +
29
+ 'With no name it lists the swizzlable components. ' +
21
30
  'An integration component that replaces a Core component is what that Core name ' +
22
31
  'copies; --package @astryxdesign/core copies the original. --list lists Core ' +
23
32
  'components, including one an integration replaces.',
@@ -46,7 +55,7 @@ export const doc = {
46
55
  flag: '-f, --overwrite',
47
56
  param: 'options.overwrite',
48
57
  description:
49
- 'Replace existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written',
58
+ "Replace the component's existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written. A helper an earlier swizzle wrote is reused when it is the same and is never replaced by a copy that carries it: a different one stays, and this copy writes its own under a version-suffixed name. Swizzling the component whose folder holds that helper counts it as one of that component's own files. A changed private attribute owner module, or a style module it imports, fails the command without --overwrite and is replaced with it",
50
59
  },
51
60
  ],
52
61
  examples: [
@@ -3,11 +3,10 @@
3
3
  /**
4
4
  * @file swizzle command — thin wrapper around api/swizzle.
5
5
  *
6
- * Copies a component's source into the consumer project for customization
7
- * (imports rewritten to the owner package's subpaths). All logic — owner
8
- * resolution, copy, import rewriting, StyleX detection, maintainer feedback —
9
- * lives in api/swizzle; this file only parses flags, prints, and prefixes
10
- * commands for the caller's package manager.
6
+ * Copies a component's source into the consumer project for customization,
7
+ * with the internal modules it needs. All logic — owner resolution, the copy,
8
+ * StyleX detection, maintainer feedback — lives in api/swizzle; this file only
9
+ * parses flags, prints, and prefixes commands for the caller's package manager.
11
10
  */
12
11
 
13
12
  import {jsonOut} from '../../../foundation/response/json.mjs';
@@ -85,18 +84,43 @@ export function registerSwizzle(program) {
85
84
  text(`[ok] Copied ${filesCopied} files to ${outputDir}/`),
86
85
  text(
87
86
  [
88
- `Relative imports have been rewritten to use ${ownerPackage}.`,
87
+ `What ${ownerPackage} exports is imported from ${ownerPackage}; the internal modules the component needs are copied beside it.`,
89
88
  'You can now customize the component source freely.',
90
89
  ].join('\n'),
91
90
  ),
92
91
  ];
93
- // Files the copy wrote outside the component folder: the owner modules
94
- // and their unexported style modules (spec:AST-110 FR4).
92
+ // Files the copy wrote outside the component folder: the internal
93
+ // modules it needs, in the package's folder layout.
95
94
  const shared = (result.data.files ?? []).filter(f => f.startsWith('../'));
96
95
  if (shared.length > 0) {
97
96
  out.push(
98
97
  text(
99
- `Shared modules: ${shared.join(', ')} (copied whole; their imports between each other stay relative)`,
98
+ `Copied beside it: ${shared.join(', ')} (in the package's folder layout; imported by relative path)`,
99
+ ),
100
+ );
101
+ }
102
+
103
+ // npm packages the copy imports, each range quoted so the list pastes
104
+ // safely after an install command.
105
+ const dependencies = Object.entries(result.data.dependencies ?? {});
106
+ if (dependencies.length > 0) {
107
+ out.push(
108
+ text(
109
+ `It imports these npm packages; install any your project lacks: ${dependencies
110
+ .map(([name, range]) => (range === '*' ? name : `${name}@"${range}"`))
111
+ .join(' ')}`,
112
+ ),
113
+ );
114
+ }
115
+
116
+ const {marker} = result.data;
117
+ if (marker) {
118
+ const folder = marker.path.replace(/\/?astryx-swizzle\.json$/, '') || '.';
119
+ out.push(
120
+ text(
121
+ marker.written
122
+ ? `Marked ${folder}/ with astryx-swizzle.json: with @astryxdesign/build's Babel, PostCSS and Vite integrations, or withAstryx() under webpack, every module under it compiles below your theme, so theme overrides reach the copy. Keep only swizzled copies there. Turbopack does not read the marker yet.`
123
+ : `Did not mark ${folder}/ with astryx-swizzle.json: it already holds ${(marker.found ?? []).join(', ')} and no astryx-swizzle.json. If it holds only swizzled copies, add ${marker.path} to mark it, so theme overrides reach them; keep the product's own components out of a marked folder.`,
100
124
  ),
101
125
  );
102
126
  }