@astryxdesign/cli 0.7.12 → 0.7.13-canary.a5ad1f2

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 (82) hide show
  1. package/api/doctor/_adapter.d.mts +17 -0
  2. package/api/doctor/_adapter.mjs +40 -0
  3. package/api/doctor/doctor.d.mts +34 -4
  4. package/api/doctor/doctor.mjs +108 -21
  5. package/api/icon/_adapter.d.mts +6 -3
  6. package/api/icon/_adapter.mjs +11 -3
  7. package/api/icon/icon.type.d.mts +22 -1
  8. package/api/icon/icon.type.mjs +12 -4
  9. package/api/icon/iconUse.doc.mjs +27 -7
  10. package/api/icon/list/list.mjs +29 -3
  11. package/api/icon/use/use.d.mts +7 -3
  12. package/api/icon/use/use.mjs +68 -18
  13. package/api/integration/validate-integration.d.mts +4 -0
  14. package/api/integration/validate-integration.mjs +32 -2
  15. package/api/integration/validate-integration.type.d.mts +15 -0
  16. package/api/integration/validate-integration.type.mjs +6 -1
  17. package/api/template/copy/copy.mjs +4 -2
  18. package/api/template/template.type.d.mts +42 -4
  19. package/api/template/template.type.mjs +9 -6
  20. package/assets/discover/official-packages.json +4 -0
  21. package/assets/docs/tree/icon-sets.doc.mjs +91 -7
  22. package/assets/icons/definitions/alignBottom.doc.mjs +9 -0
  23. package/assets/icons/definitions/alignJustify.doc.mjs +9 -0
  24. package/assets/icons/definitions/alignMiddle.doc.mjs +9 -0
  25. package/assets/icons/definitions/alignTop.doc.mjs +9 -0
  26. package/assets/icons/definitions/angle.doc.mjs +9 -0
  27. package/assets/icons/definitions/cloud.doc.mjs +9 -0
  28. package/assets/icons/definitions/collection.doc.mjs +9 -0
  29. package/assets/icons/definitions/contrast.doc.mjs +9 -0
  30. package/assets/icons/definitions/cornerRadius.doc.mjs +9 -0
  31. package/assets/icons/definitions/cut.doc.mjs +9 -0
  32. package/assets/icons/definitions/fingerprint.doc.mjs +9 -0
  33. package/assets/icons/definitions/fire.doc.mjs +9 -0
  34. package/assets/icons/definitions/frame.doc.mjs +9 -0
  35. package/assets/icons/definitions/gift.doc.mjs +9 -0
  36. package/assets/icons/definitions/group.doc.mjs +9 -0
  37. package/assets/icons/definitions/integration.doc.mjs +9 -0
  38. package/assets/icons/definitions/lowercase.doc.mjs +9 -0
  39. package/assets/icons/definitions/paddingHorizontal.doc.mjs +9 -0
  40. package/assets/icons/definitions/paddingPerSide.doc.mjs +9 -0
  41. package/assets/icons/definitions/paddingVertical.doc.mjs +9 -0
  42. package/assets/icons/definitions/panelBottom.doc.mjs +9 -0
  43. package/assets/icons/definitions/photoEffect.doc.mjs +9 -0
  44. package/assets/icons/definitions/radiusPerCorner.doc.mjs +9 -0
  45. package/assets/icons/definitions/rotateCounterclockwise.doc.mjs +9 -0
  46. package/assets/icons/definitions/tablet.doc.mjs +9 -0
  47. package/assets/icons/definitions/text.doc.mjs +9 -0
  48. package/assets/icons/definitions/textRegular.doc.mjs +9 -0
  49. package/assets/icons/definitions/transfer.doc.mjs +9 -0
  50. package/assets/icons/definitions/uppercase.doc.mjs +9 -0
  51. package/assets/icons/definitions/userRemove.doc.mjs +9 -0
  52. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.doc.mjs +23 -0
  53. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.tsx +199 -0
  54. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -0
  55. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.doc.mjs +7 -2
  56. package/assets/templates/pages/canvas-editor/template.doc.mjs +20 -0
  57. package/assets/templates/pages/editor/template.doc.mjs +1 -0
  58. package/assets/templates/pages/form-wizard-vertical/template.doc.mjs +1 -0
  59. package/assets/templates/pages/settings-dialog/template.doc.mjs +4 -0
  60. package/assets/templates/pages/shell-top-nav/template.doc.mjs +3 -0
  61. package/assets/templates/pages/table-collapsible/template.doc.mjs +1 -0
  62. package/assets/templates/pages/table-comparison/template.doc.mjs +1 -0
  63. package/authoring/config/config.doc.mjs +4 -4
  64. package/authoring/config/parse.d.mts +1 -1
  65. package/authoring/config/parse.mjs +3 -1
  66. package/authoring/config/type.ts +7 -5
  67. package/authoring/doctypes/template/template.doc.mjs +1 -1
  68. package/authoring/doctypes/template/type.ts +5 -3
  69. package/clients/cli/commands/experimental/icon.mjs +38 -9
  70. package/clients/cli/commands/experimental-icon-use.doc.mjs +9 -4
  71. package/clients/cli/commands/template.mjs +12 -3
  72. package/foundation/config/config-writer.d.mts +14 -0
  73. package/foundation/config/config-writer.mjs +73 -17
  74. package/foundation/discovery/icon-set-discovery.d.mts +77 -7
  75. package/foundation/discovery/icon-set-discovery.mjs +128 -42
  76. package/foundation/discovery/template-icon-notes.d.mts +46 -0
  77. package/foundation/discovery/template-icon-notes.mjs +94 -16
  78. package/foundation/discovery/template-icons.d.mts +247 -0
  79. package/foundation/discovery/template-icons.mjs +591 -37
  80. package/foundation/integrations/cli-requirement.d.mts +13 -4
  81. package/foundation/integrations/cli-requirement.mjs +18 -6
  82. package/package.json +6 -6
@@ -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
  };