@astryxdesign/cli 0.7.11-canary.ec945c9 → 0.7.11

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 (64) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/api/build/kit/rank.mjs +4 -21
  3. package/api/build/kit/words.d.mts +0 -1
  4. package/api/build/kit/words.mjs +1 -1
  5. package/api/icon/_adapter.d.mts +2 -3
  6. package/api/icon/_adapter.mjs +2 -8
  7. package/api/icon/_authoring.d.mts +0 -1
  8. package/api/icon/_authoring.mjs +66 -586
  9. package/api/icon/_records.d.mts +1 -1
  10. package/api/icon/_records.mjs +0 -1
  11. package/api/icon/add/add.mjs +38 -224
  12. package/api/icon/icon.type.d.mts +2 -22
  13. package/api/icon/icon.type.mjs +2 -6
  14. package/api/icon/iconAdd.doc.mjs +2 -2
  15. package/api/icon/iconNewDefinition.doc.mjs +2 -3
  16. package/api/icon/iconNewSet.doc.mjs +4 -4
  17. package/api/icon/search/search.mjs +9 -10
  18. package/api/integration/add-helpers.d.mts +1 -11
  19. package/api/integration/add-helpers.mjs +2 -5
  20. package/api/integration/authoring-checks.d.mts +2 -0
  21. package/api/integration/authoring-checks.mjs +6 -1
  22. package/api/logger.mjs +1 -2
  23. package/api/swizzle/_adapter.d.mts +0 -1
  24. package/api/swizzle/_adapter.mjs +1 -4
  25. package/api/swizzle/copy/copy.d.mts +43 -2
  26. package/api/swizzle/copy/copy.mjs +314 -194
  27. package/api/swizzle/swizzle.d.mts +2 -0
  28. package/api/swizzle/swizzle.doc.mjs +4 -8
  29. package/api/swizzle/swizzle.mjs +7 -3
  30. package/api/swizzle/swizzle.type.d.mts +1 -1
  31. package/api/swizzle/swizzle.type.mjs +2 -2
  32. package/assets/discover/official-packages.json +0 -12
  33. package/assets/docs/tree/icon-sets.doc.mjs +5 -11
  34. package/assets/templates/pages/file-explorer/page.tsx +79 -103
  35. package/assets/templates/pages/table-grouped/page.tsx +232 -160
  36. package/assets/templates/pages/table-grouped/template.doc.mjs +2 -0
  37. package/assets/templates/pages/theme-showcase/page.tsx +792 -724
  38. package/assets/templates/pages/theme-showcase/template.doc.mjs +5 -4
  39. package/clients/cli/commands/experimental/icon.mjs +10 -31
  40. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  41. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +1 -2
  42. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  43. package/clients/cli/commands/swizzle.doc.mjs +3 -6
  44. package/clients/cli/commands/swizzle.mjs +9 -8
  45. package/foundation/discovery/component-loader.d.mts +1 -1
  46. package/foundation/discovery/doc-types.mjs +2 -9
  47. package/foundation/discovery/icon-ranking.d.mts +3 -27
  48. package/foundation/discovery/icon-ranking.mjs +8 -125
  49. package/foundation/discovery/icon-set-checks.mjs +35 -44
  50. package/foundation/discovery/icon-set-discovery.d.mts +0 -13
  51. package/foundation/discovery/icon-set-discovery.mjs +0 -25
  52. package/foundation/discovery/icon-set-writer.d.mts +16 -238
  53. package/foundation/discovery/icon-set-writer.mjs +79 -676
  54. package/foundation/discovery/module-exports.d.mts +2 -3
  55. package/foundation/discovery/module-exports.mjs +37 -167
  56. package/foundation/fs/paths.d.mts +1 -2
  57. package/foundation/fs/paths.mjs +4 -3
  58. package/package.json +6 -6
  59. package/api/icon/_default-look.d.mts +0 -155
  60. package/api/icon/_default-look.mjs +0 -474
  61. package/api/swizzle/_moduleGraph.d.mts +0 -162
  62. package/api/swizzle/_moduleGraph.mjs +0 -754
  63. package/foundation/text/shell-arg.d.mts +0 -14
  64. package/foundation/text/shell-arg.mjs +0 -17
@@ -6,8 +6,7 @@ export const doc = {
6
6
  name: 'Theme Showcase',
7
7
  displayName: 'Theme Showcase',
8
8
  description:
9
- 'Multi-surface comparison shell: preview palettes, typography, icons and control states across a storefront, checkout, chat and inventory on one responsive canvas. A theme preview and design-system showcase, with an embeddable content view for an existing app shell.',
10
- category: 'Shell - Top Nav',
9
+ 'Several unrelated product surfaces rendered together on one canvas so a token change can be judged across contexts at once. A comparison harness rather than a layout to ship.',
11
10
  keywords: [
12
11
  'theme',
13
12
  'tokens',
@@ -17,8 +16,10 @@ export const doc = {
17
16
  'design system preview',
18
17
  ],
19
18
  isReady: true,
20
- // The standalone entry demonstrates an application shell; the named preview
21
- // composes into its host without nesting AppShell. Keep it out of the gallery.
19
+ // Surfaced via the Themes page "Open in Playground" action, not the
20
+ // Templates gallery, so keep it out of the overview + playground menu.
21
+ // No `category` — it's hidden from the overview gallery (the only consumer
22
+ // of `category`), and 'Showcase' isn't part of the TemplateCategory taxonomy.
22
23
  isHiddenFromOverview: true,
23
24
  icons: {
24
25
  Banknote: 'money',
@@ -20,7 +20,6 @@ import {
20
20
  getCliInvocation,
21
21
  } from '../../../../foundation/env/package-manager.mjs';
22
22
  import {jsonOut} from '../../../../foundation/response/json.mjs';
23
- import {logger} from '../../../../api/logger.mjs';
24
23
  import {resultSet} from '../../../../foundation/debug/index.mjs';
25
24
  import {
26
25
  emit,
@@ -141,7 +140,7 @@ export function registerExperimentalIcon(group, program) {
141
140
  ),
142
141
  ),
143
142
  text(
144
- `Built-in definitions are the ones every set maps. Map one: ${run} experimental icon map <definition> <icon id> --set <set>`,
143
+ `Built-in definitions are the ones every set maps. Map one: ${run} experimental icon map <definition> <icon id>`,
145
144
  ),
146
145
  );
147
146
  return answered;
@@ -158,9 +157,7 @@ export function registerExperimentalIcon(group, program) {
158
157
  `${each.id}: ${each.words.join(', ')}${each.definitions.length > 0 ? ` = ${each.definitions.join(', ')}` : ''}`,
159
158
  ),
160
159
  ),
161
- text(
162
- `Map one: ${run} experimental icon map <definition> <id> --set ${set}`,
163
- ),
160
+ text(`Map one: ${run} experimental icon map <definition> <id>`),
164
161
  );
165
162
  return answered;
166
163
  }
@@ -311,9 +308,6 @@ export function registerExperimentalIcon(group, program) {
311
308
  * @param {(result: any) => void} print
312
309
  */
313
310
  const run = async (call, print) => {
314
- // Reading a large library reports its progress through the shared
315
- // logger: on stderr in text mode, never under --json.
316
- logger.setSilent(Boolean(program.opts().json));
317
311
  let result;
318
312
  try {
319
313
  result = await call();
@@ -442,7 +436,7 @@ export function registerExperimentalIcon(group, program) {
442
436
  return;
443
437
  }
444
438
  if (result.type === 'icon.definitionMatches') {
445
- const {matches, newDefinition, variant} = result.data;
439
+ const {matches, newDefinition} = result.data;
446
440
  emit(
447
441
  section(
448
442
  `Icon definitions for ${result.data.export} (${matches.length})`,
@@ -472,13 +466,6 @@ export function registerExperimentalIcon(group, program) {
472
466
  ),
473
467
  ]
474
468
  : []),
475
- ...(variant
476
- ? [
477
- text(
478
- `The set already has this glyph in another look. Add this one as its variant: ${formatCliCommand(variant)}`,
479
- ),
480
- ]
481
- : []),
482
469
  text(
483
470
  `All icon definitions: ${cli} docs cli/experimental/icon-definitions`,
484
471
  ),
@@ -513,25 +500,17 @@ export function registerExperimentalIcon(group, program) {
513
500
  const {root, manifest, files, written, dryRun} = data;
514
501
  const state = dryRun ? 'plan' : written ? 'ok' : 'unchanged';
515
502
  const refreshed = data.refreshed === true;
516
- const updated = data.updated === true;
517
- const What = `${what[0].toUpperCase()}${what.slice(1)}`;
518
503
  emit(
519
504
  section(
520
505
  refreshed
521
506
  ? dryRun
522
507
  ? `Refresh ${what} plan`
523
- : `${What} refreshed`
524
- : updated
525
- ? dryRun
526
- ? `${What} update plan`
527
- : written && files.length > 0
528
- ? `${What} updated`
529
- : `${What} unchanged`
530
- : dryRun
531
- ? `New ${what} plan`
532
- : written
533
- ? `New ${what} added`
534
- : `New ${what} unchanged`,
508
+ : `${what[0].toUpperCase()}${what.slice(1)} refreshed`
509
+ : dryRun
510
+ ? `New ${what} plan`
511
+ : written
512
+ ? `New ${what} added`
513
+ : `New ${what} unchanged`,
535
514
  ),
536
515
  text(`[${state}] ${data.name}`),
537
516
  // What the command did (or, in a dry run, would do): never a step
@@ -563,7 +542,7 @@ export function registerExperimentalIcon(group, program) {
563
542
  list(
564
543
  data.suggestions.map(
565
544
  each =>
566
- `${each.definition} -> ${each.icon} (${each.word}): ${formatCliCommand(`astryx experimental icon map ${each.definition} ${each.icon} --set ${data.name}`)}`,
545
+ `${each.definition} -> ${each.icon} (${each.word}): ${formatCliCommand(`astryx experimental icon map ${each.definition} ${each.icon}`)}`,
567
546
  ),
568
547
  ),
569
548
  ]
@@ -30,7 +30,7 @@ export const doc = {
30
30
  flag: '--new-definition <name>',
31
31
  param: 'options.newDefinition',
32
32
  description:
33
- "Add your set's own definition, named in camelCase (aiHelper) or kebab-case (ai-helper), then map the icon to it; needs --description and --words",
33
+ "Add your set's own definition, then map the icon to it; needs --description and --words",
34
34
  },
35
35
  {
36
36
  flag: '--description <text>',
@@ -18,8 +18,7 @@ export const doc = {
18
18
  name: 'name',
19
19
  param: 'name',
20
20
  required: true,
21
- description:
22
- 'The definition name, in camelCase (rocketLaunch) or kebab-case (rocket-launch)',
21
+ description: 'The definition name, in camelCase (rocketLaunch)',
23
22
  },
24
23
  ],
25
24
  options: [
@@ -11,7 +11,7 @@ export const doc = {
11
11
  stability: 'experimental',
12
12
  summary: 'Start an icon set in your integration package',
13
13
  description:
14
- "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. A library whose export names end in looks (XOutline24WGHT500Icon) gives one icon per glyph, by its glyph id (x), in the look the default variant names, else the library's usual default. Run it again with --from to refresh. --variants and --default-variant declare the set's variants; over an existing set without --from, they, --display-name and --description update the set in place and leave its icons as they are; a set with icons changes its default variant only with --from, and only in a library whose export names encode looks. Experimental: it may change or be removed in a patch release.",
14
+ "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. Run it again to refresh. --variants and --default-variant declare the set's variants. Experimental: it may change or be removed in a patch release.",
15
15
  fn: 'iconNewSet',
16
16
  args: [
17
17
  {
@@ -49,7 +49,7 @@ export const doc = {
49
49
  flag: '--default-variant <variant>',
50
50
  param: 'options.defaultVariant',
51
51
  description:
52
- "With --variants: the variant each icon's own export draws. When omitted: in a library whose export names encode looks, the look the icons draw (the library's usual default for a new set), which --variants must list; otherwise the set's current default, which --variants must list when the set has icons, else, on a set without icons, the first variant. A set with icons changes it only with --from, and only in a library whose export names encode looks",
52
+ "With --variants: the variant each icon's own export draws (the first variant when omitted)",
53
53
  },
54
54
  {
55
55
  flag: '--display-name <text>',
@@ -16,11 +16,8 @@ export const doc = {
16
16
  summary: 'Copy component source for customization',
17
17
  description:
18
18
  "Ejects a component's source from the resolved @astryxdesign/core (or its owning " +
19
- 'integration) into your project for deep customization. Every import in the copy ' +
20
- 'names a file the copy holds or a path the package exports: names the package ' +
21
- 'exports come from the package, and every internal module the component needs ' +
22
- "is copied beside it in the package's folder layout. " +
23
- 'Tests, stories and docs are not copied. With no name it lists the swizzlable components. ' +
19
+ 'integration) into your project for deep customization, rewriting imports that ' +
20
+ 'escape the component directory. With no name it lists the swizzlable components. ' +
24
21
  'An integration component that replaces a Core component is what that Core name ' +
25
22
  'copies; --package @astryxdesign/core copies the original. --list lists Core ' +
26
23
  'components, including one an integration replaces.',
@@ -49,7 +46,7 @@ export const doc = {
49
46
  flag: '-f, --overwrite',
50
47
  param: 'options.overwrite',
51
48
  description:
52
- "Replace the component's existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written. A helper an earlier swizzle wrote is reused when it is the same and is never replaced by a copy that carries it: a different one stays, and this copy writes its own under a version-suffixed name. Swizzling the component whose folder holds that helper counts it as one of that component's own files. A changed private attribute owner module, or a style module it imports, fails the command without --overwrite and is replaced with it",
49
+ 'Replace existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written',
53
50
  },
54
51
  ],
55
52
  examples: [
@@ -3,10 +3,11 @@
3
3
  /**
4
4
  * @file swizzle command — thin wrapper around api/swizzle.
5
5
  *
6
- * Copies a component's source into the consumer project for customization,
7
- * with the internal modules it needs. All logic — owner resolution, the copy,
8
- * StyleX detection, maintainer feedback — lives in api/swizzle; this file only
9
- * parses flags, prints, and prefixes commands for the caller's package manager.
6
+ * Copies a component's source into the consumer project for customization
7
+ * (imports rewritten to the owner package's subpaths). All logic — owner
8
+ * resolution, copy, import rewriting, StyleX detection, maintainer feedback —
9
+ * lives in api/swizzle; this file only parses flags, prints, and prefixes
10
+ * commands for the caller's package manager.
10
11
  */
11
12
 
12
13
  import {jsonOut} from '../../../foundation/response/json.mjs';
@@ -84,18 +85,18 @@ export function registerSwizzle(program) {
84
85
  text(`[ok] Copied ${filesCopied} files to ${outputDir}/`),
85
86
  text(
86
87
  [
87
- `What ${ownerPackage} exports is imported from ${ownerPackage}; the internal modules the component needs are copied beside it.`,
88
+ `Relative imports have been rewritten to use ${ownerPackage}.`,
88
89
  'You can now customize the component source freely.',
89
90
  ].join('\n'),
90
91
  ),
91
92
  ];
92
- // Files the copy wrote outside the component folder: the internal
93
- // modules it needs, in the package's folder layout.
93
+ // Files the copy wrote outside the component folder: the owner modules
94
+ // and their unexported style modules (spec:AST-110 FR4).
94
95
  const shared = (result.data.files ?? []).filter(f => f.startsWith('../'));
95
96
  if (shared.length > 0) {
96
97
  out.push(
97
98
  text(
98
- `Copied beside it: ${shared.join(', ')} (in the package's folder layout; imported by relative path)`,
99
+ `Shared modules: ${shared.join(', ')} (copied whole; their imports between each other stay relative)`,
99
100
  ),
100
101
  );
101
102
  }
@@ -43,5 +43,5 @@ export type LoadDocOptions = {
43
43
  * which root reads the doc
44
44
  * (default: components)
45
45
  */
46
- root?: "components" | "hooks" | undefined;
46
+ root?: "hooks" | "components" | undefined;
47
47
  };
@@ -27,8 +27,7 @@
27
27
  * none), and a `<topic>.doc.<lang>.mjs` overlay against
28
28
  * `ReferenceTranslationDoc`;
29
29
  * - themes root: `ThemeDoc`;
30
- * - iconSets root: `IconSetDoc`, and a set's own definition (stamped
31
- * `type: 'icon-definition'`) `IconDefinitionDoc`.
30
+ * - iconSets root: `IconSetDoc`.
32
31
  * Every finding is a warning, names the field, and says how to fix it.
33
32
  *
34
33
  * @input Doc files with the root each was found in, the package root, and the
@@ -313,13 +312,7 @@ function expectedType(ts, root, exportName, node, core = false) {
313
312
  return {typeExpr: authoring('ThemeDoc'), typeName: 'ThemeDoc'};
314
313
  }
315
314
  if (root === 'icon-sets') {
316
- // A set's own definitions live in its folder too.
317
- return shape?.stamp === 'icon-definition'
318
- ? {
319
- typeExpr: authoring('IconDefinitionDoc'),
320
- typeName: 'IconDefinitionDoc',
321
- }
322
- : {typeExpr: authoring('IconSetDoc'), typeName: 'IconSetDoc'};
315
+ return {typeExpr: authoring('IconSetDoc'), typeName: 'IconSetDoc'};
323
316
  }
324
317
  if (translation) {
325
318
  return {
@@ -30,9 +30,7 @@ export function iconRecord(set: DiscoveredIconSet, icon: IconSetIcon, definition
30
30
  * @property {boolean} meaning the query is one of the icon's tags (never
31
31
  * both: a tag is a word that is not the id or one of its parts)
32
32
  * @property {number} rank within-tier key, lower first: for a name match 0
33
- * (whole id), 1 (the whole id's plural or singular), 2 (an id part), or 3
34
- * (an id part's plural or singular); for a meaning match the tag's
35
- * position
33
+ * (whole id) or 1 (an id part); for a meaning match the tag's position
36
34
  * @property {string} reason
37
35
  */
38
36
  /**
@@ -43,24 +41,6 @@ export function iconRecord(set: DiscoveredIconSet, icon: IconSetIcon, definition
43
41
  * @returns {IconMatch | null}
44
42
  */
45
43
  export function matchIcon(query: string, icon: IconSetIcon, definitions?: string[]): IconMatch | null;
46
- /**
47
- * The query without the words that only phrase it, when it has several
48
- * words and some word names something; else the query as typed.
49
- * @param {string} query
50
- */
51
- export function iconQuery(query: string): string;
52
- /**
53
- * The matches that answer a query: the whole-word ones (a definition or an
54
- * exact match, 80 and up) when there are any, else word starts (60) when
55
- * there are any, else partial matches. A longer word that only starts with
56
- * the query (`start` for `star`) never stands beside a whole-word answer.
57
- * @template {{score: number}} T
58
- * @param {T[]} ranked best first
59
- * @returns {T[]}
60
- */
61
- export function answeringMatches<T extends {
62
- score: number;
63
- }>(ranked: T[]): T[];
64
44
  /**
65
45
  * Which exact reading leads for a set of matches: meaning, unless more icons
66
46
  * carry the query as a name than as a tag.
@@ -98,9 +78,7 @@ export function withDefinitionWords(icon: IconSetIcon, definitions: string[], lo
98
78
  words: string[];
99
79
  } | undefined): IconSetIcon;
100
80
  /**
101
- * Every icon in `sets` that answers the query, ranked. The query is
102
- * scored as typed; when nothing answers it with a whole word (80 and up),
103
- * it is scored again without its filler words ({@link iconQuery}).
81
+ * Every icon in `sets` that answers the query, ranked (FR6).
104
82
  * @param {DiscoveredIconSet[]} sets in tie order
105
83
  * @param {string} query
106
84
  * @returns {IconMatchEntry[]}
@@ -128,9 +106,7 @@ export type IconMatch = {
128
106
  meaning: boolean;
129
107
  /**
130
108
  * within-tier key, lower first: for a name match 0
131
- * (whole id), 1 (the whole id's plural or singular), 2 (an id part), or 3
132
- * (an id part's plural or singular); for a meaning match the tag's
133
- * position
109
+ * (whole id) or 1 (an id part); for a meaning match the tag's position
134
110
  */
135
111
  rank: number;
136
112
  reason: string;
@@ -9,18 +9,8 @@
9
9
  * 90 an exact match in the reading the searched sets favor (below)
10
10
  * 80 an exact match in the other reading
11
11
  * 60 one of its words starts with the query
12
- * 40 a partial match: the id or a word contains the query (three
13
- * letters or more), or every word of the query starts one of the
14
- * icon's words or id parts
15
- *
16
- * A word matches a whole word: a word's plural or singular (`stars` for
17
- * `star`) is an exact match, while a longer word that only starts with it
18
- * (`start`) is a word-start match, and {@link answeringMatches} keeps
19
- * word-start and partial matches only when nothing matches a whole word.
20
- * A query is scored as typed first. Only when nothing answers it with a
21
- * whole word are the words that only phrase it (`go`, `the`, `icon`) left
22
- * out of a query of several words, so `go home` asks for `home` while
23
- * `arrow up to line` still names `arrow-up-to-line`.
12
+ * 40 a partial match: the id or a word contains the query, or every
13
+ * word of the query starts one of the icon's words or id parts
24
14
  *
25
15
  * An exact match is a NAME match when the query is the icon's id, or one of
26
16
  * its words that is also a part of its id (`trash` for `trash-2`); it is a
@@ -36,8 +26,7 @@
36
26
  *
37
27
  * Equal scores keep the set order first (the project's set, then load
38
28
  * order), so the project's set always leads at a score. Within one set, a
39
- * name match on the whole id (or its plural or singular) comes before one on
40
- * a part of it, and a meaning
29
+ * name match on the whole id comes before one on a part of it, and a meaning
41
30
  * match whose query sits earlier among the icon's tags comes first (sets list
42
31
  * an icon's most telling tags first). Remaining ties keep id order, so the
43
32
  * same installation always answers the same way.
@@ -104,9 +93,7 @@ const squash = value => value.toLowerCase().replace(/[\s_-]+/g, '');
104
93
  * @property {boolean} meaning the query is one of the icon's tags (never
105
94
  * both: a tag is a word that is not the id or one of its parts)
106
95
  * @property {number} rank within-tier key, lower first: for a name match 0
107
- * (whole id), 1 (the whole id's plural or singular), 2 (an id part), or 3
108
- * (an id part's plural or singular); for a meaning match the tag's
109
- * position
96
+ * (whole id) or 1 (an id part); for a meaning match the tag's position
110
97
  * @property {string} reason
111
98
  */
112
99
 
@@ -140,27 +127,10 @@ export function matchIcon(query, icon, definitions = []) {
140
127
  tier: 'exact',
141
128
  name: wholeId || partWord,
142
129
  meaning: !wholeId && !partWord,
143
- rank: wholeId ? 0 : partWord ? 2 : tagAt,
130
+ rank: wholeId ? 0 : partWord ? 1 : tagAt,
144
131
  reason: wholeId ? `id "${icon.id}"` : `word "${query}"`,
145
132
  };
146
133
  }
147
- const plural = icon.words.find(word => sameWord(word, query));
148
- if (plural) {
149
- const named = parts.has(plural);
150
- return {
151
- tier: 'exact',
152
- name: named,
153
- meaning: !named,
154
- // The whole id's plural or singular right after the whole id, then
155
- // after the word itself, wherever it sits.
156
- rank: named
157
- ? plural === icon.id
158
- ? 1
159
- : 3
160
- : tags.length + tags.indexOf(plural),
161
- reason: `word "${plural}"`,
162
- };
163
- }
164
134
  const prefix = icon.words.find(word => word.startsWith(query));
165
135
  if (prefix) {
166
136
  return {
@@ -171,11 +141,7 @@ export function matchIcon(query, icon, definitions = []) {
171
141
  reason: `word "${prefix}" starts with "${query}"`,
172
142
  };
173
143
  }
174
- // A letter or two inside a word (`x` in `box`) says nothing about it.
175
- const contains =
176
- query.replace(/\s+/gu, '').length >= 3
177
- ? [icon.id, ...icon.words].find(text => text.includes(query))
178
- : undefined;
144
+ const contains = [icon.id, ...icon.words].find(text => text.includes(query));
179
145
  if (contains) {
180
146
  return {
181
147
  tier: 'partial',
@@ -204,72 +170,6 @@ export function matchIcon(query, icon, definitions = []) {
204
170
  return null;
205
171
  }
206
172
 
207
- /**
208
- * Whether two words are one word's singular and plural (`star`, `stars`;
209
- * `box`, `boxes`), never the same word.
210
- * @param {string} a
211
- * @param {string} b
212
- */
213
- function sameWord(a, b) {
214
- if (a === b || /\s/u.test(a) || /\s/u.test(b)) return false;
215
- const [short, long] = a.length < b.length ? [a, b] : [b, a];
216
- return short.length >= 2 && (long === `${short}s` || long === `${short}es`);
217
- }
218
-
219
- /**
220
- * Words that phrase a query without naming anything: left out of a query of
221
- * several words that nothing answers as typed (`go home` asks for `home`).
222
- */
223
- const FILLER_WORDS = new Set([
224
- 'a',
225
- 'an',
226
- 'the',
227
- 'go',
228
- 'to',
229
- 'my',
230
- 'of',
231
- 'for',
232
- 'icon',
233
- 'icons',
234
- ]);
235
-
236
- /**
237
- * A query as typed: trimmed and lower-case, one space between words.
238
- * @param {string} query
239
- */
240
- function typedQuery(query) {
241
- return query.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(' ');
242
- }
243
-
244
- /**
245
- * The query without the words that only phrase it, when it has several
246
- * words and some word names something; else the query as typed.
247
- * @param {string} query
248
- */
249
- export function iconQuery(query) {
250
- const words = typedQuery(query).split(' ').filter(Boolean);
251
- const named = words.filter(word => !FILLER_WORDS.has(word));
252
- return (words.length > 1 && named.length > 0 ? named : words).join(' ');
253
- }
254
-
255
- /**
256
- * The matches that answer a query: the whole-word ones (a definition or an
257
- * exact match, 80 and up) when there are any, else word starts (60) when
258
- * there are any, else partial matches. A longer word that only starts with
259
- * the query (`start` for `star`) never stands beside a whole-word answer.
260
- * @template {{score: number}} T
261
- * @param {T[]} ranked best first
262
- * @returns {T[]}
263
- */
264
- export function answeringMatches(ranked) {
265
- for (const floor of [80, 60]) {
266
- if (ranked.some(each => each.score >= floor)) {
267
- return ranked.filter(each => each.score >= floor);
268
- }
269
- }
270
- return ranked;
271
- }
272
-
273
173
  /**
274
174
  * The score of one match, given which exact reading leads.
275
175
  * @param {IconMatch} match
@@ -349,30 +249,13 @@ export function withDefinitionWords(icon, definitions, lookup) {
349
249
  }
350
250
 
351
251
  /**
352
- * Every icon in `sets` that answers the query, ranked. The query is
353
- * scored as typed; when nothing answers it with a whole word (80 and up),
354
- * it is scored again without its filler words ({@link iconQuery}).
252
+ * Every icon in `sets` that answers the query, ranked (FR6).
355
253
  * @param {DiscoveredIconSet[]} sets in tie order
356
254
  * @param {string} query
357
255
  * @returns {IconMatchEntry[]}
358
256
  */
359
257
  export function rankIcons(sets, query) {
360
- const typed = typedQuery(query);
361
- const asTyped = rankTerm(sets, typed);
362
- if (asTyped.some(each => each.score >= 80)) return asTyped;
363
- const named = iconQuery(query);
364
- if (named === typed) return asTyped;
365
- const withoutFiller = rankTerm(sets, named);
366
- return withoutFiller.length > 0 ? withoutFiller : asTyped;
367
- }
368
-
369
- /**
370
- * {@link rankIcons} for one normalized query.
371
- * @param {DiscoveredIconSet[]} sets
372
- * @param {string} term
373
- * @returns {IconMatchEntry[]}
374
- */
375
- function rankTerm(sets, term) {
258
+ const term = query.trim().toLowerCase();
376
259
  const astryx = astryxDefinitionsByName();
377
260
  /** @type {Array<{set: DiscoveredIconSet, icon: IconSetIcon, definitions: string[], match: IconMatch, setIndex: number}>} */
378
261
  const hits = [];