@astryxdesign/cli 0.7.13 → 0.7.14-canary.d08ce65

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 (146) 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 +10 -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 +96 -0
  31. package/api/theme-edit/_adapter.mjs +1039 -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 +842 -0
  36. package/api/theme-edit/_color.d.mts +35 -0
  37. package/api/theme-edit/_color.mjs +125 -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 +86 -0
  47. package/api/theme-edit/_preview.mjs +564 -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 +848 -0
  52. package/api/theme-edit/_tables.d.mts +130 -0
  53. package/api/theme-edit/_tables.mjs +697 -0
  54. package/api/theme-edit/theme-edit.d.mts +89 -0
  55. package/api/theme-edit/theme-edit.mjs +119 -0
  56. package/api/theme-edit/theme-edit.type.d.mts +270 -0
  57. package/api/theme-edit/theme-edit.type.mjs +155 -0
  58. package/api/theme-edit/themeEditExplain.doc.d.mts +6 -0
  59. package/api/theme-edit/themeEditExplain.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/themeEditPreview.doc.d.mts +6 -0
  63. package/api/theme-edit/themeEditPreview.doc.mjs +96 -0
  64. package/api/theme-edit/themeEditReset.doc.d.mts +6 -0
  65. package/api/theme-edit/themeEditReset.doc.mjs +161 -0
  66. package/api/theme-edit/themeEditSet.doc.d.mts +6 -0
  67. package/api/theme-edit/themeEditSet.doc.mjs +165 -0
  68. package/api/theme-edit/themeEditShow.doc.d.mts +6 -0
  69. package/api/theme-edit/themeEditShow.doc.mjs +86 -0
  70. package/api/theme-edit/themeEditUndo.doc.d.mts +6 -0
  71. package/api/theme-edit/themeEditUndo.doc.mjs +80 -0
  72. package/assets/docs/color.doc.mjs +5 -5
  73. package/assets/docs/tree/icon-sets.doc.mjs +6 -2
  74. package/assets/docs/tree/tokens-border.doc.mjs +1 -1
  75. package/assets/docs/tree/tokens-color.doc.mjs +2 -2
  76. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  77. package/assets/docs/tree/tokens-duration.doc.mjs +1 -1
  78. package/assets/docs/tree/tokens-ease.doc.mjs +1 -1
  79. package/assets/docs/tree/tokens-focus.doc.mjs +1 -1
  80. package/assets/docs/tree/tokens-font-weight.doc.mjs +1 -1
  81. package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
  82. package/assets/docs/tree/tokens-shadow.doc.mjs +1 -1
  83. package/assets/docs/tree/tokens-size.doc.mjs +1 -1
  84. package/assets/docs/tree/tokens-spacing.doc.mjs +1 -1
  85. package/assets/docs/tree/tokens-syntax.doc.mjs +1 -1
  86. package/assets/docs/tree/tokens-text-size.doc.mjs +1 -1
  87. package/assets/docs/tree/tokens-type-scale.doc.mjs +1 -1
  88. package/assets/docs/tree/tokens-typography.doc.mjs +1 -1
  89. package/assets/icons/definitions/bank.doc.mjs +1 -1
  90. package/assets/icons/definitions/save.doc.mjs +1 -1
  91. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +2 -1
  92. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +2 -1
  93. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider03RtlDirection.doc.mjs +2 -1
  94. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +2 -1
  95. package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
  96. package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
  97. package/authoring/doctypes/_schema.d.mts +1 -0
  98. package/authoring/doctypes/_schema.mjs +1 -0
  99. package/authoring/doctypes/command/command.doc.mjs +7 -0
  100. package/authoring/doctypes/command/type.ts +3 -0
  101. package/authoring/doctypes/icon-set/parse.d.mts +7 -0
  102. package/authoring/doctypes/icon-set/parse.mjs +18 -8
  103. package/clients/cli/commands/doctor.mjs +33 -3
  104. package/clients/cli/commands/experimental/icon.mjs +67 -14
  105. package/clients/cli/commands/experimental/index.mjs +2 -0
  106. package/clients/cli/commands/experimental/theme.mjs +542 -0
  107. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +7 -1
  108. package/clients/cli/commands/experimental-icon.doc.mjs +3 -2
  109. package/clients/cli/commands/experimental-theme-add.doc.mjs +78 -0
  110. package/clients/cli/commands/experimental-theme-compile.doc.mjs +97 -0
  111. package/clients/cli/commands/experimental-theme-eject.doc.mjs +71 -0
  112. package/clients/cli/commands/experimental-theme-explain.doc.mjs +84 -0
  113. package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
  114. package/clients/cli/commands/experimental-theme-new.doc.mjs +66 -0
  115. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +73 -0
  116. package/clients/cli/commands/experimental-theme-palette.doc.mjs +37 -0
  117. package/clients/cli/commands/experimental-theme-preview.doc.mjs +76 -0
  118. package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
  119. package/clients/cli/commands/experimental-theme-reset.doc.mjs +103 -0
  120. package/clients/cli/commands/experimental-theme-set.doc.mjs +121 -0
  121. package/clients/cli/commands/experimental-theme-show.doc.mjs +66 -0
  122. package/clients/cli/commands/experimental-theme-targets.doc.mjs +61 -0
  123. package/clients/cli/commands/experimental-theme-template.doc.mjs +61 -0
  124. package/clients/cli/commands/experimental-theme-undo.doc.mjs +55 -0
  125. package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
  126. package/clients/cli/commands/experimental-theme.doc.mjs +66 -0
  127. package/clients/cli/commands/experimental.doc.mjs +10 -3
  128. package/clients/cli/commands/theme.mjs +101 -34
  129. package/clients/cli/index.mjs +16 -0
  130. package/clients/cli/lib/define-command.mjs +3 -0
  131. package/foundation/discovery/icon-set-checks.d.mts +16 -1
  132. package/foundation/discovery/icon-set-checks.mjs +68 -7
  133. package/foundation/discovery/icon-set-discovery.d.mts +21 -6
  134. package/foundation/discovery/icon-set-discovery.mjs +17 -8
  135. package/foundation/discovery/template-icon-meanings.d.mts +39 -0
  136. package/foundation/discovery/template-icon-meanings.mjs +95 -0
  137. package/foundation/discovery/theming-targets.d.mts +6 -0
  138. package/foundation/discovery/theming-targets.mjs +33 -0
  139. package/foundation/response/error-codes.d.mts +12 -1
  140. package/foundation/response/error-codes.doc.mjs +66 -0
  141. package/foundation/response/error-codes.mjs +55 -0
  142. package/foundation/response/response-types.doc.mjs +43 -0
  143. package/foundation/text/template-meanings-line.d.mts +16 -0
  144. package/foundation/text/template-meanings-line.mjs +37 -0
  145. package/foundation/xle/browser.d.mts +2 -2
  146. package/package.json +6 -6
package/api/icon/icon.mjs CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  /**
4
4
  * @file Programmatic API for the `icon` command (AST-084 FR6, FR7):
5
- * dispatcher over three leaves.
5
+ * dispatcher over its read leaves.
6
6
  *
7
7
  * icon('<words>') icon.search: icons ranked by meaning
8
8
  * icon('<set>/<id>') icon.detail: one icon and every variant's import
9
9
  * icon('', {list}) icon.list: the installed sets
10
+ * icon('', {definitions}) icon.definitions: every Astryx definition, its
11
+ * template count, and whether a set maps it
10
12
  *
11
13
  * Every read comes from installed icon sets' data files, through the
12
14
  * `Project` seam; nothing executes an icon module.
@@ -22,7 +24,7 @@ import {iconSearch} from './search/search.mjs';
22
24
  import {iconDetail} from './detail/detail.mjs';
23
25
  import {iconList} from './list/list.mjs';
24
26
  import {iconSetIcons} from './search/search.mjs';
25
- import {astryxIconDefinitions} from './_adapter.mjs';
27
+ import {iconDefinitions} from './definitions/definitions.mjs';
26
28
  import {passed, refuseIgnoredPairs} from './_options.mjs';
27
29
 
28
30
  /** The default `limit` for `icon.search`. */
@@ -71,7 +73,6 @@ export async function icon(query, options = {}) {
71
73
  ['--list', '--limit'],
72
74
  ['--definitions', 'a query'],
73
75
  ['--definitions', '--all-icons'],
74
- ['--definitions', '--set'],
75
76
  ['--definitions', '--limit'],
76
77
  ['--all-icons', 'a query'],
77
78
  ['--all-icons', '--limit'],
@@ -89,19 +90,7 @@ export async function icon(query, options = {}) {
89
90
  }
90
91
  const term = (query ?? '').trim();
91
92
  if (list) return iconList({cwd});
92
- if (definitions) {
93
- return {
94
- type: /** @type {const} */ ('icon.definitions'),
95
- data: {
96
- definitions: astryxIconDefinitions().definitions.map(({doc}) => ({
97
- name: doc.name,
98
- builtIn: doc.builtIn === true,
99
- description: doc.description,
100
- words: doc.words,
101
- })),
102
- },
103
- };
104
- }
93
+ if (definitions) return iconDefinitions({cwd, set});
105
94
  if (allIcons) {
106
95
  if (set == null) {
107
96
  throw new AstryxError(
@@ -249,6 +249,7 @@ export type IconMapManyResponse = {
249
249
  module: string;
250
250
  } | undefined;
251
251
  files?: string[] | undefined;
252
+ templateMeanings?: IconTemplateMeanings | undefined;
252
253
  };
253
254
  };
254
255
  /**
@@ -269,6 +270,7 @@ export type IconMapResponse = {
269
270
  module: string;
270
271
  } | undefined;
271
272
  files?: string[] | undefined;
273
+ templateMeanings?: IconTemplateMeanings | undefined;
272
274
  };
273
275
  };
274
276
  /**
@@ -362,6 +364,7 @@ export type IconAddResponse = {
362
364
  module: string;
363
365
  } | undefined;
364
366
  note?: string | undefined;
367
+ templateMeanings?: IconTemplateMeanings | undefined;
365
368
  };
366
369
  };
367
370
  /**
@@ -405,7 +408,7 @@ export type IconOptions = {
405
408
  */
406
409
  list?: boolean | undefined;
407
410
  /**
408
- * - Keep one set, by name or `<package>/<set>`.
411
+ * - Keep one set, by name or `<package>/<set>`; with `definitions`, the set whose `map` they are checked against.
409
412
  */
410
413
  set?: string | undefined;
411
414
  /**
@@ -427,14 +430,30 @@ export type IconOptions = {
427
430
  export type IconDefinitionsResponse = {
428
431
  type: "icon.definitions";
429
432
  data: {
433
+ set: string | null;
430
434
  definitions: Array<{
431
435
  name: string;
432
436
  builtIn: boolean;
433
437
  description: string;
434
438
  words: string[];
439
+ templates: number;
440
+ mapped?: boolean;
435
441
  }>;
436
442
  };
437
443
  };
444
+ /**
445
+ * The icon definitions the bundled templates use that a set's `map` does not
446
+ * name.
447
+ */
448
+ export type IconTemplateMeanings = {
449
+ /**
450
+ * - Each such definition and how many bundled templates use it, most used first, then by name; empty when the set maps them all.
451
+ */
452
+ unmapped: Array<{
453
+ definition: string;
454
+ templates: number;
455
+ }>;
456
+ };
438
457
  /**
439
458
  * `astryx --json experimental icon --set <name> --all-icons`.
440
459
  */
@@ -472,6 +491,10 @@ export type IconNewSetOptions = {
472
491
  * - With `from`: export names that are not icons; a string is split on commas.
473
492
  */
474
493
  exclude?: string | string[] | undefined;
494
+ /**
495
+ * - `./<path>#<export>`: a function in the package that turns one library export that is not a component into one. It is written to the data file's `adapter`; with `from`, every data export of the library becomes an icon through it. On a set that already has icons, only with `from`.
496
+ */
497
+ adapter?: string | undefined;
475
498
  /**
476
499
  * - The variants the set supplies, such as `outline,solid`; a string is split on commas.
477
500
  */
@@ -547,7 +570,7 @@ export type IconNewData = {
547
570
  */
548
571
  icons?: number | undefined;
549
572
  /**
550
- * - With `from` on an existing set: the set was refreshed, not created.
573
+ * - With `from` on an existing set that has icons: the set was refreshed, not created. Absent when the set had no icons yet: its icons were created.
551
574
  */
552
575
  refreshed?: boolean | undefined;
553
576
  /**
@@ -602,6 +625,10 @@ export type IconNewData = {
602
625
  previous: string;
603
626
  module: string;
604
627
  } | undefined;
628
+ /**
629
+ * - From `iconNewSet()`, except in a dry run: the icon definitions the bundled templates use that the set's `map` does not name. A copied template renders a placeholder for each in a project that uses this set.
630
+ */
631
+ templateMeanings?: IconTemplateMeanings | undefined;
605
632
  };
606
633
  /**
607
634
  * `astryx --json experimental icon new-set <name>`.
@@ -166,6 +166,7 @@
166
166
  * @property {boolean} data.changed - Whether the file was written.
167
167
  * @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
168
168
  * @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
169
+ * @property {IconTemplateMeanings} [data.templateMeanings] - After a write: the icon definitions the bundled templates use that the set's `map` does not name. A copied template renders a placeholder for each in a project that uses this set.
169
170
  */
170
171
 
171
172
  /**
@@ -183,6 +184,7 @@
183
184
  * @property {boolean} data.changed - Whether the file was written.
184
185
  * @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
185
186
  * @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
187
+ * @property {IconTemplateMeanings} [data.templateMeanings] - After a write: the icon definitions the bundled templates use that the set's `map` does not name. A copied template renders a placeholder for each in a project that uses this set.
186
188
  */
187
189
 
188
190
  /**
@@ -237,6 +239,7 @@
237
239
  * @property {boolean} data.added - Whether the icon, its variant, its `map` entry, or a new definition was added. False when the set already had them, even when `changed` is true because the command wrote a renamed package's new name.
238
240
  * @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
239
241
  * @property {string} [data.note] - What the package still needs, as text to copy: the entry line that exports the icon from the set's module, and the package.json `files` that publishes a `./` source.
242
+ * @property {IconTemplateMeanings} [data.templateMeanings] - After a write: the icon definitions the bundled templates use that the set's `map` does not name. A copied template renders a placeholder for each in a project that uses this set.
240
243
  */
241
244
 
242
245
  /**
@@ -271,7 +274,7 @@
271
274
  * @typedef {object} IconOptions
272
275
  * @property {string} [cwd]
273
276
  * @property {boolean} [list] - List the installed sets.
274
- * @property {string} [set] - Keep one set, by name or `<package>/<set>`.
277
+ * @property {string} [set] - Keep one set, by name or `<package>/<set>`; with `definitions`, the set whose `map` they are checked against.
275
278
  * @property {number} [limit] - Max matches (default 10).
276
279
  * @property {boolean} [allIcons] - With `set` and no query: every icon of that set.
277
280
  * @property {boolean} [definitions] - Every Astryx icon definition, and nothing else.
@@ -283,7 +286,16 @@
283
286
  * @typedef {object} IconDefinitionsResponse
284
287
  * @property {'icon.definitions'} type
285
288
  * @property {object} data
286
- * @property {Array<{name: string, builtIn: boolean, description: string, words: string[]}>} data.definitions - Every Astryx icon definition, by name; `builtIn` ones every set maps.
289
+ * @property {string | null} data.set - The set `mapped` describes, as `<package>/<set>`: the one `set` names, else the project's main set, else the only set of the icon-set package the command runs in; null when there is none.
290
+ * @property {Array<{name: string, builtIn: boolean, description: string, words: string[], templates: number, mapped?: boolean}>} data.definitions - Every Astryx icon definition, by name; `builtIn` ones every set maps. `templates`: how many bundled templates use it. `mapped`: whether the set's `map` names it, present when `set` is not null.
291
+ */
292
+
293
+ /**
294
+ * The icon definitions the bundled templates use that a set's `map` does not
295
+ * name.
296
+ * @experimental May change or be removed in a patch release.
297
+ * @typedef {object} IconTemplateMeanings
298
+ * @property {Array<{definition: string, templates: number}>} unmapped - Each such definition and how many bundled templates use it, most used first, then by name; empty when the set maps them all.
287
299
  */
288
300
 
289
301
  /**
@@ -306,6 +318,7 @@
306
318
  * @property {boolean} [dryRun] - Return the receipt without writing.
307
319
  * @property {string} [from] - A module whose every icon component the set wraps: a package, a package subpath, or a ./ path in the package.
308
320
  * @property {string[] | string} [exclude] - With `from`: export names that are not icons; a string is split on commas.
321
+ * @property {string} [adapter] - `./<path>#<export>`: a function in the package that turns one library export that is not a component into one. It is written to the data file's `adapter`; with `from`, every data export of the library becomes an icon through it. On a set that already has icons, only with `from`.
309
322
  * @property {string[] | string} [variants] - The variants the set supplies, such as `outline,solid`; a string is split on commas.
310
323
  * @property {string} [defaultVariant] - With `variants`: the variant each icon's own export draws; when absent, the look the icons' exports draw in a library whose names encode looks; otherwise the set's current default, else, on a set without icons, the first variant. A set with icons changes it only with `from`, and only in a library whose names encode looks.
311
324
  * @property {string} [displayName] - The descriptor's display name; the set name in title case when absent.
@@ -337,7 +350,7 @@
337
350
  * @property {boolean} dryRun
338
351
  * @property {string} [from]
339
352
  * @property {number} [icons] - With `from`: how many icons it wrote.
340
- * @property {boolean} [refreshed] - With `from` on an existing set: the set was refreshed, not created.
353
+ * @property {boolean} [refreshed] - With `from` on an existing set that has icons: the set was refreshed, not created. Absent when the set had no icons yet: its icons were created.
341
354
  * @property {boolean} [updated] - Without `from` on an existing set: its variants, default variant, display name, or description were updated in place, not created.
342
355
  * @property {Array<{id: string, from: string, to: string}>} [moved] - On a refresh from a package root: the icons that read one file of that package (`from`) and now import from the root (`to`); each keeps its id, export, `map` entries, variants, and words.
343
356
  * @property {{library: string, path: string}} [licenseNoticeMissing] - With `from`: the wrapped library (`name@version`) ships no license file to copy and the set has none. `path` is where to add a NOTICE file that names the library and its license; the CLI never writes it.
@@ -346,6 +359,7 @@
346
359
  * @property {Array<{definition: string, icon: string, word: string}>} [suggestions] - With `from`: for each unmapped Astryx definition, up to three icons it might map to, best first: the definition's name in another spelling or as another name of an icon, ids that start with it, an id or another name that is one of its words, then two-word ids that are a one-word word sized, shaped, or numbered (`grid-2x2`); never a negated form, the opposite direction, or an icon already mapped. `word` is the name or word that matched. Never written.
347
360
  * @property {string[]} [notes] - What the author does next, including each change the package needs that the CLI never makes itself (its entry, peers, scripts), as text to copy.
348
361
  * @property {{previous: string, module: string}} [moduleUpdate] - On a refresh, an update, or a new definition with `icon`: the data file's `module` before and after this command, when the package was renamed and the command writes its new name.
362
+ * @property {IconTemplateMeanings} [templateMeanings] - From `iconNewSet()`, except in a dry run: the icon definitions the bundled templates use that the set's `map` does not name. A copied template renders a placeholder for each in a project that uses this set.
349
363
  */
350
364
 
351
365
  /**
@@ -99,7 +99,7 @@ export const doc = {
99
99
  {
100
100
  type: 'icon.add',
101
101
  description:
102
- 'The icon registered, the definition mapped, and the files written.',
102
+ "The icon registered, the definition mapped, and the files written. `templateMeanings.unmapped` lists the icon definitions the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
103
103
  },
104
104
  {
105
105
  type: 'icon.addVariants',
@@ -58,12 +58,12 @@ export const doc = {
58
58
  {
59
59
  type: 'icon.mapMany',
60
60
  description:
61
- 'With pairs: the set, the data file, each entry with the icon it replaced, and whether the file changed.',
61
+ "With pairs: the set, the data file, each entry with the icon it replaced, and whether the file changed. `templateMeanings.unmapped` lists the icon definitions the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
62
62
  },
63
63
  {
64
64
  type: 'icon.map',
65
65
  description:
66
- 'The set, the data file, the definition, the icon now mapped, the icon it replaced, and whether the file changed.',
66
+ "The set, the data file, the definition, the icon now mapped, the icon it replaced, and whether the file changed. `templateMeanings.unmapped` lists the icon definitions the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
67
67
  },
68
68
  ],
69
69
  throws: [
@@ -10,7 +10,7 @@ export const doc = {
10
10
  displayName: 'iconNewSet()',
11
11
  summary: 'Add an icon set to an integration package.',
12
12
  description:
13
- "Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx definition whose name is an icon id, and returns up to three likely icons for each other definition as suggestions (by its name, its words, and the other names the library gives an icon; never a part of a word, a negated form, or the opposite direction), never written. A library whose export names end in style, size and weight words gives one icon per glyph, named without those words, in the look the default variant names, else the library's usual default (outline, regular, the middle weight). Over an existing set, `from` refreshes it; without `from`, `variants`, `defaultVariant`, `displayName` and `description` update it in place and leave its icons, map and generated module unchanged (a variant an icon has must stay declared, and a set with icons keeps its default variant). It declares the manifest's `experimental.iconSets` root on first use, and includes the manifest and root in package.json files when the package already uses an allowlist. It never writes the package's entry, exports, main, types, files list, peers, or scripts: its notes name each change the package needs as text to copy. Every path is confined to the package, and an existing set is changed only as above. Experimental: it may change or be removed in a patch release.",
13
+ "Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx definition whose name is an icon id, and returns up to three likely icons for each other definition as suggestions (by its name, its words, and the other names the library gives an icon; never a part of a word, a negated form, or the opposite direction), never written. A library whose export names end in style, size and weight words gives one icon per glyph, named without those words, in the look the default variant names, else the library's usual default (outline, regular, the middle weight). With adapter, it declares the data file's adapter, so `from` also wraps a library's data exports through it. Over an existing set with icons, `from` refreshes it (the first `from` into a set with no icons creates them); without `from`, `variants`, `defaultVariant`, `displayName` and `description` update it in place and leave its icons, map and generated module unchanged (a variant an icon has must stay declared, and a set with icons keeps its default variant). It declares the manifest's `experimental.iconSets` root on first use, and includes the manifest and root in package.json files when the package already uses an allowlist. It never writes the package's entry, exports, main, types, files list, peers, or scripts: its notes name each change the package needs as text to copy. Every path is confined to the package, and an existing set is changed only as above. Experimental: it may change or be removed in a patch release.",
14
14
  importPath: '@astryxdesign/cli/api',
15
15
  signature:
16
16
  'iconNewSet(name: string, options?: IconNewSetOptions): Promise<IconNewSetResponse>',
@@ -46,6 +46,12 @@ export const doc = {
46
46
  description:
47
47
  'With from: export names that are not icons; a string is split on commas. SCREAMING_CASE names and number or boolean exports are always left out.',
48
48
  },
49
+ {
50
+ name: 'options.adapter',
51
+ type: 'string',
52
+ description:
53
+ "`./<path>#<export>`: a function in the package that turns one library export that is not a component (an icon data object, an SVG string) into one. The file must exist. It is written to the data file's adapter; with from, every data export of the library becomes an icon through it. A set that already has icons takes another adapter only with from.",
54
+ },
49
55
  {
50
56
  name: 'options.variants',
51
57
  type: 'string[] | string',
@@ -75,7 +81,7 @@ export const doc = {
75
81
  {
76
82
  type: 'icon.newSet',
77
83
  description:
78
- 'What it wrote: the manifest root, the files, and what to do next.',
84
+ "What it wrote: the manifest root, the files, and what to do next. Except in a dry run, `templateMeanings.unmapped` lists the icon definitions the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
79
85
  },
80
86
  ],
81
87
  throws: [
@@ -17,6 +17,7 @@ import {
17
17
  findLocalIconSet,
18
18
  mappableDefinitions,
19
19
  refuseOutsideProject,
20
+ templateMeaningsOf,
20
21
  writeGeneratedIcons,
21
22
  writeIconSetData,
22
23
  definitionNameOf,
@@ -55,9 +56,12 @@ export async function iconMap(definition, icon, options = {}) {
55
56
  ],
56
57
  );
57
58
  if (pairs != null) {
58
- return authoring(() => mapMany({cwd, selector, pairs}));
59
+ return withTemplateMeanings(
60
+ await authoring(() => mapMany({cwd, selector, pairs})),
61
+ cwd,
62
+ );
59
63
  }
60
- return authoring(async () => {
64
+ const result = await authoring(async () => {
61
65
  if (typeof definition !== 'string' || definition.trim() === '') {
62
66
  throw new AstryxError(
63
67
  'Name the icon definition to map',
@@ -146,6 +150,21 @@ export async function iconMap(definition, icon, options = {}) {
146
150
  },
147
151
  };
148
152
  });
153
+ return withTemplateMeanings(result, cwd);
154
+ }
155
+
156
+ /**
157
+ * Add the template meanings the set leaves unmapped after the write.
158
+ * @template {{data: {set: string}}} T
159
+ * @param {T} result
160
+ * @param {string} cwd
161
+ * @returns {Promise<T>}
162
+ */
163
+ async function withTemplateMeanings(result, cwd) {
164
+ const templateMeanings = await templateMeaningsOf(cwd, result.data.set);
165
+ return templateMeanings
166
+ ? {...result, data: {...result.data, templateMeanings}}
167
+ : result;
149
168
  }
150
169
 
151
170
  /**
@@ -9,7 +9,12 @@
9
9
  * command
10
10
  */
11
11
 
12
- import {addIconSet, authoring, refuseOutsideProject} from '../_adapter.mjs';
12
+ import {
13
+ addIconSet,
14
+ authoring,
15
+ refuseOutsideProject,
16
+ templateMeaningsOf,
17
+ } from '../_adapter.mjs';
13
18
  import {refuseOtherOptions} from '../_options.mjs';
14
19
 
15
20
  /**
@@ -28,5 +33,12 @@ export async function iconNewSet(name, options = {}) {
28
33
  'the integration package',
29
34
  );
30
35
  const {data} = await authoring(() => addIconSet(name, options));
31
- return {type: 'icon.newSet', data};
36
+ // A dry run writes nothing, so the set's map is not yet what it says.
37
+ const templateMeanings = data.dryRun
38
+ ? null
39
+ : await templateMeaningsOf(options.cwd ?? process.cwd(), name);
40
+ return {
41
+ type: 'icon.newSet',
42
+ data: templateMeanings ? {...data, templateMeanings} : data,
43
+ };
32
44
  }
@@ -9,11 +9,10 @@
9
9
  * @position api/icon/search — dispatched by ../icon.mjs
10
10
  */
11
11
 
12
- import {AstryxError} from '../../error.mjs';
13
- import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
14
12
  import {loadIconSets} from '../_adapter.mjs';
15
13
  import {
16
14
  answeringMatches,
15
+ oneNamedSet,
17
16
  rankIcons,
18
17
  setsNamed,
19
18
  unusableSet,
@@ -27,19 +26,7 @@ import {
27
26
  */
28
27
  export async function iconSetIcons({cwd, set}) {
29
28
  const {sets, withdrawn} = await loadIconSets(cwd);
30
- const named = setsNamed(sets, set);
31
- if (named.length === 0) throw unusableSet(sets, withdrawn, set);
32
- if (named.length > 1) {
33
- throw new AstryxError(
34
- `"${set}" names ${named.length} sets; name one as <package>/<set>`,
35
- named.map(each => ({
36
- name: `${each.package}/${each.name}`,
37
- reason: 'name the package',
38
- })),
39
- ERROR_CODES.ERR_INVALID_ARGUMENT,
40
- );
41
- }
42
- const [only] = named;
29
+ const only = oneNamedSet(sets, withdrawn, set);
43
30
  /** @type {Map<string, string[]>} */
44
31
  const drawn = new Map();
45
32
  for (const [definition, id] of Object.entries(only.data.map ?? {})) {
@@ -114,10 +114,11 @@ export async function iconUse(
114
114
  list: Array.isArray(value),
115
115
  });
116
116
  // Doctor fails a project that installs several sets and leaves one out.
117
- const unlisted = sets.filter(set => !listed.includes(set)).map(iconSetKey);
117
+ const unlistedSets = sets.filter(set => !listed.includes(set));
118
+ const unlisted = unlistedSets.map(iconSetKey);
118
119
  const left =
119
- unlisted.length > 0
120
- ? unlistedIconSets(sets.length, selector, backups, unlisted)
120
+ unlistedSets.length > 0
121
+ ? unlistedIconSets(sets, main, backupSets, unlistedSets)
121
122
  : null;
122
123
  return {
123
124
  type: 'icon.use',
@@ -41,6 +41,7 @@ import {
41
41
  iconSetIssues,
42
42
  } from '../../foundation/discovery/icon-set-checks.mjs';
43
43
  import {olderCliNotes} from '../../foundation/discovery/doc-stability.mjs';
44
+ import {templateIconMeanings} from '../../foundation/discovery/template-icon-meanings.mjs';
44
45
  import {
45
46
  templateIconNotes,
46
47
  templateIconUndeclaredNotes,
@@ -503,7 +504,11 @@ async function validateAtPackageDir(
503
504
  issues.push(...iconSetIssues(packageDir, loaded, unchecked));
504
505
  // Which definitions each set leaves unmapped, and what the checks could
505
506
  // not judge: listed, never an issue.
506
- result.iconSets = iconSetCoverage(loaded, unchecked);
507
+ result.iconSets = iconSetCoverage(
508
+ loaded,
509
+ unchecked,
510
+ await templateIconMeanings(),
511
+ );
507
512
  }
508
513
  // What the docs say that no reader serves: a prop listed twice, an
509
514
  // overlay's text for a prop the doc lacks, an empty or unreachable section,
@@ -202,6 +202,18 @@ export type IconSetCoverage = {
202
202
  entry?: string;
203
203
  reason: string;
204
204
  }>;
205
+ /**
206
+ * The icon definitions the bundled templates use that the set's `map`
207
+ * does not name, each with how many templates use it, most used first,
208
+ * then by name. A copied template renders a placeholder for each in a
209
+ * project that uses only this set. Built-in ones are also error issues.
210
+ */
211
+ templateMeanings?: {
212
+ unmapped: Array<{
213
+ definition: string;
214
+ templates: number;
215
+ }>;
216
+ } | undefined;
205
217
  };
206
218
  /**
207
219
  * A descriptor an older CLI drops: a page or block template, or a namespace
@@ -140,6 +140,11 @@
140
140
  * cannot prove either way (`icon`); an adapter export it cannot prove
141
141
  * (`adapter`); and a theme map or theme-map entry it cannot read
142
142
  * (`entry`).
143
+ * @property {{unmapped: Array<{definition: string, templates: number}>}} [templateMeanings]
144
+ * The icon definitions the bundled templates use that the set's `map`
145
+ * does not name, each with how many templates use it, most used first,
146
+ * then by name. A copied template renders a placeholder for each in a
147
+ * project that uses only this set. Built-in ones are also error issues.
143
148
  */
144
149
 
145
150
  /**
@@ -0,0 +1,96 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Start a theme in themes/<name>/, optionally on a built-in theme.
6
+ * @experimental
7
+ * @param {string} name
8
+ * @param {import('./theme-edit.type.mjs').ThemeEditNewOptions} [options]
9
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditNewResponse>}
10
+ */
11
+ export function themeEditNew(name: string, options?: import("./theme-edit.type.mjs").ThemeEditNewOptions): Promise<import("./theme-edit.type.mjs").ThemeEditNewResponse>;
12
+ /**
13
+ * Change one thing in a theme: checked, built, previewed.
14
+ * @experimental
15
+ * @param {string} theme
16
+ * @param {string} thing a dial, a token, or a CSS property
17
+ * @param {string} value
18
+ * @param {ChangeOptions} [options]
19
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditChangeResponse>}
20
+ */
21
+ export function themeEditSet(theme: string, thing: string, value: string, options?: ChangeOptions): Promise<import("./theme-edit.type.mjs").ThemeEditChangeResponse>;
22
+ /**
23
+ * Return one setting to the base theme's value: the setting is removed,
24
+ * and the theme is rebuilt and previewed.
25
+ * @experimental
26
+ * @param {string} theme
27
+ * @param {string} thing
28
+ * @param {ChangeOptions & {value?: string}} [options] `value` names which half of
29
+ * the `headings` dial to reset (`weight` or `tracking`)
30
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditChangeResponse>}
31
+ */
32
+ export function themeEditReset(theme: string, thing: string, options?: ChangeOptions & {
33
+ value?: string;
34
+ }): Promise<import("./theme-edit.type.mjs").ThemeEditChangeResponse>;
35
+ /**
36
+ * Every setting of a theme, key resolved values, problems it caused, the
37
+ * sample page and the theme-building page with every component.
38
+ * @experimental
39
+ * @param {string} theme
40
+ * @param {{cwd?: string, png?: boolean, group?: string}} [options]
41
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditShowResponse>}
42
+ */
43
+ export function themeEditShow(theme: string, options?: {
44
+ cwd?: string;
45
+ png?: boolean;
46
+ group?: string;
47
+ }): Promise<import("./theme-edit.type.mjs").ThemeEditShowResponse>;
48
+ /**
49
+ * Put the theme back as it was before its last change.
50
+ * @experimental
51
+ * @param {string} theme
52
+ * @param {{cwd?: string, png?: boolean}} [options]
53
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditUndoResponse>}
54
+ */
55
+ export function themeEditUndo(theme: string, options?: {
56
+ cwd?: string;
57
+ png?: boolean;
58
+ }): Promise<import("./theme-edit.type.mjs").ThemeEditUndoResponse>;
59
+ /**
60
+ * The theme-building page: every component grouped, each variant side by
61
+ * side, overlays open, and full template pages. Rendered to one HTML file,
62
+ * or with `write` written into the app as a page module.
63
+ * @experimental
64
+ * @param {string} theme
65
+ * @param {{cwd?: string, write?: string, group?: string, png?: boolean}} [options]
66
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditPreviewResponse>}
67
+ */
68
+ export function themeEditPreview(theme: string, options?: {
69
+ cwd?: string;
70
+ write?: string;
71
+ group?: string;
72
+ png?: boolean;
73
+ }): Promise<import("./theme-edit.type.mjs").ThemeEditPreviewResponse>;
74
+ /**
75
+ * Explain anything a theme change can name, or answer a question about one:
76
+ * a part (what it reads for each aspect, its variants, states and the parts
77
+ * inside it), a family (its members), a setting (a dial's rungs, a token's
78
+ * type and readers, a CSS property), an aspect (colors, text, corners...: the
79
+ * whole-theme tokens and dial), a plain-words question (exact commands), a
80
+ * PNG picture (its main colors, or the color at points), or with `list` a
81
+ * list of dials, tokens, parts, families or CSS properties.
82
+ * @experimental
83
+ * @param {string} subject a part, family, setting, aspect, question, or PNG file; with `list`, a filter
84
+ * @param {import('./theme-edit.type.mjs').ThemeEditExplainOptions} [options]
85
+ * @returns {Promise<import('./theme-edit.type.mjs').ThemeEditExplainResponse>}
86
+ */
87
+ export function themeEditExplain(subject: string, options?: import("./theme-edit.type.mjs").ThemeEditExplainOptions): Promise<import("./theme-edit.type.mjs").ThemeEditExplainResponse>;
88
+ /**
89
+ * Read `--at` points: "x,y;x,y", "x,y x,y", repeated, or a flat "a,b,c,d".
90
+ * @param {string[]} at
91
+ */
92
+ export function parsePoints(at: string[]): {
93
+ x: number;
94
+ y: number;
95
+ }[];
96
+ export type ChangeOptions = import("./theme-edit.type.mjs").ThemeEditChangeOptions;