@astryxdesign/cli 0.7.11 → 0.7.12-canary.0840fcc

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 (160) hide show
  1. package/api/build/blocks/blocks.d.mts +41 -0
  2. package/api/build/blocks/blocks.mjs +118 -68
  3. package/api/build/kit/rank.mjs +21 -4
  4. package/api/build/kit/words.d.mts +1 -0
  5. package/api/build/kit/words.mjs +1 -1
  6. package/api/component/__fixtures__/resolutions/modules.txt +5 -5
  7. package/api/docs/_adapter.d.mts +22 -0
  8. package/api/docs/_adapter.mjs +81 -3
  9. package/api/docs/docs.doc.mjs +5 -5
  10. package/api/docs/docs.type.d.mts +21 -0
  11. package/api/docs/docs.type.mjs +11 -0
  12. package/api/docs/list/list.d.mts +5 -1
  13. package/api/docs/list/list.mjs +72 -6
  14. package/api/docs/node/node.mjs +2 -40
  15. package/api/icon/_adapter.d.mts +3 -2
  16. package/api/icon/_adapter.mjs +8 -2
  17. package/api/icon/_authoring.d.mts +1 -0
  18. package/api/icon/_authoring.mjs +594 -67
  19. package/api/icon/_default-look.d.mts +155 -0
  20. package/api/icon/_default-look.mjs +474 -0
  21. package/api/icon/_records.d.mts +1 -1
  22. package/api/icon/_records.mjs +1 -0
  23. package/api/icon/add/add.mjs +269 -43
  24. package/api/icon/icon.type.d.mts +46 -2
  25. package/api/icon/icon.type.mjs +12 -2
  26. package/api/icon/iconAdd.doc.mjs +2 -2
  27. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  28. package/api/icon/iconNewSet.doc.mjs +4 -4
  29. package/api/icon/map/map.mjs +11 -4
  30. package/api/icon/search/search.mjs +10 -9
  31. package/api/index.d.mts +1 -0
  32. package/api/index.mjs +1 -0
  33. package/api/integration/add-helpers.d.mts +15 -1
  34. package/api/integration/add-helpers.mjs +5 -2
  35. package/api/integration/authoring-checks.d.mts +0 -2
  36. package/api/integration/authoring-checks.mjs +1 -6
  37. package/api/logger.mjs +2 -1
  38. package/api/render/_adapter.mjs +9 -0
  39. package/api/render/render.doc.mjs +3 -3
  40. package/api/render/render.type.d.mts +1 -1
  41. package/api/render/render.type.mjs +1 -1
  42. package/api/search/ORDERING.md +3 -0
  43. package/api/search/_adapter.d.mts +32 -3
  44. package/api/search/_adapter.mjs +50 -22
  45. package/api/search/_fit-order.d.mts +47 -0
  46. package/api/search/_fit-order.mjs +257 -0
  47. package/api/search/_main-searcher.mjs +15 -5
  48. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  49. package/api/search/exportSearchIndex.doc.mjs +58 -0
  50. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  51. package/api/search/rankSearchIndex.doc.mjs +79 -0
  52. package/api/search/search-index.d.mts +44 -0
  53. package/api/search/search-index.mjs +270 -0
  54. package/api/search/search.type.d.mts +28 -0
  55. package/api/search/search.type.mjs +17 -0
  56. package/api/swizzle/_adapter.d.mts +1 -0
  57. package/api/swizzle/_adapter.mjs +4 -1
  58. package/api/swizzle/_moduleGraph.d.mts +178 -0
  59. package/api/swizzle/_moduleGraph.mjs +903 -0
  60. package/api/swizzle/copy/copy.d.mts +2 -43
  61. package/api/swizzle/copy/copy.mjs +287 -315
  62. package/api/swizzle/swizzle.d.mts +0 -2
  63. package/api/swizzle/swizzle.doc.mjs +13 -4
  64. package/api/swizzle/swizzle.mjs +3 -7
  65. package/api/swizzle/swizzle.type.d.mts +7 -1
  66. package/api/swizzle/swizzle.type.mjs +4 -2
  67. package/api/template/template.mjs +1 -0
  68. package/assets/discover/official-packages.json +36 -0
  69. package/assets/docs/browser-support.doc.mjs +2 -2
  70. package/assets/docs/styling-overview.doc.mjs +6 -2
  71. package/assets/docs/tree/icon-sets.doc.mjs +13 -7
  72. package/assets/docs/tree/render-pages.doc.mjs +3 -3
  73. package/assets/docs/tree/tailwind.doc.mjs +41 -1
  74. package/assets/docs/tree/type-scale.doc.mjs +19 -2
  75. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  76. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  77. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  78. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  79. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  80. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
  82. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
  83. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
  84. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
  85. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
  86. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
  87. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
  88. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
  89. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +41 -0
  90. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  91. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  92. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
  93. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
  94. package/assets/templates/pages/course-detail/page.tsx +699 -0
  95. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  96. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  97. package/assets/templates/pages/table-filter/page.tsx +15 -23
  98. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  99. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  100. package/assets/templates/pages/table-inbox/page.tsx +3 -6
  101. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  102. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  103. package/assets/templates/themes/butter/butterTheme.ts +2 -2
  104. package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
  105. package/assets/templates/themes/matcha/matchaTheme.ts +1 -1
  106. package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
  107. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  108. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  109. package/assets/templates/themes/y2k/y2kTheme.ts +2 -2
  110. package/authoring/doctypes/template/type.ts +1 -0
  111. package/clients/cli/commands/docs.doc.mjs +5 -1
  112. package/clients/cli/commands/docs.mjs +30 -2
  113. package/clients/cli/commands/experimental/icon.mjs +56 -14
  114. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  115. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  116. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  117. package/clients/cli/commands/experimental-render.doc.mjs +1 -1
  118. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  119. package/clients/cli/commands/swizzle.mjs +33 -9
  120. package/clients/cli/lib/resolve-theme.mjs +16 -7
  121. package/foundation/discovery/component-loader.d.mts +1 -1
  122. package/foundation/discovery/doc-types.mjs +9 -2
  123. package/foundation/discovery/hook-discovery.mjs +31 -8
  124. package/foundation/discovery/icon-ranking.d.mts +27 -3
  125. package/foundation/discovery/icon-ranking.mjs +125 -8
  126. package/foundation/discovery/icon-set-checks.mjs +44 -35
  127. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  128. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  129. package/foundation/discovery/icon-set-writer.d.mts +258 -20
  130. package/foundation/discovery/icon-set-writer.mjs +785 -87
  131. package/foundation/discovery/module-exports.d.mts +3 -2
  132. package/foundation/discovery/module-exports.mjs +167 -37
  133. package/foundation/doc-compiler/import.d.mts +5 -1
  134. package/foundation/doc-compiler/import.mjs +40 -6
  135. package/foundation/fs/import-url.d.mts +20 -0
  136. package/foundation/fs/import-url.mjs +22 -0
  137. package/foundation/fs/module-loader.d.mts +24 -3
  138. package/foundation/fs/module-loader.mjs +69 -47
  139. package/foundation/fs/paths.d.mts +2 -1
  140. package/foundation/fs/paths.mjs +3 -4
  141. package/foundation/render/charts.d.mts +59 -0
  142. package/foundation/render/charts.mjs +216 -0
  143. package/foundation/render/embedded-imports.d.mts +7 -7
  144. package/foundation/render/embedded-imports.mjs +63 -54
  145. package/foundation/render/page-host.d.mts +4 -0
  146. package/foundation/render/page-host.mjs +45 -0
  147. package/foundation/render/page-worker.mjs +350 -57
  148. package/foundation/render/render-page.d.mts +11 -6
  149. package/foundation/render/render-page.mjs +164 -54
  150. package/foundation/render/ts-paths.d.mts +63 -0
  151. package/foundation/render/ts-paths.mjs +138 -0
  152. package/foundation/response/error-codes.doc.mjs +3 -3
  153. package/foundation/response/error-codes.mjs +3 -2
  154. package/foundation/text/levenshtein.d.mts +6 -1
  155. package/foundation/text/levenshtein.mjs +25 -9
  156. package/foundation/text/shell-arg.d.mts +14 -0
  157. package/foundation/text/shell-arg.mjs +17 -0
  158. package/foundation/text/suggest-order.d.mts +8 -1
  159. package/foundation/text/suggest-order.mjs +72 -6
  160. package/package.json +7 -6
@@ -16,6 +16,7 @@
16
16
 
17
17
  import {loadTopicFile} from '../../../foundation/doc-compiler/read.mjs';
18
18
  import {
19
+ childIdentity,
19
20
  holdsOwnName,
20
21
  linkDocText,
21
22
  loadDocsCatalog,
@@ -25,9 +26,12 @@ import {
25
26
  /**
26
27
  * @param {object} [options]
27
28
  * @param {string} [options.cwd]
29
+ * @param {number | 'all'} [options.depth] how many levels of the docs tree to
30
+ * list below each namespace; without it the namespaces list alone, as they
31
+ * always have
28
32
  * @returns {Promise<import('../docs.type.mjs').DocsListResponse>}
29
33
  */
30
- export async function list({cwd} = {}) {
34
+ export async function list({cwd, depth} = {}) {
31
35
  const catalog = await loadDocsCatalog(cwd);
32
36
  const tree = await projectTree(catalog);
33
37
  /** @type {Array<import('../docs.type.mjs').DocsListEntry>} */
@@ -64,11 +68,11 @@ export async function list({cwd} = {}) {
64
68
  // The docs tree's top-level namespaces, the CLI's and each integration's,
65
69
  // each the way into a whole branch (spec:AST-046 FR7). They go in `meta`,
66
70
  // so `data` stays the topic list 0.6 returned: every entry reads as a topic.
67
- const namespaces = tree.roots().map(root => ({
68
- topic: root.route,
69
- description: root.summary,
70
- package: root.provider,
71
- }));
71
+ // With `depth`, each one also carries the branch below it, so one read
72
+ // learns every route: without it a reader knows only that the namespace is
73
+ // there, and the children it must name are invisible until it opens each one.
74
+ const levels = depthLevels(depth);
75
+ const namespaces = tree.roots().map(root => branch(tree, root, levels));
72
76
  /** @type {NonNullable<import('../docs.type.mjs').DocsListResponse['meta']>} */
73
77
  const meta = {};
74
78
  if (namespaces.length > 0) meta.namespaces = namespaces;
@@ -79,3 +83,65 @@ export async function list({cwd} = {}) {
79
83
  ? {type: 'docs.list', data: entries}
80
84
  : {type: 'docs.list', data: entries, meta};
81
85
  }
86
+
87
+ /**
88
+ * How many levels below each namespace the list carries: none without
89
+ * `depth`, every level for `'all'`. `docs <namespace> --depth` reads the same
90
+ * way, so one flag means one thing everywhere.
91
+ * @param {number | 'all'} [depth]
92
+ * @returns {number | null} null for a list read with no depth, which carries
93
+ * the namespaces alone
94
+ */
95
+ function depthLevels(depth) {
96
+ if (depth == null) return null;
97
+ return depth === 'all' ? Infinity : depth;
98
+ }
99
+
100
+ /**
101
+ * One namespace of the list, with the branch below it to `levels`. A child
102
+ * reads exactly as a namespace read gives it (`childIdentity`): the route
103
+ * that opens it, and the package that owns it — the integration's, for a
104
+ * guide an integration replaced, with the package whose route it took beside
105
+ * it. Every line of the list is then an argument a reader can pass straight
106
+ * back to `astryx docs`, attributed the way the read attributes it. Where the
107
+ * depth stops on a doc with docs below it, the row says how many, as a
108
+ * namespace read's child does; `levels` of null is a read with no depth,
109
+ * which says nothing about what is below.
110
+ * @param {import('../../../foundation/doc-compiler/tree.mjs').DocsTree} tree
111
+ * @param {import('../../../foundation/doc-compiler/tree.mjs').TreeNode} node
112
+ * @param {number | null} levels
113
+ * @returns {import('../docs.type.mjs').DocsListNamespace}
114
+ */
115
+ function branch(tree, node, levels) {
116
+ /** @type {import('../docs.type.mjs').DocsListNamespace} */
117
+ const listed = {
118
+ topic: node.route,
119
+ description: node.summary,
120
+ package: node.provider,
121
+ };
122
+ if (levels == null) return listed;
123
+ const below = node.slots.flatMap(slot => slot.children);
124
+ if (levels <= 0) {
125
+ if (below.length > 0) listed.childCount = below.length;
126
+ return listed;
127
+ }
128
+ const children = below
129
+ .map(route => tree.get(route))
130
+ .filter(child => child != null)
131
+ .map(child => {
132
+ const node = /** @type {import('../../../foundation/doc-compiler/tree.mjs').TreeNode} */ (
133
+ child
134
+ );
135
+ const {topic: _route, ...rest} = branch(tree, node, levels - 1);
136
+ const identity = childIdentity(tree, node);
137
+ return /** @type {import('../docs.type.mjs').DocsListChild} */ ({
138
+ ...identity,
139
+ topic: identity.route,
140
+ description: identity.summary,
141
+ ...(rest.children ? {children: rest.children} : {}),
142
+ ...(rest.childCount ? {childCount: rest.childCount} : {}),
143
+ });
144
+ });
145
+ if (children.length > 0) listed.children = children;
146
+ return listed;
147
+ }
@@ -16,13 +16,14 @@
16
16
  */
17
17
 
18
18
  import {detailView} from '../../../foundation/doc-compiler/lenses.mjs';
19
- import {isExperimentalTreeNode} from '../../../foundation/doc-compiler/tree.mjs';
20
19
  import {
20
+ childIdentity,
21
21
  compileTopic,
22
22
  guideEntry,
23
23
  nodeContent,
24
24
  placeLinks,
25
25
  resolveDocsArgument,
26
+ stabilityOf,
26
27
  unknownTopicError,
27
28
  } from '../_adapter.mjs';
28
29
 
@@ -87,45 +88,6 @@ export async function nodeView(catalog, tree, node, read) {
87
88
  return view;
88
89
  }
89
90
 
90
- /**
91
- * `stability: 'experimental'` for a node whose doc is marked experimental, or
92
- * that sits under an experimental namespace (spec:AST-017 FR27), the way help
93
- * marks an experimental command; nothing for a stable one, so stable entries
94
- * read as they always have.
95
- * @param {DocsTree} tree
96
- * @param {TreeNode} node
97
- * @returns {{stability?: 'experimental'}}
98
- */
99
- function stabilityOf(tree, node) {
100
- return isExperimentalTreeNode(tree, node) ? {stability: 'experimental'} : {};
101
- }
102
-
103
- /**
104
- * The fields every child carries: what it is, and the route that opens it.
105
- * @param {DocsTree} tree
106
- * @param {TreeNode} child
107
- * @returns {import('../docs.type.mjs').DocsNodeChild}
108
- */
109
- function childIdentity(tree, child) {
110
- return {
111
- route: child.route,
112
- name: child.route.slice(child.route.lastIndexOf('/') + 1),
113
- package: child.guideOverlay?.replacement?.package ?? child.provider,
114
- // A guide an integration's doc took the place of names whose it was.
115
- ...(child.guideOverlay?.replacement
116
- ? {
117
- replaces: child.route,
118
- replacedPackage:
119
- child.guideOverlay.replacedPackage ?? child.provider,
120
- }
121
- : {}),
122
- kind: child.kind,
123
- title: child.title,
124
- summary: child.summary,
125
- ...stabilityOf(tree, child),
126
- };
127
- }
128
-
129
91
  /**
130
92
  * @param {TreeNode['slots']} slots
131
93
  * @returns {number}
@@ -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;