@astryxdesign/cli 0.7.11 → 0.7.12-canary.ccb4a6d

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 (68) 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/icon/_adapter.d.mts +3 -2
  5. package/api/icon/_adapter.mjs +8 -2
  6. package/api/icon/_authoring.d.mts +1 -0
  7. package/api/icon/_authoring.mjs +586 -66
  8. package/api/icon/_default-look.d.mts +155 -0
  9. package/api/icon/_default-look.mjs +474 -0
  10. package/api/icon/_records.d.mts +1 -1
  11. package/api/icon/_records.mjs +1 -0
  12. package/api/icon/add/add.mjs +224 -38
  13. package/api/icon/icon.type.d.mts +22 -2
  14. package/api/icon/icon.type.mjs +6 -2
  15. package/api/icon/iconAdd.doc.mjs +2 -2
  16. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  17. package/api/icon/iconNewSet.doc.mjs +4 -4
  18. package/api/icon/search/search.mjs +10 -9
  19. package/api/integration/add-helpers.d.mts +11 -1
  20. package/api/integration/add-helpers.mjs +5 -2
  21. package/api/integration/authoring-checks.d.mts +0 -2
  22. package/api/integration/authoring-checks.mjs +1 -6
  23. package/api/logger.mjs +2 -1
  24. package/api/swizzle/_adapter.d.mts +1 -0
  25. package/api/swizzle/_adapter.mjs +4 -1
  26. package/api/swizzle/_moduleGraph.d.mts +171 -0
  27. package/api/swizzle/_moduleGraph.mjs +795 -0
  28. package/api/swizzle/copy/copy.d.mts +2 -43
  29. package/api/swizzle/copy/copy.mjs +195 -314
  30. package/api/swizzle/swizzle.d.mts +0 -2
  31. package/api/swizzle/swizzle.doc.mjs +9 -4
  32. package/api/swizzle/swizzle.mjs +3 -7
  33. package/api/swizzle/swizzle.type.d.mts +2 -1
  34. package/api/swizzle/swizzle.type.mjs +3 -2
  35. package/assets/discover/official-packages.json +20 -0
  36. package/assets/docs/tree/icon-sets.doc.mjs +11 -5
  37. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  38. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  39. package/assets/templates/pages/course-detail/page.tsx +699 -0
  40. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  41. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  42. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  43. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  44. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  45. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  46. package/authoring/doctypes/template/type.ts +1 -0
  47. package/clients/cli/commands/experimental/icon.mjs +31 -10
  48. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  49. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  50. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  51. package/clients/cli/commands/swizzle.doc.mjs +8 -3
  52. package/clients/cli/commands/swizzle.mjs +21 -9
  53. package/foundation/discovery/component-loader.d.mts +1 -1
  54. package/foundation/discovery/doc-types.mjs +9 -2
  55. package/foundation/discovery/icon-ranking.d.mts +27 -3
  56. package/foundation/discovery/icon-ranking.mjs +125 -8
  57. package/foundation/discovery/icon-set-checks.mjs +44 -35
  58. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  59. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  60. package/foundation/discovery/icon-set-writer.d.mts +238 -16
  61. package/foundation/discovery/icon-set-writer.mjs +676 -79
  62. package/foundation/discovery/module-exports.d.mts +3 -2
  63. package/foundation/discovery/module-exports.mjs +167 -37
  64. package/foundation/fs/paths.d.mts +2 -1
  65. package/foundation/fs/paths.mjs +3 -4
  66. package/foundation/text/shell-arg.d.mts +14 -0
  67. package/foundation/text/shell-arg.mjs +17 -0
  68. package/package.json +6 -6
@@ -41,7 +41,9 @@
41
41
  * `settings`) is that family's default. A variant displaces it only with two
42
42
  * matched terms of its own ("a small comparison note" does not make a
43
43
  * dashboard the comparison dashboard), and a base too weak to start on its
44
- * own displaces no variant ("a funnel for a dashboard" is the funnel).
44
+ * own displaces no variant ("a funnel for a dashboard" is the funnel) —
45
+ * unless the idea names its family in the head, which is start evidence on
46
+ * its own ("saml login" stays the login page).
45
47
  */
46
48
 
47
49
  import {
@@ -219,7 +221,8 @@ export function rankPages(query, pages) {
219
221
  }
220
222
  }
221
223
  const familyNamed = namedFamilies.has(family);
222
- if (headFamilies.has(family)) score += HEAD_FAMILY;
224
+ const headNamed = headFamilies.has(family);
225
+ if (headNamed) score += HEAD_FAMILY;
223
226
  else if (familyNamed) score += BODY_FAMILY;
224
227
  const base = normalized(page.name) === normalized(family);
225
228
  if (familyNamed && base) score += FAMILY_BASE;
@@ -228,6 +231,7 @@ export function rankPages(query, pages) {
228
231
  score,
229
232
  hits,
230
233
  familyNamed,
234
+ headNamed,
231
235
  containerMatched,
232
236
  family,
233
237
  base,
@@ -246,7 +250,14 @@ export function rankPages(query, pages) {
246
250
  /**
247
251
  * Put a named family's base template ahead of the variant that outranks it,
248
252
  * unless the variant matched START_TERMS terms the base did not, or the base
249
- * scores too little to start on its own.
253
+ * cannot start on its own: too little score, or too few matched terms. The
254
+ * head names the exception: a family word in the idea's head is start
255
+ * evidence on its own — the same evidence pickStart accepts in place of a
256
+ * second term — so a head-named one-term base can still take the lead ("saml
257
+ * login" is the login page, not the SSO flow). A base whose family the idea
258
+ * names only elsewhere still needs a second term: score alone drifts upward
259
+ * as the catalog grows (idf rises with page count) and would eventually let a
260
+ * one-term base displace its variant, while hits do not drift.
250
261
  * @param {RankedPage[]} ranked
251
262
  * @returns {RankedPage[]}
252
263
  */
@@ -254,7 +265,13 @@ function baseFirst(ranked) {
254
265
  const top = ranked[0];
255
266
  if (!top || top.base || !top.familyNamed) return ranked;
256
267
  const base = ranked.find(r => r.base && r.family === top.family);
257
- if (!base || base.score < START_SCORE) return ranked;
268
+ if (
269
+ !base ||
270
+ base.score < START_SCORE ||
271
+ (base.hits < START_TERMS && !base.headNamed)
272
+ ) {
273
+ return ranked;
274
+ }
258
275
  const own = [...top.matched].filter(t => !base.matched.has(t)).length;
259
276
  return own >= START_TERMS
260
277
  ? ranked
@@ -64,6 +64,7 @@ export type RankedPage = {
64
64
  score: number;
65
65
  hits: number;
66
66
  familyNamed: boolean;
67
+ headNamed: boolean;
67
68
  containerMatched: boolean;
68
69
  family: string;
69
70
  base: boolean;
@@ -163,7 +163,7 @@ export const SYNONYMS_OF = (() => {
163
163
  /**
164
164
  * @typedef {import('../_adapter.mjs').PageTemplate} PageTemplate
165
165
  * @typedef {import('../_adapter.mjs').ComponentWords} ComponentWords
166
- * @typedef {{name: string, score: number, hits: number, familyNamed: boolean, containerMatched: boolean, family: string, base: boolean, matched: Set<string>}} RankedPage
166
+ * @typedef {{name: string, score: number, hits: number, familyNamed: boolean, headNamed: boolean, containerMatched: boolean, family: string, base: boolean, matched: Set<string>}} RankedPage
167
167
  * @typedef {'page' | 'part' | 'edit'} IdeaKind
168
168
  */
169
169
 
@@ -50,6 +50,7 @@ export { astryxIconDefinitions } from "../../foundation/discovery/icon-definitio
50
50
  export { iconSetKey } from "../../foundation/discovery/icon-set-discovery.mjs";
51
51
  export { setConfigString } from "../../foundation/config/config-writer.mjs";
52
52
  export { exportValueKind } from "../../foundation/discovery/module-exports.mjs";
53
- export { iconRecord, importLine, leadingReading, matchIcon, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
54
- export { assertIconExport, checkNewDefinition, definitionFile, findLocalIconSet, writeDefinitionFile, iconIdOf, closestNames, libraryIcons, mappableDefinitions, resolveIconSource, generatedModulePath, generatedNamesOf, generatedOrigins, iconModulePackage, sameIconModule, iconExportName, iconNaming, modulePrefix, setModuleNote, variantExportName, writeGeneratedIcons, writeIconSetData, definitionNameOf, iconIdIn, iconsWithWord, localSourceNote, THEME_MAP_NAME } from "../../foundation/discovery/icon-set-writer.mjs";
53
+ export { iconRecord, importLine, leadingReading, matchIcon, answeringMatches, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
54
+ export { assertIconExport, checkNewDefinition, definitionNameFromInput, definitionFile, findLocalIconSet, writeDefinitionFile, iconIdOf, closestNames, libraryIcons, mappableDefinitions, resolveIconSource, generatedModulePath, generatedNamesOf, generatedOrigins, iconModulePackage, sameIconModule, iconExportName, iconNaming, modulePrefix, moduleNaming, iconNamingWithoutLook, splitLook, setModuleNote, variantExportName, writeGeneratedIcons, writeIconSetData, definitionNameOf, iconIdIn, iconsWithWord, localSourceNote, THEME_MAP_NAME } from "../../foundation/discovery/icon-set-writer.mjs";
55
55
  export { addIconDefinition, addIconSet } from "./_authoring.mjs";
56
+ export { checkVariantLook, drawnLooks } from "./_default-look.mjs";
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * @position api/icon — adapter for api/icon/{search,detail,list,use,map,add,
8
8
  * new-set,new-definition}; it also carries the icon ranking, the icon-set
9
- * writer, the set and definition authoring writes, and the config writer
10
- * the leaves use
9
+ * writer, the set and definition authoring writes, the default-look
10
+ * rule, and the config writer the leaves use
11
11
  */
12
12
 
13
13
  import * as fs from 'node:fs';
@@ -28,6 +28,7 @@ export {
28
28
  importLine,
29
29
  leadingReading,
30
30
  matchIcon,
31
+ answeringMatches,
31
32
  rankIcons,
32
33
  scoreIcon,
33
34
  } from '../../foundation/discovery/icon-ranking.mjs';
@@ -37,6 +38,7 @@ export {setConfigString} from '../../foundation/config/config-writer.mjs';
37
38
  export {
38
39
  assertIconExport,
39
40
  checkNewDefinition,
41
+ definitionNameFromInput,
40
42
  definitionFile,
41
43
  findLocalIconSet,
42
44
  writeDefinitionFile,
@@ -53,6 +55,9 @@ export {
53
55
  iconExportName,
54
56
  iconNaming,
55
57
  modulePrefix,
58
+ moduleNaming,
59
+ iconNamingWithoutLook,
60
+ splitLook,
56
61
  setModuleNote,
57
62
  variantExportName,
58
63
  writeGeneratedIcons,
@@ -65,6 +70,7 @@ export {
65
70
  } from '../../foundation/discovery/icon-set-writer.mjs';
66
71
  export {exportValueKind} from '../../foundation/discovery/module-exports.mjs';
67
72
  export {addIconDefinition, addIconSet} from './_authoring.mjs';
73
+ export {checkVariantLook, drawnLooks} from './_default-look.mjs';
68
74
 
69
75
  /**
70
76
  * Refuse a command that writes to a project or package when `cwd` is outside
@@ -44,3 +44,4 @@ export function addIconDefinition(name: string, options: {
44
44
  type: "integration.add";
45
45
  data: import("./icon.type.mjs").IconNewData;
46
46
  }>;
47
+ export type Looks = import("./_default-look.mjs").Looks;