@astryxdesign/cli 0.7.13 → 0.7.14-canary.108f354

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 (164) hide show
  1. package/README.md +18 -18
  2. package/api/component/__fixtures__/resolutions/modules.txt +1 -1
  3. package/api/doctor/doctor.mjs +3 -7
  4. package/api/experimental.d.mts +2 -0
  5. package/api/experimental.mjs +12 -0
  6. package/api/icon/_adapter.d.mts +10 -0
  7. package/api/icon/_adapter.mjs +31 -2
  8. package/api/icon/_authoring.d.mts +2 -1
  9. package/api/icon/_authoring.mjs +91 -6
  10. package/api/icon/_options.mjs +1 -0
  11. package/api/icon/_records.d.mts +18 -0
  12. package/api/icon/_records.mjs +26 -0
  13. package/api/icon/add/add.mjs +7 -1
  14. package/api/icon/definitions/definitions.d.mts +12 -0
  15. package/api/icon/definitions/definitions.mjs +83 -0
  16. package/api/icon/icon.doc.mjs +5 -4
  17. package/api/icon/icon.mjs +5 -16
  18. package/api/icon/icon.type.d.mts +29 -2
  19. package/api/icon/icon.type.mjs +17 -3
  20. package/api/icon/iconAdd.doc.mjs +1 -1
  21. package/api/icon/iconMap.doc.mjs +2 -2
  22. package/api/icon/iconNewSet.doc.mjs +8 -2
  23. package/api/icon/map/map.mjs +21 -2
  24. package/api/icon/new-set/new-set.mjs +14 -2
  25. package/api/icon/search/search.mjs +2 -15
  26. package/api/icon/use/use.mjs +4 -3
  27. package/api/integration/validate-integration.mjs +6 -1
  28. package/api/integration/validate-integration.type.d.mts +12 -0
  29. package/api/integration/validate-integration.type.mjs +5 -0
  30. package/api/theme-edit/_adapter.d.mts +116 -0
  31. package/api/theme-edit/_adapter.mjs +1683 -0
  32. package/api/theme-edit/_catalog.d.mts +59 -0
  33. package/api/theme-edit/_catalog.mjs +564 -0
  34. package/api/theme-edit/_check.d.mts +49 -0
  35. package/api/theme-edit/_check.mjs +845 -0
  36. package/api/theme-edit/_color.d.mts +29 -0
  37. package/api/theme-edit/_color.mjs +300 -0
  38. package/api/theme-edit/_compiler.d.mts +61 -0
  39. package/api/theme-edit/_compiler.mjs +522 -0
  40. package/api/theme-edit/_css-properties.d.mts +10 -0
  41. package/api/theme-edit/_css-properties.mjs +556 -0
  42. package/api/theme-edit/_parts.d.mts +111 -0
  43. package/api/theme-edit/_parts.mjs +409 -0
  44. package/api/theme-edit/_png.d.mts +40 -0
  45. package/api/theme-edit/_png.mjs +187 -0
  46. package/api/theme-edit/_preview.d.mts +121 -0
  47. package/api/theme-edit/_preview.mjs +720 -0
  48. package/api/theme-edit/_project.d.mts +83 -0
  49. package/api/theme-edit/_project.mjs +289 -0
  50. package/api/theme-edit/_settings.d.mts +222 -0
  51. package/api/theme-edit/_settings.mjs +861 -0
  52. package/api/theme-edit/_tables.d.mts +132 -0
  53. package/api/theme-edit/_tables.mjs +700 -0
  54. package/api/theme-edit/theme-edit.d.mts +93 -0
  55. package/api/theme-edit/theme-edit.mjs +145 -0
  56. package/api/theme-edit/theme-edit.type.d.mts +413 -0
  57. package/api/theme-edit/theme-edit.type.mjs +233 -0
  58. package/api/theme-edit/themeEditHow.doc.d.mts +6 -0
  59. package/api/theme-edit/themeEditHow.doc.mjs +88 -0
  60. package/api/theme-edit/themeEditNew.doc.d.mts +6 -0
  61. package/api/theme-edit/themeEditNew.doc.mjs +89 -0
  62. package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +6 -0
  63. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +100 -0
  64. package/api/theme-edit/themeEditPreviewApp.doc.d.mts +6 -0
  65. package/api/theme-edit/themeEditPreviewApp.doc.mjs +84 -0
  66. package/api/theme-edit/themeEditPreviewList.doc.d.mts +6 -0
  67. package/api/theme-edit/themeEditPreviewList.doc.mjs +53 -0
  68. package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +6 -0
  69. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +66 -0
  70. package/api/theme-edit/themeEditSet.doc.d.mts +6 -0
  71. package/api/theme-edit/themeEditSet.doc.mjs +165 -0
  72. package/api/theme-edit/themeEditShow.doc.d.mts +6 -0
  73. package/api/theme-edit/themeEditShow.doc.mjs +86 -0
  74. package/api/theme-edit/themeEditUndo.doc.d.mts +6 -0
  75. package/api/theme-edit/themeEditUndo.doc.mjs +124 -0
  76. package/assets/docs/color.doc.mjs +5 -5
  77. package/assets/docs/tree/icon-sets.doc.mjs +6 -2
  78. package/assets/docs/tree/tokens-border.doc.mjs +1 -1
  79. package/assets/docs/tree/tokens-color.doc.mjs +2 -2
  80. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  81. package/assets/docs/tree/tokens-duration.doc.mjs +1 -1
  82. package/assets/docs/tree/tokens-ease.doc.mjs +1 -1
  83. package/assets/docs/tree/tokens-focus.doc.mjs +1 -1
  84. package/assets/docs/tree/tokens-font-weight.doc.mjs +1 -1
  85. package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
  86. package/assets/docs/tree/tokens-shadow.doc.mjs +1 -1
  87. package/assets/docs/tree/tokens-size.doc.mjs +1 -1
  88. package/assets/docs/tree/tokens-spacing.doc.mjs +1 -1
  89. package/assets/docs/tree/tokens-syntax.doc.mjs +1 -1
  90. package/assets/docs/tree/tokens-text-size.doc.mjs +1 -1
  91. package/assets/docs/tree/tokens-type-scale.doc.mjs +1 -1
  92. package/assets/docs/tree/tokens-typography.doc.mjs +1 -1
  93. package/assets/icons/definitions/bank.doc.mjs +1 -1
  94. package/assets/icons/definitions/save.doc.mjs +1 -1
  95. package/assets/preview-app/README.md +6 -0
  96. package/assets/preview-app/css.d.ts +5 -0
  97. package/assets/preview-app/gitignore +1 -0
  98. package/assets/preview-app/next.config.mjs +6 -0
  99. package/assets/preview-app/package.json +23 -0
  100. package/assets/preview-app/src/app/globals.css +5 -0
  101. package/assets/preview-app/src/app/layout.tsx +21 -0
  102. package/assets/preview-app/src/app/page.tsx +94 -0
  103. package/assets/preview-app/src/app/providers.tsx +16 -0
  104. package/assets/preview-app/tsconfig.json +27 -0
  105. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +2 -1
  106. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +2 -1
  107. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider03RtlDirection.doc.mjs +2 -1
  108. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +2 -1
  109. package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
  110. package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
  111. package/authoring/doctypes/_schema.d.mts +1 -0
  112. package/authoring/doctypes/_schema.mjs +1 -0
  113. package/authoring/doctypes/command/command.doc.mjs +7 -0
  114. package/authoring/doctypes/command/type.ts +3 -0
  115. package/authoring/doctypes/icon-set/parse.d.mts +7 -0
  116. package/authoring/doctypes/icon-set/parse.mjs +18 -8
  117. package/clients/cli/commands/doctor.mjs +33 -3
  118. package/clients/cli/commands/experimental/icon.mjs +67 -14
  119. package/clients/cli/commands/experimental/index.mjs +2 -0
  120. package/clients/cli/commands/experimental/theme.mjs +684 -0
  121. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +7 -1
  122. package/clients/cli/commands/experimental-icon.doc.mjs +3 -2
  123. package/clients/cli/commands/experimental-theme-add.doc.mjs +78 -0
  124. package/clients/cli/commands/experimental-theme-compile.doc.mjs +97 -0
  125. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +84 -0
  126. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +66 -0
  127. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +121 -0
  128. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +66 -0
  129. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +104 -0
  130. package/clients/cli/commands/experimental-theme-editor.doc.mjs +49 -0
  131. package/clients/cli/commands/experimental-theme-eject.doc.mjs +71 -0
  132. package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
  133. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +73 -0
  134. package/clients/cli/commands/experimental-theme-palette.doc.mjs +37 -0
  135. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +86 -0
  136. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +66 -0
  137. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +48 -0
  138. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +59 -0
  139. package/clients/cli/commands/experimental-theme-preview.doc.mjs +40 -0
  140. package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
  141. package/clients/cli/commands/experimental-theme-targets.doc.mjs +61 -0
  142. package/clients/cli/commands/experimental-theme-template.doc.mjs +61 -0
  143. package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
  144. package/clients/cli/commands/experimental-theme.doc.mjs +57 -0
  145. package/clients/cli/commands/experimental.doc.mjs +10 -3
  146. package/clients/cli/commands/theme.mjs +101 -34
  147. package/clients/cli/index.mjs +18 -0
  148. package/clients/cli/lib/define-command.mjs +3 -0
  149. package/foundation/discovery/icon-set-checks.d.mts +16 -1
  150. package/foundation/discovery/icon-set-checks.mjs +68 -7
  151. package/foundation/discovery/icon-set-discovery.d.mts +21 -6
  152. package/foundation/discovery/icon-set-discovery.mjs +17 -8
  153. package/foundation/discovery/template-icon-meanings.d.mts +39 -0
  154. package/foundation/discovery/template-icon-meanings.mjs +95 -0
  155. package/foundation/discovery/theming-targets.d.mts +6 -0
  156. package/foundation/discovery/theming-targets.mjs +33 -0
  157. package/foundation/response/error-codes.d.mts +12 -1
  158. package/foundation/response/error-codes.doc.mjs +66 -0
  159. package/foundation/response/error-codes.mjs +55 -0
  160. package/foundation/response/response-types.doc.mjs +55 -0
  161. package/foundation/text/template-meanings-line.d.mts +16 -0
  162. package/foundation/text/template-meanings-line.mjs +37 -0
  163. package/foundation/xle/browser.d.mts +2 -2
  164. package/package.json +6 -6
@@ -0,0 +1,61 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme targets`: the experimental
5
+ * copy of `astryx theme targets`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme targets',
12
+ displayName: 'astryx experimental theme targets',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'List the component theming targets a theme can override',
16
+ description:
17
+ 'Prints every `defineTheme` components key across the system: the stable class it paints, the component that declares it, and the props and states that are legal override keys under it. This is the whole themeable surface in one command: what auditing a theme, or answering "which key paints this pixel?", used to need one `{@command component <Name>}` per component to assemble. Pass a component name to scope it; pass any other text to search target keys, classes, and components. `--json` for a list a repo can lint its own theme against.',
18
+ fn: 'themeTargets',
19
+ args: [
20
+ {
21
+ name: 'filter',
22
+ param: 'filter',
23
+ required: false,
24
+ },
25
+ ],
26
+ examples: [
27
+ {
28
+ label: 'The whole themeable surface',
29
+ cli: 'astryx experimental theme targets',
30
+ },
31
+ {
32
+ label: "One component's targets",
33
+ cli: 'astryx experimental theme targets Switch',
34
+ },
35
+ {
36
+ label: 'Search keys',
37
+ cli: 'astryx experimental theme targets thumb',
38
+ },
39
+ {
40
+ label: 'For a lint or an audit script',
41
+ cli: 'astryx --json theme targets',
42
+ },
43
+ ],
44
+ outsideProject: 'same',
45
+ exitCodes: [
46
+ {
47
+ code: 0,
48
+ when: 'success',
49
+ },
50
+ {
51
+ code: 1,
52
+ when: 'a filter matches no target, or core cannot be resolved',
53
+ },
54
+ ],
55
+ related: [
56
+ 'component',
57
+ 'experimental theme compile',
58
+ 'experimental theme template',
59
+ ],
60
+ replaces: ['theme targets'],
61
+ };
@@ -0,0 +1,61 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme template`: the experimental
5
+ * copy of `astryx theme template`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme template',
12
+ displayName: 'astryx experimental theme template',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Write the annotated theme template into your project',
16
+ description:
17
+ 'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every defineTheme field, the token families, the component override syntax, and how a theme is consumed, naming the CLI command that prints the authoritative reference for each. Read it, copy what you need into your own theme file, delete it. Use `experimental theme add <slug>` to use an installed built theme, extend that theme for ordinary customization, or use `experimental theme eject <slug>` for a complete source fork. Leaves an existing file untouched unless --overwrite.',
18
+ fn: 'themeTemplate',
19
+ args: [
20
+ {
21
+ name: 'path',
22
+ param: 'options.targetPath',
23
+ required: false,
24
+ },
25
+ ],
26
+ options: [
27
+ {
28
+ flag: '-f, --overwrite',
29
+ param: 'options.overwrite',
30
+ description: 'Replace an existing file',
31
+ },
32
+ ],
33
+ examples: [
34
+ {
35
+ label: 'Write it at the project root',
36
+ cli: 'astryx experimental theme template',
37
+ },
38
+ {
39
+ label: 'Somewhere else',
40
+ cli: 'astryx experimental theme template src/themes/starter.ts',
41
+ },
42
+ ],
43
+ outsideProject: 'same',
44
+ exitCodes: [
45
+ {
46
+ code: 0,
47
+ when: 'success, including when an existing file was left untouched',
48
+ },
49
+ {
50
+ code: 1,
51
+ when: 'the target path escapes the project, or the file cannot be written',
52
+ },
53
+ ],
54
+ related: [
55
+ 'experimental theme add',
56
+ 'experimental theme eject',
57
+ 'experimental theme list',
58
+ 'experimental theme compile',
59
+ ],
60
+ replaces: ['theme template'],
61
+ };
@@ -0,0 +1,55 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme use`: the experimental
5
+ * copy of `astryx theme use`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme use',
12
+ displayName: 'astryx experimental theme use',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Choose the app default from its added themes',
16
+ description:
17
+ 'Sets one added slug as the default and regenerates the generated theme module. Add the theme first if it is not already in the app.',
18
+ fn: 'themeUse',
19
+ args: [
20
+ {
21
+ name: 'slug',
22
+ param: 'slug',
23
+ required: true,
24
+ },
25
+ ],
26
+ examples: [
27
+ {
28
+ label: 'Choose the default theme',
29
+ cli: 'astryx experimental theme use ocean',
30
+ },
31
+ ],
32
+ outsideProject: 'refuse',
33
+ exitCodes: [
34
+ {
35
+ code: 0,
36
+ when: 'the module is regenerated with the selected default',
37
+ },
38
+ {
39
+ code: 1,
40
+ when: 'the theme is not added or state is invalid',
41
+ },
42
+ ],
43
+ related: [
44
+ 'experimental theme add',
45
+ 'experimental theme remove',
46
+ 'experimental theme list',
47
+ ],
48
+ notes: [
49
+ {
50
+ type: 'prose',
51
+ text: 'In global mode: outside a project, experimental theme use writes nothing and stops with `ERR_THEME_INVALID`: "No package.json found. Run this command inside an app project." In a project, the project\'s version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.',
52
+ },
53
+ ],
54
+ replaces: ['theme use'],
55
+ };
@@ -0,0 +1,57 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for the `astryx experimental theme` group: checked theme
5
+ * editing, the in-app preview, and experimental copies of the theme commands.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme',
12
+ displayName: 'astryx experimental theme',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary:
16
+ 'Make and change a theme one checked change at a time, preview it in the app, and the experimental copies of the theme commands',
17
+ description:
18
+ "Themes, experimental. `editor` makes and changes a theme one checked change at a time: every change is checked against what the installed Core's components really read, and a change that cannot take effect is refused. `preview` writes a page into the app that shows the theme on real pages. The group also carries experimental copies of every `astryx theme` command (compile, the copy of theme build; list, add, remove, use, eject, template, targets, palette), with the same functions and output. Experimental: it may change or be removed in a patch release.",
19
+ subcommands: [
20
+ 'editor',
21
+ 'preview',
22
+ 'compile',
23
+ 'list',
24
+ 'add',
25
+ 'remove',
26
+ 'use',
27
+ 'eject',
28
+ 'template',
29
+ 'targets',
30
+ 'palette',
31
+ ],
32
+ examples: [
33
+ {
34
+ label: 'Start a theme',
35
+ cli: 'astryx experimental theme editor new brand --like neutral',
36
+ },
37
+ {
38
+ label: 'Round everything',
39
+ cli: 'astryx experimental theme editor set brand corners pill',
40
+ },
41
+ {
42
+ label: 'Build it',
43
+ cli: 'astryx experimental theme compile',
44
+ },
45
+ ],
46
+ exitCodes: [
47
+ {
48
+ code: 0,
49
+ when: 'help is shown or a subcommand succeeds',
50
+ },
51
+ {
52
+ code: 1,
53
+ when: 'an unknown subcommand, a refused change, or a subcommand failure',
54
+ },
55
+ ],
56
+ related: ['theme build', 'experimental render'],
57
+ };
@@ -14,14 +14,21 @@ export const doc = {
14
14
  namespace: 'cli/commands',
15
15
  stability: 'experimental',
16
16
  summary:
17
- 'Try features that may change in a patch release: icon sets (find icons, build an icon-set package)',
17
+ 'Try features that may change in a patch release: icon sets, page rendering, checked theme editing',
18
18
  description:
19
19
  'The experimental command group. Every command under it is experimental: its arguments, options, output, and JSON may change or be removed in any patch release, with no deprecation period. A feature leaves this group when it becomes stable. Nothing here changes what any other command does unless you use it.',
20
- subcommands: ['icon', 'render'],
20
+ subcommands: ['icon', 'render', 'theme'],
21
21
  examples: [
22
22
  {label: 'List the experiments', cli: 'astryx experimental'},
23
23
  {label: 'Find an icon by meaning', cli: 'astryx experimental icon delete'},
24
- {label: 'Render a page to one HTML file', cli: 'astryx experimental render page.tsx'},
24
+ {
25
+ label: 'Render a page to one HTML file',
26
+ cli: 'astryx experimental render page.tsx',
27
+ },
28
+ {
29
+ label: 'Change a theme, checked',
30
+ cli: 'astryx experimental theme editor set brand corners pill',
31
+ },
25
32
  ],
26
33
  exitCodes: [
27
34
  {code: 0, when: 'help is shown or a subcommand succeeds'},
@@ -94,6 +94,18 @@ import {doc as themeTemplateFn} from '../../../api/theme/themeTemplate.doc.mjs';
94
94
  import {doc as themeTargetsFn} from '../../../api/theme/themeTargets.doc.mjs';
95
95
  import {doc as themePaletteGenerateFn} from '../../../api/theme/themePaletteGenerate.doc.mjs';
96
96
 
97
+ /**
98
+ * The words a theme command is run with: `theme build` here, and the copies
99
+ * under `experimental theme`, where `build` is called `compile`. The actions
100
+ * and API calls are the same; only these words and the docs differ.
101
+ * @typedef {object} ThemeCommandWords
102
+ * @property {string} group - The group's command path: `theme` or `experimental theme`.
103
+ * @property {string} build - The build subcommand's name: `build` or `compile`.
104
+ */
105
+
106
+ /** @type {ThemeCommandWords} */
107
+ const THEME_WORDS = {group: 'theme', build: 'build'};
108
+
97
109
  /**
98
110
  * Path to this CLI's real entry (clients/cli/bin/astryx.mjs), resolved from
99
111
  * this module's location (clients/cli/commands/theme.mjs → ../bin/
@@ -115,14 +127,16 @@ function resolveCliBin() {
115
127
  * level the user chose.
116
128
  * @param {(child: import('node:child_process').ChildProcess) => void} [onSpawn] -
117
129
  * Receives the child, so a watcher that stops can stop it too.
130
+ * @param {ThemeCommandWords} [words]
118
131
  * @returns {Promise<number>}
119
132
  */
120
- function runThemeBuildOnceChild(file, options, onSpawn) {
133
+ function runThemeBuildOnceChild(file, options, onSpawn, words = THEME_WORDS) {
121
134
  const cliBin = resolveCliBin();
135
+ const command = [...words.group.split(' '), words.build];
122
136
  // A detail level the user chose applies to every rebuild.
123
137
  const args = options.detail
124
- ? [cliBin, '--detail', options.detail, 'theme', 'build', file]
125
- : [cliBin, 'theme', 'build', file];
138
+ ? [cliBin, '--detail', options.detail, ...command, file]
139
+ : [cliBin, ...command, file];
126
140
  if (options.out) args.push('--out', options.out);
127
141
  if (options.iconsSpecifier)
128
142
  args.push('--icons-specifier', options.iconsSpecifier);
@@ -150,9 +164,10 @@ function runThemeBuildOnceChild(file, options, onSpawn) {
150
164
  * @param {Array<{file: string, filePath: string}>} entries - The theme file
151
165
  * arguments as the user passed them, with their resolved absolute paths.
152
166
  * @param {{out?: string, iconsSpecifier?: string, detail?: string}} options - Parsed command options, plus the detail level the user chose.
167
+ * @param {ThemeCommandWords} [words]
153
168
  * @returns {Promise<void>} Resolves when the watcher is stopped (Ctrl-C).
154
169
  */
155
- async function runThemeBuildWatch(entries, options) {
170
+ async function runThemeBuildWatch(entries, options, words = THEME_WORDS) {
156
171
  const rel = (/** @type {string} */ filePath) =>
157
172
  path.relative(process.cwd(), filePath);
158
173
  const watchingLine = `\nWatching ${entries
@@ -161,7 +176,7 @@ async function runThemeBuildWatch(entries, options) {
161
176
 
162
177
  // Initial build.
163
178
  for (const entry of entries) {
164
- await runThemeBuildOnceChild(entry.file, options);
179
+ await runThemeBuildOnceChild(entry.file, options, undefined, words);
165
180
  }
166
181
 
167
182
  let building = false;
@@ -185,9 +200,14 @@ async function runThemeBuildWatch(entries, options) {
185
200
  }
186
201
  building = true;
187
202
  emit(text(`\nChange detected — rebuilding ${rel(entry.filePath)}...`));
188
- const done = runThemeBuildOnceChild(entry.file, options, child => {
189
- rebuildChild = child;
190
- });
203
+ const done = runThemeBuildOnceChild(
204
+ entry.file,
205
+ options,
206
+ child => {
207
+ rebuildChild = child;
208
+ },
209
+ words,
210
+ );
191
211
  rebuildDone = done.then(() => {});
192
212
  await done;
193
213
  rebuildChild = null;
@@ -268,8 +288,9 @@ async function warnOnThemeIntegrationIssues(json) {
268
288
  * Print cleanup-stage `theme add --list`. Its JSON stays the released
269
289
  * `theme.list`; its text names the cleanup commands (AST-050 FR12).
270
290
  * @param {import('../../../api/theme/theme.type.mjs').ThemeListEntry[]} themes
291
+ * @param {ThemeCommandWords} [words]
271
292
  */
272
- function printThemeAddList(themes) {
293
+ function printThemeAddList(themes, words = THEME_WORDS) {
273
294
  const run = getCliInvocation();
274
295
  // `theme list` shows what this project can add now. Themes in packages it
275
296
  // has not installed are `discover`'s.
@@ -289,7 +310,7 @@ function printThemeAddList(themes) {
289
310
  return theme.description ? [head, theme.description] : head;
290
311
  }),
291
312
  ),
292
- text(themeNextSteps(run)),
313
+ text(themeNextSteps(run, words)),
293
314
  more,
294
315
  );
295
316
  }
@@ -298,13 +319,14 @@ function printThemeAddList(themes) {
298
319
  * What to do with a listed theme. Outside a project there is no app to add one
299
320
  * to, so only the fork step is named (spec AST-081 FR3).
300
321
  * @param {string} run the CLI invocation
322
+ * @param {ThemeCommandWords} [words]
301
323
  * @returns {string}
302
324
  */
303
- function themeNextSteps(run) {
304
- const fork = `Fork source: ${run} theme eject <slug> [target-path]`;
325
+ function themeNextSteps(run, words = THEME_WORDS) {
326
+ const fork = `Fork source: ${run} ${words.group} eject <slug> [target-path]`;
305
327
  return isOutsideProject()
306
328
  ? fork
307
- : `Import one: ${run} theme add <slug> [--package <package>]\n${fork}`;
329
+ : `Import one: ${run} ${words.group} add <slug> [--package <package>]\n${fork}`;
308
330
  }
309
331
 
310
332
  /**
@@ -312,8 +334,9 @@ function themeNextSteps(run) {
312
334
  * because each record names its owner.
313
335
  * @param {import('../../../api/theme/theme.type.mjs').ThemeListEntry[]} themes
314
336
  * @param {import('../../../api/theme/theme.type.mjs').ThemeUnmigratedCopy[]} [unmigratedCopies]
337
+ * @param {ThemeCommandWords} [words]
315
338
  */
316
- function printThemeList(themes, unmigratedCopies = []) {
339
+ function printThemeList(themes, unmigratedCopies = [], words = THEME_WORDS) {
317
340
  const run = getCliInvocation();
318
341
  const more = text(
319
342
  `More themes in packages you could add: ${run} discover theme`,
@@ -341,7 +364,7 @@ function printThemeList(themes, unmigratedCopies = []) {
341
364
  default: (/** @type {boolean} */ value) => (value ? 'yes' : 'no'),
342
365
  },
343
366
  }),
344
- text(themeNextSteps(run)),
367
+ text(themeNextSteps(run, words)),
345
368
  more,
346
369
  );
347
370
  }
@@ -420,8 +443,9 @@ function printThemeApp(result) {
420
443
  /**
421
444
  * Print every field in a source-fork receipt.
422
445
  * @param {import('../../../api/theme/theme.type.mjs').ThemeEjectResponse} result
446
+ * @param {ThemeCommandWords} [words]
423
447
  */
424
- function printThemeEject(result) {
448
+ function printThemeEject(result, words = THEME_WORDS) {
425
449
  const {data} = result;
426
450
  emit(
427
451
  section('Ejected theme'),
@@ -439,11 +463,40 @@ function printThemeEject(result) {
439
463
  layout: 'stacked',
440
464
  }),
441
465
  text(
442
- `This is a local fork. Build it with ${getCliInvocation()} theme build ${path.join(data.outputDir, data.entry)}.`,
466
+ `This is a local fork. Build it with ${getCliInvocation()} ${words.group} ${words.build} ${path.join(data.outputDir, data.entry)}.`,
443
467
  ),
444
468
  );
445
469
  }
446
470
 
471
+ /**
472
+ * The CommandDocs one copy of the theme subcommands is built from.
473
+ * @typedef {object} ThemeCommandDocs
474
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} palette
475
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} paletteGenerate
476
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} build
477
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} list
478
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} add
479
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} remove
480
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} use
481
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} eject
482
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} template
483
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} targets
484
+ */
485
+
486
+ /** @type {ThemeCommandDocs} */
487
+ const THEME_DOCS = {
488
+ palette: themePaletteGroup,
489
+ paletteGenerate: themePaletteGenerateCommand,
490
+ build: themeBuildCommand,
491
+ list: themeListCommand,
492
+ add: themeAddCommand,
493
+ remove: themeRemoveCommand,
494
+ use: themeUseCommand,
495
+ eject: themeEjectCommand,
496
+ template: themeTemplateCommand,
497
+ targets: themeTargetsCommand,
498
+ };
499
+
447
500
  /**
448
501
  * @param {import('commander').Command} program
449
502
  */
@@ -487,7 +540,21 @@ export function registerTheme(program) {
487
540
  ` ${getCliInvocation()} docs theme How component overrides work\n`,
488
541
  );
489
542
 
490
- const palette = defineCommand(theme, themePaletteGroup, {
543
+ registerThemeSubcommands(theme, program, THEME_DOCS, THEME_WORDS);
544
+ }
545
+
546
+ /**
547
+ * Register the theme subcommands under a group: palette (generate), build,
548
+ * list, add, remove, use, eject, template and targets. `astryx theme` and the
549
+ * copies under `astryx experimental theme` share these actions and their API
550
+ * calls; `docs` and `words` give each copy its own names.
551
+ * @param {import('commander').Command} theme the group to register under
552
+ * @param {import('commander').Command} program the root program
553
+ * @param {ThemeCommandDocs} docs
554
+ * @param {ThemeCommandWords} words
555
+ */
556
+ export function registerThemeSubcommands(theme, program, docs, words) {
557
+ const palette = defineCommand(theme, docs.palette, {
491
558
  action: (
492
559
  /** @type {unknown} */ options,
493
560
  /** @type {import('commander').Command} */ cmd,
@@ -499,7 +566,7 @@ export function registerTheme(program) {
499
566
  reason: 'available subcommand',
500
567
  }));
501
568
  return cliError(
502
- `unknown subcommand 'theme palette ${String(extras[0])}'`,
569
+ `unknown subcommand '${words.group} palette ${String(extras[0])}'`,
503
570
  {
504
571
  suggestions,
505
572
  code: ERROR_CODES.ERR_UNKNOWN_SUBCOMMAND,
@@ -511,7 +578,7 @@ export function registerTheme(program) {
511
578
  },
512
579
  });
513
580
 
514
- defineCommand(palette, themePaletteGenerateCommand, {
581
+ defineCommand(palette, docs.paletteGenerate, {
515
582
  fn: themePaletteGenerateFn,
516
583
  action: (
517
584
  /** @type {string} */ configPath,
@@ -576,7 +643,7 @@ export function registerTheme(program) {
576
643
  },
577
644
  });
578
645
 
579
- defineCommand(theme, themeBuildCommand, {
646
+ defineCommand(theme, docs.build, {
580
647
  fn: themeBuildFn,
581
648
  action: async (
582
649
  /** @type {string[]} */ files,
@@ -605,7 +672,7 @@ export function registerTheme(program) {
605
672
  suggestions: looksGlobby
606
673
  ? [
607
674
  {
608
- name: `astryx theme build ${entry.file.replace(/['"]/g, '')}`,
675
+ name: `astryx ${words.group} ${words.build} ${entry.file.replace(/['"]/g, '')}`,
609
676
  reason:
610
677
  'globs are expanded by your shell; pass the pattern unquoted, or list the files',
611
678
  },
@@ -665,7 +732,7 @@ export function registerTheme(program) {
665
732
  code: ERROR_CODES.ERR_THEME_INVALID,
666
733
  });
667
734
  }
668
- await runThemeBuildWatch(entries, {...options, detail});
735
+ await runThemeBuildWatch(entries, {...options, detail}, words);
669
736
  return NO_RESULT_SET;
670
737
  }
671
738
 
@@ -817,7 +884,7 @@ export function registerTheme(program) {
817
884
  },
818
885
  });
819
886
 
820
- defineCommand(theme, themeListCommand, {
887
+ defineCommand(theme, docs.list, {
821
888
  fn: themeListFn,
822
889
  action: async (/** @type {{package?: string}} */ options) => {
823
890
  const json = program.opts().json || false;
@@ -847,12 +914,12 @@ export function registerTheme(program) {
847
914
  return answered;
848
915
  }
849
916
 
850
- printThemeList(result.data, result.meta?.unmigratedCopies);
917
+ printThemeList(result.data, result.meta?.unmigratedCopies, words);
851
918
  return answered;
852
919
  },
853
920
  });
854
921
 
855
- const themeAddCli = defineCommand(theme, themeAddCommand, {
922
+ const themeAddCli = defineCommand(theme, docs.add, {
856
923
  fn: themeAddFn,
857
924
  action: async (
858
925
  /** @type {string | undefined} */ slug,
@@ -893,7 +960,7 @@ export function registerTheme(program) {
893
960
  return answered;
894
961
  }
895
962
  if (result.type === 'theme.list') {
896
- printThemeAddList(result.data);
963
+ printThemeAddList(result.data, words);
897
964
  return answered;
898
965
  }
899
966
  printThemeApp(result);
@@ -903,7 +970,7 @@ export function registerTheme(program) {
903
970
  // Reject the removed target-path argument in Commander's standard parse path.
904
971
  themeAddCli.allowExcessArguments(false);
905
972
 
906
- defineCommand(theme, themeRemoveCommand, {
973
+ defineCommand(theme, docs.remove, {
907
974
  fn: themeRemoveFn,
908
975
  action: async (/** @type {string} */ slug) => {
909
976
  const json = program.opts().json || false;
@@ -926,7 +993,7 @@ export function registerTheme(program) {
926
993
  },
927
994
  });
928
995
 
929
- defineCommand(theme, themeUseCommand, {
996
+ defineCommand(theme, docs.use, {
930
997
  fn: themeUseFn,
931
998
  action: async (/** @type {string} */ slug) => {
932
999
  const json = program.opts().json || false;
@@ -949,7 +1016,7 @@ export function registerTheme(program) {
949
1016
  },
950
1017
  });
951
1018
 
952
- defineCommand(theme, themeEjectCommand, {
1019
+ defineCommand(theme, docs.eject, {
953
1020
  fn: themeEjectFn,
954
1021
  action: async (
955
1022
  /** @type {string} */ slug,
@@ -976,12 +1043,12 @@ export function registerTheme(program) {
976
1043
  }
977
1044
  await warnOnThemeIntegrationIssues(json);
978
1045
  if (json) jsonOut(result);
979
- else printThemeEject(result);
1046
+ else printThemeEject(result, words);
980
1047
  return NO_RESULT_SET;
981
1048
  },
982
1049
  });
983
1050
 
984
- defineCommand(theme, themeTemplateCommand, {
1051
+ defineCommand(theme, docs.template, {
985
1052
  fn: themeTemplateFn,
986
1053
  action: (
987
1054
  /** @type {string | undefined} */ targetPath,
@@ -1026,13 +1093,13 @@ export function registerTheme(program) {
1026
1093
  'It documents every defineTheme field, the token families, and the component override syntax. ' +
1027
1094
  'Copy what you need into your own theme file, then delete it.',
1028
1095
  ),
1029
- code(`${invocation} theme build ${result.data.path}`),
1096
+ code(`${invocation} ${words.group} ${words.build} ${result.data.path}`),
1030
1097
  );
1031
1098
  return NO_RESULT_SET;
1032
1099
  },
1033
1100
  });
1034
1101
 
1035
- defineCommand(theme, themeTargetsCommand, {
1102
+ defineCommand(theme, docs.targets, {
1036
1103
  fn: themeTargetsFn,
1037
1104
  action: async (/** @type {string | undefined} */ filter) => {
1038
1105
  const json = program.opts().json || false;
@@ -106,6 +106,24 @@ export const JSON_SUPPORTED = new Set([
106
106
  'experimental icon new-set',
107
107
  'experimental icon new-definition',
108
108
  'experimental render',
109
+ 'experimental theme editor new',
110
+ 'experimental theme editor set',
111
+ 'experimental theme editor undo',
112
+ 'experimental theme editor show',
113
+ 'experimental theme editor how',
114
+ 'experimental theme preview add',
115
+ 'experimental theme preview app',
116
+ 'experimental theme preview list',
117
+ 'experimental theme preview remove',
118
+ 'experimental theme compile',
119
+ 'experimental theme list',
120
+ 'experimental theme add',
121
+ 'experimental theme remove',
122
+ 'experimental theme use',
123
+ 'experimental theme eject',
124
+ 'experimental theme template',
125
+ 'experimental theme targets',
126
+ 'experimental theme palette generate',
109
127
  'build',
110
128
  'swizzle',
111
129
  'gap-report',
@@ -137,6 +137,9 @@ export function defineCommand(parent, doc, {fn, action, hidden} = {}) {
137
137
  const base = cmd.description() || '';
138
138
  cmd.description(`${base} [DEPRECATED: ${doc.deprecated}]`);
139
139
  }
140
+ if (doc.replaces?.length) {
141
+ cmd.addHelpText('before', `Will replace: ${doc.replaces.map(name => `astryx ${name}`).join(', ')}\n`);
142
+ }
140
143
 
141
144
  const paramDesc = (/** @type {string | undefined} */ name) =>
142
145
  (fn?.params ?? []).find(p => p.name === name)?.description ?? '';
@@ -32,6 +32,10 @@ export function iconSetIssues(packageDir: string, loaded: {
32
32
  * {@link suggestedIcons} gives, if any
33
33
  * @property {IconSetUnchecked[]} unchecked what the checks could not judge:
34
34
  * never counted, never failing, even under `--strict`
35
+ * @property {{unmapped: import('./template-icon-meanings.mjs').TemplateMeaning[]}} [templateMeanings]
36
+ * the icon definitions the bundled templates use that the set's `map` does
37
+ * not name, most used first: a copied template renders a placeholder for
38
+ * each. Never counted, never failing
35
39
  */
36
40
  /**
37
41
  * Which icon definitions each valid set under a package's
@@ -40,12 +44,15 @@ export function iconSetIssues(packageDir: string, loaded: {
40
44
  * @param {{name: string, iconSets?: string}} loaded
41
45
  * @param {Map<string, IconSetUnchecked[]>} [unchecked] what
42
46
  * {@link iconSetIssues} could not judge, by set name
47
+ * @param {import('./template-icon-meanings.mjs').TemplateMeaning[]} [templateMeanings]
48
+ * the definitions the bundled templates use; each set lists the ones it
49
+ * leaves unmapped
43
50
  * @returns {IconSetCoverage[]}
44
51
  */
45
52
  export function iconSetCoverage(loaded: {
46
53
  name: string;
47
54
  iconSets?: string;
48
- }, unchecked?: Map<string, IconSetUnchecked[]>): IconSetCoverage[];
55
+ }, unchecked?: Map<string, IconSetUnchecked[]>, templateMeanings?: import("./template-icon-meanings.mjs").TemplateMeaning[]): IconSetCoverage[];
49
56
  /**
50
57
  * The best icon {@link suggestedIcons} gives for a definition, or null when
51
58
  * it gives none.
@@ -171,6 +178,14 @@ export type IconSetCoverage = {
171
178
  * never counted, never failing, even under `--strict`
172
179
  */
173
180
  unchecked: IconSetUnchecked[];
181
+ /**
182
+ * the icon definitions the bundled templates use that the set's `map` does
183
+ * not name, most used first: a copied template renders a placeholder for
184
+ * each. Never counted, never failing
185
+ */
186
+ templateMeanings?: {
187
+ unmapped: import("./template-icon-meanings.mjs").TemplateMeaning[];
188
+ } | undefined;
174
189
  };
175
190
  export type Issue = import("../integrations/issue").AstryxIntegrationIssue;
176
191
  export type DiscoveredIconSet = import("./icon-set-discovery.mjs").DiscoveredIconSet;