@astryxdesign/cli 0.7.16 → 0.7.17-canary.g0135e03

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 (369) 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 +122 -1
  79. package/api/theme/build/build.mjs +412 -84
  80. package/api/theme/build/core-interception.d.mts +10 -0
  81. package/api/theme/build/core-interception.mjs +10 -0
  82. package/api/theme/build/font-warning.d.mts +23 -3
  83. package/api/theme/build/font-warning.mjs +54 -5
  84. package/api/theme/build/icon-imports.mjs +25 -2
  85. package/api/theme/theme.type.d.mts +10 -0
  86. package/api/theme/theme.type.mjs +7 -1
  87. package/api/theme-edit/_adapter.d.mts +103 -3
  88. package/api/theme-edit/_adapter.mjs +961 -82
  89. package/api/theme-edit/_catalog.mjs +19 -4
  90. package/api/theme-edit/_check.d.mts +63 -24
  91. package/api/theme-edit/_check.mjs +2467 -362
  92. package/api/theme-edit/_color.d.mts +10 -0
  93. package/api/theme-edit/_color.mjs +49 -1
  94. package/api/theme-edit/_compiler.mjs +89 -6
  95. package/api/theme-edit/_context.d.mts +3 -3
  96. package/api/theme-edit/_context.mjs +165 -54
  97. package/api/theme-edit/_css.d.mts +14 -0
  98. package/api/theme-edit/_css.mjs +46 -1
  99. package/api/theme-edit/_edit.d.mts +31 -4
  100. package/api/theme-edit/_edit.mjs +2433 -204
  101. package/api/theme-edit/_how-commands.d.mts +72 -1
  102. package/api/theme-edit/_how-commands.mjs +759 -9
  103. package/api/theme-edit/_how-question.d.mts +82 -5
  104. package/api/theme-edit/_how-question.mjs +6473 -553
  105. package/api/theme-edit/_how.d.mts +2 -1
  106. package/api/theme-edit/_how.mjs +237 -41
  107. package/api/theme-edit/_marks.d.mts +31 -5
  108. package/api/theme-edit/_marks.mjs +57 -5
  109. package/api/theme-edit/_name-rule.d.mts +11 -0
  110. package/api/theme-edit/_name-rule.mjs +12 -0
  111. package/api/theme-edit/_normal.d.mts +292 -0
  112. package/api/theme-edit/_normal.mjs +1454 -0
  113. package/api/theme-edit/_palette.mjs +10 -4
  114. package/api/theme-edit/_part-words.d.mts +31 -0
  115. package/api/theme-edit/_part-words.mjs +126 -0
  116. package/api/theme-edit/_parts.d.mts +18 -1
  117. package/api/theme-edit/_parts.mjs +246 -23
  118. package/api/theme-edit/_preview-app.d.mts +7 -1
  119. package/api/theme-edit/_preview-app.mjs +776 -187
  120. package/api/theme-edit/_preview.d.mts +100 -14
  121. package/api/theme-edit/_preview.mjs +582 -139
  122. package/api/theme-edit/_project.d.mts +4 -0
  123. package/api/theme-edit/_project.mjs +3 -1
  124. package/api/theme-edit/_settings.d.mts +417 -42
  125. package/api/theme-edit/_settings.mjs +3262 -424
  126. package/api/theme-edit/_tables.d.mts +15 -0
  127. package/api/theme-edit/_tables.mjs +63 -1
  128. package/api/theme-edit/_vet.d.mts +20 -0
  129. package/api/theme-edit/_vet.mjs +47 -2
  130. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  131. package/api/theme-edit/theme-edit.type.mjs +4 -1
  132. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  133. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  134. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  135. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  136. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  137. package/api/upgrade/run/run.mjs +4 -3
  138. package/assets/codemods/integration-discovery.mjs +2 -1
  139. package/assets/codemods/run-codemod.mjs +87 -7
  140. package/assets/codemods/transforms/next/index.mjs +11 -1
  141. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  142. package/assets/component-list.generated.json +1 -0
  143. package/assets/docs/author-a-theme.doc.mjs +1 -0
  144. package/assets/docs/theme.doc.dense.mjs +2 -2
  145. package/assets/docs/theme.doc.mjs +1 -1
  146. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  147. package/assets/docs/tree/checks.doc.mjs +1 -1
  148. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  149. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  150. package/assets/docs/tree/single-component.doc.mjs +4 -0
  151. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  152. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  153. package/assets/docs/use-a-theme.doc.mjs +1 -1
  154. package/assets/docs.generated.json +2 -2
  155. package/assets/search-catalog.generated.json +2 -0
  156. package/assets/self-audit.generated.json +1 -1
  157. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  158. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  159. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  160. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  161. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  162. package/assets/templates/components.generated.json +1 -1
  163. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  164. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
  165. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  166. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  167. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  168. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  169. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  170. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  171. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  172. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  173. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  174. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  175. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  176. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  177. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  178. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  179. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  180. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  181. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  182. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  183. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  184. package/assets/templates/pages/ide/page.tsx +24 -2
  185. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  186. package/assets/templates/pages/library/template.doc.mjs +4 -1
  187. package/assets/templates/pages/login/template.doc.mjs +2 -1
  188. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  189. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  190. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  191. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  192. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  193. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  194. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  195. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  196. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  197. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  198. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  199. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  200. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  201. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  202. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  203. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  204. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  205. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  206. package/assets/theme.template.ts +6 -0
  207. package/authoring/debug/parse.d.mts +3 -3
  208. package/authoring/doctypes/_schema.d.mts +3 -3
  209. package/authoring/doctypes/command/command.doc.mjs +1 -1
  210. package/authoring/doctypes/component/categories.d.mts +37 -0
  211. package/authoring/doctypes/component/categories.mjs +54 -0
  212. package/authoring/doctypes/template/template.doc.mjs +1 -1
  213. package/authoring/doctypes/template/type.ts +9 -0
  214. package/authoring/example/example.doc.d.mts +12 -0
  215. package/authoring/example/example.doc.mjs +69 -0
  216. package/authoring/example/preview.d.mts +92 -0
  217. package/authoring/example/preview.mjs +994 -0
  218. package/authoring/example/type.ts +102 -0
  219. package/authoring/index.d.mts +1 -0
  220. package/authoring/index.d.ts +12 -0
  221. package/authoring/index.mjs +3 -1
  222. package/clients/cli/bin/astryx.mjs +6 -9
  223. package/clients/cli/build-id.generated.json +1 -1
  224. package/clients/cli/commands/component.doc.mjs +1 -1
  225. package/clients/cli/commands/component.mjs +22 -3
  226. package/clients/cli/commands/docs.doc.mjs +7 -1
  227. package/clients/cli/commands/docs.mjs +3 -1
  228. package/clients/cli/commands/doctor.mjs +32 -14
  229. package/clients/cli/commands/experimental/render.mjs +42 -1
  230. package/clients/cli/commands/experimental/theme.mjs +358 -63
  231. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  232. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  233. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  234. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  235. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  236. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  237. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  238. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  239. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  240. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  241. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  242. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  243. package/clients/cli/commands/search.doc.mjs +2 -1
  244. package/clients/cli/commands/search.mjs +6 -1
  245. package/clients/cli/commands/template.mjs +4 -2
  246. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  247. package/clients/cli/commands/theme.doc.mjs +1 -1
  248. package/clients/cli/commands/theme.mjs +317 -47
  249. package/clients/cli/commands/upgrade.mjs +42 -7
  250. package/clients/cli/index.mjs +1 -1
  251. package/clients/cli/lib/cli-error.mjs +2 -1
  252. package/clients/cli/lib/component-format.mjs +205 -98
  253. package/clients/cli/lib/hook-format.mjs +9 -19
  254. package/clients/cli/lib/json-shim.mjs +92 -21
  255. package/clients/cli/lib/manifest.mjs +3 -2
  256. package/clients/cli/manifest.generated.json +1 -1
  257. package/foundation/agent-docs/agent-docs.mjs +1 -1
  258. package/foundation/config/theme-state.d.mts +13 -1
  259. package/foundation/config/theme-state.mjs +47 -7
  260. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  261. package/foundation/discovery/component-discovery.d.mts +11 -0
  262. package/foundation/discovery/component-discovery.mjs +56 -8
  263. package/foundation/discovery/component-replacement.mjs +130 -1
  264. package/foundation/discovery/copied-passages.mjs +2 -1
  265. package/foundation/discovery/doc-types.mjs +4 -3
  266. package/foundation/discovery/entry-name-files.d.mts +43 -0
  267. package/foundation/discovery/entry-name-files.mjs +264 -0
  268. package/foundation/discovery/hook-discovery.d.mts +8 -2
  269. package/foundation/discovery/hook-discovery.mjs +22 -8
  270. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  271. package/foundation/discovery/icon-set-checks.mjs +2 -1
  272. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  273. package/foundation/discovery/integration-doc-files.mjs +2 -1
  274. package/foundation/discovery/package-exports.d.mts +10 -0
  275. package/foundation/discovery/package-exports.mjs +56 -3
  276. package/foundation/discovery/prop-drift.mjs +9 -9
  277. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  278. package/foundation/discovery/runner-allowlist.mjs +2 -0
  279. package/foundation/discovery/stored-component-list.d.mts +43 -0
  280. package/foundation/discovery/stored-component-list.mjs +90 -0
  281. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  282. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  283. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  284. package/foundation/discovery/stored-self-audit.mjs +38 -18
  285. package/foundation/discovery/template-adapter.d.mts +53 -1
  286. package/foundation/discovery/template-adapter.mjs +176 -12
  287. package/foundation/discovery/template-icons.mjs +2 -1
  288. package/foundation/discovery/theme-discovery.mjs +31 -4
  289. package/foundation/discovery/theme-imports.d.mts +14 -0
  290. package/foundation/discovery/theme-imports.mjs +43 -1
  291. package/foundation/discovery/theming-targets.mjs +3 -2
  292. package/foundation/doc-compiler/import.mjs +7 -1
  293. package/foundation/doc-compiler/inputs.mjs +3 -2
  294. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  295. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  296. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  297. package/foundation/env/semver.mjs +3 -1
  298. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  299. package/foundation/fonts/font-stylesheet.mjs +115 -0
  300. package/foundation/fs/cache-eviction.d.mts +21 -0
  301. package/foundation/fs/cache-eviction.mjs +73 -0
  302. package/foundation/fs/exact-codec.d.mts +12 -2
  303. package/foundation/fs/exact-codec.mjs +23 -6
  304. package/foundation/fs/file-protection.mjs +4 -3
  305. package/foundation/fs/gather-cache.d.mts +62 -4
  306. package/foundation/fs/gather-cache.mjs +512 -91
  307. package/foundation/fs/jiti-cache.d.mts +19 -1
  308. package/foundation/fs/jiti-cache.mjs +130 -6
  309. package/foundation/fs/kept-tree.d.mts +60 -0
  310. package/foundation/fs/kept-tree.mjs +154 -0
  311. package/foundation/fs/listing-cache.d.mts +7 -0
  312. package/foundation/fs/listing-cache.mjs +10 -0
  313. package/foundation/fs/module-loader.d.mts +24 -2
  314. package/foundation/fs/module-loader.mjs +94 -21
  315. package/foundation/fs/paths.d.mts +18 -0
  316. package/foundation/fs/paths.mjs +15 -2
  317. package/foundation/fs/read-record.d.mts +9 -0
  318. package/foundation/fs/read-record.mjs +19 -11
  319. package/foundation/fs/stop-cleanup.d.mts +12 -0
  320. package/foundation/fs/stop-cleanup.mjs +66 -0
  321. package/foundation/identity/provider-identity.d.mts +6 -0
  322. package/foundation/identity/provider-identity.mjs +10 -1
  323. package/foundation/integrations/contribution-inventory.mjs +4 -3
  324. package/foundation/integrations/example-code.d.mts +63 -0
  325. package/foundation/integrations/example-code.mjs +416 -0
  326. package/foundation/integrations/public-imports.d.mts +9 -0
  327. package/foundation/integrations/public-imports.mjs +3 -2
  328. package/foundation/integrations/validate-contributions.mjs +17 -45
  329. package/foundation/render/embedded-files.d.mts +6 -0
  330. package/foundation/render/embedded-files.mjs +25 -5
  331. package/foundation/render/embedded-imports.d.mts +39 -7
  332. package/foundation/render/embedded-imports.mjs +66 -27
  333. package/foundation/render/file-header.d.mts +66 -0
  334. package/foundation/render/file-header.mjs +118 -0
  335. package/foundation/render/host-answer.d.mts +18 -0
  336. package/foundation/render/host-answer.mjs +46 -0
  337. package/foundation/render/host-exit.d.mts +1 -0
  338. package/foundation/render/host-exit.mjs +6 -1
  339. package/foundation/render/html-reader.d.mts +55 -2
  340. package/foundation/render/html-reader.mjs +145 -26
  341. package/foundation/render/markup-edits.d.mts +57 -0
  342. package/foundation/render/markup-edits.mjs +182 -0
  343. package/foundation/render/page-host.mjs +29 -12
  344. package/foundation/render/page-worker.mjs +121 -13
  345. package/foundation/render/picture-chrome.d.mts +4 -0
  346. package/foundation/render/picture-chrome.mjs +185 -0
  347. package/foundation/render/picture-playwright.d.mts +4 -0
  348. package/foundation/render/picture-playwright.mjs +34 -0
  349. package/foundation/render/rebuild.mjs +2 -1
  350. package/foundation/render/render-page.d.mts +35 -3
  351. package/foundation/render/render-page.mjs +641 -96
  352. package/foundation/render/source-block.d.mts +85 -6
  353. package/foundation/render/source-block.mjs +211 -20
  354. package/foundation/render/ts-paths.d.mts +69 -6
  355. package/foundation/render/ts-paths.mjs +326 -40
  356. package/foundation/response/error-codes.d.mts +3 -1
  357. package/foundation/response/error-codes.d.ts +1 -0
  358. package/foundation/response/error-codes.doc.mjs +12 -1
  359. package/foundation/response/error-codes.mjs +11 -1
  360. package/foundation/response/response-types.doc.mjs +2 -2
  361. package/foundation/text/compare-text.d.mts +14 -0
  362. package/foundation/text/compare-text.mjs +68 -0
  363. package/foundation/text/string-utils.d.mts +3 -2
  364. package/foundation/text/string-utils.mjs +18 -4
  365. package/foundation/text/suggest-order.d.mts +9 -0
  366. package/foundation/text/suggest-order.mjs +15 -1
  367. package/foundation/xle/expand.mjs +2 -1
  368. package/host/index.mjs +8 -6
  369. package/package.json +7 -6
@@ -26,6 +26,7 @@ export function themeFiles(cwd: string, slug: string): {
26
26
  * files (what `git rm -r` or a branch switch leaves). A path that is not a
27
27
  * folder, or one that does not read, is not empty.
28
28
  * @param {string} dir
29
+ * @returns {boolean}
29
30
  */
30
31
  export function folderIsEmpty(dir: string): boolean;
31
32
  /**
@@ -52,15 +53,15 @@ export function recordWritten(cwd: string, slug: string, files: string[]): void;
52
53
  */
53
54
  export function editorWrote(cwd: string, slug: string, file: string): boolean;
54
55
  /**
55
- * Adopt a picture an older editor took (before it recorded or stamped its
56
- * pictures) into the record: only while the theme has no record at all, the
57
- * name is one the editor writes, and the picture is the editor's 1280-pixel
58
- * wide window. Returns whether it was adopted.
56
+ * Whether the pictures record names this file and it is unchanged since the
57
+ * editor wrote it. Only such a file is ever deleted: a stamp alone is not
58
+ * enough, since a byte copy of a picture (preview-before.png) carries the
59
+ * same stamp and is the person's.
59
60
  * @param {string} cwd
60
61
  * @param {string} slug
61
62
  * @param {string} file
62
63
  */
63
- export function adoptOlderPicture(cwd: string, slug: string, file: string): boolean;
64
+ export function editorRecorded(cwd: string, slug: string, file: string): boolean;
64
65
  /**
65
66
  * A name `new` takes, for a suggestion: `name` itself when it is valid, not a
66
67
  * built-in theme and its folder is free; `my-<name>` for a built-in theme's
@@ -116,6 +117,12 @@ export function editedThemes(cwd: string, order?: "name" | "changed"): string[];
116
117
  * @param {number} [n]
117
118
  */
118
119
  export function nearest(x: string, list: Iterable<string>, n?: number): string[];
120
+ /**
121
+ * Whether typed words negate what they name (`not round`, `no caps`,
122
+ * `anything but blue`, `unbold`, `non-bold`, `rounded-none`).
123
+ * @param {string} x
124
+ */
125
+ export function negates(x: string): boolean;
119
126
  /**
120
127
  * A refusal: nothing was changed, and the suggestions lead with the command
121
128
  * that does what the person wanted.
@@ -147,6 +154,40 @@ export function unlabeledThemeName(s: unknown): string;
147
154
  * @returns {string}
148
155
  */
149
156
  export function typedThemeName(s: unknown): string;
157
+ /**
158
+ * The theme names a name typed the way the app shows it may mean, most
159
+ * likely first: a path with doubled slashes or `../` (`themes//t`), a file
160
+ * name with or without its folder (`brand.theme.ts`, `tTheme.ts`), the app
161
+ * copy's export (`tTheme`), camelCase (`brandDark`) and spaces
162
+ * (`Brand Dark`) each read as dashes. The caller picks the first that
163
+ * exists, else the first.
164
+ * @param {string} s
165
+ * @returns {string[]}
166
+ */
167
+ export function themeNameReadings(s: string): string[];
168
+ /**
169
+ * A vibrancy written as set reads typed input: a share of one (0.5) or a
170
+ * percent (50%) is that much of the 0-100 scale, as a whole number. Any
171
+ * other dial's value, or a vibrancy that is no such number, comes back as
172
+ * it was.
173
+ * @param {string} dial
174
+ * @param {string} v
175
+ * @returns {string}
176
+ */
177
+ export function vibrancyMeant(dial: string, v: string): string;
178
+ /**
179
+ * The mode and base a damaged theme file meant, read the way typed input
180
+ * is: other letters, stray spaces, `_` or a space for a dash (`Dark-Only`,
181
+ * ` Neutral`), and a base written as its package name
182
+ * (`@astryxdesign/theme-neutral`). Each is the cleaned text even when it is
183
+ * no value the editor takes; the caller checks it.
184
+ * @param {any} data
185
+ * @returns {{mode: string, like: string}}
186
+ */
187
+ export function fieldsMeant(data: any): {
188
+ mode: string;
189
+ like: string;
190
+ };
150
191
  /**
151
192
  * The settings of a theme, or a refusal naming the command that makes it.
152
193
  * @param {string} cwd
@@ -157,6 +198,16 @@ export function typedThemeName(s: unknown): string;
157
198
  * @returns {ThemeData}
158
199
  */
159
200
  export function loadTheme(cwd: string, slug: string, skip?: string | Partial<Setting>): ThemeData;
201
+ /**
202
+ * A command that builds on a built-in theme, as it runs here: after the
203
+ * line that installs that theme's package when the project does not have
204
+ * it, so the first line offered always works.
205
+ * @param {string} cwd
206
+ * @param {string} base a built-in theme
207
+ * @param {string} line the command on that base
208
+ * @returns {string[]}
209
+ */
210
+ export function onBuiltIn(cwd: string, base: string, line: string): string[];
160
211
  /**
161
212
  * What is wrong with settings data, or null: its shape, and each value with
162
213
  * the same rules `set` checks it by (without the installed Core), so a value
@@ -167,6 +218,53 @@ export function loadTheme(cwd: string, slug: string, skip?: string | Partial<Set
167
218
  * @returns {string | null}
168
219
  */
169
220
  export function settingsProblem(data: any, skip?: string | Partial<Setting>): string | null;
221
+ /**
222
+ * The built-in base the editor last built a theme on, read from the
223
+ * generated module's header (`// Built on @astryxdesign/theme-neutral …`),
224
+ * else from the newest undo step, or null when neither can be read. What a damaged base in
225
+ * the settings file is put back to, and what a theme made again keeps.
226
+ * @param {string} cwd
227
+ * @param {string} slug
228
+ * @returns {string | null}
229
+ */
230
+ export function builtOnBase(cwd: string, slug: string): string | null;
231
+ /**
232
+ * The `new` that makes a theme again in place, on the base it was built on
233
+ * as far as can still be read: the settings file's base (in any case), else
234
+ * the base the generated module was built on. With none, it says the theme
235
+ * starts on no base.
236
+ * @param {string} cwd
237
+ * @param {string} slug
238
+ * @returns {{lines: string[], base: string | null}}
239
+ */
240
+ export function remakeLines(cwd: string, slug: string): {
241
+ lines: string[];
242
+ base: string | null;
243
+ };
244
+ /**
245
+ * A dial's own word typed in any case (ROOMY, MORE, Both, NONE): the word,
246
+ * or null when the value is no word of that dial. The one case rule for
247
+ * every dial, typed or saved. On the font dial several words are a family
248
+ * list, whose names keep their letters; one word is the preset.
249
+ * @param {string} thing
250
+ * @param {string} value
251
+ * @returns {string | null}
252
+ */
253
+ export function dialWordOf(thing: string, value: string): string | null;
254
+ /**
255
+ * What loading read differently from the file in the theme's entries (a
256
+ * mode or source in other letters, a missing source): one note each.
257
+ * @param {object} data the theme as {@link loadTheme} returned it
258
+ * @returns {string[]}
259
+ */
260
+ export function entryNotes(data: object): string[];
261
+ /**
262
+ * Which part of an entry means nothing after reading: its source, mode or
263
+ * `only`, or null.
264
+ * @param {any} s
265
+ * @returns {'mode' | 'source' | 'only' | null}
266
+ */
267
+ export function entryDamage(s: any): "mode" | "source" | "only" | null;
170
268
  /**
171
269
  * Every setting whose only problem is its value or scope, each with the
172
270
  * command that removes it.
@@ -179,6 +277,13 @@ export function badSettings(data: any): Setting[];
179
277
  * @param {import('./_settings.mjs').Setting} x
180
278
  */
181
279
  export function undoArgs(x: import("./_settings.mjs").Setting): string;
280
+ /**
281
+ * The words of a `set` that gives a setting's scope a value: set reads a
282
+ * headings half from its word, so no half is named.
283
+ * @param {import('./_settings.mjs').Setting} x
284
+ * @param {string} value
285
+ */
286
+ export function setArgs(x: import("./_settings.mjs").Setting, value: string): string;
182
287
  /**
183
288
  * The first setting whose only problem is its value (made under looser
184
289
  * rules): `undo <theme> <undoArgs>` removes it.
@@ -202,6 +307,26 @@ export function withoutBadValues(data: ThemeData): {
202
307
  * @returns {string | null}
203
308
  */
204
309
  export function valueProblem(s: any): string | null;
310
+ /**
311
+ * One entry of the top-level `tokens` map in a theme's own source, as
312
+ * written: its token (null for a computed key no read of the file can
313
+ * resolve), the key as typed, the line that sets it, and its value's shape.
314
+ * A `scope` entry names where a scope (`components`, `onDark`, `onLight`,
315
+ * `adaptations`) starts; a `scoped` entry is a token one sets, with its
316
+ * scope path (`components.button.base`). A `duplicate` entry names a
317
+ * second `tokens` key (with every line); a
318
+ * `typography` entry is one typography field (its dotted key and value);
319
+ * an `unresolved` entry says the map holds something only a build reads.
320
+ * @typedef {{token: string | null, key: string, line: number | null, kind: 'text' | 'number' | 'pair' | 'object' | 'other' | 'duplicate' | 'typography' | 'unresolved' | 'scope' | 'scoped', scope?: string, value?: any, halves?: Array<string | number | undefined>, lines?: Array<number | null>, file?: string, overridden?: boolean, expression?: boolean, notToken?: boolean}} OwnTokenEntry
321
+ */
322
+ /**
323
+ * The entries of the top-level `tokens` map in a theme's own source, read
324
+ * from its syntax tree, each with the line that sets it.
325
+ * @param {string} cwd
326
+ * @param {string} slug
327
+ * @returns {OwnTokenEntry[]}
328
+ */
329
+ export function ownTokenEntries(cwd: string, slug: string): OwnTokenEntry[];
205
330
  /**
206
331
  * The tokens a base theme's own component rules for a part read through
207
332
  * var() (neutral's progress-bar reads --color-border-emphasized), from its
@@ -279,6 +404,14 @@ export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing">): st
279
404
  * @returns {number | null}
280
405
  */
281
406
  export function lengthPx(v: string): number | null;
407
+ /**
408
+ * The base theme's body text size in px, read back from its built base
409
+ * size (14 when it writes none).
410
+ * @param {{light: Record<string, string>}} base
411
+ */
412
+ export function baseTextPx(base: {
413
+ light: Record<string, string>;
414
+ }): number;
282
415
  /**
283
416
  * The family and fallbacks a font value means: a preset, an open font, a
284
417
  * whole stack with commas, or one family name.
@@ -342,6 +475,27 @@ export function stopsIn(source: string): Record<string, Record<"light" | "dark",
342
475
  stop: number;
343
476
  alpha?: string;
344
477
  }>>;
478
+ /**
479
+ * A size in px: px, rem (16px each), or a calc() of those added and
480
+ * subtracted; null for anything else.
481
+ * @param {string} v
482
+ * @param {Record<string, string>} [vars] values for the tokens a var() may name
483
+ * @returns {number | null}
484
+ */
485
+ export function sizePx(v: string, vars?: Record<string, string>): number | null;
486
+ /**
487
+ * Spacing steps scaled with the spacing dial, kept in order around the
488
+ * steps the theme keeps exact: each the plain scaled value unless it would
489
+ * meet or pass a kept one; those are spread evenly between the kept one and
490
+ * the nearest step that keeps its place. A step with no room below a kept
491
+ * one takes the value of the one below it.
492
+ * @param {Array<[string, number]>} steps token name and the base value, in px
493
+ * @param {number} f the rung's factor
494
+ * @param {Record<string, number>} kept exact steps the theme keeps, in px
495
+ * @param {string[]} [noRoom] filled with the steps left no room
496
+ * @returns {Array<[string, number]>} every step's new value in px, kept ones as kept
497
+ */
498
+ export function spacingSteps(steps: Array<[string, number]>, f: number, kept: Record<string, number>, noRoom?: string[]): Array<[string, number]>;
345
499
  /**
346
500
  * Control heights scaled with the spacing dial (a denser theme has shorter
347
501
  * controls), each kept distinct and in order: smallest to largest, a
@@ -351,9 +505,13 @@ export function stopsIn(source: string): Record<string, Record<"light" | "dark",
351
505
  * scaled above it.
352
506
  * @param {Array<[string, string]>} sizes token name and the theme's value
353
507
  * @param {number} f the spacing rung's factor
508
+ * @param {Record<string, number>} [kept] exact sizes the theme keeps, in px,
509
+ * which the others stay in order around
510
+ * @param {string[]} [noRoom] filled with the sizes left no room between
511
+ * two kept ones (each then equals the one below it)
354
512
  * @returns {Array<[string, string]>} the tokens it writes, in px
355
513
  */
356
- export function controlSizes(sizes: Array<[string, string]>, f: number): Array<[string, string]>;
514
+ export function controlSizes(sizes: Array<[string, string]>, f: number, kept?: Record<string, number>, noRoom?: string[]): Array<[string, string]>;
357
515
  /**
358
516
  * The settings, as a `defineTheme` object.
359
517
  * @param {Ctx} ctx
@@ -365,6 +523,17 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
365
523
  light: Record<string, string>;
366
524
  dark: Record<string, string>;
367
525
  }): any;
526
+ /**
527
+ * A background shorthand split into its image layers and the color its
528
+ * last layer may carry (the color under every image): a color word beside
529
+ * the last image, or a last layer that is a color alone.
530
+ * @param {string} value
531
+ * @returns {{images: string, color: string | null}}
532
+ */
533
+ export function backgroundColorLayer(value: string): {
534
+ images: string;
535
+ color: string | null;
536
+ };
368
537
  /**
369
538
  * Settings whose effect a later or stronger setting hides, with why: `type`
370
539
  * loses heading weight and tracking to `headings`.
@@ -379,23 +548,32 @@ export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting,
379
548
  * {font-weight}`. Find those rules in the built stylesheet.
380
549
  * @param {string} cssText
381
550
  * @param {any} theme
382
- * @returns {Array<{target: string, key: string, prop: string, value: string}>}
551
+ * @returns {Array<{target: string, key: string, prop: string, value: string, state?: string}>}
383
552
  */
384
553
  export function findOverrides(cssText: string, theme: any): Array<{
385
554
  target: string;
386
555
  key: string;
387
556
  prop: string;
388
557
  value: string;
558
+ state?: string;
389
559
  }>;
390
560
  /**
391
- * Why `<slug>.theme.ts` cannot carry the settings, or null: it must import
392
- * `./<slug>.settings`, extend `<camel>Settings` and keep the name, or no
393
- * setting takes effect.
561
+ * Why a theme's source cannot carry its settings, with the step that puts
562
+ * it right; null when it carries them. The theme is the export a build of
563
+ * the source reads, loaded as the build loads it: it must be named for the
564
+ * theme, and the settings module's own export must be in the chain of
565
+ * themes it extends (after every spread and repeated key), the very object,
566
+ * not a theme named like it. Null for a source that does not parse (its
567
+ * parse error is its own finding), and for one that imports the settings
568
+ * but does not load (outputsDrift and the build report that).
394
569
  * @param {string} cwd
395
570
  * @param {string} slug
396
- * @returns {string | null}
571
+ * @returns {Promise<{problem: string, fix: string} | null>}
397
572
  */
398
- export function themeSourceProblem(cwd: string, slug: string): string | null;
573
+ export function themeSourceProblem(cwd: string, slug: string): Promise<{
574
+ problem: string;
575
+ fix: string;
576
+ } | null>;
399
577
  /**
400
578
  * Why the person's own theme source does not parse (its line and the
401
579
  * parser's message), or null when it parses or is not there.
@@ -418,24 +596,43 @@ export function refuseThemeParse(cwd: string, slug: string): void;
418
596
  * @param {string} cwd
419
597
  * @param {string} slug
420
598
  */
421
- export function refuseThemeSource(cwd: string, slug: string): void;
599
+ export function refuseThemeSource(cwd: string, slug: string): Promise<void>;
600
+ /**
601
+ * The refusal for a theme source that cannot carry the settings (it no
602
+ * longer imports or extends them, or names another theme), naming the
603
+ * lines that put it back; null when it carries them. Every command that
604
+ * builds the theme refuses with it.
605
+ * @param {string} cwd
606
+ * @param {string} slug
607
+ * @returns {Promise<AstryxError | null>}
608
+ */
609
+ export function themeSourceRefusal(cwd: string, slug: string): Promise<AstryxError | null>;
422
610
  /**
423
- * The tokens that are not colors the theme as it builds now gives a
424
- * [light, dark] pair (light-dark()), however its file writes them (a
425
- * constant, `as const`, `satisfies`, a spread from an imported module):
426
- * read from a build made into the project's cache folder, never beside the
427
- * theme. Empty when it does not build there (the build names that itself).
611
+ * The input the theme's own source gives `defineTheme()`, evaluated as a
612
+ * build evaluates it, with the theme Core made of it (or Core's error when
613
+ * it refuses the input); null when the source does not load.
428
614
  * @param {Ctx} ctx
429
615
  * @param {string} slug
430
- * @returns {Promise<string[]>}
616
+ * @param {string | null} like the base theme, whose built tokens are `base`
617
+ * @returns {Promise<{input: any, theme: any, error: Error | null, base: Map<string, string | null>} | null>}
431
618
  */
432
- export function builtPairs(ctx: Ctx, slug: string): Promise<string[]>;
619
+ export function ownThemeInput(ctx: Ctx, slug: string, like: string | null): Promise<{
620
+ input: any;
621
+ theme: any;
622
+ error: Error | null;
623
+ base: Map<string, string | null>;
624
+ } | null>;
433
625
  /**
434
626
  * The refusal of a [light, dark] pair on tokens that are not colors.
435
627
  * @param {string} slug
436
628
  * @param {string[]} names
437
629
  */
438
630
  export function ownPairMessage(slug: string, names: string[]): string;
631
+ /**
632
+ * Set the check of a theme's own token values run before every build.
633
+ * @param {((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null} fn
634
+ */
635
+ export function setOwnTokenCheck(fn: ((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null): void;
439
636
  /**
440
637
  * Set what runs after every build of a theme.
441
638
  * @param {((ctx: Ctx, slug: string, data: ThemeData) => void) | null} fn
@@ -453,13 +650,23 @@ export function holdAfterBuild(ctx: Ctx): void;
453
650
  * @param {Ctx} ctx
454
651
  * @param {string} slug
455
652
  * @param {ThemeData} data
456
- * @returns {Promise<{warnings: string[], lifted: string[], notes: string[]}>} `notes`: what the color config kept or replaced of a hand edit
653
+ * @returns {Promise<{warnings: string[], lifted: string[], notes: string[], removedPictures: string[]}>} `notes`: what the color config kept or replaced of a hand edit; `removedPictures`: the editor's pictures of the look before, removed
457
654
  */
458
655
  export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
459
656
  warnings: string[];
460
657
  lifted: string[];
461
658
  notes: string[];
659
+ removedPictures: string[];
462
660
  }>;
661
+ /**
662
+ * The one color mode of a light-only or dark-only theme, from its settings,
663
+ * for the build to write into the built module (`colorModes`); null for a
664
+ * theme with both modes.
665
+ * @param {string} cwd
666
+ * @param {string} slug
667
+ * @returns {['light'] | ['dark'] | null}
668
+ */
669
+ export function buildColorModes(cwd: string, slug: string): ["light"] | ["dark"] | null;
463
670
  /**
464
671
  * Why the built outputs differ from what the theme builds now: one that is
465
672
  * missing or changed by hand, found the way `compile --check` finds it
@@ -479,6 +686,22 @@ export function resolvedTokens(ctx: Ctx, slug: string): Promise<{
479
686
  light: Record<string, string>;
480
687
  dark: Record<string, string>;
481
688
  }>;
689
+ /**
690
+ * A value as a message names it, whatever it is: text in quotes, a number,
691
+ * a BigInt with its `n`, a symbol, a function, an array or an object as
692
+ * JSON where it has one. Never throws.
693
+ * @param {unknown} value
694
+ * @returns {string}
695
+ */
696
+ export function describeValue(value: unknown): string;
697
+ /**
698
+ * Why a token value is not one, with a value of the token's own type to
699
+ * write instead (a size in px, a weight as a number in quotes), or none.
700
+ * @param {Ctx} ctx
701
+ * @param {string} slug
702
+ * @param {[string, unknown, ('object' | 'pair' | 'unit' | 'value' | 'mode')?]} bad
703
+ */
704
+ export function nonTextMessage(ctx: Ctx, slug: string, [name, value, kind]: [string, unknown, ("object" | "pair" | "unit" | "value" | "mode")?]): string;
482
705
  /**
483
706
  * Contrast problems this theme caused: text below 4.5:1 that was not as low
484
707
  * in the base theme. A part's own color or background setting, or a token
@@ -493,8 +716,55 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
493
716
  dark: Record<string, string>;
494
717
  }): Promise<string[]>;
495
718
  /**
496
- * Whether parsed settings have the shape the editor reads: an object with a
497
- * list of settings.
719
+ * A settings file's or an undo step's text as JSON, a byte-order mark
720
+ * aside; undefined when there is no text or it does not parse. Every reader
721
+ * of settings text reads it here.
722
+ * @param {string | null | undefined} text
723
+ * @returns {any}
724
+ */
725
+ export function settingsJson(text: string | null | undefined): any;
726
+ /**
727
+ * Whether settings data has its shape and every entry is an object with a
728
+ * thing name: what a reader may go through entry by entry. Any other entry
729
+ * (null, a number, text) is damage the file check names.
730
+ * @param {any} data
731
+ */
732
+ export function entriesReadable(data: any): any;
733
+ /**
734
+ * Read a damaged mode or base the way a change reads it, in place: one
735
+ * written in other letters, as a package name, as a mode word or with a
736
+ * typo (`Dark-Only`, `@astryxdesign/theme-neutral`, `light`, `neutrl`) is
737
+ * the value meant, as `set` reads it. Any other is refused for a change
738
+ * (slug given), with the line that sets it; read for an undo step, it goes
739
+ * back to its default. `like: "none"` is no base. The field a command sets
740
+ * itself is left to that command.
741
+ * @param {any} data
742
+ * @param {string} cwd
743
+ * @param {string} [fixing] `mode` or `base` when the command sets it
744
+ * @param {string} [slug] the theme a change is made to
745
+ * @returns {string[]} a note for each field read differently from the file
746
+ */
747
+ export function readFields(data: any, cwd: string, fixing?: string, slug?: string): string[];
748
+ /**
749
+ * Read settings data as a change reads it, in place: entry modes and
750
+ * sources in other words, and a damaged mode or base (see
751
+ * {@link readFields}). The settings file and every undo step are read
752
+ * through here.
753
+ * @param {any} data
754
+ * @param {string} cwd
755
+ * @param {string} [fixing] `mode` or `base` when the command sets it
756
+ * @returns {string[]} a note for each thing read differently from the text
757
+ */
758
+ export function readAsMeant(data: any, cwd: string, fixing?: string): string[];
759
+ /**
760
+ * Whether every settings entry has the parts the editor reads (a thing, a
761
+ * value and a source); one without is damage `new` keeps aside.
762
+ * @param {any} data
763
+ */
764
+ export function settingsEntriesOk(data: any): any;
765
+ /**
766
+ * Whether settings data has the shape the editor reads: an object with a
767
+ * settings list.
498
768
  * @param {any} data
499
769
  */
500
770
  export function settingsShapeOk(data: any): boolean;
@@ -525,6 +795,36 @@ export function baseComponent(base: {
525
795
  * @returns {string | null}
526
796
  */
527
797
  export function focusStateOf(ctx: Ctx, part: string): string | null;
798
+ /**
799
+ * The radius token a part's corners follow when Core draws its corners one
800
+ * by one from that token by position (a button squares the joins inside a
801
+ * button group; a button group's outer corners are its end buttons'), or
802
+ * null. A radius for such a part is written as that
803
+ * token on the part, so every position keeps its own corner; a radius
804
+ * written on the part would override Core's per-corner rules.
805
+ * @param {Ctx} ctx
806
+ * @param {string} part
807
+ * @returns {string | null}
808
+ */
809
+ export function positionalCornerToken(ctx: Ctx, part: string): string | null;
810
+ /**
811
+ * The parts that draw a part's corners: the part itself, or, when Core gives
812
+ * it no radius of its own, the parts inside it that it has (a date-time
813
+ * input's date and time boxes).
814
+ * @param {Ctx} ctx
815
+ * @param {string} part
816
+ * @returns {string[]}
817
+ */
818
+ export function cornerParts(ctx: Ctx, part: string): string[];
819
+ /**
820
+ * The parts that take a part's padding: the part itself, or, when Core
821
+ * renders it as a box CSS draws no padding on (a table row) and gives it no
822
+ * other display, the parts inside it with padding of their own (its cells).
823
+ * @param {Ctx} ctx
824
+ * @param {string} part
825
+ * @returns {string[]}
826
+ */
827
+ export function paddedParts(ctx: Ctx, part: string): string[];
528
828
  /**
529
829
  * The radius token a part's resting corners read. A part the census saw
530
830
  * closed (a menu, a popover) has none recorded: a container or menu reads
@@ -555,6 +855,21 @@ export function clearNewMarker(dir: string): void;
555
855
  * @returns {string}
556
856
  */
557
857
  export function stateKey(state: string, wrapsControl?: boolean): string;
858
+ /**
859
+ * The text color tokens Core's elements inside a part read for their own
860
+ * color (a top nav heading's title span reads --color-text-primary itself),
861
+ * so a color set on the part never reaches that text. Only the main and
862
+ * supporting text colors count: the disabled, placeholder and accent ones
863
+ * mark a state or a role, not the part's text. With `deep`, the parts inside
864
+ * it count too (a top nav's heading and items).
865
+ * @param {{MAP: Record<string, any>}} C
866
+ * @param {string} part
867
+ * @param {boolean} [deep]
868
+ * @returns {string[]}
869
+ */
870
+ export function innerTextTokens(C: {
871
+ MAP: Record<string, any>;
872
+ }, part: string, deep?: boolean): string[];
558
873
  /**
559
874
  * The component docs of a part: its own component's, and the one named like
560
875
  * the part (tab is Tab, under TabList), each with its name, for the ones the
@@ -604,6 +919,19 @@ export function radiusAt(base: {
604
919
  * editor's header).
605
920
  * @param {string} file
606
921
  */
922
+ /**
923
+ * Whether the editor made a theme's folder, though its settings may be
924
+ * gone: a stopped `new` left its marker, or the folder holds what only the
925
+ * editor writes (the generated settings module, an undo history, the theme
926
+ * source with the header the editor wrote it with).
927
+ * @param {string} cwd
928
+ * @param {string} slug
929
+ */
930
+ export function editorMadeFolder(cwd: string, slug: string): boolean;
931
+ /**
932
+ * Whether a file carries the editor's generated header.
933
+ * @param {string} file
934
+ */
607
935
  export function madeByEditor(file: string): boolean;
608
936
  /**
609
937
  * Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
@@ -676,18 +1004,43 @@ export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history,
676
1004
  notes: string[];
677
1005
  unchanged: boolean;
678
1006
  }>;
679
- /** @param {Ctx} ctx @param {ThemeData} data */
680
- export function fontPackages(ctx: Ctx, data: ThemeData): {
1007
+ /**
1008
+ * The @fontsource package for a font family: an open font's own package
1009
+ * as the editor's font table names it (Geist is `@fontsource/geist-sans`),
1010
+ * else the family's name in Fontsource's form (`Open Sans` is
1011
+ * `@fontsource/open-sans`).
1012
+ * @param {string} family
1013
+ * @returns {string}
1014
+ */
1015
+ export function fontsourcePackageOf(family: string): string;
1016
+ /**
1017
+ * The font families the theme's last build names (its `--font-family-*`
1018
+ * tokens, every part's `font-family`, and a `font` shorthand's families), by lowercase name; null before the
1019
+ * theme has been built.
1020
+ * @param {Ctx} ctx
1021
+ * @param {string} slug
1022
+ * @returns {Map<string, string> | null}
1023
+ */
1024
+ export function builtFontFamilies(ctx: Ctx, slug: string): Map<string, string> | null;
1025
+ /**
1026
+ * The font packages that load the families the theme builds: a font
1027
+ * setting's package while the build still uses its family, and the
1028
+ * installed @fontsource package of a family the theme's own source sets.
1029
+ * Font notes, the previews and the app copy all load fonts from this list.
1030
+ * For a new app that installs its own packages (`forNewApp`), every built
1031
+ * family that is an open font comes too, installed here or not.
1032
+ * @param {Ctx} ctx
1033
+ * @param {ThemeData} data
1034
+ * @param {{forNewApp?: boolean}} [opts]
1035
+ */
1036
+ export function fontPackages(ctx: Ctx, data: ThemeData, { forNewApp }?: {
1037
+ forNewApp?: boolean;
1038
+ }): {
681
1039
  pkg: string;
682
1040
  family: string;
683
1041
  installed: boolean;
684
- of: Setting;
1042
+ of: Setting | null;
685
1043
  }[];
686
- /** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null, derived?: Record<string, Array<{property: string, vars?: string[], replaces?: boolean, expand?: string}>>}} Ctx */
687
- /** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
688
- /** @typedef {import('./_parts.mjs').TextPair} TextPair */
689
- /** What a theme name may be, in words. */
690
- export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, 64 characters at most, and not a name Windows reserves (con, prn, aux, nul, com1-com9, lpt1-lpt9)";
691
1044
  export function slugOk(s: string): boolean;
692
1045
  export function windowsReserved(s: string): boolean;
693
1046
  export function slugFor(name: unknown): string;
@@ -702,6 +1055,9 @@ export function textPx(v: string): number;
702
1055
  /** The type tokens base themes set again for phones: families and weights. */
703
1056
  export const PHONE_TYPE: RegExp;
704
1057
  export function themeSource(slug: string): string;
1058
+ export function settingsThemeName(slug: string): string;
1059
+ /** The radius tokens the corners dial moves. */
1060
+ export const DIAL_RADII: string[];
705
1061
  /** The file a `new` keeps beside the files it writes until it is done. */
706
1062
  export const NEW_MARKER: ".astryx-new.json";
707
1063
  /**
@@ -713,6 +1069,31 @@ export const EDITOR_SUFFIXES: string[];
713
1069
  export function isEditorFile(slug: string, n: string): boolean;
714
1070
  /** The undo steps a theme keeps; older ones are dropped. */
715
1071
  export const HISTORY_STEPS: 80;
1072
+ /**
1073
+ * One entry of the top-level `tokens` map in a theme's own source, as
1074
+ * written: its token (null for a computed key no read of the file can
1075
+ * resolve), the key as typed, the line that sets it, and its value's shape.
1076
+ * A `scope` entry names where a scope (`components`, `onDark`, `onLight`,
1077
+ * `adaptations`) starts; a `scoped` entry is a token one sets, with its
1078
+ * scope path (`components.button.base`). A `duplicate` entry names a
1079
+ * second `tokens` key (with every line); a
1080
+ * `typography` entry is one typography field (its dotted key and value);
1081
+ * an `unresolved` entry says the map holds something only a build reads.
1082
+ */
1083
+ export type OwnTokenEntry = {
1084
+ token: string | null;
1085
+ key: string;
1086
+ line: number | null;
1087
+ kind: "text" | "number" | "pair" | "object" | "other" | "duplicate" | "typography" | "unresolved" | "scope" | "scoped";
1088
+ scope?: string;
1089
+ value?: any;
1090
+ halves?: Array<string | number | undefined>;
1091
+ lines?: Array<number | null>;
1092
+ file?: string;
1093
+ overridden?: boolean;
1094
+ expression?: boolean;
1095
+ notToken?: boolean;
1096
+ };
716
1097
  /**
717
1098
  * One setting the CLI owns.
718
1099
  */
@@ -777,6 +1158,8 @@ export type Ctx = {
777
1158
  alpha?: string;
778
1159
  }>> | null;
779
1160
  keepRadii?: Record<string, string> | null;
1161
+ sizeNotes?: string[];
1162
+ compileNotes?: string[];
780
1163
  derived?: Record<string, Array<{
781
1164
  property: string;
782
1165
  vars?: string[];
@@ -786,15 +1169,7 @@ export type Ctx = {
786
1169
  };
787
1170
  export type PaintSide = import("./_parts.mjs").PaintSide;
788
1171
  export type TextPair = import("./_parts.mjs").TextPair;
1172
+ import { AstryxError } from '../error.mjs';
1173
+ import { NAME_RULE } from './_name-rule.mjs';
789
1174
  import { modesOf } from './_palette.mjs';
790
- /**
791
- * What a part reads for a property when the theme does not set it, so a
792
- * one-mode component setting keeps the other mode as it was.
793
- * @param {Ctx} ctx
794
- * @param {string} target
795
- * @param {string} prop camelCase or kebab-case
796
- * @param {string | undefined} when
797
- * @param {string} [state] a state (hover): that state's own value
798
- */
799
- export function partDefault(ctx: Ctx, target: string, prop: string, when: string | undefined, state?: string): string | null;
800
- export { modesOf };
1175
+ export { NAME_RULE, modesOf };