@astryxdesign/cli 0.7.16 → 0.7.17-canary.g49a475f

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 (354) 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.d.mts +4 -2
  13. package/api/build/kit/rank.mjs +125 -24
  14. package/api/build/kit/start.d.mts +5 -4
  15. package/api/build/kit/start.mjs +12 -8
  16. package/api/build/kit/weights.d.mts +39 -3
  17. package/api/build/kit/weights.json +1 -1
  18. package/api/build/kit/weights.mjs +340 -43
  19. package/api/build/kit/word-model.d.mts +23 -0
  20. package/api/build/kit/word-model.mjs +46 -0
  21. package/api/build/kit/words.d.mts +48 -0
  22. package/api/build/kit/words.mjs +90 -1
  23. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  24. package/api/component/list/list.d.mts +1 -1
  25. package/api/component/list/list.mjs +48 -6
  26. package/api/discover/_adapter.d.mts +1 -1
  27. package/api/discover/search/search.mjs +3 -2
  28. package/api/docs/_adapter.d.mts +26 -2
  29. package/api/docs/_adapter.mjs +219 -6
  30. package/api/docs/docs.d.mts +3 -0
  31. package/api/docs/docs.doc.mjs +7 -1
  32. package/api/docs/docs.mjs +12 -0
  33. package/api/docs/docs.type.d.mts +5 -0
  34. package/api/docs/docs.type.mjs +2 -0
  35. package/api/docs/node/node.mjs +1 -1
  36. package/api/doctor/_adapter.d.mts +27 -5
  37. package/api/doctor/_adapter.mjs +83 -10
  38. package/api/doctor/built-checks.mjs +40 -14
  39. package/api/doctor/doctor.d.mts +4 -3
  40. package/api/doctor/doctor.mjs +14 -7
  41. package/api/doctor/theme-checks.mjs +121 -17
  42. package/api/icon/_records.mjs +2 -1
  43. package/api/index.d.mts +2 -0
  44. package/api/index.mjs +2 -0
  45. package/api/integration/_adapter.d.mts +44 -0
  46. package/api/integration/_adapter.mjs +77 -1
  47. package/api/integration/authoring-checks.mjs +6 -6
  48. package/api/integration/example-scope.d.mts +14 -0
  49. package/api/integration/example-scope.mjs +44 -0
  50. package/api/integration/example-scope.type.d.mts +29 -0
  51. package/api/integration/example-scope.type.mjs +25 -0
  52. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  53. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  54. package/api/integration/validate-integration.mjs +19 -1
  55. package/api/integration/validate-integration.type.d.mts +9 -0
  56. package/api/integration/validate-integration.type.mjs +1 -1
  57. package/api/integration/validateIntegration.doc.mjs +1 -1
  58. package/api/render/_adapter.mjs +591 -195
  59. package/api/render/render.doc.mjs +11 -3
  60. package/api/render/render.type.d.mts +52 -0
  61. package/api/render/render.type.mjs +31 -1
  62. package/api/search/ORDERING.md +1 -1
  63. package/api/search/_adapter.d.mts +9 -0
  64. package/api/search/_adapter.mjs +85 -0
  65. package/api/search/_candidate-score.mjs +51 -32
  66. package/api/search/_fit-order.mjs +3 -3
  67. package/api/search/_gather-components.d.mts +3 -2
  68. package/api/search/_gather-components.mjs +12 -3
  69. package/api/search/_lexical.d.mts +5 -0
  70. package/api/search/_lexical.mjs +8 -2
  71. package/api/search/_result.d.mts +11 -9
  72. package/api/search/_result.mjs +4 -4
  73. package/api/search/_score.d.mts +6 -1
  74. package/api/search/_score.mjs +15 -3
  75. package/api/search/search-index.mjs +7 -1
  76. package/api/search/search.d.mts +1 -1
  77. package/api/theme/_adapter.mjs +12 -1
  78. package/api/theme/build/build.d.mts +75 -0
  79. package/api/theme/build/build.mjs +243 -58
  80. package/api/theme/build/font-warning.d.mts +7 -0
  81. package/api/theme/build/font-warning.mjs +17 -0
  82. package/api/theme/theme.type.d.mts +10 -0
  83. package/api/theme/theme.type.mjs +7 -1
  84. package/api/theme-edit/_adapter.d.mts +63 -2
  85. package/api/theme-edit/_adapter.mjs +771 -57
  86. package/api/theme-edit/_check.d.mts +40 -22
  87. package/api/theme-edit/_check.mjs +2029 -336
  88. package/api/theme-edit/_color.d.mts +10 -0
  89. package/api/theme-edit/_color.mjs +49 -1
  90. package/api/theme-edit/_compiler.mjs +9 -0
  91. package/api/theme-edit/_context.d.mts +3 -3
  92. package/api/theme-edit/_context.mjs +111 -48
  93. package/api/theme-edit/_css.d.mts +14 -0
  94. package/api/theme-edit/_css.mjs +46 -1
  95. package/api/theme-edit/_edit.d.mts +18 -4
  96. package/api/theme-edit/_edit.mjs +1685 -155
  97. package/api/theme-edit/_how-commands.d.mts +65 -0
  98. package/api/theme-edit/_how-commands.mjs +633 -1
  99. package/api/theme-edit/_how-question.d.mts +84 -0
  100. package/api/theme-edit/_how-question.mjs +5124 -281
  101. package/api/theme-edit/_how.mjs +140 -29
  102. package/api/theme-edit/_marks.d.mts +31 -5
  103. package/api/theme-edit/_marks.mjs +57 -5
  104. package/api/theme-edit/_name-rule.d.mts +11 -0
  105. package/api/theme-edit/_name-rule.mjs +12 -0
  106. package/api/theme-edit/_normal.d.mts +257 -0
  107. package/api/theme-edit/_normal.mjs +1252 -0
  108. package/api/theme-edit/_palette.mjs +10 -4
  109. package/api/theme-edit/_parts.d.mts +10 -1
  110. package/api/theme-edit/_parts.mjs +179 -3
  111. package/api/theme-edit/_preview-app.d.mts +7 -1
  112. package/api/theme-edit/_preview-app.mjs +515 -148
  113. package/api/theme-edit/_preview.d.mts +100 -14
  114. package/api/theme-edit/_preview.mjs +549 -137
  115. package/api/theme-edit/_settings.d.mts +347 -30
  116. package/api/theme-edit/_settings.mjs +2971 -327
  117. package/api/theme-edit/_tables.d.mts +6 -0
  118. package/api/theme-edit/_tables.mjs +44 -1
  119. package/api/theme-edit/_vet.d.mts +18 -0
  120. package/api/theme-edit/_vet.mjs +32 -0
  121. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  122. package/api/theme-edit/theme-edit.type.mjs +4 -1
  123. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  124. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  125. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  126. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  128. package/api/upgrade/run/run.mjs +4 -3
  129. package/assets/codemods/integration-discovery.mjs +2 -1
  130. package/assets/codemods/run-codemod.mjs +87 -7
  131. package/assets/codemods/transforms/next/index.mjs +11 -1
  132. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  133. package/assets/component-list.generated.json +1 -0
  134. package/assets/docs/author-a-theme.doc.mjs +1 -0
  135. package/assets/docs/theme.doc.dense.mjs +2 -2
  136. package/assets/docs/theme.doc.mjs +1 -1
  137. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  138. package/assets/docs/tree/checks.doc.mjs +1 -1
  139. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  140. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  141. package/assets/docs/tree/single-component.doc.mjs +4 -0
  142. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  143. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  144. package/assets/docs/use-a-theme.doc.mjs +1 -1
  145. package/assets/docs.generated.json +2 -2
  146. package/assets/search-catalog.generated.json +2 -0
  147. package/assets/self-audit.generated.json +1 -1
  148. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  149. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  150. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  151. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  152. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  153. package/assets/templates/components.generated.json +1 -1
  154. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  155. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  156. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  157. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  158. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  159. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  160. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  161. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  162. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  163. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  164. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  165. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  166. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  167. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  168. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  169. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  170. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  171. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  172. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  173. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  174. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  175. package/assets/templates/pages/ide/page.tsx +24 -2
  176. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  177. package/assets/templates/pages/library/template.doc.mjs +4 -1
  178. package/assets/templates/pages/login/template.doc.mjs +2 -1
  179. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  180. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  181. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  182. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  183. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  184. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  185. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  186. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  187. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  188. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  189. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  190. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  191. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  192. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  193. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  194. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  195. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  196. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  197. package/assets/theme.template.ts +6 -0
  198. package/authoring/debug/parse.d.mts +3 -3
  199. package/authoring/doctypes/_schema.d.mts +3 -3
  200. package/authoring/doctypes/command/command.doc.mjs +1 -1
  201. package/authoring/doctypes/component/categories.d.mts +37 -0
  202. package/authoring/doctypes/component/categories.mjs +54 -0
  203. package/authoring/doctypes/template/template.doc.mjs +1 -1
  204. package/authoring/doctypes/template/type.ts +9 -0
  205. package/authoring/example/example.doc.d.mts +12 -0
  206. package/authoring/example/example.doc.mjs +69 -0
  207. package/authoring/example/preview.d.mts +92 -0
  208. package/authoring/example/preview.mjs +994 -0
  209. package/authoring/example/type.ts +102 -0
  210. package/authoring/index.d.mts +1 -0
  211. package/authoring/index.d.ts +12 -0
  212. package/authoring/index.mjs +3 -1
  213. package/clients/cli/bin/astryx.mjs +6 -9
  214. package/clients/cli/build-id.generated.json +1 -1
  215. package/clients/cli/commands/component.doc.mjs +1 -1
  216. package/clients/cli/commands/component.mjs +22 -3
  217. package/clients/cli/commands/docs.doc.mjs +7 -1
  218. package/clients/cli/commands/docs.mjs +3 -1
  219. package/clients/cli/commands/doctor.mjs +32 -14
  220. package/clients/cli/commands/experimental/render.mjs +42 -1
  221. package/clients/cli/commands/experimental/theme.mjs +163 -28
  222. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  223. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  224. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  225. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  226. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  227. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  228. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  229. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  230. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  231. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  232. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  233. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  234. package/clients/cli/commands/search.doc.mjs +2 -1
  235. package/clients/cli/commands/search.mjs +6 -1
  236. package/clients/cli/commands/template.mjs +4 -2
  237. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  238. package/clients/cli/commands/theme.doc.mjs +1 -1
  239. package/clients/cli/commands/theme.mjs +209 -8
  240. package/clients/cli/commands/upgrade.mjs +42 -7
  241. package/clients/cli/index.mjs +1 -1
  242. package/clients/cli/lib/cli-error.mjs +2 -1
  243. package/clients/cli/lib/component-format.mjs +205 -98
  244. package/clients/cli/lib/hook-format.mjs +9 -19
  245. package/clients/cli/lib/json-shim.mjs +77 -21
  246. package/clients/cli/lib/manifest.mjs +3 -2
  247. package/clients/cli/manifest.generated.json +1 -1
  248. package/foundation/agent-docs/agent-docs.mjs +1 -1
  249. package/foundation/config/theme-state.d.mts +13 -1
  250. package/foundation/config/theme-state.mjs +47 -7
  251. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  252. package/foundation/discovery/component-discovery.d.mts +11 -0
  253. package/foundation/discovery/component-discovery.mjs +56 -8
  254. package/foundation/discovery/component-replacement.mjs +130 -1
  255. package/foundation/discovery/copied-passages.mjs +2 -1
  256. package/foundation/discovery/doc-types.mjs +4 -3
  257. package/foundation/discovery/entry-name-files.d.mts +43 -0
  258. package/foundation/discovery/entry-name-files.mjs +264 -0
  259. package/foundation/discovery/hook-discovery.d.mts +8 -2
  260. package/foundation/discovery/hook-discovery.mjs +22 -8
  261. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  262. package/foundation/discovery/icon-set-checks.mjs +2 -1
  263. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  264. package/foundation/discovery/integration-doc-files.mjs +2 -1
  265. package/foundation/discovery/package-exports.d.mts +10 -0
  266. package/foundation/discovery/package-exports.mjs +56 -3
  267. package/foundation/discovery/prop-drift.mjs +9 -9
  268. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  269. package/foundation/discovery/runner-allowlist.mjs +2 -0
  270. package/foundation/discovery/stored-component-list.d.mts +43 -0
  271. package/foundation/discovery/stored-component-list.mjs +90 -0
  272. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  273. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  274. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  275. package/foundation/discovery/stored-self-audit.mjs +38 -18
  276. package/foundation/discovery/template-adapter.d.mts +52 -0
  277. package/foundation/discovery/template-adapter.mjs +176 -12
  278. package/foundation/discovery/template-icons.mjs +2 -1
  279. package/foundation/discovery/theme-discovery.mjs +3 -2
  280. package/foundation/discovery/theme-imports.d.mts +14 -0
  281. package/foundation/discovery/theme-imports.mjs +43 -1
  282. package/foundation/discovery/theming-targets.mjs +3 -2
  283. package/foundation/doc-compiler/import.mjs +7 -1
  284. package/foundation/doc-compiler/inputs.mjs +3 -2
  285. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  286. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  287. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  288. package/foundation/env/semver.mjs +3 -1
  289. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  290. package/foundation/fonts/font-stylesheet.mjs +115 -0
  291. package/foundation/fs/cache-eviction.d.mts +21 -0
  292. package/foundation/fs/cache-eviction.mjs +73 -0
  293. package/foundation/fs/file-protection.mjs +4 -3
  294. package/foundation/fs/gather-cache.d.mts +25 -4
  295. package/foundation/fs/gather-cache.mjs +164 -55
  296. package/foundation/fs/jiti-cache.d.mts +19 -1
  297. package/foundation/fs/jiti-cache.mjs +130 -6
  298. package/foundation/fs/kept-tree.d.mts +60 -0
  299. package/foundation/fs/kept-tree.mjs +154 -0
  300. package/foundation/fs/listing-cache.d.mts +7 -0
  301. package/foundation/fs/listing-cache.mjs +10 -0
  302. package/foundation/fs/module-loader.d.mts +24 -2
  303. package/foundation/fs/module-loader.mjs +94 -21
  304. package/foundation/fs/paths.d.mts +18 -0
  305. package/foundation/fs/paths.mjs +15 -2
  306. package/foundation/identity/provider-identity.d.mts +6 -0
  307. package/foundation/identity/provider-identity.mjs +10 -1
  308. package/foundation/integrations/contribution-inventory.mjs +4 -3
  309. package/foundation/integrations/example-code.d.mts +63 -0
  310. package/foundation/integrations/example-code.mjs +416 -0
  311. package/foundation/integrations/public-imports.d.mts +9 -0
  312. package/foundation/integrations/public-imports.mjs +3 -2
  313. package/foundation/integrations/validate-contributions.mjs +17 -45
  314. package/foundation/render/embedded-files.d.mts +6 -0
  315. package/foundation/render/embedded-files.mjs +25 -5
  316. package/foundation/render/embedded-imports.d.mts +39 -7
  317. package/foundation/render/embedded-imports.mjs +66 -27
  318. package/foundation/render/file-header.d.mts +66 -0
  319. package/foundation/render/file-header.mjs +118 -0
  320. package/foundation/render/host-answer.d.mts +18 -0
  321. package/foundation/render/host-answer.mjs +46 -0
  322. package/foundation/render/host-exit.d.mts +1 -0
  323. package/foundation/render/host-exit.mjs +6 -1
  324. package/foundation/render/html-reader.d.mts +55 -2
  325. package/foundation/render/html-reader.mjs +145 -26
  326. package/foundation/render/markup-edits.d.mts +57 -0
  327. package/foundation/render/markup-edits.mjs +182 -0
  328. package/foundation/render/page-host.mjs +29 -12
  329. package/foundation/render/page-worker.mjs +121 -13
  330. package/foundation/render/picture-chrome.d.mts +4 -0
  331. package/foundation/render/picture-chrome.mjs +185 -0
  332. package/foundation/render/picture-playwright.d.mts +4 -0
  333. package/foundation/render/picture-playwright.mjs +34 -0
  334. package/foundation/render/rebuild.mjs +2 -1
  335. package/foundation/render/render-page.d.mts +35 -3
  336. package/foundation/render/render-page.mjs +316 -42
  337. package/foundation/render/source-block.d.mts +85 -6
  338. package/foundation/render/source-block.mjs +211 -20
  339. package/foundation/render/ts-paths.d.mts +69 -6
  340. package/foundation/render/ts-paths.mjs +326 -40
  341. package/foundation/response/error-codes.d.mts +3 -1
  342. package/foundation/response/error-codes.d.ts +1 -0
  343. package/foundation/response/error-codes.doc.mjs +12 -1
  344. package/foundation/response/error-codes.mjs +11 -1
  345. package/foundation/response/response-types.doc.mjs +2 -2
  346. package/foundation/text/compare-text.d.mts +14 -0
  347. package/foundation/text/compare-text.mjs +68 -0
  348. package/foundation/text/string-utils.d.mts +3 -2
  349. package/foundation/text/string-utils.mjs +18 -4
  350. package/foundation/text/suggest-order.d.mts +9 -0
  351. package/foundation/text/suggest-order.mjs +15 -1
  352. package/foundation/xle/expand.mjs +2 -1
  353. package/host/index.mjs +8 -6
  354. package/package.json +7 -6
@@ -673,7 +673,7 @@ export function generateCompressedIndex(
673
673
  } else {
674
674
  lines.push("- Style with component props first, then tokens (var(--color-*|--spacing-*|--radius-*)). No raw hex/px. No StyleX/Tailwind compiler here — don't use xstyle/utility classes directly. Some templates use StyleX and need a compiler plugin; see `astryx docs styling-overview`.");
675
675
  }
676
- lines.push('- THEMES: palettes and custom colors go through the theme, never :root overrides. To make or change a theme (colors, fonts, corners, spacing, a look from a picture), prefer the experimental theme editor over hand-written theme files: `astryx experimental theme editor new <name> --like neutral`, then `editor set <name> <thing> <value>` or `editor how "<what you want>"`; wire it with `astryx theme add <name>`; after each change look at it with `astryx experimental theme editor show <name> --png` and open the PNGs it writes (changes nothing in the app); a theme change is not done until you have looked at the pictures. In code, extend an imported theme to customize it; `theme eject <slug>` only forks source. See `astryx docs theme`.');
676
+ lines.push('- THEMES: palettes and custom colors go through the theme, never :root overrides; so does a denser or roomier app (`editor set <name> spacing tight`), never gap and padding changes page by page. No app yet: `astryx experimental theme preview app <dir>` makes a starter app that shows the theme. To make or change a theme (colors, fonts, corners, spacing, a look from a picture), prefer the experimental theme editor over hand-written theme files: `astryx experimental theme editor new <name> --like neutral`, then `editor set <name> <thing> <value>` or `editor how "<what you want>"`; wire it with `astryx theme add <name>`; after each change look at it with `astryx experimental theme editor show <name> --png` (takes pictures of real components) and open the PNGs it writes; a theme change is not done until you have looked at the pictures. In code, extend an imported theme to customize it; `theme eject <slug>` only forks source. See `astryx docs theme`.');
677
677
  // Self-check — post-generation pass. Validated via vibe tests (internal/vibe-tests/
678
678
  // prompt-purity-test): on complex multi-step UIs the rules above alone still leave raw
679
679
  // CSS in ~11-13% of runs; a re-read-and-fix pass cuts that ~4x at negligible token cost.
@@ -86,14 +86,21 @@ export function readThemeState(cwd?: string): ThemeState;
86
86
  * @property {string} stylesheetFile
87
87
  * @property {string} [fontStylesheetFile]
88
88
  * @property {'bundled'|'package'|'local'} source
89
+ * @property {'light'|'dark'} [mode] the one color mode its built module
90
+ * exports; absent for a theme with both modes
89
91
  */
90
92
  /**
91
93
  * Render one generated module from final resolved state.
92
94
  * @param {ResolvedAppTheme[]} themes
93
95
  * @param {string} defaultSlug
94
96
  * @param {boolean} typescript
97
+ * @param {{keepModes?: boolean}} [options] `keepModes`: the module has
98
+ * exported `themeModes` before, so it keeps exporting it (empty when no
99
+ * theme has one mode), as the app's wiring imports it
95
100
  */
96
- export function renderThemeModule(themes: ResolvedAppTheme[], defaultSlug: string, typescript: boolean): string;
101
+ export function renderThemeModule(themes: ResolvedAppTheme[], defaultSlug: string, typescript: boolean, { keepModes }?: {
102
+ keepModes?: boolean;
103
+ }): string;
97
104
  /**
98
105
  * Resolve a project-relative import from the generated module to a local file.
99
106
  * @param {string} moduleFile
@@ -167,4 +174,9 @@ export type ResolvedAppTheme = {
167
174
  stylesheetFile: string;
168
175
  fontStylesheetFile?: string | undefined;
169
176
  source: "bundled" | "package" | "local";
177
+ /**
178
+ * the one color mode its built module
179
+ * exports; absent for a theme with both modes
180
+ */
181
+ mode?: "light" | "dark" | undefined;
170
182
  };
@@ -138,8 +138,7 @@ export function projectUsesTypeScript(projectDir) {
138
138
  .readdirSync(projectDir, {withFileTypes: true})
139
139
  .some(
140
140
  entry =>
141
- entry.isFile() &&
142
- /^tsconfig(?:\.[^.]+)*\.json$/u.test(entry.name),
141
+ entry.isFile() && /^tsconfig(?:\.[^.]+)*\.json$/u.test(entry.name),
143
142
  );
144
143
  } catch {
145
144
  return false;
@@ -226,7 +225,9 @@ function validThemeRecord(value, label, source = '') {
226
225
  */
227
226
  export function parseThemeModuleRecord(source, label = 'theme module') {
228
227
  if (!source.includes(THEME_MODULE_MARKER)) {
229
- throw new ThemeStateError(`${label} does not carry the Astryx generated marker.`);
228
+ throw new ThemeStateError(
229
+ `${label} does not carry the Astryx generated marker.`,
230
+ );
230
231
  }
231
232
  const recordLines = source
232
233
  .split(/\r?\n/u)
@@ -276,7 +277,9 @@ export function resolveThemeModule(projectDir, {forWrite = false} = {}) {
276
277
  throw new ThemeStateError(
277
278
  `More than one generated theme module exists: ${generated
278
279
  .map(file => projectPath(path.relative(projectDir, file)))
279
- .join(', ')}. Keep one and remove the others before running the command again.`,
280
+ .join(
281
+ ', ',
282
+ )}. Keep one and remove the others before running the command again.`,
280
283
  );
281
284
  }
282
285
  const file = generated[0] ?? candidates[0];
@@ -391,6 +394,8 @@ export function readThemeState(cwd = process.cwd()) {
391
394
  * @property {string} stylesheetFile
392
395
  * @property {string} [fontStylesheetFile]
393
396
  * @property {'bundled'|'package'|'local'} source
397
+ * @property {'light'|'dark'} [mode] the one color mode its built module
398
+ * exports; absent for a theme with both modes
394
399
  */
395
400
 
396
401
  /**
@@ -398,8 +403,16 @@ export function readThemeState(cwd = process.cwd()) {
398
403
  * @param {ResolvedAppTheme[]} themes
399
404
  * @param {string} defaultSlug
400
405
  * @param {boolean} typescript
406
+ * @param {{keepModes?: boolean}} [options] `keepModes`: the module has
407
+ * exported `themeModes` before, so it keeps exporting it (empty when no
408
+ * theme has one mode), as the app's wiring imports it
401
409
  */
402
- export function renderThemeModule(themes, defaultSlug, typescript) {
410
+ export function renderThemeModule(
411
+ themes,
412
+ defaultSlug,
413
+ typescript,
414
+ {keepModes = false} = {},
415
+ ) {
403
416
  if (!themes.some(theme => theme.slug === defaultSlug)) {
404
417
  // The record's default names no added theme; choosing an added one as the
405
418
  // default rewrites the record.
@@ -418,7 +431,14 @@ export function renderThemeModule(themes, defaultSlug, typescript) {
418
431
  const entries = [];
419
432
  /** @type {Record<string, string>} */
420
433
  const owners = {};
434
+ /** The one color mode of each theme that has one only. */
435
+ /** @type {string[]} */
436
+ const modes = [];
421
437
  themes.forEach((theme, index) => {
438
+ if (theme.mode)
439
+ modes.push(
440
+ ` ${JSON.stringify(theme.slug)}: ${JSON.stringify(theme.mode)},`,
441
+ );
422
442
  const local = `_astryxTheme${index}`;
423
443
  imports.push(
424
444
  `import {${theme.exportName} as ${local}} from ${JSON.stringify(theme.module)};`,
@@ -430,7 +450,10 @@ export function renderThemeModule(themes, defaultSlug, typescript) {
430
450
  entries.push(` ${JSON.stringify(theme.slug)}: ${local},`);
431
451
  owners[theme.slug] = theme.owner;
432
452
  });
433
- const record = JSON.stringify({themes: owners, defaultThemeSlug: defaultSlug});
453
+ const record = JSON.stringify({
454
+ themes: owners,
455
+ defaultThemeSlug: defaultSlug,
456
+ });
434
457
  return `/**\n * ${THEME_MODULE_MARKER}\n * ${THEME_RECORD_MARKER} ${record}\n */\n\n${imports.join(
435
458
  '\n',
436
459
  )}\n\nexport const themes = {\n${entries.join('\n')}\n}${
@@ -439,7 +462,19 @@ export function renderThemeModule(themes, defaultSlug, typescript) {
439
462
  typescript ? 'export type ThemeSlug = keyof typeof themes;\n' : ''
440
463
  }\nexport const defaultThemeSlug${
441
464
  typescript ? ': keyof typeof themes' : ''
442
- } = ${JSON.stringify(defaultSlug)};\n`;
465
+ } = ${JSON.stringify(defaultSlug)};\n${
466
+ // When an added theme has one color mode: `Theme`'s `mode` for each
467
+ // such theme, so the app follows the selected one; kept (empty) once the
468
+ // module has exported it, as the app's wiring imports it. A record of
469
+ // two-mode themes that never had one writes the module as before.
470
+ modes.length > 0 || keepModes
471
+ ? `\nexport const themeModes${
472
+ typescript
473
+ ? `: Partial<Record<keyof typeof themes, 'light' | 'dark'>>`
474
+ : ''
475
+ } = {${modes.length > 0 ? `\n${modes.join('\n')}\n` : ''}};\n`
476
+ : ''
477
+ }`;
443
478
  }
444
479
 
445
480
  /**
@@ -491,6 +526,11 @@ export function planThemeAppWrite(state, themes, defaultSlug, resolvedThemes) {
491
526
  entries,
492
527
  defaultSlug,
493
528
  module.typescript,
529
+ {
530
+ keepModes: /\bexport const themeModes\b/.test(
531
+ String(module.expectedOriginal ?? ''),
532
+ ),
533
+ },
494
534
  );
495
535
  return {
496
536
  module,
@@ -43,6 +43,7 @@ export const AUTHORING_SELF_DOCS = [
43
43
  'debug/debug.doc.mjs',
44
44
  'gap-report/gap-report.doc.mjs',
45
45
  'discover/discover.doc.mjs',
46
+ 'example/example.doc.mjs',
46
47
  'codemod/codemod.doc.mjs',
47
48
  'identity/identity.doc.mjs',
48
49
  'doctypes/base/graph-fields.doc.mjs',
@@ -33,6 +33,17 @@ export function familyMember(docs: any, name: string): any;
33
33
  * @returns {Record<string, string[]>}
34
34
  */
35
35
  export function discoverComponents(coreDir: string): Record<string, string[]>;
36
+ /**
37
+ * The Core component names `keep` accepts, in discovery order. Each name is
38
+ * listed exactly when {@link discoverComponents} lists it, but no doc is read
39
+ * for a name `keep` rejects, so a check for one name is cheap.
40
+ * @param {string} coreDir
41
+ * @param {(name: string) => boolean} keep
42
+ * @param {Set<string>} [tops] the top folders of `src` that can hold a name
43
+ * `keep` accepts; the others are not read
44
+ * @returns {string[]}
45
+ */
46
+ export function discoverComponentNamesWhere(coreDir: string, keep: (name: string) => boolean, tops?: Set<string>): string[];
36
47
  /**
37
48
  * Find the .doc.mjs file for a component.
38
49
  * For sub-components (e.g. StackItem), returns the parent's .doc.mjs
@@ -18,6 +18,10 @@ import {
18
18
  import {existsCaseExact} from '../fs/paths.mjs';
19
19
  import {CORE_PROVIDER_ID} from '../identity/providers.mjs';
20
20
  import {loadComponentDoc} from './component-loader.mjs';
21
+ import {
22
+ checkedComponentList,
23
+ storedComponentList,
24
+ } from './stored-component-list.mjs';
21
25
  import {
22
26
  HAS_COMPUTED,
23
27
  moduleExportSource,
@@ -26,6 +30,7 @@ import {
26
30
  } from './module-exports.mjs';
27
31
  import {inspectPackageExport, sourceExportTarget} from './package-exports.mjs';
28
32
  import {babelParser} from '../runtime/lazy-dependencies.mjs';
33
+ import {compareText} from '../text/compare-text.mjs';
29
34
 
30
35
  const SKIP_DIRS = new Set(['hooks', 'utils', '__tests__', 'node_modules']);
31
36
 
@@ -371,20 +376,44 @@ export function familyMember(docs, name) {
371
376
  export function discoverComponents(coreDir) {
372
377
  // The component matcher calls this for each name it resolves, so one
373
378
  // operation reads the docs once. Each caller gets its own copy to change.
374
- const found = oncePerListing(`components\0${coreDir}`, () =>
375
- readComponentGroups(coreDir),
376
- );
379
+ // The Core the CLI was published with, unchanged, has its list stored.
380
+ const found = oncePerListing(`components\0${coreDir}`, () => {
381
+ const stored = storedComponentList(coreDir)?.groups;
382
+ return stored
383
+ ? inGroupOrder(
384
+ Object.entries(stored).map(([key, values]) => ({key, values})),
385
+ )
386
+ : readComponentGroups(coreDir);
387
+ });
377
388
  return Object.fromEntries(
378
389
  Object.entries(found).map(([key, names]) => [key, [...names]]),
379
390
  );
380
391
  }
381
392
 
393
+ /**
394
+ * The Core component names `keep` accepts, in discovery order. Each name is
395
+ * listed exactly when {@link discoverComponents} lists it, but no doc is read
396
+ * for a name `keep` rejects, so a check for one name is cheap.
397
+ * @param {string} coreDir
398
+ * @param {(name: string) => boolean} keep
399
+ * @param {Set<string>} [tops] the top folders of `src` that can hold a name
400
+ * `keep` accepts; the others are not read
401
+ * @returns {string[]}
402
+ */
403
+ export function discoverComponentNamesWhere(coreDir, keep, tops) {
404
+ return Object.values(readComponentGroups(coreDir, keep, tops)).flat();
405
+ }
406
+
382
407
  /**
383
408
  * The component groups under `coreDir`, read from disk.
384
409
  * @param {string} coreDir
410
+ * @param {(name: string) => boolean} [keep] the names to read; the others
411
+ * are left out
412
+ * @param {Set<string>} [tops] the top folders to read, when only these can
413
+ * hold a name `keep` accepts
385
414
  * @returns {Record<string, string[]>}
386
415
  */
387
- function readComponentGroups(coreDir) {
416
+ function readComponentGroups(coreDir, keep = () => true, tops) {
388
417
  const srcDir = path.join(coreDir, 'src');
389
418
  /** @type {Map<string, string|null>} componentName → group */
390
419
  const componentGroups = new Map();
@@ -401,7 +430,10 @@ function readComponentGroups(coreDir) {
401
430
  for (const entry of entries) {
402
431
  if (entry.isDirectory()) {
403
432
  results.push(...collectXDSFiles(path.join(dirPath, entry.name)));
404
- } else if (isComponentSourceFile(entry.name, dirPath)) {
433
+ } else if (
434
+ keep(componentNameFromFile(entry.name)) &&
435
+ isComponentSourceFile(entry.name, dirPath)
436
+ ) {
405
437
  results.push(entry.name);
406
438
  }
407
439
  }
@@ -411,9 +443,11 @@ function readComponentGroups(coreDir) {
411
443
  const topEntries = listDirEntries(srcDir);
412
444
  for (const entry of topEntries) {
413
445
  if (!entry.isDirectory() || SKIP_DIRS.has(entry.name)) continue;
446
+ if (tops && !tops.has(entry.name)) continue;
414
447
 
415
448
  const dirPath = path.join(srcDir, entry.name);
416
449
  const xdsFiles = collectXDSFiles(dirPath);
450
+ if (xdsFiles.length === 0) continue;
417
451
 
418
452
  // Read the group from the directory's .doc.mjs file (if it exists)
419
453
  // Check both {Name}.doc.mjs and Astryx{Name}.doc.mjs naming conventions
@@ -461,7 +495,9 @@ function readComponentGroups(coreDir) {
461
495
  // (HStack and VStack in Stack's doc).
462
496
  for (const entry of topEntries) {
463
497
  if (!entry.isDirectory() || SKIP_DIRS.has(entry.name)) continue;
498
+ if (tops && !tops.has(entry.name)) continue;
464
499
  const name = entry.name;
500
+ if (!keep(name)) continue;
465
501
  if (componentGroups.has(name) || name.endsWith('Context')) continue;
466
502
  if (
467
503
  listDir(path.join(srcDir, name)).some(file => file.endsWith('.doc.mjs'))
@@ -505,14 +541,22 @@ function readComponentGroups(coreDir) {
505
541
  for (const name of ungrouped) {
506
542
  entries.push({key: name, values: [name]});
507
543
  }
508
- entries.sort((a, b) => a.key.localeCompare(b.key));
544
+ return inGroupOrder(entries);
545
+ }
509
546
 
547
+ /**
548
+ * Groups as one record, keys in the fixed text order (`compareText`), so a
549
+ * live read and the list stored at publish print alike on every host.
550
+ * @param {Array<{key: string, values: string[]}>} entries
551
+ * @returns {Record<string, string[]>}
552
+ */
553
+ function inGroupOrder(entries) {
554
+ entries.sort((a, b) => compareText(a.key, b.key));
510
555
  /** @type {Record<string, string[]>} */
511
556
  const ordered = {};
512
557
  for (const {key, values} of entries) {
513
558
  ordered[key] = values;
514
559
  }
515
-
516
560
  return ordered;
517
561
  }
518
562
 
@@ -770,6 +814,10 @@ function caseSpelledComponentSource(srcDir, name) {
770
814
  * @returns {string}
771
815
  */
772
816
  export function resolveImportPath(coreDir, componentName) {
817
+ const stored = checkedComponentList(coreDir)?.imports;
818
+ if (stored && Object.hasOwn(stored, componentName)) {
819
+ return stored[componentName];
820
+ }
773
821
  const srcDir = path.join(coreDir, 'src');
774
822
  const exportKeys = exportKeysOf(coreDir);
775
823
 
@@ -988,7 +1036,7 @@ export function discoverExternalComponentsGrouped(docsDir) {
988
1036
  for (const name of ungrouped) {
989
1037
  entries.push({key: name, values: [name]});
990
1038
  }
991
- entries.sort((a, b) => a.key.localeCompare(b.key));
1039
+ entries.sort((a, b) => compareText(a.key, b.key));
992
1040
 
993
1041
  /** @type {Record<string, string[]>} */
994
1042
  const ordered = {};
@@ -10,7 +10,8 @@
10
10
  * @position foundation/discovery — the one place component replacement is
11
11
  * decided. Component detail, list, search, swizzle, gap-report routing,
12
12
  * Project, and `doctor integration components` read the result instead of
13
- * deciding it again.
13
+ * deciding it again. The result is kept between runs
14
+ * (foundation/fs/gather-cache.mjs), as part of the component list.
14
15
  *
15
16
  * A component opts in by setting `replaces` in its own doc. The replacement
16
17
  * applies only when the component's package also declares a
@@ -19,6 +20,7 @@
19
20
  * and every finding about it is a warning.
20
21
  */
21
22
 
23
+ import {createHash} from 'node:crypto';
22
24
  import * as fs from 'node:fs';
23
25
  import * as path from 'node:path';
24
26
  import {
@@ -31,6 +33,7 @@ import {
31
33
  componentReplacesCliProblem,
32
34
  } from '../integrations/cli-requirement.mjs';
33
35
  import {formatCliCommand} from '../env/package-manager.mjs';
36
+ import {persistedGather} from '../fs/gather-cache.mjs';
34
37
 
35
38
  /**
36
39
  * @typedef {import('../integrations/integrations.mjs').LoadedIntegration} LoadedIntegration
@@ -149,6 +152,132 @@ export async function resolveComponentReplacements(
149
152
  coreDir,
150
153
  loadedIntegrations,
151
154
  ) {
155
+ // Without an integration that contributes components nothing is read.
156
+ if (!loadedIntegrations.some(contributesComponents)) {
157
+ return replacementsNow(coreDir, loadedIntegrations);
158
+ }
159
+ // Every file and module the decision reads is stamped by the kept gather.
160
+ // What it reads from the loaded integrations was read when they loaded,
161
+ // before the gather, so those values are the key.
162
+ return persistedGather(
163
+ ['component-replacements', coreDir, loadedIntegrations.map(integrationKey)],
164
+ () => replacementsNow(coreDir, loadedIntegrations),
165
+ replacementsCodec(loadedIntegrations),
166
+ );
167
+ }
168
+
169
+ /**
170
+ * @param {LoadedIntegration | null | undefined} integration
171
+ * @returns {boolean} whether the decision reads the integration's components
172
+ */
173
+ function contributesComponents(integration) {
174
+ return (
175
+ integration != null &&
176
+ !integration.__loadError &&
177
+ Boolean(integration.components)
178
+ );
179
+ }
180
+
181
+ /**
182
+ * The fields of a loaded integration the decision reads: its name, its
183
+ * components folder, its issues link, its package folder and exports, why it
184
+ * failed to load, and whether it was autolinked.
185
+ * @param {LoadedIntegration | null | undefined} integration
186
+ * @returns {unknown}
187
+ */
188
+ function integrationKey(integration) {
189
+ if (integration == null) return null;
190
+ const exports = integration.__packageExports ?? null;
191
+ return [
192
+ integration.name ?? null,
193
+ integration.components ?? null,
194
+ integration.issuesUrl ?? null,
195
+ integration.__packageDir ?? null,
196
+ exports == null
197
+ ? null
198
+ : createHash('sha256').update(JSON.stringify(exports)).digest('hex'),
199
+ integration.__loadError ? String(integration.__loadError) : null,
200
+ integration.__autolinked === true,
201
+ ];
202
+ }
203
+
204
+ /**
205
+ * The result with `forTarget` answering from its active replacements.
206
+ * @param {ActiveComponentReplacement[]} active
207
+ * @param {ComponentReplacementFinding[]} findings
208
+ * @returns {ComponentReplacements}
209
+ */
210
+ function replacementsOf(active, findings) {
211
+ /** @type {Map<string, ActiveComponentReplacement>} */
212
+ const byTarget = new Map(active.map(each => [each.target, each]));
213
+ return {
214
+ active,
215
+ findings,
216
+ forTarget: name =>
217
+ typeof name === 'string' ? byTarget.get(name) : undefined,
218
+ };
219
+ }
220
+
221
+ /**
222
+ * The kept form of a result: each active replacement names its integration by
223
+ * its place in `loadedIntegrations`, which the key holds in order, and reads
224
+ * back as this run's loaded integration.
225
+ * @param {readonly LoadedIntegration[]} loadedIntegrations
226
+ */
227
+ function replacementsCodec(loadedIntegrations) {
228
+ return {
229
+ /** @param {ComponentReplacements} value */
230
+ encode: value => ({
231
+ active: value.active.map(each => ({
232
+ target: each.target,
233
+ name: each.name,
234
+ package: each.package,
235
+ docPath: each.docPath,
236
+ sourcePath: each.sourcePath,
237
+ ...(each.issuesUrl === undefined ? {} : {issuesUrl: each.issuesUrl}),
238
+ integration: loadedIntegrations.indexOf(each.integration),
239
+ })),
240
+ findings: value.findings,
241
+ }),
242
+ /** @param {any} stored @returns {ComponentReplacements} */
243
+ decode: stored =>
244
+ replacementsOf(
245
+ stored.active.map((/** @type {any} */ each) => ({
246
+ target: each.target,
247
+ name: each.name,
248
+ package: each.package,
249
+ docPath: each.docPath,
250
+ sourcePath: each.sourcePath,
251
+ issuesUrl: each.issuesUrl,
252
+ integration: loadedIntegrations[each.integration],
253
+ })),
254
+ stored.findings,
255
+ ),
256
+ /** @param {ComponentReplacements} value */
257
+ valid: value =>
258
+ Array.isArray(value.active) &&
259
+ Array.isArray(value.findings) &&
260
+ value.active.every(
261
+ each =>
262
+ each.integration != null &&
263
+ typeof each.target === 'string' &&
264
+ typeof each.name === 'string',
265
+ ) &&
266
+ value.findings.every(
267
+ finding =>
268
+ typeof finding?.code === 'string' &&
269
+ typeof finding.message === 'string',
270
+ ),
271
+ };
272
+ }
273
+
274
+ /**
275
+ * resolveComponentReplacements, gathered now.
276
+ * @param {string|null} coreDir
277
+ * @param {readonly LoadedIntegration[]} loadedIntegrations
278
+ * @returns {Promise<ComponentReplacements>}
279
+ */
280
+ async function replacementsNow(coreDir, loadedIntegrations) {
152
281
  /** @type {ComponentReplacementFinding[]} */
153
282
  const findings = [];
154
283
  /** @type {Map<string, ActiveComponentReplacement>} */
@@ -13,6 +13,7 @@
13
13
  import fs from 'node:fs';
14
14
 
15
15
  import {builtinGuideFiles, loadTopicModule} from './docs-discovery.mjs';
16
+ import {compareText} from '../text/compare-text.mjs';
16
17
 
17
18
  /** The shortest run of identical words reported as a copy. */
18
19
  export const PASSAGE_WORDS = 10;
@@ -613,7 +614,7 @@ export async function findCopiedPassages(discovered) {
613
614
  // name sorts first, so the advice is the same on every run.
614
615
  const firstKeeps =
615
616
  firstFit > secondFit ||
616
- (firstFit === secondFit && first.name.localeCompare(second.name) < 0);
617
+ (firstFit === secondFit && compareText(first.name, second.name) < 0);
617
618
  if (firstKeeps && otherRuns.length) {
618
619
  topic = second;
619
620
  owner = first;
@@ -47,6 +47,7 @@ import {
47
47
  unusableTypeScriptReason,
48
48
  } from './project-typescript.mjs';
49
49
  import {keepSourceFiles} from './source-file-cache.mjs';
50
+ import {compareText} from '../text/compare-text.mjs';
50
51
 
51
52
  /**
52
53
  * @typedef {'components' | 'hooks' | 'templates' | 'docs' | 'docs-overlay' | 'themes' | 'icon-sets'} DocRoot
@@ -1213,11 +1214,11 @@ export async function checkDocTypes(files, options) {
1213
1214
  }
1214
1215
  findings.sort(
1215
1216
  (a, b) =>
1216
- a.doc.localeCompare(b.doc) ||
1217
+ compareText(a.doc, b.doc) ||
1217
1218
  a.line - b.line ||
1218
- a.field.localeCompare(b.field),
1219
+ compareText(a.field, b.field),
1219
1220
  );
1220
- unchecked.sort((a, b) => a.doc.localeCompare(b.doc));
1221
+ unchecked.sort((a, b) => compareText(a.doc, b.doc));
1221
1222
  return {
1222
1223
  status: 'checked',
1223
1224
  typescript: version,
@@ -0,0 +1,43 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * A name as a reader may type it: case, spaces and hyphens do not count.
6
+ * @param {string} name
7
+ * @returns {string}
8
+ */
9
+ export function foldEntryName(name: string): string;
10
+ /**
11
+ * Which Core entries can fold to `wanted`. Every Core component takes its
12
+ * name from a `.tsx` file (without an `XDS` prefix) or a folder, and every
13
+ * hook from its doc's file name, so a name no such file carries is neither.
14
+ * @param {string} coreDir
15
+ * @param {string} wanted a folded name
16
+ * @returns {{component: boolean, hook: boolean, componentTops: Set<string>, hookTops: Set<string>}}
17
+ * `hook` also counts a hook named `use` + `wanted`; the tops are the top
18
+ * folders of `src` that hold such a file or folder
19
+ */
20
+ export function coreFilesNaming(coreDir: string, wanted: string): {
21
+ component: boolean;
22
+ hook: boolean;
23
+ componentTops: Set<string>;
24
+ hookTops: Set<string>;
25
+ };
26
+ /**
27
+ * Whether an integration component can fold to `wanted`, for each
28
+ * components folder in order. Integration discovery names a component after
29
+ * its doc's file, or after a name the doc spells out (its export, or a family
30
+ * member), so a doc whose file name and text both lack the name lists no
31
+ * such component.
32
+ * @param {Array<string | undefined>} componentsDirs
33
+ * @param {string} wanted a folded name
34
+ * @returns {boolean[]}
35
+ */
36
+ export function integrationsFilesNaming(componentsDirs: Array<string | undefined>, wanted: string): boolean[];
37
+ /**
38
+ * {@link integrationsFilesNaming} for one components folder.
39
+ * @param {string | undefined} componentsDir
40
+ * @param {string} wanted a folded name
41
+ * @returns {boolean}
42
+ */
43
+ export function integrationFilesNaming(componentsDir: string | undefined, wanted: string): boolean;