@astryxdesign/cli 0.7.18-canary.gfca8508 → 0.7.18

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 (341) hide show
  1. package/CHANGELOG.md +185 -19
  2. package/README.md +19 -19
  3. package/api/component/_adapter.d.mts +2 -1
  4. package/api/component/_adapter.mjs +2 -1
  5. package/api/docs/_adapter.d.mts +6 -5
  6. package/api/docs/_adapter.mjs +36 -5
  7. package/api/doctor/_adapter.d.mts +6 -3
  8. package/api/doctor/_adapter.mjs +13 -5
  9. package/api/doctor/doctor.mjs +2 -2
  10. package/api/doctor/font-packages.d.mts +36 -0
  11. package/api/doctor/font-packages.mjs +124 -0
  12. package/api/doctor/theme-checks.mjs +110 -49
  13. package/api/experimental.d.mts +0 -2
  14. package/api/experimental.mjs +0 -12
  15. package/api/icon/_adapter.d.mts +1 -1
  16. package/api/icon/_adapter.mjs +1 -0
  17. package/api/icon/_authoring.mjs +17 -8
  18. package/api/icon/_default-look.mjs +15 -15
  19. package/api/icon/add/add.mjs +9 -4
  20. package/api/icon/exportIconIndex.doc.mjs +1 -1
  21. package/api/icon/icon.doc.mjs +1 -1
  22. package/api/icon/icon.type.d.mts +33 -33
  23. package/api/icon/icon.type.mjs +45 -45
  24. package/api/icon/iconAdd.doc.mjs +1 -1
  25. package/api/icon/iconNewSet.doc.mjs +3 -3
  26. package/api/icon/iconUse.doc.mjs +5 -5
  27. package/api/icon/rankIconIndex.doc.mjs +1 -1
  28. package/api/icon/use/use.mjs +4 -4
  29. package/api/init/run/run.mjs +0 -1
  30. package/api/integration/add-helpers.mjs +1 -1
  31. package/api/render/_adapter.mjs +7 -1
  32. package/api/search/ORDERING.md +1 -1
  33. package/api/search/_candidate-score.mjs +20 -0
  34. package/api/search/_words.d.mts +8 -0
  35. package/api/search/_words.mjs +15 -0
  36. package/api/template/template.type.d.mts +2 -2
  37. package/api/template/template.type.mjs +2 -2
  38. package/api/theme/_adapter.mjs +19 -11
  39. package/api/theme/build/build.d.mts +19 -51
  40. package/api/theme/build/build.mjs +195 -189
  41. package/api/theme/build/font-warning.d.mts +19 -2
  42. package/api/theme/build/font-warning.mjs +46 -5
  43. package/api/theme/generateTonalPalette.doc.mjs +1 -1
  44. package/api/theme/palette/generate/derive-look.mjs +108 -37
  45. package/api/theme/palette/generate/mapping.mjs +2 -0
  46. package/api/theme/template/template.d.mts +0 -17
  47. package/api/theme/template/template.mjs +1 -42
  48. package/api/theme/theme.type.d.mts +5 -4
  49. package/api/theme/theme.type.mjs +5 -4
  50. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  51. package/api/theme/themeRemove.doc.mjs +1 -1
  52. package/assets/codemods/transforms/v0.7.0/preserve-bottom-sheet-content-padding.mjs +3 -1
  53. package/assets/component-list.generated.json +1 -1
  54. package/assets/discover/official-packages.json +26 -2
  55. package/assets/docs/author-a-theme.doc.mjs +6 -5
  56. package/assets/docs/browser-support.doc.mjs +1 -0
  57. package/assets/docs/icons.doc.mjs +8 -7
  58. package/assets/docs/motion.doc.mjs +46 -0
  59. package/assets/docs/theme.doc.dense.mjs +6 -17
  60. package/assets/docs/theme.doc.mjs +6 -16
  61. package/assets/docs/theme.doc.zh.mjs +6 -16
  62. package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
  63. package/assets/docs/tree/font-setup.doc.mjs +30 -0
  64. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  65. package/assets/docs/tree/template-icons.doc.mjs +3 -3
  66. package/assets/docs/tree/tokens-color.doc.mjs +5 -0
  67. package/assets/docs/tree/tokens.doc.mjs +4 -3
  68. package/assets/docs/tree/updates.doc.mjs +1 -1
  69. package/assets/docs-routes.generated.json +1 -1
  70. package/assets/docs.generated.json +2 -2
  71. package/assets/icons/definitions/drag.doc.mjs +1 -0
  72. package/assets/search-catalog.generated.json +2 -2
  73. package/assets/self-audit.generated.json +1 -1
  74. package/assets/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +1 -1
  75. package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +20 -10
  76. package/assets/templates/blocks/components/Card/SelectableCardShowcase.doc.mjs +1 -1
  77. package/assets/templates/blocks/components/Card/SelectableCardShowcase.tsx +36 -16
  78. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +6 -0
  79. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +6 -0
  80. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.tsx +63 -0
  82. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.doc.mjs +29 -0
  83. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.tsx +237 -0
  84. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +10 -72
  85. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.doc.mjs +1 -1
  86. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +7 -7
  87. package/assets/templates/blocks/components/Table/TableCustomRowTable.doc.mjs +14 -0
  88. package/assets/templates/blocks/components/Table/TableCustomRowTable.tsx +96 -0
  89. package/assets/templates/components.generated.json +1 -1
  90. package/assets/templates/pages/ai-chat-landing/page.tsx +4 -0
  91. package/assets/templates/pages/dashboard-scorecard/page.tsx +26 -7
  92. package/assets/templates/pages/editor/page.tsx +13 -3
  93. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +2 -2
  94. package/assets/templates/themes/butter/butterTheme.ts +12 -10
  95. package/assets/templates/themes/butter/icons.tsx +2 -0
  96. package/assets/templates/themes/chocolate/chocolateTheme.ts +1 -0
  97. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  98. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
  99. package/assets/templates/themes/gothic/gothicTheme.ts +1 -0
  100. package/assets/templates/themes/gothic/icons.tsx +2 -0
  101. package/assets/templates/themes/matcha/icons.tsx +2 -0
  102. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +2 -2
  103. package/assets/templates/themes/matcha/matchaTheme.ts +1 -0
  104. package/assets/templates/themes/neutral/icons.tsx +2 -0
  105. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +2 -2
  106. package/assets/templates/themes/neutral/neutralTheme.ts +1 -0
  107. package/assets/templates/themes/stone/icons.tsx +2 -0
  108. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +1 -1
  109. package/assets/templates/themes/stone/stoneTheme.ts +1 -0
  110. package/assets/templates/themes/y2k/icons.tsx +2 -0
  111. package/assets/templates/themes/y2k/y2kTheme.ts +1 -0
  112. package/assets/theme.template.ts +9 -5
  113. package/authoring/config/parse.mjs +1 -1
  114. package/authoring/doctypes/base/type.ts +2 -3
  115. package/authoring/doctypes/component/component.doc.mjs +1 -1
  116. package/authoring/doctypes/icon-set/icon-names.mjs +1 -0
  117. package/authoring/integration/integration.doc.mjs +1 -1
  118. package/authoring/integration/type.ts +1 -1
  119. package/clients/cli/build-id.generated.json +1 -1
  120. package/clients/cli/commands/experimental/icon.mjs +7 -7
  121. package/clients/cli/commands/experimental/index.mjs +0 -5
  122. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  123. package/clients/cli/commands/experimental-icon-use.doc.mjs +4 -4
  124. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  125. package/clients/cli/commands/experimental.doc.mjs +2 -6
  126. package/clients/cli/commands/template.mjs +1 -1
  127. package/clients/cli/commands/theme-build.doc.mjs +8 -1
  128. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -1
  129. package/clients/cli/commands/theme-remove.doc.mjs +1 -1
  130. package/clients/cli/commands/theme.doc.mjs +1 -11
  131. package/clients/cli/commands/theme.mjs +110 -475
  132. package/clients/cli/commands.generated.json +1 -1
  133. package/clients/cli/index.mjs +4 -34
  134. package/clients/cli/lib/base-gate.mjs +2 -3
  135. package/clients/cli/lib/cli-error.mjs +8 -72
  136. package/clients/cli/lib/define-command.mjs +0 -19
  137. package/clients/cli/lib/json-shim.mjs +11 -633
  138. package/clients/cli/lib/manifest.mjs +0 -4
  139. package/clients/cli/lib/stray-option.mjs +1 -2
  140. package/clients/cli/manifest.generated.json +1 -1
  141. package/foundation/agent-docs/agent-docs.mjs +1 -1
  142. package/foundation/color/css-color.mjs +2 -3
  143. package/foundation/discovery/app-layout.d.mts +13 -0
  144. package/foundation/discovery/app-layout.mjs +35 -0
  145. package/foundation/discovery/fixture-refs.d.mts +51 -0
  146. package/foundation/discovery/fixture-refs.mjs +351 -0
  147. package/foundation/discovery/icon-definition-discovery.mjs +1 -1
  148. package/foundation/discovery/icon-ranking.mjs +2 -2
  149. package/foundation/discovery/icon-set-checks.mjs +1 -1
  150. package/foundation/discovery/icon-set-discovery.mjs +1 -1
  151. package/foundation/discovery/icon-set-writer.d.mts +24 -7
  152. package/foundation/discovery/icon-set-writer.mjs +66 -22
  153. package/foundation/discovery/static-descriptor.d.mts +49 -0
  154. package/foundation/discovery/static-descriptor.mjs +548 -0
  155. package/foundation/discovery/template-adapter.d.mts +0 -47
  156. package/foundation/discovery/template-adapter.mjs +1 -333
  157. package/foundation/discovery/theme-discovery.d.mts +6 -47
  158. package/foundation/discovery/theme-discovery.mjs +15 -537
  159. package/foundation/doc-compiler/import.mjs +1 -1
  160. package/foundation/env/user-dirs.d.mts +5 -2
  161. package/foundation/env/user-dirs.mjs +12 -5
  162. package/foundation/fonts/next-font.d.mts +26 -0
  163. package/foundation/fonts/next-font.mjs +149 -0
  164. package/foundation/fs/empty-folder.mjs +2 -2
  165. package/foundation/fs/read-record.mjs +11 -4
  166. package/foundation/pictures/pictures.d.mts +1 -45
  167. package/foundation/pictures/pictures.mjs +8 -8
  168. package/foundation/release/folder-lock.mjs +3 -2
  169. package/foundation/render/cut-short.d.mts +2 -2
  170. package/foundation/render/cut-short.mjs +2 -2
  171. package/foundation/render/drawn-contrast.d.mts +2 -2
  172. package/foundation/render/drawn-contrast.mjs +2 -2
  173. package/foundation/render/font-probe.d.mts +2 -2
  174. package/foundation/render/font-probe.mjs +2 -2
  175. package/foundation/render/layers.mjs +1 -2
  176. package/foundation/render/package-resolve-hooks.d.mts +25 -5
  177. package/foundation/render/package-resolve-hooks.mjs +77 -14
  178. package/foundation/render/page-worker.mjs +24 -12
  179. package/foundation/render/part-boxes.d.mts +2 -3
  180. package/foundation/render/part-boxes.mjs +2 -3
  181. package/foundation/render/picture-chrome.mjs +5 -0
  182. package/foundation/render/render-page.d.mts +1 -1
  183. package/foundation/render/render-page.mjs +4 -5
  184. package/foundation/render/single-copy-hooks.d.mts +2 -0
  185. package/foundation/render/single-copy-hooks.mjs +2 -0
  186. package/foundation/response/error-codes.doc.mjs +14 -14
  187. package/foundation/response/error-codes.mjs +13 -13
  188. package/foundation/response/response-types.doc.mjs +7 -68
  189. package/foundation/runtime/css-tree.mjs +2 -2
  190. package/foundation/runtime/word-table.d.mts +1 -1
  191. package/foundation/runtime/word-table.mjs +1 -1
  192. package/foundation/suggest/other-command.d.mts +52 -15
  193. package/foundation/suggest/other-command.mjs +168 -45
  194. package/foundation/text/suggest-order.d.mts +7 -0
  195. package/foundation/text/suggest-order.mjs +1 -1
  196. package/package.json +7 -8
  197. package/api/theme-edit/_adapter.d.mts +0 -228
  198. package/api/theme-edit/_adapter.mjs +0 -2025
  199. package/api/theme-edit/_catalog.d.mts +0 -172
  200. package/api/theme-edit/_catalog.mjs +0 -806
  201. package/api/theme-edit/_check.d.mts +0 -391
  202. package/api/theme-edit/_check.mjs +0 -9370
  203. package/api/theme-edit/_color.d.mts +0 -135
  204. package/api/theme-edit/_color.mjs +0 -480
  205. package/api/theme-edit/_compiler.d.mts +0 -77
  206. package/api/theme-edit/_compiler.mjs +0 -1053
  207. package/api/theme-edit/_context.d.mts +0 -399
  208. package/api/theme-edit/_context.mjs +0 -1778
  209. package/api/theme-edit/_css.d.mts +0 -169
  210. package/api/theme-edit/_css.mjs +0 -1167
  211. package/api/theme-edit/_edit.d.mts +0 -167
  212. package/api/theme-edit/_edit.mjs +0 -11220
  213. package/api/theme-edit/_how-commands.d.mts +0 -315
  214. package/api/theme-edit/_how-commands.mjs +0 -1664
  215. package/api/theme-edit/_how-question.d.mts +0 -341
  216. package/api/theme-edit/_how-question.mjs +0 -33339
  217. package/api/theme-edit/_how-sides.d.mts +0 -22
  218. package/api/theme-edit/_how-sides.mjs +0 -173
  219. package/api/theme-edit/_how-steps.d.mts +0 -42
  220. package/api/theme-edit/_how-steps.mjs +0 -208
  221. package/api/theme-edit/_how-values.d.mts +0 -29
  222. package/api/theme-edit/_how-values.mjs +0 -111
  223. package/api/theme-edit/_how-words.d.mts +0 -15
  224. package/api/theme-edit/_how-words.mjs +0 -239
  225. package/api/theme-edit/_how.d.mts +0 -55
  226. package/api/theme-edit/_how.mjs +0 -2388
  227. package/api/theme-edit/_importers.d.mts +0 -38
  228. package/api/theme-edit/_importers.mjs +0 -188
  229. package/api/theme-edit/_marks.d.mts +0 -39
  230. package/api/theme-edit/_marks.mjs +0 -67
  231. package/api/theme-edit/_missed.d.mts +0 -56
  232. package/api/theme-edit/_missed.mjs +0 -1128
  233. package/api/theme-edit/_name-rule.d.mts +0 -11
  234. package/api/theme-edit/_name-rule.mjs +0 -12
  235. package/api/theme-edit/_normal.d.mts +0 -365
  236. package/api/theme-edit/_normal.mjs +0 -1978
  237. package/api/theme-edit/_overview.d.mts +0 -9
  238. package/api/theme-edit/_overview.mjs +0 -293
  239. package/api/theme-edit/_palette.d.mts +0 -616
  240. package/api/theme-edit/_palette.mjs +0 -2776
  241. package/api/theme-edit/_part-pieces.d.mts +0 -54
  242. package/api/theme-edit/_part-pieces.mjs +0 -179
  243. package/api/theme-edit/_part-words.d.mts +0 -39
  244. package/api/theme-edit/_part-words.mjs +0 -242
  245. package/api/theme-edit/_parts.d.mts +0 -402
  246. package/api/theme-edit/_parts.mjs +0 -2322
  247. package/api/theme-edit/_picture-traits.d.mts +0 -259
  248. package/api/theme-edit/_picture-traits.mjs +0 -1030
  249. package/api/theme-edit/_png.d.mts +0 -94
  250. package/api/theme-edit/_png.mjs +0 -479
  251. package/api/theme-edit/_preview-app.d.mts +0 -172
  252. package/api/theme-edit/_preview-app.mjs +0 -6430
  253. package/api/theme-edit/_preview.d.mts +0 -484
  254. package/api/theme-edit/_preview.mjs +0 -2775
  255. package/api/theme-edit/_project.d.mts +0 -207
  256. package/api/theme-edit/_project.mjs +0 -643
  257. package/api/theme-edit/_resolved.d.mts +0 -46
  258. package/api/theme-edit/_resolved.mjs +0 -800
  259. package/api/theme-edit/_set-line.d.mts +0 -29
  260. package/api/theme-edit/_set-line.mjs +0 -100
  261. package/api/theme-edit/_settings.d.mts +0 -2426
  262. package/api/theme-edit/_settings.mjs +0 -18449
  263. package/api/theme-edit/_tables.d.mts +0 -227
  264. package/api/theme-edit/_tables.mjs +0 -1128
  265. package/api/theme-edit/_text-looks.d.mts +0 -78
  266. package/api/theme-edit/_text-looks.mjs +0 -376
  267. package/api/theme-edit/_vet.d.mts +0 -50
  268. package/api/theme-edit/_vet.mjs +0 -166
  269. package/api/theme-edit/how/how.d.mts +0 -17
  270. package/api/theme-edit/how/how.mjs +0 -28
  271. package/api/theme-edit/new/new.d.mts +0 -11
  272. package/api/theme-edit/new/new.mjs +0 -22
  273. package/api/theme-edit/preview-add/preview-add.d.mts +0 -14
  274. package/api/theme-edit/preview-add/preview-add.mjs +0 -25
  275. package/api/theme-edit/preview-app/preview-app.d.mts +0 -13
  276. package/api/theme-edit/preview-app/preview-app.mjs +0 -24
  277. package/api/theme-edit/preview-list/preview-list.d.mts +0 -10
  278. package/api/theme-edit/preview-list/preview-list.mjs +0 -21
  279. package/api/theme-edit/preview-remove/preview-remove.d.mts +0 -12
  280. package/api/theme-edit/preview-remove/preview-remove.mjs +0 -23
  281. package/api/theme-edit/set/set.d.mts +0 -13
  282. package/api/theme-edit/set/set.mjs +0 -24
  283. package/api/theme-edit/show/show.d.mts +0 -13
  284. package/api/theme-edit/show/show.mjs +0 -24
  285. package/api/theme-edit/theme-edit.d.mts +0 -12
  286. package/api/theme-edit/theme-edit.mjs +0 -36
  287. package/api/theme-edit/theme-edit.type.d.mts +0 -730
  288. package/api/theme-edit/theme-edit.type.mjs +0 -342
  289. package/api/theme-edit/themeEditHow.doc.d.mts +0 -6
  290. package/api/theme-edit/themeEditHow.doc.mjs +0 -105
  291. package/api/theme-edit/themeEditNew.doc.d.mts +0 -5
  292. package/api/theme-edit/themeEditNew.doc.mjs +0 -112
  293. package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +0 -6
  294. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +0 -121
  295. package/api/theme-edit/themeEditPreviewApp.doc.d.mts +0 -6
  296. package/api/theme-edit/themeEditPreviewApp.doc.mjs +0 -87
  297. package/api/theme-edit/themeEditPreviewList.doc.d.mts +0 -6
  298. package/api/theme-edit/themeEditPreviewList.doc.mjs +0 -62
  299. package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +0 -6
  300. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +0 -96
  301. package/api/theme-edit/themeEditSet.doc.d.mts +0 -6
  302. package/api/theme-edit/themeEditSet.doc.mjs +0 -175
  303. package/api/theme-edit/themeEditShow.doc.d.mts +0 -6
  304. package/api/theme-edit/themeEditShow.doc.mjs +0 -118
  305. package/api/theme-edit/themeEditUndo.doc.d.mts +0 -6
  306. package/api/theme-edit/themeEditUndo.doc.mjs +0 -133
  307. package/api/theme-edit/undo/undo.d.mts +0 -13
  308. package/api/theme-edit/undo/undo.mjs +0 -24
  309. package/assets/preview-app/README.md +0 -6
  310. package/assets/preview-app/css.d.ts +0 -5
  311. package/assets/preview-app/gitignore +0 -4
  312. package/assets/preview-app/next.config.mjs +0 -12
  313. package/assets/preview-app/package.json +0 -24
  314. package/assets/preview-app/src/app/globals.css +0 -6
  315. package/assets/preview-app/src/app/layout.tsx +0 -21
  316. package/assets/preview-app/src/app/page.tsx +0 -94
  317. package/assets/preview-app/src/app/providers.tsx +0 -16
  318. package/assets/preview-app/tsconfig.json +0 -27
  319. package/clients/cli/commands/experimental/theme.mjs +0 -2990
  320. package/clients/cli/commands/experimental-theme-add.doc.mjs +0 -80
  321. package/clients/cli/commands/experimental-theme-compile.doc.mjs +0 -98
  322. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +0 -196
  323. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -174
  324. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +0 -139
  325. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +0 -77
  326. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +0 -105
  327. package/clients/cli/commands/experimental-theme-editor.doc.mjs +0 -49
  328. package/clients/cli/commands/experimental-theme-eject.doc.mjs +0 -72
  329. package/clients/cli/commands/experimental-theme-list.doc.mjs +0 -49
  330. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +0 -88
  331. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +0 -61
  332. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +0 -48
  333. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +0 -59
  334. package/clients/cli/commands/experimental-theme-preview.doc.mjs +0 -41
  335. package/clients/cli/commands/experimental-theme-remove.doc.mjs +0 -57
  336. package/clients/cli/commands/experimental-theme-targets.doc.mjs +0 -62
  337. package/clients/cli/commands/experimental-theme-template.doc.mjs +0 -63
  338. package/clients/cli/commands/experimental-theme-use.doc.mjs +0 -57
  339. package/clients/cli/commands/experimental-theme.doc.mjs +0 -60
  340. package/foundation/fonts/fontsource-families.generated.d.mts +0 -5
  341. package/foundation/fonts/fontsource-families.generated.mjs +0 -2110
@@ -1,6 +1,14 @@
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 folded names a typed name's last path segment may mean: as typed, with
6
+ * its words singular, and with a final `s` or `es` dropped
7
+ * (`components/Tabs` may mean Tab, `widgets/Switches` Switch).
8
+ * @param {string} typed
9
+ * @returns {string[]}
10
+ */
11
+ export function tailForms(typed: string): string[];
4
12
  /**
5
13
  * The hint that names `name`, an entry of `command`, for `from`, at `tier`.
6
14
  * Without `from` (a word that is no command), the reason names the entry's
@@ -38,7 +46,9 @@ export function otherCommand(typed: string, entries: LookupNames, from: LookupCo
38
46
  * near hook or hook keyword hint, a suggestion also matches as well when one
39
47
  * of its names is a near name or carries every typed word, and, for a hook
40
48
  * keyword hint, when one of its `keywordsOf` has exactly the typed words.
41
- * The first `pinned` suggestions always stay ahead of the hint.
49
+ * For a hook stem hint, a suggestion matches as well when its folded name
50
+ * carries the folded stem. The first `pinned` suggestions always stay ahead
51
+ * of the hint.
42
52
  * @template {Suggestion} T
43
53
  * @param {T[] | undefined} suggestions
44
54
  * @param {Found | null} found
@@ -67,8 +77,8 @@ export function withOtherCommand<T extends Suggestion>(suggestions: T[] | undefi
67
77
  * text, says first which catalogs can hold the name; a catalog is asked only
68
78
  * then, only for the names that fold to it, and only until a catalog before
69
79
  * it has an exact match. So a name no file carries reads no doc and loads no
70
- * discovery, except the hook discovery that the near hook and hook keyword
71
- * tiers read when a component or template lookup misses. The docs catalog is every route of the docs tree, from
80
+ * discovery, except the hook discovery that the near hook, hook keyword and
81
+ * hook stem tiers read when a component or template lookup misses. The docs catalog is every route of the docs tree, from
72
82
  * `docsRoutes`, which the docs lookup owns; the index keeps them where it is
73
83
  * kept, and they are worked out only when the name's last segment can end a
74
84
  * route. A check that fails gives no hint.
@@ -79,19 +89,22 @@ export function withOtherCommand<T extends Suggestion>(suggestions: T[] | undefi
79
89
  * coreDir?: string | null,
80
90
  * integrations?: import('../integrations/integrations.mjs').LoadedIntegration[],
81
91
  * docsRoutes?: import('./name-index.mjs').DocsRoutes,
92
+ * tail?: string[],
82
93
  * }} context `from` is the lookup command that did not find the name; without
83
94
  * it, every lookup command is asked. `coreDir` and `integrations` are the
84
95
  * ones the lookup found, if any. `docsRoutes` works out every route
85
96
  * `astryx docs` reads in the project with these integrations; without it,
86
- * no docs route is a hint
97
+ * no docs route is a hint. `tail` holds the folded names a component or
98
+ * hook may have for the typed last path segment to name it ({@link tailForms})
87
99
  * @returns {Promise<Found | null>}
88
100
  */
89
- export function findOtherCommand(typed: unknown, { from, cwd, coreDir: knownCoreDir, integrations: known, docsRoutes, }: {
101
+ export function findOtherCommand(typed: unknown, { from, cwd, coreDir: knownCoreDir, integrations: known, docsRoutes, tail, }: {
90
102
  from?: LookupCommand;
91
103
  cwd?: string;
92
104
  coreDir?: string | null;
93
105
  integrations?: import("../integrations/integrations.mjs").LoadedIntegration[];
94
106
  docsRoutes?: import("./name-index.mjs").DocsRoutes;
107
+ tail?: string[];
95
108
  }): Promise<Found | null>;
96
109
  /**
97
110
  * Each Core hook with the keywords its doc declares, as
@@ -113,28 +126,49 @@ export function coreHookKeywords(coreDir: string): Promise<Array<{
113
126
  * means the one hook whose doc declares a keyword with exactly those words
114
127
  * (suggest-order.mjs synonymMatches); one word names a topic many hooks
115
128
  * share, not a hook. A tie, or a keyword more than one hook declares, means
116
- * no hook.
129
+ * no hook. With `stems`, a name that means no hook so far means the hook
130
+ * whose name without its first word, the verb, is the longest run of the
131
+ * typed words ({@link hookByStem}).
117
132
  * @param {string} typed
118
133
  * @param {Array<{name: string, keywords: string[]}>} hooks
119
- * @param {{keywords?: boolean}} [options]
120
- * @returns {{name: string, tier: number} | null}
134
+ * @param {{keywords?: boolean, stems?: boolean}} [options]
135
+ * @returns {{name: string, tier: number, stem?: string} | null}
121
136
  */
122
137
  export function hookByMeaning(typed: string, hooks: Array<{
123
138
  name: string;
124
139
  keywords: string[];
125
- }>, { keywords }?: {
140
+ }>, { keywords, stems }?: {
126
141
  keywords?: boolean;
142
+ stems?: boolean;
127
143
  }): {
128
144
  name: string;
129
145
  tier: number;
146
+ stem?: string;
147
+ } | null;
148
+ /**
149
+ * The hook whose stem is the longest run of the typed words, with its tier
150
+ * and folded stem, or null. A hook's name is a verb and what it acts on
151
+ * (`useLayer`, `createReorderable`), so its stem is its words without the
152
+ * first. A tie in length means no hook.
153
+ * @param {string} typed
154
+ * @param {Array<{name: string}>} hooks
155
+ * @returns {{name: string, tier: number, stem: string} | null}
156
+ */
157
+ export function hookByStem(typed: string, hooks: Array<{
158
+ name: string;
159
+ }>): {
160
+ name: string;
161
+ tier: number;
162
+ stem: string;
130
163
  } | null;
131
164
  /**
132
165
  * @typedef {'component' | 'hook' | 'template' | 'docs'} LookupCommand
133
166
  * @typedef {{components?: string[], hooks?: string[], templates?: string[], docs?: string[]}} LookupNames
134
167
  * @typedef {import('../response/base').Suggestion} Suggestion
135
168
  * @typedef {{name: string, reason: string}} Hint
136
- * @typedef {{hint: Hint, tier: number}} Found a hint and the tier its entry
137
- * matches the typed name at
169
+ * @typedef {{hint: Hint, tier: number, stem?: string}} Found a hint and the
170
+ * tier its entry matches the typed name at; for the hook stem tier, also
171
+ * the folded stem the typed words carry
138
172
  */
139
173
  /** The lookup commands, in the order the hint prefers them. */
140
174
  export const LOOKUP_COMMANDS: readonly ["component", "hook", "template", "docs"];
@@ -144,8 +178,9 @@ export namespace MATCH_TIER {
144
178
  let segment: 2;
145
179
  let near: 3;
146
180
  let keyword: 4;
147
- let words: 5;
148
- let none: 6;
181
+ let stem: 5;
182
+ let words: 6;
183
+ let none: 7;
149
184
  }
150
185
  export type LookupCommand = "component" | "hook" | "template" | "docs";
151
186
  export type LookupNames = {
@@ -160,10 +195,12 @@ export type Hint = {
160
195
  reason: string;
161
196
  };
162
197
  /**
163
- * a hint and the tier its entry
164
- * matches the typed name at
198
+ * a hint and the
199
+ * tier its entry matches the typed name at; for the hook stem tier, also
200
+ * the folded stem the typed words carry
165
201
  */
166
202
  export type Found = {
167
203
  hint: Hint;
168
204
  tier: number;
205
+ stem?: string;
169
206
  };
@@ -4,19 +4,25 @@
4
4
  * @file The lookup commands' shared hint: when `astryx component`, `hook`,
5
5
  * `template` or `docs` finds no entry for a name, and the name matches an
6
6
  * entry another of those commands reads, the not-found error suggests that
7
- * command (`astryx hook useHotkeys`). A name matches at one of six tiers,
7
+ * command (`astryx hook useHotkeys`). A name matches at one of seven tiers,
8
8
  * best first: exact (the whole name, any case), folded (without spaces and
9
9
  * hyphens, a hook with or without `use`), last segment (of a path name, exact
10
- * or folded), near hook (a `use…` name a slip or two from a hook's name, or
11
- * one whose every word the hook's name carries), hook keyword (two or more words that are a keyword
12
- * one hook's doc declares), and word cover (every word of the name); word
13
- * cover gives no hint. The near hook tier gives one when a component or
10
+ * or folded; for a docs miss, also a Core component or hook that the typed
11
+ * name's last path segment names, as typed or with its words singular), near
12
+ * hook (a `use…` name a slip or two from a hook's name, or one whose every
13
+ * word the hook's name carries), hook keyword (two or more words that are a
14
+ * keyword one hook's doc declares), hook stem (a run of the typed words that
15
+ * is a hook's name without its first word, the verb: `TopLayer` names
16
+ * `useLayer`), and word cover (every word of the name); word cover gives no
17
+ * hint. The near hook tier gives one when a component or
14
18
  * template lookup misses and no better tier matches; the hook keyword tier
15
19
  * only for a component lookup, the one lookup that knows its suggestions'
16
- * declared keywords. A better tier wins; inside a tier, commands win in
17
- * {@link LOOKUP_COMMANDS} order, and docs routes with the fewest segments
18
- * first, then in tree order. The hint goes right after the command's own
19
- * suggestions that match at its tier or a better one (an own suggestion that
20
+ * declared keywords; and the hook stem tier only for a component lookup too,
21
+ * since a template's or doc's name is a page or topic, not a thing a hook
22
+ * acts on. A better tier wins; inside a tier,
23
+ * commands win in {@link LOOKUP_COMMANDS} order, and docs routes with the
24
+ * fewest segments first, then in tree order. The hint goes right after the
25
+ * command's own suggestions that match at its tier or a better one (an own suggestion that
20
26
  * declares the name as a keyword or synonym matches at the folded tier), and the list never
21
27
  * grows: the last suggestion drops, and a hint that would come last is left
22
28
  * out.
@@ -48,6 +54,7 @@ import {findCoreDir} from '../fs/paths.mjs';
48
54
  import {mayHaveIntegrations} from '../integrations/may-have-integrations.mjs';
49
55
  import {
50
56
  closeNameScore,
57
+ containsRun,
51
58
  nameWords,
52
59
  synonymMatches,
53
60
  } from '../text/suggest-order.mjs';
@@ -72,8 +79,9 @@ const NAMES_CODE = [
72
79
  * @typedef {{components?: string[], hooks?: string[], templates?: string[], docs?: string[]}} LookupNames
73
80
  * @typedef {import('../response/base').Suggestion} Suggestion
74
81
  * @typedef {{name: string, reason: string}} Hint
75
- * @typedef {{hint: Hint, tier: number}} Found a hint and the tier its entry
76
- * matches the typed name at
82
+ * @typedef {{hint: Hint, tier: number, stem?: string}} Found a hint and the
83
+ * tier its entry matches the typed name at; for the hook stem tier, also
84
+ * the folded stem the typed words carry
77
85
  */
78
86
 
79
87
  /** The lookup commands, in the order the hint prefers them. */
@@ -109,7 +117,11 @@ export const MATCH_TIER = /** @type {const} */ ({
109
117
  exact: 0,
110
118
  /** The whole name without spaces and hyphens, and a hook without `use`. */
111
119
  folded: 1,
112
- /** Only the last segment of a path name, as exact or folded. */
120
+ /**
121
+ * Only the last segment of a path name, as exact or folded; or, for a docs
122
+ * miss, a name the typed last path segment folds to, as typed or with its
123
+ * words singular ({@link tailForms}).
124
+ */
113
125
  segment: 2,
114
126
  /**
115
127
  * A hook a `use…` name nearly spells: one or two slips, or every typed
@@ -121,10 +133,15 @@ export const MATCH_TIER = /** @type {const} */ ({
121
133
  * more.
122
134
  */
123
135
  keyword: 4,
136
+ /**
137
+ * A hook whose name without its first word (the verb) is a run of the
138
+ * typed words, and the longest such run.
139
+ */
140
+ stem: 5,
124
141
  /** A name that carries every typed word. */
125
- words: 5,
142
+ words: 6,
126
143
  /** None of the above. */
127
- none: 6,
144
+ none: 7,
128
145
  });
129
146
 
130
147
  /** The lookups whose misses can get a near hook hint. */
@@ -139,9 +156,10 @@ const HOOK_SHAPED = /^use[A-Z0-9]/;
139
156
  * @param {LookupCommand} command
140
157
  * @param {string} name
141
158
  * @param {string} typed
159
+ * @param {string[]} [tail] the folded names the typed last segment may mean
142
160
  * @returns {number}
143
161
  */
144
- function nameTier(command, name, typed) {
162
+ function nameTier(command, name, typed, tail = []) {
145
163
  const lower = typed.toLowerCase();
146
164
  const wanted = foldEntryName(typed);
147
165
  /** @param {string} spelling */
@@ -158,6 +176,12 @@ function nameTier(command, name, typed) {
158
176
  const last = name.slice(at + 1);
159
177
  if (last.toLowerCase() === lower || folds(last)) return MATCH_TIER.segment;
160
178
  }
179
+ if (
180
+ (command === 'component' || command === 'hook') &&
181
+ tail.includes(foldEntryName(name))
182
+ ) {
183
+ return MATCH_TIER.segment;
184
+ }
161
185
  return MATCH_TIER.none;
162
186
  }
163
187
 
@@ -186,19 +210,38 @@ function beats(command, match, best) {
186
210
  * @param {LookupCommand} command
187
211
  * @param {string[] | undefined} names
188
212
  * @param {string} typed
213
+ * @param {string[]} [tail]
189
214
  * @returns {{name: string, tier: number} | null}
190
215
  */
191
- function bestMatch(command, names, typed) {
216
+ function bestMatch(command, names, typed, tail = []) {
192
217
  /** @type {{name: string, tier: number} | null} */
193
218
  let best = null;
194
219
  for (const name of names ?? []) {
195
- const match = {name, tier: nameTier(command, name, typed)};
220
+ const match = {name, tier: nameTier(command, name, typed, tail)};
196
221
  if (beats(command, match, best)) best = match;
197
222
  if (match.tier === MATCH_TIER.exact) break;
198
223
  }
199
224
  return best;
200
225
  }
201
226
 
227
+ /**
228
+ * The folded names a typed name's last path segment may mean: as typed, with
229
+ * its words singular, and with a final `s` or `es` dropped
230
+ * (`components/Tabs` may mean Tab, `widgets/Switches` Switch).
231
+ * @param {string} typed
232
+ * @returns {string[]}
233
+ */
234
+ export function tailForms(typed) {
235
+ const last = typed.slice(typed.lastIndexOf('/') + 1);
236
+ const folded = foldEntryName(last);
237
+ const forms = [folded, nameWords(folded).join(''), nameWords(last).join('')];
238
+ if (folded.endsWith('s') && !folded.endsWith('ss')) {
239
+ forms.push(folded.slice(0, -1));
240
+ }
241
+ if (folded.endsWith('es')) forms.push(folded.slice(0, -2));
242
+ return [...new Set(forms)].filter(Boolean);
243
+ }
244
+
202
245
  /**
203
246
  * The hint that names `name`, an entry of `command`, for `from`, at `tier`.
204
247
  * Without `from` (a word that is no command), the reason names the entry's
@@ -260,7 +303,9 @@ export function otherCommand(typed, entries, from) {
260
303
  * near hook or hook keyword hint, a suggestion also matches as well when one
261
304
  * of its names is a near name or carries every typed word, and, for a hook
262
305
  * keyword hint, when one of its `keywordsOf` has exactly the typed words.
263
- * The first `pinned` suggestions always stay ahead of the hint.
306
+ * For a hook stem hint, a suggestion matches as well when its folded name
307
+ * carries the folded stem. The first `pinned` suggestions always stay ahead
308
+ * of the hint.
264
309
  * @template {Suggestion} T
265
310
  * @param {T[] | undefined} suggestions
266
311
  * @param {Found | null} found
@@ -290,7 +335,9 @@ export function withOtherCommand(
290
335
  ) {
291
336
  if (!found) return suggestions;
292
337
  if (alone || !suggestions || suggestions.length === 0) return [found.hint];
293
- const byHook = found.tier >= MATCH_TIER.near;
338
+ const byHook =
339
+ found.tier >= MATCH_TIER.near && found.tier <= MATCH_TIER.keyword;
340
+ const stem = found.tier === MATCH_TIER.stem ? (found.stem ?? '') : null;
294
341
  const wanted = foldEntryName(typed);
295
342
  /** @param {T} suggestion */
296
343
  const declares = suggestion =>
@@ -299,6 +346,10 @@ export function withOtherCommand(
299
346
  /** @param {T} suggestion */
300
347
  const matchesAsWell = suggestion =>
301
348
  declares(suggestion) ||
349
+ (stem !== null &&
350
+ namesOf(suggestion).some(
351
+ name => name && foldEntryName(name).includes(stem),
352
+ )) ||
302
353
  namesOf(suggestion).some(
303
354
  name =>
304
355
  name &&
@@ -325,8 +376,8 @@ export function withOtherCommand(
325
376
  * text, says first which catalogs can hold the name; a catalog is asked only
326
377
  * then, only for the names that fold to it, and only until a catalog before
327
378
  * it has an exact match. So a name no file carries reads no doc and loads no
328
- * discovery, except the hook discovery that the near hook and hook keyword
329
- * tiers read when a component or template lookup misses. The docs catalog is every route of the docs tree, from
379
+ * discovery, except the hook discovery that the near hook, hook keyword and
380
+ * hook stem tiers read when a component or template lookup misses. The docs catalog is every route of the docs tree, from
330
381
  * `docsRoutes`, which the docs lookup owns; the index keeps them where it is
331
382
  * kept, and they are worked out only when the name's last segment can end a
332
383
  * route. A check that fails gives no hint.
@@ -337,11 +388,13 @@ export function withOtherCommand(
337
388
  * coreDir?: string | null,
338
389
  * integrations?: import('../integrations/integrations.mjs').LoadedIntegration[],
339
390
  * docsRoutes?: import('./name-index.mjs').DocsRoutes,
391
+ * tail?: string[],
340
392
  * }} context `from` is the lookup command that did not find the name; without
341
393
  * it, every lookup command is asked. `coreDir` and `integrations` are the
342
394
  * ones the lookup found, if any. `docsRoutes` works out every route
343
395
  * `astryx docs` reads in the project with these integrations; without it,
344
- * no docs route is a hint
396
+ * no docs route is a hint. `tail` holds the folded names a component or
397
+ * hook may have for the typed last path segment to name it ({@link tailForms})
345
398
  * @returns {Promise<Found | null>}
346
399
  */
347
400
  export async function findOtherCommand(
@@ -352,23 +405,27 @@ export async function findOtherCommand(
352
405
  coreDir: knownCoreDir,
353
406
  integrations: known,
354
407
  docsRoutes,
408
+ tail = [],
355
409
  },
356
410
  ) {
357
411
  if (typeof typed !== 'string') return null;
358
412
  const wanted = foldEntryName(typed);
359
413
  if (wanted === '') return null;
360
414
  // A name with a `/` can be only an integration template's full id or a
361
- // docs route.
415
+ // docs route, or, through `tail`, name a component or hook by its last part.
362
416
  const isPath = typed.includes('/');
363
417
  /** @type {import('../integrations/integrations.mjs').LoadedIntegration[] | undefined} */
364
418
  let loaded = known;
365
419
  const integrationsOnce = async () =>
366
420
  (loaded ??= await projectIntegrations(cwd));
367
421
  /** @param {string} name */
368
- const isWanted = name => foldEntryName(name) === wanted;
422
+ const isWantedWhole = name => foldEntryName(name) === wanted;
423
+ /** @param {string} name */
424
+ const isWanted = name =>
425
+ isWantedWhole(name) || tail.includes(foldEntryName(name));
369
426
  /** @param {string} name */
370
427
  const isWantedHook = name =>
371
- foldEntryName(name) === wanted || foldEntryName(name) === `use${wanted}`;
428
+ isWanted(name) || foldEntryName(name) === `use${wanted}`;
372
429
 
373
430
  /** @type {string | null} */
374
431
  let coreDir = null;
@@ -380,11 +437,15 @@ export async function findOtherCommand(
380
437
  let inCore = {component: false, hook: false};
381
438
  try {
382
439
  coreDir = knownCoreDir ?? findCoreDir(cwd);
383
- if (coreDir && !isPath) {
384
- inCore = coreFilesNaming(
385
- /** @type {string | string[]} */ ((await indexOnce()).core),
386
- wanted,
387
- );
440
+ if (coreDir && (!isPath || tail.length > 0)) {
441
+ const core = /** @type {string | string[]} */ ((await indexOnce()).core);
442
+ const named = [wanted, ...tail].map(name => coreFilesNaming(core, name));
443
+ inCore = {
444
+ component: named.some(one => one.component),
445
+ hook: named.some(one => one.hook),
446
+ componentTops: new Set(named.flatMap(one => [...one.componentTops])),
447
+ hookTops: new Set(named.flatMap(one => [...one.hookTops])),
448
+ };
388
449
  }
389
450
  } catch {
390
451
  inCore = {component: true, hook: true};
@@ -409,12 +470,15 @@ export async function findOtherCommand(
409
470
  [
410
471
  'component',
411
472
  async () => ({
412
- components: await integrationComponentNames(
413
- await integrationsOnce(),
414
- (await indexOnce()).components,
415
- wanted,
416
- isWanted,
417
- ),
473
+ // `tail` reaches Core components only.
474
+ components: isPath
475
+ ? []
476
+ : await integrationComponentNames(
477
+ await integrationsOnce(),
478
+ (await indexOnce()).components,
479
+ wanted,
480
+ isWantedWhole,
481
+ ),
418
482
  }),
419
483
  ],
420
484
  [
@@ -479,7 +543,10 @@ export async function findOtherCommand(
479
543
  for (const [command, load] of catalogs) {
480
544
  if (
481
545
  command === from ||
482
- (isPath && command !== 'template' && command !== 'docs')
546
+ (isPath &&
547
+ tail.length === 0 &&
548
+ command !== 'template' &&
549
+ command !== 'docs')
483
550
  ) {
484
551
  continue;
485
552
  }
@@ -489,7 +556,7 @@ export async function findOtherCommand(
489
556
  } catch {
490
557
  continue;
491
558
  }
492
- const match = bestMatch(command, entries[LISTED[command]], typed);
559
+ const match = bestMatch(command, entries[LISTED[command]], typed, tail);
493
560
  if (match && match.tier < (best?.tier ?? MATCH_TIER.words)) {
494
561
  best = hintFor(command, match.name, from, match.tier);
495
562
  if (match.tier === MATCH_TIER.exact) break;
@@ -499,8 +566,12 @@ export async function findOtherCommand(
499
566
  try {
500
567
  const found = hookByMeaning(typed, await coreHookKeywords(coreDir), {
501
568
  keywords: from === 'component',
569
+ stems: from === 'component',
502
570
  });
503
- if (found) best = hintFor('hook', found.name, from, found.tier);
571
+ if (found) {
572
+ best = hintFor('hook', found.name, from, found.tier);
573
+ if (found.stem) best.stem = found.stem;
574
+ }
504
575
  } catch {
505
576
  // A check that fails gives no hint.
506
577
  }
@@ -558,13 +629,32 @@ export async function coreHookKeywords(coreDir) {
558
629
  * means the one hook whose doc declares a keyword with exactly those words
559
630
  * (suggest-order.mjs synonymMatches); one word names a topic many hooks
560
631
  * share, not a hook. A tie, or a keyword more than one hook declares, means
561
- * no hook.
632
+ * no hook. With `stems`, a name that means no hook so far means the hook
633
+ * whose name without its first word, the verb, is the longest run of the
634
+ * typed words ({@link hookByStem}).
562
635
  * @param {string} typed
563
636
  * @param {Array<{name: string, keywords: string[]}>} hooks
564
- * @param {{keywords?: boolean}} [options]
637
+ * @param {{keywords?: boolean, stems?: boolean}} [options]
638
+ * @returns {{name: string, tier: number, stem?: string} | null}
639
+ */
640
+ export function hookByMeaning(
641
+ typed,
642
+ hooks,
643
+ {keywords = true, stems = false} = {},
644
+ ) {
645
+ const found = hookBySpelling(typed, hooks, keywords);
646
+ return found ?? (stems ? hookByStem(typed, hooks) : null);
647
+ }
648
+
649
+ /**
650
+ * The hook a `use…` name nearly spells, or the one whose keyword has the
651
+ * typed words ({@link hookByMeaning}), or null.
652
+ * @param {string} typed
653
+ * @param {Array<{name: string, keywords: string[]}>} hooks
654
+ * @param {boolean} keywords
565
655
  * @returns {{name: string, tier: number} | null}
566
656
  */
567
- export function hookByMeaning(typed, hooks, {keywords = true} = {}) {
657
+ function hookBySpelling(typed, hooks, keywords) {
568
658
  if (HOOK_SHAPED.test(typed)) {
569
659
  let best = 0;
570
660
  /** @type {string | null} */
@@ -592,6 +682,39 @@ export function hookByMeaning(typed, hooks, {keywords = true} = {}) {
592
682
  : null;
593
683
  }
594
684
 
685
+ /**
686
+ * The hook whose stem is the longest run of the typed words, with its tier
687
+ * and folded stem, or null. A hook's name is a verb and what it acts on
688
+ * (`useLayer`, `createReorderable`), so its stem is its words without the
689
+ * first. A tie in length means no hook.
690
+ * @param {string} typed
691
+ * @param {Array<{name: string}>} hooks
692
+ * @returns {{name: string, tier: number, stem: string} | null}
693
+ */
694
+ export function hookByStem(typed, hooks) {
695
+ const words = nameWords(typed);
696
+ let best = 0;
697
+ /** @type {{name: string, tier: number, stem: string} | null} */
698
+ let found = null;
699
+ for (const hook of hooks) {
700
+ const stem = nameWords(hook.name).slice(1);
701
+ if (stem.length === 0 || stem.length < best || !containsRun(words, stem)) {
702
+ continue;
703
+ }
704
+ if (stem.length === best) {
705
+ found = null;
706
+ continue;
707
+ }
708
+ best = stem.length;
709
+ found = {
710
+ name: hook.name,
711
+ tier: MATCH_TIER.stem,
712
+ stem: foldEntryName(hook.name).slice(nameWords(hook.name)[0].length),
713
+ };
714
+ }
715
+ return found;
716
+ }
717
+
595
718
  /**
596
719
  * The root routes of the docs tree whose names `isWanted` accepts, from file
597
720
  * names and doc text: the CLI's flat topics and root namespaces, the levels
@@ -613,9 +736,9 @@ async function rootDocNames(docsDirs, index, wanted, isWanted) {
613
736
  // A level exists while a topic sits in it; an integration's topic keeps
614
737
  // its level on any base.
615
738
  const filled = new Set(
616
- index.docs.flat().flatMap(({declared}) =>
617
- declared?.level ? [declared.level] : [],
618
- ),
739
+ index.docs
740
+ .flat()
741
+ .flatMap(({declared}) => (declared?.level ? [declared.level] : [])),
619
742
  );
620
743
  const builtin = [
621
744
  ...index.topics.filter(served),
@@ -144,6 +144,13 @@ export function orderDocSuggestions<T extends {
144
144
  export function synonymMatches(needle: string, cards: Record<string, {
145
145
  synonyms?: string[];
146
146
  }>): Set<string>;
147
+ /**
148
+ * Whether `run` sits in `words` as a contiguous run.
149
+ * @param {string[]} words
150
+ * @param {string[]} run
151
+ * @returns {boolean}
152
+ */
153
+ export function containsRun(words: string[], run: string[]): boolean;
147
154
  /**
148
155
  * Rank component suggestions for a name that resolved to nothing.
149
156
  *
@@ -604,7 +604,7 @@ function namePartMatch(typed, name) {
604
604
  * @param {string[]} run
605
605
  * @returns {boolean}
606
606
  */
607
- function containsRun(words, run) {
607
+ export function containsRun(words, run) {
608
608
  for (let i = 0; i + run.length <= words.length; i++) {
609
609
  if (run.every((w, j) => words[i + j] === w)) return true;
610
610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.18-canary.gfca8508",
3
+ "version": "0.7.18",
4
4
  "displayName": "CLI",
5
5
  "description": "The Astryx CLI: scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -130,7 +130,7 @@
130
130
  "zod": "^4.6.7"
131
131
  },
132
132
  "peerDependencies": {
133
- "@astryxdesign/core": "0.7.18-canary.gfca8508"
133
+ "@astryxdesign/core": "*"
134
134
  },
135
135
  "peerDependenciesMeta": {
136
136
  "@astryxdesign/core": {
@@ -138,11 +138,11 @@
138
138
  }
139
139
  },
140
140
  "devDependencies": {
141
- "@astryxdesign/charts": "0.7.18-canary.gfca8508",
142
- "@astryxdesign/core": "0.7.18-canary.gfca8508",
143
- "@astryxdesign/lab": "0.7.18-canary.gfca8508",
144
- "@astryxdesign/theme-neutral": "0.7.18-canary.gfca8508",
145
- "@astryxdesign/template-icons": "0.7.18-canary.gfca8508",
141
+ "@astryxdesign/charts": "*",
142
+ "@astryxdesign/core": "*",
143
+ "@astryxdesign/lab": "*",
144
+ "@astryxdesign/theme-neutral": "*",
145
+ "@astryxdesign/template-icons": "*",
146
146
  "@heroicons/react": "^2.2.0",
147
147
  "@stylexjs/stylex": "^0.19.1",
148
148
  "@types/babel__core": "^7.20.5",
@@ -161,7 +161,6 @@
161
161
  "typecheck:authoring": "tsc --project tsconfig.authoring-contract.json",
162
162
  "sync:api-types": "node scripts/sync-api-types.mjs",
163
163
  "generate:build-id": "node scripts/generate-build-id.mjs",
164
- "generate:font-families": "node scripts/generate-fontsource-families.mjs",
165
164
  "readme": "node scripts/generate-cli-readme.mjs",
166
165
  "readme:check": "node scripts/generate-cli-readme.mjs --check"
167
166
  }