@astryxdesign/cli 0.7.12 → 0.7.13-canary.802938b

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 (89) hide show
  1. package/api/component/__fixtures__/resolutions/modules.txt +2 -2
  2. package/api/doctor/_adapter.d.mts +17 -0
  3. package/api/doctor/_adapter.mjs +40 -0
  4. package/api/doctor/doctor.d.mts +34 -4
  5. package/api/doctor/doctor.mjs +108 -21
  6. package/api/icon/_adapter.d.mts +6 -3
  7. package/api/icon/_adapter.mjs +11 -3
  8. package/api/icon/icon.type.d.mts +22 -1
  9. package/api/icon/icon.type.mjs +12 -4
  10. package/api/icon/iconUse.doc.mjs +27 -7
  11. package/api/icon/list/list.mjs +29 -3
  12. package/api/icon/use/use.d.mts +7 -3
  13. package/api/icon/use/use.mjs +68 -18
  14. package/api/integration/validate-integration.d.mts +4 -0
  15. package/api/integration/validate-integration.mjs +32 -2
  16. package/api/integration/validate-integration.type.d.mts +15 -0
  17. package/api/integration/validate-integration.type.mjs +6 -1
  18. package/api/template/copy/copy.mjs +4 -2
  19. package/api/template/template.type.d.mts +42 -4
  20. package/api/template/template.type.mjs +9 -6
  21. package/assets/discover/official-packages.json +4 -0
  22. package/assets/docs/tree/icon-sets.doc.mjs +91 -7
  23. package/assets/icons/definitions/alignBottom.doc.mjs +9 -0
  24. package/assets/icons/definitions/alignJustify.doc.mjs +9 -0
  25. package/assets/icons/definitions/alignMiddle.doc.mjs +9 -0
  26. package/assets/icons/definitions/alignTop.doc.mjs +9 -0
  27. package/assets/icons/definitions/angle.doc.mjs +9 -0
  28. package/assets/icons/definitions/cloud.doc.mjs +9 -0
  29. package/assets/icons/definitions/collection.doc.mjs +9 -0
  30. package/assets/icons/definitions/contrast.doc.mjs +9 -0
  31. package/assets/icons/definitions/cornerRadius.doc.mjs +9 -0
  32. package/assets/icons/definitions/cut.doc.mjs +9 -0
  33. package/assets/icons/definitions/fingerprint.doc.mjs +9 -0
  34. package/assets/icons/definitions/fire.doc.mjs +9 -0
  35. package/assets/icons/definitions/frame.doc.mjs +9 -0
  36. package/assets/icons/definitions/gift.doc.mjs +9 -0
  37. package/assets/icons/definitions/group.doc.mjs +9 -0
  38. package/assets/icons/definitions/integration.doc.mjs +9 -0
  39. package/assets/icons/definitions/lowercase.doc.mjs +9 -0
  40. package/assets/icons/definitions/paddingHorizontal.doc.mjs +9 -0
  41. package/assets/icons/definitions/paddingPerSide.doc.mjs +9 -0
  42. package/assets/icons/definitions/paddingVertical.doc.mjs +9 -0
  43. package/assets/icons/definitions/panelBottom.doc.mjs +9 -0
  44. package/assets/icons/definitions/photoEffect.doc.mjs +9 -0
  45. package/assets/icons/definitions/radiusPerCorner.doc.mjs +9 -0
  46. package/assets/icons/definitions/rotateCounterclockwise.doc.mjs +9 -0
  47. package/assets/icons/definitions/tablet.doc.mjs +9 -0
  48. package/assets/icons/definitions/text.doc.mjs +9 -0
  49. package/assets/icons/definitions/textRegular.doc.mjs +9 -0
  50. package/assets/icons/definitions/transfer.doc.mjs +9 -0
  51. package/assets/icons/definitions/uppercase.doc.mjs +9 -0
  52. package/assets/icons/definitions/userRemove.doc.mjs +9 -0
  53. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.doc.mjs +23 -0
  54. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.tsx +199 -0
  55. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -0
  56. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.doc.mjs +7 -2
  57. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +21 -0
  58. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.tsx +46 -0
  59. package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.doc.mjs +18 -0
  60. package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.tsx +101 -0
  61. package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
  62. package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
  63. package/assets/templates/pages/canvas-editor/template.doc.mjs +20 -0
  64. package/assets/templates/pages/editor/template.doc.mjs +1 -0
  65. package/assets/templates/pages/form-wizard-vertical/template.doc.mjs +1 -0
  66. package/assets/templates/pages/settings-dialog/template.doc.mjs +4 -0
  67. package/assets/templates/pages/shell-top-nav/template.doc.mjs +3 -0
  68. package/assets/templates/pages/table-collapsible/template.doc.mjs +1 -0
  69. package/assets/templates/pages/table-comparison/template.doc.mjs +1 -0
  70. package/authoring/config/config.doc.mjs +4 -4
  71. package/authoring/config/parse.d.mts +1 -1
  72. package/authoring/config/parse.mjs +3 -1
  73. package/authoring/config/type.ts +7 -5
  74. package/authoring/doctypes/template/template.doc.mjs +1 -1
  75. package/authoring/doctypes/template/type.ts +5 -3
  76. package/clients/cli/commands/experimental/icon.mjs +38 -9
  77. package/clients/cli/commands/experimental-icon-use.doc.mjs +9 -4
  78. package/clients/cli/commands/template.mjs +12 -3
  79. package/foundation/config/config-writer.d.mts +14 -0
  80. package/foundation/config/config-writer.mjs +73 -17
  81. package/foundation/discovery/icon-set-discovery.d.mts +77 -7
  82. package/foundation/discovery/icon-set-discovery.mjs +128 -42
  83. package/foundation/discovery/template-icon-notes.d.mts +46 -0
  84. package/foundation/discovery/template-icon-notes.mjs +94 -16
  85. package/foundation/discovery/template-icons.d.mts +247 -0
  86. package/foundation/discovery/template-icons.mjs +591 -37
  87. package/foundation/integrations/cli-requirement.d.mts +13 -4
  88. package/foundation/integrations/cli-requirement.mjs +18 -6
  89. package/package.json +14 -14
@@ -1,18 +1,25 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file Template `icons` keys a template's source never imports (spec:AST-084
5
- * FR10).
4
+ * @file A template's `icons` checked against the icons its source imports.
6
5
  *
7
6
  * A template's `icons` names each icon it imports, by the name it imports or,
8
7
  * for a default import, its local name. A key that no import or re-export in
9
8
  * the template's source binds can never map to a project's icon set, so each
10
- * one gets a note with its fix.
9
+ * one gets a note with its fix. An icon the template imports but does not
10
+ * declare never maps either: in a package whose templates declare `icons`,
11
+ * each one gets a note too, which `validate` marks `next`. An import counts
12
+ * only when the template renders it as an element without children or
13
+ * passes it as a value. Any other import from that module, a generic
14
+ * renderer, and an import that matches an icon by its name only, are listed
15
+ * as not checked instead.
11
16
  *
12
17
  * @input A loaded integration (absolute roots) and its package directory.
13
- * @output One `template_icon_not_imported` note per such key. A note is not an
14
- * issue: it is never an error or a warning, and never fails a check, even
15
- * under `--strict` (architecture:cli-surface INV35).
18
+ * @output One `template_icon_not_imported` note per such key, one
19
+ * `template_icon_undeclared` note per undeclared icon, and each import not
20
+ * rendered as an icon, generic renderer, or import matched by its name
21
+ * only, as not checked. A note is never an error or a warning, even under
22
+ * `--strict`.
16
23
  * @position foundation/discovery; read by `doctor integration validate` (and
17
24
  * so `integration check`) for the package being authored.
18
25
  */
@@ -21,46 +28,117 @@ import * as fs from 'node:fs';
21
28
  import * as path from 'node:path';
22
29
  import {loadTopicModule} from './docs-discovery.mjs';
23
30
  import {discoverIntegrationTemplatesForOne} from './template-adapter.mjs';
24
- import {iconsNotImported} from './template-icons.mjs';
31
+ import {iconsNotImported, undeclaredTemplateIcons} from './template-icons.mjs';
25
32
 
26
33
  /** A template `icons` key its source never imports. */
27
34
  export const TEMPLATE_ICON_NOT_IMPORTED = 'template_icon_not_imported';
28
35
 
36
+ /** An icon a template imports that its `icons` does not declare. */
37
+ export const TEMPLATE_ICON_UNDECLARED = 'template_icon_undeclared';
38
+
29
39
  /**
30
- * One note per template `icons` key the template's source never imports.
40
+ * Each template in the package, with its source and its doc's `icons`. A
41
+ * template whose doc or source cannot be read is left out.
31
42
  * @param {any} loaded a loaded integration (absolute roots)
32
43
  * @param {string} packageDir
33
- * @returns {Promise<Array<{code: string, message: string}>>}
44
+ * @returns {Promise<Array<{id: string, docPath: string, source: string, declared: Record<string, string> | null}>>}
34
45
  */
35
- export async function templateIconNotes(loaded, packageDir) {
46
+ async function readTemplates(loaded, packageDir) {
36
47
  if (!loaded.templates) return [];
37
48
  const {templates} = await discoverIntegrationTemplatesForOne(loaded).catch(
38
49
  () => ({templates: []}),
39
50
  );
40
- /** @type {Array<{code: string, message: string}>} */
41
- const notes = [];
42
51
  /** @param {string} file */
43
52
  const shown = file =>
44
53
  path.relative(packageDir, file).split(path.sep).join('/');
54
+ /** @type {Array<{id: string, docPath: string, source: string, declared: Record<string, string> | null}>} */
55
+ const read = [];
45
56
  for (const template of templates) {
46
57
  if (!template.docPath || !template.filePath) continue;
47
58
  const doc = /** @type {any} */ (
48
59
  await loadTopicModule(template.docPath).catch(() => null)
49
60
  );
50
- const declared = doc?.icons;
51
- if (declared == null || typeof declared !== 'object') continue;
52
61
  let source;
53
62
  try {
54
63
  source = fs.readFileSync(template.filePath, 'utf-8');
55
64
  } catch {
56
65
  continue;
57
66
  }
58
- for (const key of iconsNotImported(source, declared) ?? []) {
67
+ read.push({
68
+ id: shown(template.filePath),
69
+ docPath: shown(template.docPath),
70
+ source,
71
+ declared:
72
+ doc?.icons != null && typeof doc.icons === 'object' ? doc.icons : null,
73
+ });
74
+ }
75
+ return read;
76
+ }
77
+
78
+ /**
79
+ * One note per template `icons` key the template's source never imports.
80
+ * @param {any} loaded a loaded integration (absolute roots)
81
+ * @param {string} packageDir
82
+ * @returns {Promise<Array<{code: string, message: string}>>}
83
+ */
84
+ export async function templateIconNotes(loaded, packageDir) {
85
+ /** @type {Array<{code: string, message: string}>} */
86
+ const notes = [];
87
+ for (const template of await readTemplates(loaded, packageDir)) {
88
+ if (!template.declared) continue;
89
+ for (const key of iconsNotImported(template.source, template.declared) ??
90
+ []) {
59
91
  notes.push({
60
92
  code: TEMPLATE_ICON_NOT_IMPORTED,
61
- message: `${shown(template.docPath)} declares icon "${key}" in \`icons\`, which ${shown(template.filePath)} does not import, so it never maps to a project's icon set. Name a named import by the name it imports and a default import by its local name, or remove "${key}" from \`icons\`.`,
93
+ message: `${template.docPath} declares icon "${key}" in \`icons\`, which ${template.id} does not import, so it never maps to a project's icon set. Name a named import by the name it imports and a default import by its local name, or remove "${key}" from \`icons\`.`,
62
94
  });
63
95
  }
64
96
  }
65
97
  return notes;
66
98
  }
99
+
100
+ /**
101
+ * One item the undeclared-icon check could not judge.
102
+ * @typedef {object} TemplateIconUnchecked
103
+ * @property {string} file the template, relative to the package
104
+ * @property {string} icon the imported name
105
+ * @property {string} module the module it is imported from
106
+ * @property {string} reason why, and what would let the check judge it
107
+ */
108
+
109
+ /**
110
+ * One note per icon a template imports but does not declare in `icons`, and
111
+ * each import the check cannot judge. Only a package whose templates declare
112
+ * `icons` gets either: a package that never labels its icons sees no change.
113
+ * @param {any} loaded a loaded integration (absolute roots)
114
+ * @param {string} packageDir
115
+ * @returns {Promise<{notes: Array<{code: string, message: string}>, unchecked: TemplateIconUnchecked[]}>}
116
+ */
117
+ export async function templateIconUndeclaredNotes(loaded, packageDir) {
118
+ const read = (await readTemplates(loaded, packageDir)).map(each => ({
119
+ ...each,
120
+ declared: each.declared ?? {},
121
+ }));
122
+ if (!read.some(each => Object.keys(each.declared).length > 0)) {
123
+ return {notes: [], unchecked: []};
124
+ }
125
+ const docOf = new Map(read.map(each => [each.id, each.docPath]));
126
+ const {undeclared, unchecked} = undeclaredTemplateIcons(read);
127
+ return {
128
+ notes: undeclared.map(({id, key, module}) => ({
129
+ code: TEMPLATE_ICON_UNDECLARED,
130
+ message: `${id} imports icon "${key}" from ${module}, but ${docOf.get(id)} does not declare it in \`icons\`, so it never follows a project's icon set. Add \`${key}: '<definition>'\` to \`icons\` (\`astryx experimental icon --definitions\` lists the definitions).`,
131
+ })),
132
+ unchecked: unchecked.map(({id, key, module, why}) => ({
133
+ file: id,
134
+ icon: key,
135
+ module,
136
+ reason:
137
+ why === 'renderer'
138
+ ? `"${key}" is a generic renderer: it is a bare \`Icon\`, or every use gives it an icon prop, so it draws no one icon definition and needs no \`icons\` key.`
139
+ : why === 'use'
140
+ ? `"${key}" is not rendered as an icon: the template never renders it as an element without children or passes it as a value, so it needs no \`icons\` key. Declaring it would make \`astryx template\` swap it for an icon.`
141
+ : `"${key}" matches an icon by its name only: no template in the package declares an icon from ${module}, so the check cannot tell whether it draws one icon definition. Declare an icon from ${module} in a template's \`icons\` to have its imports checked.`,
142
+ })),
143
+ };
144
+ }
@@ -1,6 +1,46 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The placeholder component the CLI declares once in a copied file. It sizes
6
+ * like an icon (1em, in the current text color). It is hidden from assistive
7
+ * technology unless a use gives it a label.
8
+ * @param {string} name
9
+ */
10
+ export function placeholderDeclaration(name: string): string;
11
+ /**
12
+ * The comment beside each use of the placeholder, so `astryx doctor` can name
13
+ * the meaning it stands for.
14
+ * @param {string[]} definitions
15
+ */
16
+ export function placeholderNote(definitions: string[]): string;
17
+ /**
18
+ * Read the meanings back from a placeholder use's comment. Null for a
19
+ * comment that is not one.
20
+ * @param {string} comment the comment's text, with or without its markers
21
+ * @returns {string[] | null}
22
+ */
23
+ export function placeholderMeanings(comment: string): string[] | null;
24
+ /**
25
+ * Each use of the placeholder component in a file: the name it is declared
26
+ * under and the meanings its comment names (null when it names none). Only
27
+ * the declaration the CLI writes counts, and only code: commented-out code
28
+ * and text in strings are never uses. A closing JSX tag is part of its
29
+ * element's use. Null when the source does not parse.
30
+ * @param {string} source
31
+ * @returns {Array<{local: string, meanings: string[] | null}> | null}
32
+ */
33
+ export function placeholderUses(source: string): Array<{
34
+ local: string;
35
+ meanings: string[] | null;
36
+ }> | null;
37
+ /**
38
+ * The commands that give a placeholder icon a real one.
39
+ * @param {string[]} definitions
40
+ * @param {string} main the main set's name as the list writes it
41
+ * @returns {string[]}
42
+ */
43
+ export function placeholderFixes(definitions: string[], main: string): string[];
4
44
  /**
5
45
  * The target-set icon whose reviewed `matches` name the source icon with one
6
46
  * of `confidences`, ties broken by the order the confidences are given and
@@ -33,6 +73,55 @@ export function matchIcon(source: SourceIcon, target: DiscoveredIconSet): {
33
73
  * @returns {string[] | null}
34
74
  */
35
75
  export function iconsNotImported(source: string, declared: Record<string, string>): string[] | null;
76
+ /**
77
+ * The value imports a template takes from other packages, as the keys its
78
+ * `icons` uses: a named import by the name it imports, a default import by
79
+ * its local name. Astryx's own packages, relative files, namespace imports,
80
+ * and type-only imports are left out. `renderer` marks a generic renderer:
81
+ * the key is `Icon`, or every JSX use passes an icon-choosing prop. `icon`
82
+ * marks an import the template uses as an icon: it renders it as a childless
83
+ * element or passes it as a value. Null when the source does not parse.
84
+ * @param {string} source
85
+ * @returns {Array<{key: string, module: string, renderer: boolean, icon: boolean}> | null}
86
+ */
87
+ export function packageImports(source: string): Array<{
88
+ key: string;
89
+ module: string;
90
+ renderer: boolean;
91
+ icon: boolean;
92
+ }> | null;
93
+ /**
94
+ * The icons each template imports but does not declare in its `icons`. An
95
+ * import is undeclared when it comes from a module that some template
96
+ * declares an icon from (an icon library) and the template uses it as an
97
+ * icon: it renders it as a childless element or passes it as a value. Any
98
+ * other import from that module, such as a type, a factory it calls, or a
99
+ * provider with children, is listed as not checked (`use`): declaring it
100
+ * would make a template swap it for an icon. The check also cannot tell that
101
+ * an import draws one icon definition when it is a generic renderer, or when
102
+ * it comes from any other package and only its key ends in `Icon`, so it
103
+ * lists those as not checked (`architecture:cli-surface` DEC-7). Only
104
+ * templates that parse are read.
105
+ * @param {Array<{id: string, source: string, declared: Record<string, string>}>} templates
106
+ * @returns {{undeclared: Array<{id: string, key: string, module: string}>, unchecked: Array<{id: string, key: string, module: string, why: 'renderer' | 'use' | 'name'}>}}
107
+ */
108
+ export function undeclaredTemplateIcons(templates: Array<{
109
+ id: string;
110
+ source: string;
111
+ declared: Record<string, string>;
112
+ }>): {
113
+ undeclared: Array<{
114
+ id: string;
115
+ key: string;
116
+ module: string;
117
+ }>;
118
+ unchecked: Array<{
119
+ id: string;
120
+ key: string;
121
+ module: string;
122
+ why: "renderer" | "use" | "name";
123
+ }>;
124
+ };
36
125
  /**
37
126
  * Rewrite a template's icon imports to the project's icon set (FR9, FR10).
38
127
  * @param {string} source
@@ -52,6 +141,88 @@ export function mapTemplateIcons(source: string, { sets, choice }: {
52
141
  source: string;
53
142
  icons: TemplateIconsReport | undefined;
54
143
  };
144
+ /** @typedef {import('./icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
145
+ /** @typedef {import('./icon-set-discovery.mjs').IconSetChoice} IconSetChoice */
146
+ /** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetIcon} IconSetIcon */
147
+ /**
148
+ * A source icon: what an imported icon means.
149
+ * @typedef {object} SourceIcon
150
+ * @property {string | null} setName the installed set it comes from, as a
151
+ * reviewed match names it; null for an icon only the template declares
152
+ * @property {string} export the export the template imports
153
+ * @property {string} [variant] which of its set's declared variants the
154
+ * export draws, as a reviewed match names it
155
+ * @property {string} id
156
+ * @property {string[]} definitions the Astryx definitions it draws
157
+ * @property {DiscoveredIconSet} [set] the set it came from, when installed
158
+ */
159
+ /**
160
+ * One mapped icon.
161
+ * @typedef {object} MappedIcon
162
+ * @property {{module: string, export: string}} source
163
+ * @property {{set: string, package: string, id: string, module: string, export: string}} target
164
+ * @property {string[]} [dropped] the library's sizing props (`size`,
165
+ * `strokeWidth`, `absoluteStrokeWidth`) removed from its elements: an icon
166
+ * set's icons take their size from CSS
167
+ * @property {'match' | 'definition'} by `match`: a reviewed
168
+ * `exact` or `strong` match in the project set's data names the source
169
+ * icon; `definition`: the target's `map` names it for the Astryx icon
170
+ * definition the source draws
171
+ * @property {{asked: string, used: string | null}} [variant] present when the
172
+ * source draws a look the target set's icon does not have: the look it
173
+ * asked for, and the look used (the set's default look)
174
+ */
175
+ /**
176
+ * One icon no set in the project's list has: each of its uses in the copied
177
+ * code renders the placeholder component that the file declares.
178
+ * @typedef {object} PlaceholderIcon
179
+ * @property {{module: string, export: string}} source
180
+ * @property {{local: string}} target the name of the placeholder component
181
+ * in the file
182
+ * @property {string[]} definitions the icon definitions the icon draws
183
+ * @property {string[]} fixes the commands that give it a real icon: map the
184
+ * definition in the main set, or add a backup set that has it
185
+ * @property {string[]} [dropped] the library's sizing props removed from its
186
+ * elements, as for a mapped icon
187
+ * @property {{set: string, id: string, module: string, export: string, confidence: 'likely'}} [suggestion]
188
+ * a `likely` reviewed match in the main set, suggested and never applied
189
+ */
190
+ /**
191
+ * One set a template's mapped icons come from.
192
+ * @typedef {object} UsedIconSet
193
+ * @property {string} set `<package>/<set>`
194
+ * @property {string} license
195
+ * @property {number} icons how many mapped icons it gives
196
+ */
197
+ /**
198
+ * One icon kept as the template wrote it.
199
+ * @typedef {object} KeptIcon
200
+ * @property {string | null} module the module it is imported or re-exported
201
+ * from; null when the template does not import it
202
+ * @property {string} export the name it is imported by: `default` for a
203
+ * default import, `*` for a namespace import
204
+ * @property {string} reason
205
+ * @property {{set: string, id: string, module: string, export: string, confidence: 'likely'}} [suggestion]
206
+ * a `likely` reviewed match, suggested and never applied
207
+ */
208
+ /**
209
+ * What template icon mapping did.
210
+ * @typedef {object} TemplateIconsReport
211
+ * @property {'selected' | 'none' | 'ambiguous' | 'missing' | 'withdrawn'} status the
212
+ * project's icon-set state; only `selected` maps anything
213
+ * @property {string | null} set the project set as `<package>/<set>`
214
+ * @property {string[]} [order] the main set and each backup, as
215
+ * `<package>/<set>`, in the order icons are looked up; present when the
216
+ * project lists backups
217
+ * @property {string} reason
218
+ * @property {MappedIcon[]} mapped
219
+ * @property {PlaceholderIcon[]} placeholder
220
+ * @property {KeptIcon[]} kept
221
+ * @property {UsedIconSet[]} sets each set the mapped icons come from, with
222
+ * its license
223
+ */
224
+ /** The name of the placeholder component, when the file does not use it. */
225
+ export const PLACEHOLDER_NAME: "MissingIcon";
55
226
  /** What a template reads with no icon-set state given: nothing is mapped. */
56
227
  export const NO_ICON_SETS: Readonly<{
57
228
  sets: never[];
@@ -116,6 +287,70 @@ export type MappedIcon = {
116
287
  * definition the source draws
117
288
  */
118
289
  by: "match" | "definition";
290
+ /**
291
+ * present when the
292
+ * source draws a look the target set's icon does not have: the look it
293
+ * asked for, and the look used (the set's default look)
294
+ */
295
+ variant?: {
296
+ asked: string;
297
+ used: string | null;
298
+ } | undefined;
299
+ };
300
+ /**
301
+ * One icon no set in the project's list has: each of its uses in the copied
302
+ * code renders the placeholder component that the file declares.
303
+ */
304
+ export type PlaceholderIcon = {
305
+ source: {
306
+ module: string;
307
+ export: string;
308
+ };
309
+ /**
310
+ * the name of the placeholder component
311
+ * in the file
312
+ */
313
+ target: {
314
+ local: string;
315
+ };
316
+ /**
317
+ * the icon definitions the icon draws
318
+ */
319
+ definitions: string[];
320
+ /**
321
+ * the commands that give it a real icon: map the
322
+ * definition in the main set, or add a backup set that has it
323
+ */
324
+ fixes: string[];
325
+ /**
326
+ * the library's sizing props removed from its
327
+ * elements, as for a mapped icon
328
+ */
329
+ dropped?: string[] | undefined;
330
+ /**
331
+ * a `likely` reviewed match in the main set, suggested and never applied
332
+ */
333
+ suggestion?: {
334
+ set: string;
335
+ id: string;
336
+ module: string;
337
+ export: string;
338
+ confidence: "likely";
339
+ } | undefined;
340
+ };
341
+ /**
342
+ * One set a template's mapped icons come from.
343
+ */
344
+ export type UsedIconSet = {
345
+ /**
346
+ * `<package>/<set>`
347
+ */
348
+ set: string;
349
+ license: string;
350
+ /**
351
+ * how many mapped icons it gives
352
+ */
353
+ icons: number;
119
354
  };
120
355
  /**
121
356
  * One icon kept as the template wrote it.
@@ -156,7 +391,19 @@ export type TemplateIconsReport = {
156
391
  * the project set as `<package>/<set>`
157
392
  */
158
393
  set: string | null;
394
+ /**
395
+ * the main set and each backup, as
396
+ * `<package>/<set>`, in the order icons are looked up; present when the
397
+ * project lists backups
398
+ */
399
+ order?: string[] | undefined;
159
400
  reason: string;
160
401
  mapped: MappedIcon[];
402
+ placeholder: PlaceholderIcon[];
161
403
  kept: KeptIcon[];
404
+ /**
405
+ * each set the mapped icons come from, with
406
+ * its license
407
+ */
408
+ sets: UsedIconSet[];
162
409
  };