@astryxdesign/cli 0.7.16 → 0.7.17-canary.g335a172

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 (339) hide show
  1. package/README.md +76 -86
  2. package/api/build/_adapter.d.mts +12 -0
  3. package/api/build/_adapter.mjs +51 -34
  4. package/api/build/blocks/blocks.d.mts +7 -5
  5. package/api/build/blocks/blocks.mjs +113 -26
  6. package/api/build/build.doc.mjs +4 -3
  7. package/api/build/build.type.d.mts +2 -2
  8. package/api/build/build.type.mjs +3 -3
  9. package/api/build/kit/kind.d.mts +2 -1
  10. package/api/build/kit/kind.mjs +199 -10
  11. package/api/build/kit/kit.mjs +6 -4
  12. package/api/build/kit/rank.mjs +69 -16
  13. package/api/build/kit/start.d.mts +5 -4
  14. package/api/build/kit/start.mjs +12 -8
  15. package/api/build/kit/weights.d.mts +16 -3
  16. package/api/build/kit/weights.json +1 -1
  17. package/api/build/kit/weights.mjs +251 -35
  18. package/api/build/kit/word-model.d.mts +23 -0
  19. package/api/build/kit/word-model.mjs +46 -0
  20. package/api/build/kit/words.d.mts +48 -0
  21. package/api/build/kit/words.mjs +90 -1
  22. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  23. package/api/component/list/list.d.mts +1 -1
  24. package/api/component/list/list.mjs +48 -6
  25. package/api/discover/_adapter.d.mts +1 -1
  26. package/api/discover/search/search.mjs +3 -2
  27. package/api/docs/_adapter.d.mts +26 -2
  28. package/api/docs/_adapter.mjs +219 -6
  29. package/api/docs/docs.d.mts +3 -0
  30. package/api/docs/docs.doc.mjs +7 -1
  31. package/api/docs/docs.mjs +12 -0
  32. package/api/docs/docs.type.d.mts +5 -0
  33. package/api/docs/docs.type.mjs +2 -0
  34. package/api/docs/node/node.mjs +1 -1
  35. package/api/doctor/_adapter.d.mts +27 -5
  36. package/api/doctor/_adapter.mjs +83 -10
  37. package/api/doctor/built-checks.mjs +40 -14
  38. package/api/doctor/doctor.d.mts +4 -3
  39. package/api/doctor/doctor.mjs +14 -7
  40. package/api/doctor/theme-checks.mjs +121 -17
  41. package/api/icon/_records.mjs +2 -1
  42. package/api/index.d.mts +2 -0
  43. package/api/index.mjs +2 -0
  44. package/api/integration/_adapter.d.mts +44 -0
  45. package/api/integration/_adapter.mjs +77 -1
  46. package/api/integration/authoring-checks.mjs +6 -6
  47. package/api/integration/example-scope.d.mts +14 -0
  48. package/api/integration/example-scope.mjs +44 -0
  49. package/api/integration/example-scope.type.d.mts +29 -0
  50. package/api/integration/example-scope.type.mjs +25 -0
  51. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  52. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  53. package/api/integration/validate-integration.mjs +19 -1
  54. package/api/integration/validate-integration.type.d.mts +9 -0
  55. package/api/integration/validate-integration.type.mjs +1 -1
  56. package/api/integration/validateIntegration.doc.mjs +1 -1
  57. package/api/render/_adapter.mjs +591 -195
  58. package/api/render/render.doc.mjs +11 -3
  59. package/api/render/render.type.d.mts +52 -0
  60. package/api/render/render.type.mjs +31 -1
  61. package/api/search/ORDERING.md +1 -1
  62. package/api/search/_candidate-score.mjs +51 -32
  63. package/api/search/_fit-order.mjs +3 -3
  64. package/api/search/_gather-components.d.mts +3 -2
  65. package/api/search/_gather-components.mjs +12 -3
  66. package/api/search/_lexical.d.mts +5 -0
  67. package/api/search/_lexical.mjs +8 -2
  68. package/api/search/_result.d.mts +11 -9
  69. package/api/search/_result.mjs +4 -4
  70. package/api/search/_score.d.mts +6 -1
  71. package/api/search/_score.mjs +15 -3
  72. package/api/search/search-index.mjs +7 -1
  73. package/api/search/search.d.mts +1 -1
  74. package/api/theme/_adapter.mjs +12 -1
  75. package/api/theme/build/build.d.mts +60 -0
  76. package/api/theme/build/build.mjs +210 -54
  77. package/api/theme/build/font-warning.d.mts +8 -0
  78. package/api/theme/build/font-warning.mjs +19 -0
  79. package/api/theme/theme.type.d.mts +10 -0
  80. package/api/theme/theme.type.mjs +7 -1
  81. package/api/theme-edit/_adapter.d.mts +55 -0
  82. package/api/theme-edit/_adapter.mjs +673 -42
  83. package/api/theme-edit/_check.d.mts +28 -22
  84. package/api/theme-edit/_check.mjs +1858 -312
  85. package/api/theme-edit/_color.d.mts +10 -0
  86. package/api/theme-edit/_color.mjs +49 -1
  87. package/api/theme-edit/_compiler.mjs +9 -0
  88. package/api/theme-edit/_context.mjs +60 -3
  89. package/api/theme-edit/_css.mjs +21 -1
  90. package/api/theme-edit/_edit.d.mts +22 -0
  91. package/api/theme-edit/_edit.mjs +1533 -92
  92. package/api/theme-edit/_how-commands.d.mts +57 -0
  93. package/api/theme-edit/_how-commands.mjs +587 -1
  94. package/api/theme-edit/_how-question.d.mts +78 -0
  95. package/api/theme-edit/_how-question.mjs +4716 -235
  96. package/api/theme-edit/_how.mjs +134 -8
  97. package/api/theme-edit/_marks.d.mts +31 -5
  98. package/api/theme-edit/_marks.mjs +57 -5
  99. package/api/theme-edit/_normal.d.mts +219 -0
  100. package/api/theme-edit/_normal.mjs +1041 -0
  101. package/api/theme-edit/_palette.mjs +10 -4
  102. package/api/theme-edit/_parts.d.mts +8 -0
  103. package/api/theme-edit/_parts.mjs +103 -2
  104. package/api/theme-edit/_playwright-picture.d.mts +4 -0
  105. package/api/theme-edit/_playwright-picture.mjs +34 -0
  106. package/api/theme-edit/_preview-app.d.mts +7 -1
  107. package/api/theme-edit/_preview-app.mjs +394 -74
  108. package/api/theme-edit/_preview.d.mts +69 -8
  109. package/api/theme-edit/_preview.mjs +531 -108
  110. package/api/theme-edit/_settings.d.mts +243 -6
  111. package/api/theme-edit/_settings.mjs +2415 -147
  112. package/api/theme-edit/_tables.d.mts +6 -0
  113. package/api/theme-edit/_tables.mjs +44 -1
  114. package/api/theme-edit/_vet.d.mts +18 -0
  115. package/api/theme-edit/_vet.mjs +32 -0
  116. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  117. package/api/theme-edit/theme-edit.type.mjs +4 -1
  118. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  119. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  120. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  121. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  122. package/api/upgrade/run/run.mjs +4 -3
  123. package/assets/codemods/integration-discovery.mjs +2 -1
  124. package/assets/codemods/run-codemod.mjs +87 -7
  125. package/assets/codemods/transforms/next/index.mjs +11 -1
  126. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  127. package/assets/component-list.generated.json +1 -0
  128. package/assets/docs/author-a-theme.doc.mjs +1 -0
  129. package/assets/docs/theme.doc.dense.mjs +2 -2
  130. package/assets/docs/theme.doc.mjs +1 -1
  131. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  132. package/assets/docs/tree/checks.doc.mjs +1 -1
  133. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  134. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  135. package/assets/docs/tree/single-component.doc.mjs +4 -0
  136. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  137. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  138. package/assets/docs/use-a-theme.doc.mjs +1 -1
  139. package/assets/docs.generated.json +2 -2
  140. package/assets/self-audit.generated.json +1 -1
  141. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  142. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  143. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  144. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  145. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  146. package/assets/templates/components.generated.json +1 -1
  147. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  148. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  149. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  150. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  151. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  152. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  153. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  154. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  155. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  156. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  157. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  158. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  159. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  160. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  161. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  162. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  163. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  164. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  165. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  166. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  167. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  168. package/assets/templates/pages/ide/page.tsx +24 -2
  169. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  170. package/assets/templates/pages/library/template.doc.mjs +4 -1
  171. package/assets/templates/pages/login/template.doc.mjs +2 -1
  172. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  173. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  174. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  175. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  176. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  177. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  178. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  179. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  180. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  181. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  182. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  183. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  184. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  185. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  186. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  187. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  188. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  189. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  190. package/assets/theme.template.ts +6 -0
  191. package/authoring/debug/parse.d.mts +3 -3
  192. package/authoring/doctypes/_schema.d.mts +3 -3
  193. package/authoring/doctypes/command/command.doc.mjs +1 -1
  194. package/authoring/doctypes/component/categories.d.mts +37 -0
  195. package/authoring/doctypes/component/categories.mjs +54 -0
  196. package/authoring/doctypes/template/template.doc.mjs +1 -1
  197. package/authoring/doctypes/template/type.ts +9 -0
  198. package/authoring/example/example.doc.d.mts +12 -0
  199. package/authoring/example/example.doc.mjs +69 -0
  200. package/authoring/example/preview.d.mts +92 -0
  201. package/authoring/example/preview.mjs +994 -0
  202. package/authoring/example/type.ts +102 -0
  203. package/authoring/index.d.mts +1 -0
  204. package/authoring/index.d.ts +12 -0
  205. package/authoring/index.mjs +3 -1
  206. package/clients/cli/bin/astryx.mjs +6 -9
  207. package/clients/cli/build-id.generated.json +1 -1
  208. package/clients/cli/commands/component.doc.mjs +1 -1
  209. package/clients/cli/commands/component.mjs +22 -3
  210. package/clients/cli/commands/docs.doc.mjs +7 -1
  211. package/clients/cli/commands/docs.mjs +3 -1
  212. package/clients/cli/commands/doctor.mjs +32 -14
  213. package/clients/cli/commands/experimental/render.mjs +42 -1
  214. package/clients/cli/commands/experimental/theme.mjs +145 -16
  215. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  216. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  217. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  218. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  219. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  220. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  221. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  222. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  223. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  224. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  225. package/clients/cli/commands/search.doc.mjs +2 -1
  226. package/clients/cli/commands/search.mjs +6 -1
  227. package/clients/cli/commands/template.mjs +4 -2
  228. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  229. package/clients/cli/commands/theme.doc.mjs +1 -1
  230. package/clients/cli/commands/theme.mjs +183 -6
  231. package/clients/cli/commands/upgrade.mjs +42 -7
  232. package/clients/cli/index.mjs +1 -1
  233. package/clients/cli/lib/cli-error.mjs +2 -1
  234. package/clients/cli/lib/component-format.mjs +205 -98
  235. package/clients/cli/lib/hook-format.mjs +9 -19
  236. package/clients/cli/lib/json-shim.mjs +77 -21
  237. package/clients/cli/lib/manifest.mjs +3 -2
  238. package/clients/cli/manifest.generated.json +1 -1
  239. package/foundation/agent-docs/agent-docs.mjs +1 -1
  240. package/foundation/config/theme-state.d.mts +13 -1
  241. package/foundation/config/theme-state.mjs +47 -7
  242. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  243. package/foundation/discovery/component-discovery.d.mts +11 -0
  244. package/foundation/discovery/component-discovery.mjs +56 -8
  245. package/foundation/discovery/component-replacement.mjs +130 -1
  246. package/foundation/discovery/copied-passages.mjs +2 -1
  247. package/foundation/discovery/doc-types.mjs +4 -3
  248. package/foundation/discovery/entry-name-files.d.mts +43 -0
  249. package/foundation/discovery/entry-name-files.mjs +264 -0
  250. package/foundation/discovery/hook-discovery.d.mts +8 -2
  251. package/foundation/discovery/hook-discovery.mjs +22 -8
  252. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  253. package/foundation/discovery/icon-set-checks.mjs +2 -1
  254. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  255. package/foundation/discovery/integration-doc-files.mjs +2 -1
  256. package/foundation/discovery/package-exports.d.mts +10 -0
  257. package/foundation/discovery/package-exports.mjs +56 -3
  258. package/foundation/discovery/prop-drift.mjs +9 -9
  259. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  260. package/foundation/discovery/runner-allowlist.mjs +2 -0
  261. package/foundation/discovery/stored-component-list.d.mts +43 -0
  262. package/foundation/discovery/stored-component-list.mjs +90 -0
  263. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  264. package/foundation/discovery/stored-self-audit.mjs +38 -18
  265. package/foundation/discovery/template-adapter.d.mts +52 -0
  266. package/foundation/discovery/template-adapter.mjs +176 -12
  267. package/foundation/discovery/template-icons.mjs +2 -1
  268. package/foundation/discovery/theme-discovery.mjs +3 -2
  269. package/foundation/discovery/theme-imports.d.mts +14 -0
  270. package/foundation/discovery/theme-imports.mjs +43 -1
  271. package/foundation/discovery/theming-targets.mjs +3 -2
  272. package/foundation/doc-compiler/import.mjs +7 -1
  273. package/foundation/doc-compiler/inputs.mjs +3 -2
  274. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  275. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  276. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  277. package/foundation/env/semver.mjs +3 -1
  278. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  279. package/foundation/fonts/font-stylesheet.mjs +115 -0
  280. package/foundation/fs/cache-eviction.d.mts +21 -0
  281. package/foundation/fs/cache-eviction.mjs +73 -0
  282. package/foundation/fs/file-protection.mjs +4 -3
  283. package/foundation/fs/gather-cache.d.mts +25 -4
  284. package/foundation/fs/gather-cache.mjs +164 -55
  285. package/foundation/fs/jiti-cache.d.mts +19 -1
  286. package/foundation/fs/jiti-cache.mjs +130 -6
  287. package/foundation/fs/kept-tree.d.mts +60 -0
  288. package/foundation/fs/kept-tree.mjs +154 -0
  289. package/foundation/fs/listing-cache.d.mts +7 -0
  290. package/foundation/fs/listing-cache.mjs +10 -0
  291. package/foundation/fs/module-loader.d.mts +24 -2
  292. package/foundation/fs/module-loader.mjs +94 -21
  293. package/foundation/fs/paths.d.mts +18 -0
  294. package/foundation/fs/paths.mjs +15 -2
  295. package/foundation/identity/provider-identity.d.mts +6 -0
  296. package/foundation/identity/provider-identity.mjs +10 -1
  297. package/foundation/integrations/contribution-inventory.mjs +4 -3
  298. package/foundation/integrations/example-code.d.mts +63 -0
  299. package/foundation/integrations/example-code.mjs +416 -0
  300. package/foundation/integrations/public-imports.d.mts +9 -0
  301. package/foundation/integrations/public-imports.mjs +3 -2
  302. package/foundation/integrations/validate-contributions.mjs +17 -45
  303. package/foundation/render/embedded-files.d.mts +6 -0
  304. package/foundation/render/embedded-files.mjs +25 -5
  305. package/foundation/render/embedded-imports.d.mts +39 -7
  306. package/foundation/render/embedded-imports.mjs +66 -27
  307. package/foundation/render/file-header.d.mts +66 -0
  308. package/foundation/render/file-header.mjs +118 -0
  309. package/foundation/render/host-answer.d.mts +18 -0
  310. package/foundation/render/host-answer.mjs +46 -0
  311. package/foundation/render/host-exit.d.mts +1 -0
  312. package/foundation/render/host-exit.mjs +6 -1
  313. package/foundation/render/html-reader.d.mts +55 -2
  314. package/foundation/render/html-reader.mjs +145 -26
  315. package/foundation/render/markup-edits.d.mts +57 -0
  316. package/foundation/render/markup-edits.mjs +182 -0
  317. package/foundation/render/page-host.mjs +29 -12
  318. package/foundation/render/page-worker.mjs +121 -13
  319. package/foundation/render/rebuild.mjs +2 -1
  320. package/foundation/render/render-page.d.mts +35 -3
  321. package/foundation/render/render-page.mjs +316 -42
  322. package/foundation/render/source-block.d.mts +85 -6
  323. package/foundation/render/source-block.mjs +211 -20
  324. package/foundation/render/ts-paths.d.mts +69 -6
  325. package/foundation/render/ts-paths.mjs +326 -40
  326. package/foundation/response/error-codes.d.mts +3 -1
  327. package/foundation/response/error-codes.d.ts +1 -0
  328. package/foundation/response/error-codes.doc.mjs +12 -1
  329. package/foundation/response/error-codes.mjs +11 -1
  330. package/foundation/response/response-types.doc.mjs +2 -2
  331. package/foundation/text/compare-text.d.mts +14 -0
  332. package/foundation/text/compare-text.mjs +68 -0
  333. package/foundation/text/string-utils.d.mts +3 -2
  334. package/foundation/text/string-utils.mjs +18 -4
  335. package/foundation/text/suggest-order.d.mts +9 -0
  336. package/foundation/text/suggest-order.mjs +15 -1
  337. package/foundation/xle/expand.mjs +2 -1
  338. package/host/index.mjs +8 -6
  339. package/package.json +7 -6
@@ -8,7 +8,10 @@
8
8
  * not a page, and the system's own components say what a part is: an idea
9
9
  * whose head noun is a word of a component's name or keywords, Core's or an
10
10
  * integration's, asks for that part, unless the noun is a family word ("a data
11
- * table") or the idea lists a page's worth of pieces. Words search drops as
11
+ * table") or the idea lists a page's worth of pieces. A component named with
12
+ * its listed contents ("a side panel with an owner, a status, and a history")
13
+ * is still one part, unless the component holds records: its category declares
14
+ * a page family (a list, a table). Words search drops as
12
15
  * stopwords ("page", "screen", "app", "view") name no component, so "a calendar
13
16
  * page" asks for a page and "a calendar" for a part. A part starts from the
14
17
  * base template of the family the idea names ("an empty state for a settings
@@ -19,14 +22,20 @@
19
22
  * existing table"), unless the idea asks for a new page ("a new dashboard like
20
23
  * the existing dashboard", "clone the existing dashboard as a new page"). A
21
24
  * bare "existing" phrase that names a page ("existing reports dashboard with a
22
- * date filter") reads as the builder's own page.
25
+ * date filter") reads as the builder's own page. An idea that opens with "add"
26
+ * and says where the piece goes ("add a filter row above the table") puts it
27
+ * into a page the builder already has, so it is a change too, unless the piece
28
+ * is a page ("add a dashboard to the app") or it asks for a new page ("add a
29
+ * new dashboard").
23
30
  */
24
31
 
32
+ import {COMPONENT_CATEGORIES} from '../../../authoring/doctypes/component/categories.mjs';
25
33
  import {stem} from '../../search/search.mjs';
26
34
  import {
27
35
  HEAD_END,
28
36
  CONTAINER_PHRASE,
29
37
  PHRASE_END,
38
+ PLACE_PHRASE,
30
39
  terms,
31
40
  containersOf,
32
41
  familyWordsOf,
@@ -41,7 +50,7 @@ import {
41
50
  /**
42
51
  * How many listed pieces make an idea a page: a part is one thing with a detail
43
52
  * or two ("a status pill with a tooltip"), while three pieces, two commas
44
- * apart, describe a page.
53
+ * apart, describe a page, unless they are one component's contents.
45
54
  */
46
55
  const PAGE_PIECES = 3;
47
56
 
@@ -51,6 +60,12 @@ const PAGE_PIECES = 3;
51
60
  */
52
61
  const EXISTING = /\bexisting\b/i;
53
62
 
63
+ /**
64
+ * The word that opens an idea adding a piece to a page the builder already
65
+ * has (spec:AST-048/FR3, FR9), when the idea says where the piece goes.
66
+ */
67
+ const ADDS = /^\s*add\b/i;
68
+
54
69
  /**
55
70
  * The word that marks an idea asking for a new page ("a new dashboard", "as a
56
71
  * new page"), which is never a change to one the builder has.
@@ -60,7 +75,8 @@ const NEW = /\bnew\b/;
60
75
  /**
61
76
  * What an idea asks for (spec:AST-048/FR3): a whole `page`; a `part` of one,
62
77
  * when its head noun names one of the system's components and it lists fewer
63
- * than PAGE_PIECES pieces; or an `edit` of a page the builder already has.
78
+ * than PAGE_PIECES pieces or only that component's contents; or an `edit` of a
79
+ * page the builder already has.
64
80
  *
65
81
  * @param {string} query
66
82
  * @param {PageTemplate[]} pages
@@ -71,25 +87,198 @@ export function ideaKind(query, pages, components) {
71
87
  const text = String(query);
72
88
  const familyWords = familyWordsOf(pages);
73
89
  if (changesExistingPage(text, familyWords, components)) return 'edit';
90
+ if (addsToPage(text, familyWords, pages, components)) return 'edit';
74
91
  // The head's last word, page words included: "calendar" is the noun of "a
75
92
  // calendar", "page" the noun of "a calendar page". An overlay frame names
76
93
  // where the thing lives, not the thing: "drafts" is the noun of "drafts in
77
94
  // a modal".
78
- const head = (text.split(HEAD_END)[0] ?? '').replace(CONTAINER_PHRASE, m =>
95
+ const rawHead = text.split(HEAD_END)[0] ?? '';
96
+ const head = rawHead.replace(CONTAINER_PHRASE, m =>
79
97
  containersOf(m).size > 0 ? ' ' : m,
80
98
  );
81
- const words = (head.toLowerCase().match(/[a-z0-9]+/g) ?? []).filter(
82
- w => w.length >= 2,
83
- );
84
- const noun = stem(words[words.length - 1] ?? '');
99
+ const noun = lastNoun(head);
85
100
  if (familyWords.has(noun)) return 'page';
101
+ const holdsRecords = (/** @type {string} */ word) =>
102
+ namedComponents(word, components).some(c => namesFamily(c, familyWords));
103
+ if (
104
+ describesOnePart(text, rawHead, noun, familyWords, components) &&
105
+ !holdsRecords(noun)
106
+ )
107
+ return 'part';
86
108
  const pieces = (text.match(/,/g) ?? []).length + 1;
87
109
  if (pieces >= PAGE_PIECES) return 'page';
88
- return components.some(c => componentTerms(c).includes(noun))
110
+ const namesPart = (/** @type {string} */ word) =>
111
+ components.some(c => componentTerms(c).includes(word));
112
+ if (!namesPart(noun)) return 'page';
113
+ // A component that holds records, followed by "of", is a page of those
114
+ // records ("a list of jobs"), unless what follows names a component ("a list
115
+ // of buttons") or a page family ("a list of settings toggles").
116
+ if (!holdsRecords(noun) || !endsOnOf(text)) return 'part';
117
+ const phrase = madeOf(text);
118
+ return terms(phrase).some(t => familyWords.has(t)) ||
119
+ namesPart(lastNoun(phrase))
89
120
  ? 'part'
90
121
  : 'page';
91
122
  }
92
123
 
124
+ /**
125
+ * Whether an idea describes one part and its contents: its head names a
126
+ * component by name and ends on a word ("a side panel with a, b and c"), not
127
+ * on a comma or a colon that starts a list of peers, and no word of the idea
128
+ * names a page family. Such an idea is a part however many pieces it lists.
129
+ * @param {string} text
130
+ * @param {string} head the idea's head, before any frame is removed
131
+ * @param {string} noun
132
+ * @param {Map<string, string>} familyWords
133
+ * @param {ComponentWords[]} components
134
+ * @returns {boolean}
135
+ */
136
+ function describesOnePart(text, head, noun, familyWords, components) {
137
+ const end = text.slice(head.length).match(/^\s*([a-z]+)/i);
138
+ return (
139
+ end !== null &&
140
+ components.some(c => nameTerms(c).includes(noun)) &&
141
+ !terms(text).some(t => familyWords.has(t))
142
+ );
143
+ }
144
+
145
+ /**
146
+ * The components a word names: the one whose whole name is the word
147
+ * ("button" names Button), else every component whose name holds it.
148
+ * @param {string} word
149
+ * @param {ComponentWords[]} components
150
+ * @returns {ComponentWords[]}
151
+ */
152
+ function namedComponents(word, components) {
153
+ const whole = components.filter(c => {
154
+ const name = nameTerms(c);
155
+ return name.length === 1 && name[0] === word;
156
+ });
157
+ return whole.length > 0
158
+ ? whole
159
+ : components.filter(c => nameTerms(c).includes(word));
160
+ }
161
+
162
+ /**
163
+ * Whether a component's doc files it under a category that declares a page
164
+ * family the project has ("Table & List" declares the table family): such a
165
+ * component holds the records a page of that family shows.
166
+ * @param {ComponentWords} component
167
+ * @param {Map<string, string>} familyWords
168
+ * @returns {boolean}
169
+ */
170
+ function namesFamily(component, familyWords) {
171
+ const family = Object.hasOwn(COMPONENT_CATEGORIES, component.category ?? '')
172
+ ? COMPONENT_CATEGORIES[component.category ?? ''].pageFamily
173
+ : undefined;
174
+ return family !== undefined && [...familyWords.values()].includes(family);
175
+ }
176
+
177
+ /**
178
+ * The stem of a phrase's last word.
179
+ * @param {string} phrase
180
+ * @returns {string}
181
+ */
182
+ function lastNoun(phrase) {
183
+ const words = (phrase.toLowerCase().match(/[a-z0-9]+/g) ?? []).filter(
184
+ w => w.length >= 2,
185
+ );
186
+ return stem(words[words.length - 1] ?? '');
187
+ }
188
+
189
+ /**
190
+ * Whether an idea's head ends on "of" ("a list of jobs").
191
+ * @param {string} text
192
+ * @returns {boolean}
193
+ */
194
+ function endsOnOf(text) {
195
+ return text.match(HEAD_END)?.[0].toLowerCase() === 'of';
196
+ }
197
+
198
+ /**
199
+ * What a head that ends on "of" is made of: the phrase after "of", up to the
200
+ * next head end, without an overlay frame.
201
+ * @param {string} text
202
+ * @returns {string}
203
+ */
204
+ function madeOf(text) {
205
+ const end = text.match(HEAD_END);
206
+ const rest = text.slice((end?.index ?? 0) + (end?.[0].length ?? 0));
207
+ return (rest.split(HEAD_END)[0] ?? '').replace(CONTAINER_PHRASE, m =>
208
+ containersOf(m).size > 0 ? ' ' : m,
209
+ );
210
+ }
211
+
212
+ /**
213
+ * Whether an idea adds a piece to a page the builder already has: it opens
214
+ * with "add", says where the piece goes with a place phrase that names
215
+ * something build knows (a page family word, a page template by its whole
216
+ * name, or a component by the head word of its name:
217
+ * "above the table", "to the settings page"; not "to my project"), the
218
+ * piece's head names no page ("add a dashboard with a chart to my project"
219
+ * is a new page), and it asks for no new page.
220
+ * @param {string} text
221
+ * @param {Map<string, string>} familyWords
222
+ * @param {PageTemplate[]} pages
223
+ * @param {ComponentWords[]} components
224
+ * @returns {boolean}
225
+ */
226
+ function addsToPage(text, familyWords, pages, components) {
227
+ if (!ADDS.test(text)) return false;
228
+ const place = text.match(PLACE_PHRASE);
229
+ if (!place || place.index === undefined) return false;
230
+ const piece = text.slice(0, place.index).split(HEAD_END)[0] ?? '';
231
+ const target =
232
+ text.slice(place.index + place[0].length).split(HEAD_END)[0] ?? '';
233
+ const named = new Set(terms(target));
234
+ const known = new Set([
235
+ ...familyWords.keys(),
236
+ ...components.map(c => nameTerms(c).at(-1) ?? ''),
237
+ ]);
238
+ const namesTemplate = pages.some(page => {
239
+ const name = templateTerms(page);
240
+ return name.length > 0 && name.every(t => named.has(t));
241
+ });
242
+ return (
243
+ ([...named].some(t => known.has(t)) || namesTemplate) &&
244
+ !namesPage(piece, familyWords, pages) &&
245
+ !asksNewPage(text.toLowerCase().split(PHRASE_END), familyWords)
246
+ );
247
+ }
248
+
249
+ /**
250
+ * Whether a phrase names a page: it ends on a page family word ("add a
251
+ * dashboard"), on a word search drops, such as "page" ("add a settings
252
+ * page"), or on a page template's own name ("add a kanban board").
253
+ * @param {string} phrase
254
+ * @param {Map<string, string>} familyWords
255
+ * @param {PageTemplate[]} pages
256
+ * @returns {boolean}
257
+ */
258
+ function namesPage(phrase, familyWords, pages) {
259
+ const words = phrase.toLowerCase().match(/[a-z0-9]+/g) ?? [];
260
+ const last = words[words.length - 1] ?? '';
261
+ if (familyWords.has(stem(last)) || terms(last).length === 0) return true;
262
+ const named = new Set(terms(phrase));
263
+ return pages.some(page => {
264
+ const name = templateTerms(page);
265
+ return (
266
+ name.length > 0 &&
267
+ name.includes(stem(last)) &&
268
+ name.every(t => named.has(t))
269
+ );
270
+ });
271
+ }
272
+
273
+ /**
274
+ * The terms of a page template's own name: "kanban-board" is kanban, board.
275
+ * @param {PageTemplate} page
276
+ * @returns {string[]}
277
+ */
278
+ function templateTerms(page) {
279
+ return terms(page.name.replace(/-/g, ' '));
280
+ }
281
+
93
282
  /**
94
283
  * Whether an idea changes a page or part the builder already has: "existing"
95
284
  * in the same phrase as a word that names a family of page templates or one of
@@ -3,10 +3,12 @@
3
3
  /**
4
4
  * @file build.kit leaf — the page template to start from, and the kit around it.
5
5
  *
6
- * Every kit names a page template to START from: the page the page ranker
7
- * (rank.mjs) puts first when it has the evidence to lead, else the app shell.
8
- * The ranker is the only thing that picks the start, so one noisy signal —
9
- * search matching "site" to a gallery's "side" — cannot choose the page. A
6
+ * Every kit names a page template to START from, else the app shell. The page
7
+ * ranker (rank.mjs) orders the page templates; for a whole page the word
8
+ * weights (weights.mjs) decide page or shell and the page-pick model chooses
9
+ * the page from that list (start.mjs). Search's own matches never choose the
10
+ * start, so one noisy signal — search matching "site" to a gallery's "side" —
11
+ * cannot choose the page. A
10
12
  * template carries the page frame, the spacing, and the section rhythm; a page
11
13
  * composed from components carries none of that, so the kit never recommends
12
14
  * composing from scratch while a template exists. Next to the start it names
@@ -23,14 +23,19 @@
23
23
  * "board" picks the kanban board for a game board. Here every matched term
24
24
  * counts, weighted by how rare it is among page templates (inverse document
25
25
  * frequency), so the page that answers more of the idea — and its rarer words —
26
- * wins. Structural signals sit on top:
26
+ * wins. Structural signals sit on top. They order the ranker's list; for a
27
+ * whole page, the page-pick model in weights.mjs reads that list beside its
28
+ * own word tables and picks the start, so the start can differ from the
29
+ * ranker's first template:
27
30
  *
28
31
  * - The head noun. The words before the first "with", ":" or "," name what
29
32
  * the page is ("audit dashboard: dense table with …"); a family word there
30
33
  * outweighs the same word among the parts.
31
34
  * - The container. In "draft history in a modal", the modal is the page's
32
- * frame, and a template is its frame; container words count double, and a
33
- * container match is evidence enough to start from. Only an overlay frame
35
+ * frame, and a template is its frame; container words count double. A
36
+ * container match is evidence enough to start from only when the frame holds
37
+ * a word of the template's own family ("settings in a modal"); a frame that
38
+ * holds a part ("saved drafts in a modal") is not. Only an overlay frame
34
39
  * counts: "inside a data card" names a component the part lives in, and "in
35
40
  * an existing dashboard" names the page being changed.
36
41
  * - Phrase heads. In "side-by-side product response", "product" describes the
@@ -56,7 +61,11 @@ import {
56
61
  normalized,
57
62
  SYNONYMS_OF,
58
63
  familyWordsOf,
64
+ keywordUnits,
65
+ keywordWordsFor,
66
+ framesOf,
59
67
  } from './words.mjs';
68
+ import {compareText} from '../../../foundation/text/compare-text.mjs';
60
69
 
61
70
  /**
62
71
  * @typedef {import('./words.mjs').PageTemplate} PageTemplate
@@ -136,14 +145,17 @@ const START_TERMS = 2;
136
145
  export function rankPages(query, pages) {
137
146
  const docs = pages.map(page => {
138
147
  const [family = '', ...variantParts] = page.category.split(' - ');
148
+ const keywords = page.keywords ?? [];
149
+ const phrases = keywordUnits(keywords, terms).filter(u => u.includes(' '));
139
150
  /** @type {Record<keyof typeof FIELD_WEIGHT, string>} */
140
151
  const fields = {
141
152
  id: page.name.replace(/-/g, ' '),
142
153
  variant: variantParts.join(' - '),
143
154
  family,
144
155
  display: page.displayName,
145
- // Each keyword is its own phrase: a pair never spans two of them.
146
- keywords: (page.keywords ?? []).join(', '),
156
+ // A one-word keyword is a term like any other. A longer one gives its
157
+ // words only to an idea that names the whole phrase (keywordWordsFor).
158
+ keywords: keywords.filter(k => terms(k).length === 1).join(', '),
147
159
  description: page.description,
148
160
  };
149
161
  /** @type {Map<string, number>} */
@@ -158,7 +170,9 @@ export function rankPages(query, pages) {
158
170
  page,
159
171
  family: family.trim(),
160
172
  bag,
161
- pairs: pairsOf(Object.values(fields)),
173
+ phrases,
174
+ // Each keyword is its own phrase: a pair never spans two of them.
175
+ pairs: pairsOf([...Object.values(fields), keywords.join(', ')]),
162
176
  };
163
177
  });
164
178
 
@@ -169,27 +183,52 @@ export function rankPages(query, pages) {
169
183
  for (const {bag} of docs)
170
184
  for (const t of bag.keys()) df.set(t, (df.get(t) ?? 0) + 1);
171
185
  const n = docs.length;
172
- /** @param {string} t */
173
- const idf = t => {
174
- const d = df.get(t);
186
+ /**
187
+ * @param {string} t
188
+ * @param {number} [own] 1 when the template scored carries `t` only through
189
+ * a phrase keyword the idea names, so it counts among the templates that
190
+ * carry `t`
191
+ */
192
+ const idf = (t, own = 0) => {
193
+ const d = (df.get(t) ?? 0) + own;
175
194
  return d ? Math.log(1 + (n - d + 0.5) / (d + 0.5)) : 0;
176
195
  };
177
196
 
197
+ // How many templates of each family carry each term, for how typical of its
198
+ // family a template's descriptor is.
199
+ /** @type {Map<string, Map<string, number>>} */
200
+ const familyDf = new Map();
201
+ for (const {family, bag} of docs) {
202
+ const counts = familyDf.get(family) ?? new Map();
203
+ familyDf.set(family, counts);
204
+ for (const t of bag.keys()) counts.set(t, (counts.get(t) ?? 0) + 1);
205
+ }
206
+
178
207
  const familyOfWord = familyWordsOf(pages);
179
208
  /** @param {string[]} ts */
180
209
  const familiesIn = ts =>
181
210
  new Set(ts.filter(t => familyOfWord.has(t)).map(t => familyOfWord.get(t)));
182
211
 
183
- const queryTerms = [...new Set(terms(query))];
212
+ const queryWords = terms(query);
213
+ const queryTerms = [...new Set(queryWords)];
184
214
  const headFamilies = familiesIn(
185
215
  terms(String(query).split(HEAD_END)[0] ?? ''),
186
216
  );
187
217
  const namedFamilies = familiesIn(queryTerms);
188
218
  const modifiers = modifiersOf(query);
189
219
  const containers = containersOf(query);
220
+ const frames = framesOf(query);
190
221
 
191
222
  const ranked = docs
192
- .map(({page, family, bag, pairs}) => {
223
+ .map(({page, family, bag, phrases, pairs}) => {
224
+ // The words of the phrase keywords this idea names count as keywords.
225
+ const phraseWords = new Set(keywordWordsFor(phrases, queryWords));
226
+ /** @param {string} t */
227
+ const weightOf = t =>
228
+ Math.max(
229
+ bag.get(t) ?? 0,
230
+ phraseWords.has(t) ? FIELD_WEIGHT.keywords : 0,
231
+ );
193
232
  let score = 0;
194
233
  let hits = 0;
195
234
  let containerMatched = false;
@@ -202,7 +241,10 @@ export function rankPages(query, pages) {
202
241
  const discounted =
203
242
  modified !== undefined &&
204
243
  ![...modified].some(n => pairs.has(`${t} ${n}`));
205
- const direct = idf(t) * (bag.get(t) ?? 0) * (discounted ? MODIFIER : 1);
244
+ const direct =
245
+ idf(t, bag.has(t) ? 0 : Number(phraseWords.has(t))) *
246
+ weightOf(t) *
247
+ (discounted ? MODIFIER : 1);
206
248
  let viaSynonym = 0;
207
249
  for (const s of SYNONYMS_OF.get(t) ?? []) {
208
250
  if (queryTerms.includes(s)) continue;
@@ -217,7 +259,12 @@ export function rankPages(query, pages) {
217
259
  score += value;
218
260
  hits++;
219
261
  matched.add(t);
220
- if (containers.has(t)) containerMatched = true;
262
+ // A frame is start evidence only when it holds the template's
263
+ // family itself, not a part placed on some page.
264
+ if (
265
+ [...(frames.get(t) ?? [])].some(h => familyOfWord.get(h) === family)
266
+ )
267
+ containerMatched = true;
221
268
  }
222
269
  }
223
270
  const familyNamed = namedFamilies.has(family);
@@ -226,8 +273,12 @@ export function rankPages(query, pages) {
226
273
  else if (familyNamed) score += BODY_FAMILY;
227
274
  const base = normalized(page.name) === normalized(family);
228
275
  if (familyNamed && base) score += FAMILY_BASE;
276
+ const inFamily = familyDf.get(family);
277
+ let shared = 0;
278
+ for (const t of bag.keys()) shared += (inFamily?.get(t) ?? 1) - 1;
229
279
  return {
230
280
  name: page.name,
281
+ typical: bag.size ? shared / bag.size : 0,
231
282
  score,
232
283
  hits,
233
284
  familyNamed,
@@ -242,14 +293,15 @@ export function rankPages(query, pages) {
242
293
  (a, b) =>
243
294
  b.score - a.score ||
244
295
  a.name.split('-').length - b.name.split('-').length ||
245
- a.name.localeCompare(b.name),
296
+ compareText(a.name, b.name),
246
297
  );
247
298
  return baseFirst(ranked);
248
299
  }
249
300
 
250
301
  /**
251
302
  * Put a named family's base template ahead of the variant that outranks it,
252
- * unless the variant matched START_TERMS terms the base did not, or the base
303
+ * unless the variant matched START_TERMS terms the base did not, the idea
304
+ * places the page in the variant's frame and not the base's, or the base
253
305
  * cannot start on its own: too little score, or too few matched terms. The
254
306
  * head names the exception: a family word in the idea's head is start
255
307
  * evidence on its own — the same evidence pickStart accepts in place of a
@@ -272,8 +324,9 @@ function baseFirst(ranked) {
272
324
  ) {
273
325
  return ranked;
274
326
  }
327
+ // The frame is what a template is, and pickStart takes it as evidence.
275
328
  const own = [...top.matched].filter(t => !base.matched.has(t)).length;
276
- return own >= START_TERMS
329
+ return own >= START_TERMS || (top.containerMatched && !base.containerMatched)
277
330
  ? ranked
278
331
  : [base, ...ranked.filter(r => r !== base)];
279
332
  }
@@ -2,12 +2,13 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * The template to start from: the ready page the ranker puts first when it
6
- * has the evidence to lead, else the first fallback shell the project can
5
+ * The template to start from: for a whole page, the ready page the word
6
+ * weights and the page-pick model choose (weighStart); for a part or an edit,
7
+ * the ranker's placement; else the first fallback shell the project can
7
8
  * scaffold. Null only when the project has no page template to offer at all.
8
9
  *
9
- * `direct` means two independent signals agree: the ranker's pick is also
10
- * search's direct match. The ranker sees only ready templates, so a template
10
+ * `direct` means two independent signals agree: the start is also search's
11
+ * direct match. The ranker sees only ready templates, so a template
11
12
  * still marked not ready is never the start; when search matched one directly
12
13
  * the reason names it, so the reader knows why the kit starts elsewhere.
13
14
  *
@@ -1,8 +1,10 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file The page template a kit starts from: the page ranker's pick when it has
5
- * the evidence to lead, the template a part lives in, else the app shell.
4
+ * @file The page template a kit starts from: for a whole page, the page the
5
+ * word weights and the page-pick model choose from the ranker's list; for a
6
+ * part or an edit, where the ranker's placement rules put it; else the app
7
+ * shell.
6
8
  */
7
9
 
8
10
  import {loadWeights} from '../_adapter.mjs';
@@ -113,12 +115,13 @@ function liftFromShell(ranked, kind, catalog, idea) {
113
115
  }
114
116
 
115
117
  /**
116
- * The template to start from: the ready page the ranker puts first when it
117
- * has the evidence to lead, else the first fallback shell the project can
118
+ * The template to start from: for a whole page, the ready page the word
119
+ * weights and the page-pick model choose (weighStart); for a part or an edit,
120
+ * the ranker's placement; else the first fallback shell the project can
118
121
  * scaffold. Null only when the project has no page template to offer at all.
119
122
  *
120
- * `direct` means two independent signals agree: the ranker's pick is also
121
- * search's direct match. The ranker sees only ready templates, so a template
123
+ * `direct` means two independent signals agree: the start is also search's
124
+ * direct match. The ranker sees only ready templates, so a template
122
125
  * still marked not ready is never the start; when search matched one directly
123
126
  * the reason names it, so the reader knows why the kit starts elsewhere.
124
127
  *
@@ -149,8 +152,9 @@ export function chooseStart(ranked, kind, pages, directMatch, catalog, idea) {
149
152
  : place[0].toUpperCase() + place.slice(1);
150
153
  const proposed = pickStart(ranked, kind);
151
154
  // The checked-in word weights (weights.mjs), blended with the ranker's
152
- // scores, decide the start of a whole page. A part or an edit starts where
153
- // the ranker's placement rules put it (spec:AST-048/FR3).
155
+ // scores, decide the start of a whole page, so it can differ from the
156
+ // ranker's own pick, its head-noun family included. A part or an edit starts
157
+ // where the ranker's placement rules put it (spec:AST-048/FR3).
154
158
  const weighed =
155
159
  kind === 'page'
156
160
  ? weighStart(idea, ranked, proposed, catalog, {
@@ -41,8 +41,9 @@ export function weighStart(idea: string, ranked: import("./rank.mjs").RankedPage
41
41
  newPage?: boolean;
42
42
  }): string | null | undefined;
43
43
  /**
44
- * The blend's scores: the app shell's, and the best non-shell template with
45
- * its score and the runner-up's. Null without weights.
44
+ * The call model's scores: the app shell's, the best non-shell template's and
45
+ * the runner-up's, with the page to start from (the pick model's choice when
46
+ * the file has one, else the call model's best page). Null without weights.
46
47
  * @param {string} idea
47
48
  * @param {import('./rank.mjs').RankedPage[]} ranked
48
49
  * @param {import('./rank.mjs').RankedPage | null} pick
@@ -51,7 +52,7 @@ export function weighStart(idea: string, ranked: import("./rank.mjs").RankedPage
51
52
  */
52
53
  export function blendSummary(idea: string, ranked: import("./rank.mjs").RankedPage[], pick: import("./rank.mjs").RankedPage | null, catalog: DescribedTemplate[], weights: WeightsFile | null): {
53
54
  shell: number;
54
- best: string;
55
+ best: string | null;
55
56
  bestScore: number;
56
57
  secondScore: number;
57
58
  } | null;
@@ -86,10 +87,22 @@ export type WeightsFile = {
86
87
  * with the ranker second), then one for `SHELL`
87
88
  */
88
89
  blend: number[];
90
+ /**
91
+ * the pick
92
+ * model: its own tables and blend numbers, used only to choose which page
93
+ * starts once the call model (the top-level tables and blend) has called a
94
+ * page. Without it, one model does both.
95
+ */
96
+ pick?: {
97
+ tables: WeightTable[];
98
+ blend: number[];
99
+ } | undefined;
89
100
  };
90
101
  export type DescribedTemplate = {
91
102
  name: string;
92
103
  displayName?: string | undefined;
93
104
  category?: string | undefined;
94
105
  keywords?: string[] | undefined;
106
+ description?: string | undefined;
107
+ components?: string[] | undefined;
95
108
  };