@astryxdesign/cli 0.7.11 → 0.7.12-canary.0edaed8

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 (127) hide show
  1. package/api/build/kit/rank.mjs +21 -4
  2. package/api/build/kit/words.d.mts +1 -0
  3. package/api/build/kit/words.mjs +1 -1
  4. package/api/component/__fixtures__/resolutions/modules.txt +3 -3
  5. package/api/docs/_adapter.d.mts +22 -0
  6. package/api/docs/_adapter.mjs +81 -3
  7. package/api/docs/docs.doc.mjs +5 -5
  8. package/api/docs/docs.type.d.mts +21 -0
  9. package/api/docs/docs.type.mjs +11 -0
  10. package/api/docs/list/list.d.mts +5 -1
  11. package/api/docs/list/list.mjs +72 -6
  12. package/api/docs/node/node.mjs +2 -40
  13. package/api/icon/_adapter.d.mts +3 -2
  14. package/api/icon/_adapter.mjs +8 -2
  15. package/api/icon/_authoring.d.mts +1 -0
  16. package/api/icon/_authoring.mjs +586 -66
  17. package/api/icon/_default-look.d.mts +155 -0
  18. package/api/icon/_default-look.mjs +474 -0
  19. package/api/icon/_records.d.mts +1 -1
  20. package/api/icon/_records.mjs +1 -0
  21. package/api/icon/add/add.mjs +224 -38
  22. package/api/icon/icon.type.d.mts +22 -2
  23. package/api/icon/icon.type.mjs +6 -2
  24. package/api/icon/iconAdd.doc.mjs +2 -2
  25. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  26. package/api/icon/iconNewSet.doc.mjs +4 -4
  27. package/api/icon/search/search.mjs +10 -9
  28. package/api/index.d.mts +1 -0
  29. package/api/index.mjs +1 -0
  30. package/api/integration/add-helpers.d.mts +11 -1
  31. package/api/integration/add-helpers.mjs +5 -2
  32. package/api/integration/authoring-checks.d.mts +0 -2
  33. package/api/integration/authoring-checks.mjs +1 -6
  34. package/api/logger.mjs +2 -1
  35. package/api/render/_adapter.mjs +9 -0
  36. package/api/render/render.doc.mjs +2 -2
  37. package/api/search/_adapter.d.mts +22 -1
  38. package/api/search/_adapter.mjs +37 -20
  39. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  40. package/api/search/exportSearchIndex.doc.mjs +58 -0
  41. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  42. package/api/search/rankSearchIndex.doc.mjs +79 -0
  43. package/api/search/search-index.d.mts +44 -0
  44. package/api/search/search-index.mjs +270 -0
  45. package/api/search/search.type.d.mts +28 -0
  46. package/api/search/search.type.mjs +17 -0
  47. package/api/swizzle/_adapter.d.mts +1 -0
  48. package/api/swizzle/_adapter.mjs +4 -1
  49. package/api/swizzle/_moduleGraph.d.mts +178 -0
  50. package/api/swizzle/_moduleGraph.mjs +903 -0
  51. package/api/swizzle/copy/copy.d.mts +2 -43
  52. package/api/swizzle/copy/copy.mjs +287 -315
  53. package/api/swizzle/swizzle.d.mts +0 -2
  54. package/api/swizzle/swizzle.doc.mjs +13 -4
  55. package/api/swizzle/swizzle.mjs +3 -7
  56. package/api/swizzle/swizzle.type.d.mts +7 -1
  57. package/api/swizzle/swizzle.type.mjs +4 -2
  58. package/api/template/template.mjs +1 -0
  59. package/assets/discover/official-packages.json +32 -0
  60. package/assets/docs/browser-support.doc.mjs +2 -2
  61. package/assets/docs/styling-overview.doc.mjs +4 -0
  62. package/assets/docs/tree/icon-sets.doc.mjs +11 -5
  63. package/assets/docs/tree/render-pages.doc.mjs +2 -2
  64. package/assets/docs/tree/type-scale.doc.mjs +19 -2
  65. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  66. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  67. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  68. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  69. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  70. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
  71. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +35 -0
  72. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  73. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  74. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
  75. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
  76. package/assets/templates/pages/course-detail/page.tsx +699 -0
  77. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  78. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  79. package/assets/templates/pages/table-filter/page.tsx +15 -23
  80. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  81. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  82. package/assets/templates/pages/table-inbox/page.tsx +3 -6
  83. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  84. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  85. package/assets/templates/themes/butter/butterTheme.ts +2 -2
  86. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  87. package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
  88. package/authoring/doctypes/template/type.ts +1 -0
  89. package/clients/cli/commands/docs.doc.mjs +5 -1
  90. package/clients/cli/commands/docs.mjs +30 -2
  91. package/clients/cli/commands/experimental/icon.mjs +31 -10
  92. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  93. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  94. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  95. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  96. package/clients/cli/commands/swizzle.mjs +33 -9
  97. package/foundation/discovery/component-loader.d.mts +1 -1
  98. package/foundation/discovery/doc-types.mjs +9 -2
  99. package/foundation/discovery/hook-discovery.mjs +31 -8
  100. package/foundation/discovery/icon-ranking.d.mts +27 -3
  101. package/foundation/discovery/icon-ranking.mjs +125 -8
  102. package/foundation/discovery/icon-set-checks.mjs +44 -35
  103. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  104. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  105. package/foundation/discovery/icon-set-writer.d.mts +238 -16
  106. package/foundation/discovery/icon-set-writer.mjs +676 -79
  107. package/foundation/discovery/module-exports.d.mts +3 -2
  108. package/foundation/discovery/module-exports.mjs +167 -37
  109. package/foundation/fs/paths.d.mts +2 -1
  110. package/foundation/fs/paths.mjs +3 -4
  111. package/foundation/render/charts.d.mts +59 -0
  112. package/foundation/render/charts.mjs +216 -0
  113. package/foundation/render/embedded-imports.d.mts +7 -7
  114. package/foundation/render/embedded-imports.mjs +63 -54
  115. package/foundation/render/page-worker.mjs +339 -52
  116. package/foundation/render/render-page.mjs +26 -10
  117. package/foundation/render/ts-paths.d.mts +63 -0
  118. package/foundation/render/ts-paths.mjs +138 -0
  119. package/foundation/response/error-codes.doc.mjs +2 -2
  120. package/foundation/response/error-codes.mjs +3 -2
  121. package/foundation/text/levenshtein.d.mts +6 -1
  122. package/foundation/text/levenshtein.mjs +25 -9
  123. package/foundation/text/shell-arg.d.mts +14 -0
  124. package/foundation/text/shell-arg.mjs +17 -0
  125. package/foundation/text/suggest-order.d.mts +8 -1
  126. package/foundation/text/suggest-order.mjs +72 -6
  127. package/package.json +7 -6
@@ -166,29 +166,158 @@ export function modulePrefix(file: string, options?: {
166
166
  adapter?: boolean;
167
167
  exclude?: string[];
168
168
  }): string[];
169
+ /**
170
+ * How a module names its icons: the library prefix every icon export shares
171
+ * ({@link modulePrefix}) and the look words its names end in
172
+ * ({@link lookPositions}), read from its icon exports once. A large module
173
+ * reports its reading, as {@link libraryIcons} does.
174
+ * @param {string} file
175
+ * @param {{adapter?: boolean, module?: string, progress?: (line: string) => void}} [options]
176
+ * `module`: the module as the author named it, for progress; `progress`:
177
+ * hears the reading of a large module
178
+ * @returns {{prefix: string[], positions: Array<Set<string>>}}
179
+ */
180
+ export function moduleNaming(file: string, options?: {
181
+ adapter?: boolean;
182
+ module?: string;
183
+ progress?: (line: string) => void;
184
+ }): {
185
+ prefix: string[];
186
+ positions: Array<Set<string>>;
187
+ };
188
+ /**
189
+ * An export's id and set name ({@link iconNaming}) without the look words
190
+ * its library's names end in ({@link lookPositions}):
191
+ * `XOutline24WGHT500Icon` is `x`, `XIcon`.
192
+ * @param {string} name
193
+ * @param {{prefix: string[], positions: Array<Set<string>>}} naming
194
+ * @returns {{id: string, name: string}}
195
+ */
196
+ export function iconNamingWithoutLook(name: string, { prefix, positions }: {
197
+ prefix: string[];
198
+ positions: Array<Set<string>>;
199
+ }): {
200
+ id: string;
201
+ name: string;
202
+ };
203
+ /**
204
+ * The trailing words a library encodes its looks with: a style, a size, a
205
+ * weight (`XOutline24WGHT500Icon` is `x` in the `outline`, `24`, `wght500`
206
+ * look). A trailing position is a look position when, across at least
207
+ * {@link LOOK_MIN_ICONS} icons, at most {@link LOOK_MAX_VALUES} words fill
208
+ * it, each on at least 5% of the icons and together on at least 90%, and
209
+ * those words name a look ({@link namesLook}); the positions are read from
210
+ * the end while they hold. Glyph names never meet that bar (`trash-2` and
211
+ * `clock-10` are a few icons each, and `up` and `down` are directions), so
212
+ * a library that encodes no looks has none. Reads each id once per
213
+ * position and keeps only counts.
214
+ * @param {string[]} ids every icon's id
215
+ * @returns {Array<Set<string>>} the look positions, the last word first
216
+ */
217
+ export function lookPositions(ids: string[]): Array<Set<string>>;
218
+ /**
219
+ * An id's glyph words and its look words, by {@link lookPositions}:
220
+ * `x-outline-24-wght500` is `x` with `[wght500, 24, outline]`, null where
221
+ * the id has no look word.
222
+ * @param {string[]} words
223
+ * @param {Array<Set<string>>} positions
224
+ * @returns {{base: string[], look: Array<string | null>}}
225
+ */
226
+ export function splitLook(words: string[], positions: Array<Set<string>>): {
227
+ base: string[];
228
+ look: Array<string | null>;
229
+ };
230
+ /**
231
+ * The word each look position prefers: a word of `prefer` it has (the set's
232
+ * default variant), else a usual default style word, else the middle of a
233
+ * series of numbered words (`wght300` … `wght700` gives `wght500`), else
234
+ * its first word in order.
235
+ * @param {Array<Set<string>>} positions
236
+ * @param {string[]} [prefer]
237
+ * @returns {string[]}
238
+ */
239
+ export function preferredLook(positions: Array<Set<string>>, prefer?: string[]): string[];
240
+ /**
241
+ * One icon a library gives.
242
+ * @typedef {object} LibraryIcon
243
+ * @property {string} export the library export it reads
244
+ * @property {string} id
245
+ * @property {string} name the name the set exports it as
246
+ * @property {boolean} adapt
247
+ * @property {string[]} aliases the ids of the other names the library
248
+ * exports the icon as, leaving out the library's own name (`lucide-trash`)
249
+ * @property {Array<string | null>} [look] in a library that encodes looks:
250
+ * this export's look words by position, the last word first
251
+ * @property {string[]} [looks] in a library that encodes looks: every
252
+ * export that draws the glyph, this one included
253
+ */
254
+ /**
255
+ * The words a library's looks are named by, and the look a set takes from
256
+ * it: what {@link libraryIcons} found, for the receipt.
257
+ * @typedef {object} LibraryLookSummary
258
+ * @property {string[][]} positions each position's words, sorted, the last
259
+ * word of a name first
260
+ * @property {string[]} preferred the word taken in each position
261
+ * @property {number} exports how many exports draw the icons
262
+ */
169
263
  /**
170
264
  * Every icon a whole library exports, for wrapping it at once: one entry per
171
265
  * component (and, with an adapter, per data export), read by its `…Icon`
172
266
  * export when it has one (an alias of the same value is recorded once), with
173
267
  * its id and the name the set exports it as from the name, the library
174
268
  * prefix left out ({@link libraryPrefix}).
269
+ *
270
+ * A library that encodes looks in its export names ({@link lookPositions})
271
+ * gives one icon per glyph: the look {@link preferredLook} prefers, its id
272
+ * and name without the look words (`XOutline24WGHT500Icon` is `x`,
273
+ * `XIcon`), and its `looks`, every export that draws the glyph.
175
274
  * @param {string} file
176
- * @param {{adapter?: boolean, exclude?: string[]}} [options] `adapter`:
177
- * whether the set declares one; `exclude`: export names that are not icons
178
- * @returns {Array<{export: string, id: string, name: string, adapt: boolean, aliases: string[]}>}
179
- * `aliases`: the ids of the other names the library exports the icon as,
180
- * leaving out the library's own name (`lucide-trash`)
275
+ * @param {{adapter?: boolean, exclude?: string[], prefer?: string[] | ((positions: Array<Set<string>>) => string[]), module?: string, progress?: (line: string) => void, summary?: (summary: LibraryLookSummary) => void}} [options]
276
+ * `adapter`: whether the set declares one; `exclude`: export names that
277
+ * are not icons; `prefer`: look words to prefer (the set's default
278
+ * variant), or a function that gives them from the library's look
279
+ * positions before any glyph is picked; `module`: the module as the author named it, for progress;
280
+ * `progress`: hears the reading of a large module;
281
+ * `summary`: hears the looks found, when the library has any
282
+ * @returns {LibraryIcon[]}
181
283
  */
182
284
  export function libraryIcons(file: string, options?: {
183
285
  adapter?: boolean;
184
286
  exclude?: string[];
185
- }): Array<{
186
- export: string;
187
- id: string;
188
- name: string;
189
- adapt: boolean;
190
- aliases: string[];
191
- }>;
287
+ prefer?: string[] | ((positions: Array<Set<string>>) => string[]);
288
+ module?: string;
289
+ progress?: (line: string) => void;
290
+ summary?: (summary: LibraryLookSummary) => void;
291
+ }): LibraryIcon[];
292
+ /**
293
+ * The library's icons grouped by glyph when its export names encode looks
294
+ * ({@link libraryIcons}), with the look positions and the words preferred.
295
+ * Without look positions the icons are returned as they are.
296
+ * @param {LibraryIcon[]} all every icon, one per export
297
+ * @param {string[]} [prefer]
298
+ * @returns {{icons: LibraryIcon[], positions: Array<Set<string>>, preferred: string[]}}
299
+ */
300
+ export function libraryLooks(all: LibraryIcon[], prefer?: string[]): {
301
+ icons: LibraryIcon[];
302
+ positions: Array<Set<string>>;
303
+ preferred: string[];
304
+ };
305
+ /**
306
+ * Every icon a library exports, one per export: {@link libraryIcons} before
307
+ * looks are grouped. A large module reports its reading, as
308
+ * {@link libraryIcons} does.
309
+ * @param {string} file
310
+ * @param {{adapter?: boolean, exclude?: string[], module?: string, progress?: (line: string) => void}} [options]
311
+ * `module`: the module as the author named it, for progress; `progress`:
312
+ * hears the reading of a large module
313
+ * @returns {LibraryIcon[]}
314
+ */
315
+ export function everyLibraryIcon(file: string, options?: {
316
+ adapter?: boolean;
317
+ exclude?: string[];
318
+ module?: string;
319
+ progress?: (line: string) => void;
320
+ }): LibraryIcon[];
192
321
  /**
193
322
  * The source of one icon definition file, typed IconDefinitionDoc.
194
323
  * @param {{name: string, description: string, words: string[]}} doc
@@ -199,13 +328,20 @@ export function iconDefinitionSource(doc: {
199
328
  words: string[];
200
329
  }): string;
201
330
  /**
202
- * Check a new icon definition for a set: a camelCase name no Astryx
203
- * definition has, a description, and at least one lower-case word.
331
+ * A new definition's name as written in a command: camelCase as given, or
332
+ * kebab-case as the docs list definitions (`ai-helper` is `aiHelper`).
333
+ * @param {string} name
334
+ */
335
+ export function definitionNameFromInput(name: string): string;
336
+ /**
337
+ * Check a new icon definition for a set: a camelCase name (or its kebab-case
338
+ * form, {@link definitionNameFromInput}) no Astryx definition has, a
339
+ * description, and at least one lower-case word.
204
340
  * @param {DiscoveredIconSet} set
205
- * @param {{name: string, description?: string, words?: string[]}} doc
341
+ * @param {{name: string, description?: string, words?: string[]}} given
206
342
  * @returns {{name: string, description: string, words: string[]}}
207
343
  */
208
- export function checkNewDefinition(set: DiscoveredIconSet, doc: {
344
+ export function checkNewDefinition(set: DiscoveredIconSet, given: {
209
345
  name: string;
210
346
  description?: string;
211
347
  words?: string[];
@@ -232,6 +368,15 @@ export function writeDefinitionFile(set: DiscoveredIconSet, doc: {
232
368
  description: string;
233
369
  words: string[];
234
370
  }): () => void;
371
+ /**
372
+ * Whether a generated declaration file declares what its generated module
373
+ * gives, statement by statement however a formatter left either file
374
+ * ({@link generatedStatements}); the header comment is ignored.
375
+ * @param {string} actual the declaration file as it is
376
+ * @param {string} expected {@link generatedTypesText} for the module
377
+ * @param {string} label the declaration file's path, for a parse error
378
+ */
379
+ export function generatedTypesMatch(actual: string, expected: string, label: string): boolean;
235
380
  /**
236
381
  * The generated icons module of a set, from the package root: `generated`
237
382
  * in its data file, else `<set directory>/<set>.generated.js`.
@@ -316,6 +461,34 @@ export function sameIconModule(a: string, b: string): boolean;
316
461
  * @param {string} specifier
317
462
  */
318
463
  export function iconModulePackage(specifier: string): string;
464
+ /**
465
+ * The set's exports that read one file of a package, where a refresh from
466
+ * that package's root can read them from the root instead. An export moves
467
+ * when the root exports the same icon: an export that resolves to the same
468
+ * file and binding. When the subpath export cannot be resolved, a root
469
+ * export of the same name counts. Each maps to the root's
470
+ * export and the module it reads now. Empty unless `root` is a package
471
+ * root, not a subpath or a ./ path.
472
+ * @param {Map<string, {module: string, source: string}>} origins the
473
+ * set's exports ({@link generatedOrigins})
474
+ * @param {{file: string, module: string}} root the refreshed module
475
+ * @param {string[]} rootExports the root's icon exports
476
+ * @param {{packageDir: string, pkg: Record<string, any>}} where
477
+ * @returns {Map<string, {source: string, from: string}>}
478
+ */
479
+ export function packageRootMoves(origins: Map<string, {
480
+ module: string;
481
+ source: string;
482
+ }>, root: {
483
+ file: string;
484
+ module: string;
485
+ }, rootExports: string[], where: {
486
+ packageDir: string;
487
+ pkg: Record<string, any>;
488
+ }): Map<string, {
489
+ source: string;
490
+ from: string;
491
+ }>;
319
492
  /**
320
493
  * Write the set's generated module and its declaration file
321
494
  * ({@link generatedModuleText}). Returns whether either changed, and a
@@ -469,6 +642,55 @@ export class IconSetAuthoringError extends Error {
469
642
  }
470
643
  /** The theme map the generated module writes. */
471
644
  export const THEME_MAP_NAME: "themeIcons";
645
+ /**
646
+ * One icon a library gives.
647
+ */
648
+ export type LibraryIcon = {
649
+ /**
650
+ * the library export it reads
651
+ */
652
+ export: string;
653
+ id: string;
654
+ /**
655
+ * the name the set exports it as
656
+ */
657
+ name: string;
658
+ adapt: boolean;
659
+ /**
660
+ * the ids of the other names the library
661
+ * exports the icon as, leaving out the library's own name (`lucide-trash`)
662
+ */
663
+ aliases: string[];
664
+ /**
665
+ * in a library that encodes looks:
666
+ * this export's look words by position, the last word first
667
+ */
668
+ look?: (string | null)[] | undefined;
669
+ /**
670
+ * in a library that encodes looks: every
671
+ * export that draws the glyph, this one included
672
+ */
673
+ looks?: string[] | undefined;
674
+ };
675
+ /**
676
+ * The words a library's looks are named by, and the look a set takes from
677
+ * it: what {@link libraryIcons} found, for the receipt.
678
+ */
679
+ export type LibraryLookSummary = {
680
+ /**
681
+ * each position's words, sorted, the last
682
+ * word of a name first
683
+ */
684
+ positions: string[][];
685
+ /**
686
+ * the word taken in each position
687
+ */
688
+ preferred: string[];
689
+ /**
690
+ * how many exports draw the icons
691
+ */
692
+ exports: number;
693
+ };
472
694
  export type DiscoveredIconSet = import("./icon-set-discovery.mjs").DiscoveredIconSet;
473
695
  export type IconSetData = import("../../authoring/doctypes/icon-set/type").IconSetData;
474
696
  /**