@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8

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 (380) 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 +28 -2
  29. package/api/docs/_adapter.mjs +249 -10
  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 +132 -1
  79. package/api/theme/build/build.mjs +482 -157
  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 +44 -5
  83. package/api/theme/build/font-warning.mjs +118 -10
  84. package/api/theme/build/icon-imports.mjs +51 -9
  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 +115 -4
  88. package/api/theme-edit/_adapter.mjs +997 -83
  89. package/api/theme-edit/_catalog.d.mts +20 -2
  90. package/api/theme-edit/_catalog.mjs +50 -10
  91. package/api/theme-edit/_check.d.mts +75 -24
  92. package/api/theme-edit/_check.mjs +2672 -422
  93. package/api/theme-edit/_color.d.mts +10 -0
  94. package/api/theme-edit/_color.mjs +54 -1
  95. package/api/theme-edit/_compiler.d.mts +1 -0
  96. package/api/theme-edit/_compiler.mjs +133 -15
  97. package/api/theme-edit/_context.d.mts +14 -3
  98. package/api/theme-edit/_context.mjs +225 -65
  99. package/api/theme-edit/_css.d.mts +14 -0
  100. package/api/theme-edit/_css.mjs +46 -1
  101. package/api/theme-edit/_edit.d.mts +54 -4
  102. package/api/theme-edit/_edit.mjs +2966 -286
  103. package/api/theme-edit/_how-commands.d.mts +72 -1
  104. package/api/theme-edit/_how-commands.mjs +770 -9
  105. package/api/theme-edit/_how-question.d.mts +82 -5
  106. package/api/theme-edit/_how-question.mjs +6983 -701
  107. package/api/theme-edit/_how.d.mts +2 -1
  108. package/api/theme-edit/_how.mjs +237 -41
  109. package/api/theme-edit/_importers.d.mts +38 -0
  110. package/api/theme-edit/_importers.mjs +188 -0
  111. package/api/theme-edit/_marks.d.mts +31 -5
  112. package/api/theme-edit/_marks.mjs +57 -5
  113. package/api/theme-edit/_name-rule.d.mts +11 -0
  114. package/api/theme-edit/_name-rule.mjs +12 -0
  115. package/api/theme-edit/_normal.d.mts +303 -0
  116. package/api/theme-edit/_normal.mjs +1517 -0
  117. package/api/theme-edit/_palette.d.mts +12 -0
  118. package/api/theme-edit/_palette.mjs +37 -4
  119. package/api/theme-edit/_part-words.d.mts +31 -0
  120. package/api/theme-edit/_part-words.mjs +126 -0
  121. package/api/theme-edit/_parts.d.mts +28 -2
  122. package/api/theme-edit/_parts.mjs +267 -31
  123. package/api/theme-edit/_preview-app.d.mts +7 -13
  124. package/api/theme-edit/_preview-app.mjs +814 -406
  125. package/api/theme-edit/_preview.d.mts +116 -16
  126. package/api/theme-edit/_preview.mjs +649 -152
  127. package/api/theme-edit/_project.d.mts +22 -1
  128. package/api/theme-edit/_project.mjs +83 -3
  129. package/api/theme-edit/_settings.d.mts +467 -42
  130. package/api/theme-edit/_settings.mjs +3527 -468
  131. package/api/theme-edit/_tables.d.mts +21 -0
  132. package/api/theme-edit/_tables.mjs +97 -3
  133. package/api/theme-edit/_vet.d.mts +31 -0
  134. package/api/theme-edit/_vet.mjs +114 -8
  135. package/api/theme-edit/theme-edit.type.d.mts +16 -2
  136. package/api/theme-edit/theme-edit.type.mjs +6 -3
  137. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  138. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  139. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  140. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  141. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  142. package/api/upgrade/run/run.mjs +4 -3
  143. package/assets/codemods/integration-discovery.mjs +2 -1
  144. package/assets/codemods/run-codemod.mjs +87 -7
  145. package/assets/codemods/transforms/next/index.mjs +11 -1
  146. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  147. package/assets/component-list.generated.json +1 -0
  148. package/assets/docs/author-a-theme.doc.mjs +1 -0
  149. package/assets/docs/theme.doc.dense.mjs +2 -2
  150. package/assets/docs/theme.doc.mjs +1 -1
  151. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  152. package/assets/docs/tree/checks.doc.mjs +1 -1
  153. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  154. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  155. package/assets/docs/tree/share-a-page.doc.mjs +157 -0
  156. package/assets/docs/tree/single-component.doc.mjs +4 -0
  157. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  158. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  159. package/assets/docs/use-a-theme.doc.mjs +1 -1
  160. package/assets/docs.generated.json +2 -2
  161. package/assets/search-catalog.generated.json +2 -0
  162. package/assets/self-audit.generated.json +1 -1
  163. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  164. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  165. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  166. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  167. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  168. package/assets/templates/components.generated.json +1 -1
  169. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  170. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
  171. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  172. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  173. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  174. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  175. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  176. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  177. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  178. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  179. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  180. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  181. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  182. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  183. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  184. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  185. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  186. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  187. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  188. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  189. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  190. package/assets/templates/pages/ide/page.tsx +24 -2
  191. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  192. package/assets/templates/pages/library/template.doc.mjs +4 -1
  193. package/assets/templates/pages/login/template.doc.mjs +2 -1
  194. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  195. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  196. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  197. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  198. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  199. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  200. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  201. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  202. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  203. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  204. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  205. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  206. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  207. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  208. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  209. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  210. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  211. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  212. package/assets/theme.template.ts +6 -0
  213. package/authoring/debug/parse.d.mts +3 -3
  214. package/authoring/doctypes/_schema.d.mts +3 -3
  215. package/authoring/doctypes/command/command.doc.mjs +1 -1
  216. package/authoring/doctypes/component/categories.d.mts +37 -0
  217. package/authoring/doctypes/component/categories.mjs +54 -0
  218. package/authoring/doctypes/template/template.doc.mjs +1 -1
  219. package/authoring/doctypes/template/type.ts +9 -0
  220. package/authoring/example/example.doc.d.mts +12 -0
  221. package/authoring/example/example.doc.mjs +69 -0
  222. package/authoring/example/preview.d.mts +92 -0
  223. package/authoring/example/preview.mjs +994 -0
  224. package/authoring/example/type.ts +102 -0
  225. package/authoring/index.d.mts +1 -0
  226. package/authoring/index.d.ts +12 -0
  227. package/authoring/index.mjs +3 -1
  228. package/clients/cli/bin/astryx.mjs +6 -9
  229. package/clients/cli/build-id.generated.json +1 -1
  230. package/clients/cli/commands/component.doc.mjs +1 -1
  231. package/clients/cli/commands/component.mjs +22 -3
  232. package/clients/cli/commands/docs.doc.mjs +7 -1
  233. package/clients/cli/commands/docs.mjs +3 -1
  234. package/clients/cli/commands/doctor.mjs +32 -14
  235. package/clients/cli/commands/experimental/render.mjs +42 -1
  236. package/clients/cli/commands/experimental/theme.mjs +573 -119
  237. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  238. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  239. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  240. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  241. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  242. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
  243. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  244. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  245. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  246. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  247. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  248. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  249. package/clients/cli/commands/search.doc.mjs +2 -1
  250. package/clients/cli/commands/search.mjs +6 -1
  251. package/clients/cli/commands/template.mjs +4 -2
  252. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  253. package/clients/cli/commands/theme.doc.mjs +1 -1
  254. package/clients/cli/commands/theme.mjs +718 -438
  255. package/clients/cli/commands/upgrade.mjs +42 -7
  256. package/clients/cli/index.mjs +1 -1
  257. package/clients/cli/lib/cli-error.mjs +2 -1
  258. package/clients/cli/lib/component-format.mjs +205 -98
  259. package/clients/cli/lib/hook-format.mjs +9 -19
  260. package/clients/cli/lib/json-shim.mjs +132 -24
  261. package/clients/cli/lib/manifest.mjs +3 -2
  262. package/clients/cli/manifest.generated.json +1 -1
  263. package/foundation/agent-docs/agent-docs.mjs +1 -1
  264. package/foundation/config/theme-state.d.mts +13 -1
  265. package/foundation/config/theme-state.mjs +47 -7
  266. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  267. package/foundation/discovery/component-discovery.d.mts +11 -0
  268. package/foundation/discovery/component-discovery.mjs +56 -8
  269. package/foundation/discovery/component-replacement.mjs +130 -1
  270. package/foundation/discovery/copied-passages.mjs +2 -1
  271. package/foundation/discovery/core-component-docs.d.mts +29 -0
  272. package/foundation/discovery/core-component-docs.mjs +83 -0
  273. package/foundation/discovery/doc-types.mjs +4 -3
  274. package/foundation/discovery/entry-name-files.d.mts +43 -0
  275. package/foundation/discovery/entry-name-files.mjs +264 -0
  276. package/foundation/discovery/hook-discovery.d.mts +8 -2
  277. package/foundation/discovery/hook-discovery.mjs +22 -8
  278. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  279. package/foundation/discovery/icon-set-checks.mjs +2 -1
  280. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  281. package/foundation/discovery/integration-doc-files.mjs +2 -1
  282. package/foundation/discovery/package-exports.d.mts +10 -0
  283. package/foundation/discovery/package-exports.mjs +56 -3
  284. package/foundation/discovery/prop-drift.mjs +9 -9
  285. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  286. package/foundation/discovery/runner-allowlist.mjs +2 -0
  287. package/foundation/discovery/stored-component-list.d.mts +43 -0
  288. package/foundation/discovery/stored-component-list.mjs +90 -0
  289. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  290. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  291. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  292. package/foundation/discovery/stored-self-audit.mjs +38 -18
  293. package/foundation/discovery/template-adapter.d.mts +53 -1
  294. package/foundation/discovery/template-adapter.mjs +176 -12
  295. package/foundation/discovery/template-icons.mjs +2 -1
  296. package/foundation/discovery/theme-discovery.mjs +31 -4
  297. package/foundation/discovery/theme-imports.d.mts +14 -0
  298. package/foundation/discovery/theme-imports.mjs +43 -1
  299. package/foundation/discovery/theming-targets.d.mts +6 -5
  300. package/foundation/discovery/theming-targets.mjs +31 -47
  301. package/foundation/doc-compiler/import.mjs +7 -1
  302. package/foundation/doc-compiler/inputs.mjs +3 -2
  303. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  304. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  305. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  306. package/foundation/env/semver.mjs +3 -1
  307. package/foundation/fonts/font-stylesheet.d.mts +38 -0
  308. package/foundation/fonts/font-stylesheet.mjs +141 -0
  309. package/foundation/fs/cache-eviction.d.mts +21 -0
  310. package/foundation/fs/cache-eviction.mjs +73 -0
  311. package/foundation/fs/exact-codec.d.mts +12 -2
  312. package/foundation/fs/exact-codec.mjs +23 -6
  313. package/foundation/fs/file-protection.mjs +4 -3
  314. package/foundation/fs/gather-cache.d.mts +62 -4
  315. package/foundation/fs/gather-cache.mjs +517 -91
  316. package/foundation/fs/jiti-cache.d.mts +19 -1
  317. package/foundation/fs/jiti-cache.mjs +130 -6
  318. package/foundation/fs/kept-tree.d.mts +60 -0
  319. package/foundation/fs/kept-tree.mjs +154 -0
  320. package/foundation/fs/listing-cache.d.mts +7 -0
  321. package/foundation/fs/listing-cache.mjs +10 -0
  322. package/foundation/fs/module-loader.d.mts +24 -2
  323. package/foundation/fs/module-loader.mjs +94 -21
  324. package/foundation/fs/paths.d.mts +18 -0
  325. package/foundation/fs/paths.mjs +15 -2
  326. package/foundation/fs/read-record.d.mts +9 -0
  327. package/foundation/fs/read-record.mjs +19 -11
  328. package/foundation/fs/stop-cleanup.d.mts +12 -0
  329. package/foundation/fs/stop-cleanup.mjs +66 -0
  330. package/foundation/identity/provider-identity.d.mts +6 -0
  331. package/foundation/identity/provider-identity.mjs +10 -1
  332. package/foundation/integrations/contribution-inventory.mjs +4 -3
  333. package/foundation/integrations/example-code.d.mts +63 -0
  334. package/foundation/integrations/example-code.mjs +416 -0
  335. package/foundation/integrations/public-imports.d.mts +9 -0
  336. package/foundation/integrations/public-imports.mjs +3 -2
  337. package/foundation/integrations/validate-contributions.mjs +17 -45
  338. package/foundation/render/embedded-files.d.mts +6 -0
  339. package/foundation/render/embedded-files.mjs +25 -5
  340. package/foundation/render/embedded-imports.d.mts +39 -7
  341. package/foundation/render/embedded-imports.mjs +66 -27
  342. package/foundation/render/file-header.d.mts +66 -0
  343. package/foundation/render/file-header.mjs +118 -0
  344. package/foundation/render/host-answer.d.mts +18 -0
  345. package/foundation/render/host-answer.mjs +46 -0
  346. package/foundation/render/host-exit.d.mts +1 -0
  347. package/foundation/render/host-exit.mjs +6 -1
  348. package/foundation/render/html-reader.d.mts +55 -2
  349. package/foundation/render/html-reader.mjs +145 -26
  350. package/foundation/render/markup-edits.d.mts +57 -0
  351. package/foundation/render/markup-edits.mjs +182 -0
  352. package/foundation/render/page-host.mjs +29 -12
  353. package/foundation/render/page-worker.mjs +121 -13
  354. package/foundation/render/picture-chrome.d.mts +4 -0
  355. package/foundation/render/picture-chrome.mjs +185 -0
  356. package/foundation/render/picture-playwright.d.mts +4 -0
  357. package/foundation/render/picture-playwright.mjs +34 -0
  358. package/foundation/render/rebuild.mjs +2 -1
  359. package/foundation/render/render-page.d.mts +35 -3
  360. package/foundation/render/render-page.mjs +641 -96
  361. package/foundation/render/source-block.d.mts +85 -6
  362. package/foundation/render/source-block.mjs +211 -20
  363. package/foundation/render/ts-paths.d.mts +69 -6
  364. package/foundation/render/ts-paths.mjs +326 -40
  365. package/foundation/response/error-codes.d.mts +3 -1
  366. package/foundation/response/error-codes.d.ts +1 -0
  367. package/foundation/response/error-codes.doc.mjs +12 -1
  368. package/foundation/response/error-codes.mjs +11 -1
  369. package/foundation/response/response-types.doc.mjs +2 -2
  370. package/foundation/text/compare-text.d.mts +14 -0
  371. package/foundation/text/compare-text.mjs +68 -0
  372. package/foundation/text/css-escape.d.mts +18 -0
  373. package/foundation/text/css-escape.mjs +35 -0
  374. package/foundation/text/string-utils.d.mts +3 -2
  375. package/foundation/text/string-utils.mjs +18 -4
  376. package/foundation/text/suggest-order.d.mts +9 -0
  377. package/foundation/text/suggest-order.mjs +15 -1
  378. package/foundation/xle/expand.mjs +2 -1
  379. package/host/index.mjs +8 -6
  380. 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,29 @@ 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[];
211
+ /**
212
+ * {@link onBuiltIn} with what each line is for: the install first, then
213
+ * the line, which works once it is installed (never offered as working
214
+ * now).
215
+ * @param {string} cwd
216
+ * @param {string} base
217
+ * @param {string} line
218
+ * @returns {Array<{name: string, reason: string}>}
219
+ */
220
+ export function onBuiltInSteps(cwd: string, base: string, line: string): Array<{
221
+ name: string;
222
+ reason: string;
223
+ }>;
160
224
  /**
161
225
  * What is wrong with settings data, or null: its shape, and each value with
162
226
  * the same rules `set` checks it by (without the installed Core), so a value
@@ -167,6 +231,53 @@ export function loadTheme(cwd: string, slug: string, skip?: string | Partial<Set
167
231
  * @returns {string | null}
168
232
  */
169
233
  export function settingsProblem(data: any, skip?: string | Partial<Setting>): string | null;
234
+ /**
235
+ * The built-in base the editor last built a theme on, read from the
236
+ * generated module's header (`// Built on @astryxdesign/theme-neutral …`),
237
+ * else from the newest undo step, or null when neither can be read. What a damaged base in
238
+ * the settings file is put back to, and what a theme made again keeps.
239
+ * @param {string} cwd
240
+ * @param {string} slug
241
+ * @returns {string | null}
242
+ */
243
+ export function builtOnBase(cwd: string, slug: string): string | null;
244
+ /**
245
+ * The `new` that makes a theme again in place, on the base it was built on
246
+ * as far as can still be read: the settings file's base (in any case), else
247
+ * the base the generated module was built on. With none, it says the theme
248
+ * starts on no base.
249
+ * @param {string} cwd
250
+ * @param {string} slug
251
+ * @returns {{lines: string[], base: string | null}}
252
+ */
253
+ export function remakeLines(cwd: string, slug: string): {
254
+ lines: string[];
255
+ base: string | null;
256
+ };
257
+ /**
258
+ * A dial's own word typed in any case (ROOMY, MORE, Both, NONE): the word,
259
+ * or null when the value is no word of that dial. The one case rule for
260
+ * every dial, typed or saved. On the font dial several words are a family
261
+ * list, whose names keep their letters; one word is the preset.
262
+ * @param {string} thing
263
+ * @param {string} value
264
+ * @returns {string | null}
265
+ */
266
+ export function dialWordOf(thing: string, value: string): string | null;
267
+ /**
268
+ * What loading read differently from the file in the theme's entries (a
269
+ * mode or source in other letters, a missing source): one note each.
270
+ * @param {object} data the theme as {@link loadTheme} returned it
271
+ * @returns {string[]}
272
+ */
273
+ export function entryNotes(data: object): string[];
274
+ /**
275
+ * Which part of an entry means nothing after reading: its source, mode or
276
+ * `only`, or null.
277
+ * @param {any} s
278
+ * @returns {'mode' | 'source' | 'only' | null}
279
+ */
280
+ export function entryDamage(s: any): "mode" | "source" | "only" | null;
170
281
  /**
171
282
  * Every setting whose only problem is its value or scope, each with the
172
283
  * command that removes it.
@@ -179,6 +290,13 @@ export function badSettings(data: any): Setting[];
179
290
  * @param {import('./_settings.mjs').Setting} x
180
291
  */
181
292
  export function undoArgs(x: import("./_settings.mjs").Setting): string;
293
+ /**
294
+ * The words of a `set` that gives a setting's scope a value: set reads a
295
+ * headings half from its word, so no half is named.
296
+ * @param {import('./_settings.mjs').Setting} x
297
+ * @param {string} value
298
+ */
299
+ export function setArgs(x: import("./_settings.mjs").Setting, value: string): string;
182
300
  /**
183
301
  * The first setting whose only problem is its value (made under looser
184
302
  * rules): `undo <theme> <undoArgs>` removes it.
@@ -202,6 +320,28 @@ export function withoutBadValues(data: ThemeData): {
202
320
  * @returns {string | null}
203
321
  */
204
322
  export function valueProblem(s: any): string | null;
323
+ /**
324
+ * One entry of the top-level `tokens` map in a theme's own source, as
325
+ * written: its token (null for a computed key no read of the file can
326
+ * resolve), the key as typed, the line that sets it, and its value's shape.
327
+ * A `chain` entry is another theme the file defines (`theme`, its name):
328
+ * its call, or a token its literal tokens map sets. A `scope` entry names
329
+ * where a scope (`components`, `onDark`, `onLight`, `adaptations`,
330
+ * `localTokens`) starts; a `scoped` entry is a token one sets, with its
331
+ * scope path (`components.button.base`). A `duplicate` entry names a
332
+ * second `tokens` key (with every line); a
333
+ * `typography` entry is one typography field (its dotted key and value);
334
+ * an `unresolved` entry says the map holds something only a build reads.
335
+ * @typedef {{token: string | null, key: string, line: number | null, kind: 'text' | 'number' | 'pair' | 'object' | 'other' | 'duplicate' | 'typography' | 'unresolved' | 'scope' | 'scoped' | 'chain', scope?: string, theme?: string, value?: any, halves?: Array<string | number | undefined>, lines?: Array<number | null>, file?: string, overridden?: boolean, expression?: boolean, notToken?: boolean}} OwnTokenEntry
336
+ */
337
+ /**
338
+ * The entries of the top-level `tokens` map in a theme's own source, read
339
+ * from its syntax tree, each with the line that sets it.
340
+ * @param {string} cwd
341
+ * @param {string} slug
342
+ * @returns {OwnTokenEntry[]}
343
+ */
344
+ export function ownTokenEntries(cwd: string, slug: string): OwnTokenEntry[];
205
345
  /**
206
346
  * The tokens a base theme's own component rules for a part read through
207
347
  * var() (neutral's progress-bar reads --color-border-emphasized), from its
@@ -272,6 +412,15 @@ export function describe(s: Setting): string;
272
412
  * @returns {string[]}
273
413
  */
274
414
  export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing">): string[];
415
+ /**
416
+ * A corners value in the plain form the editor saves, typed or saved: a
417
+ * rung in any case is that rung; a size in px or rem, any way a CSS number
418
+ * is written, is that many px (a rem is 16px; 1000px and more is pill).
419
+ * Null for any other value.
420
+ * @param {string} v
421
+ * @returns {string | null}
422
+ */
423
+ export function cornersPlain(v: string): string | null;
275
424
  /**
276
425
  * A length in pixels: px as given, rem and em at 16px; null for anything
277
426
  * else (a percentage, calc(), a word).
@@ -279,6 +428,14 @@ export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing">): st
279
428
  * @returns {number | null}
280
429
  */
281
430
  export function lengthPx(v: string): number | null;
431
+ /**
432
+ * The base theme's body text size in px, read back from its built base
433
+ * size (14 when it writes none).
434
+ * @param {{light: Record<string, string>}} base
435
+ */
436
+ export function baseTextPx(base: {
437
+ light: Record<string, string>;
438
+ }): number;
282
439
  /**
283
440
  * The family and fallbacks a font value means: a preset, an open font, a
284
441
  * whole stack with commas, or one family name.
@@ -313,6 +470,14 @@ export function cssFamily(name: string, spaced?: boolean): string;
313
470
  * @param {string} slug
314
471
  */
315
472
  export function sourceChangedReason(slug: string): string;
473
+ /**
474
+ * The tokens the theme's last build sets for touch screens (in its rules
475
+ * for a coarse pointer), each with the last value it is given there.
476
+ * @param {string} cwd
477
+ * @param {string} slug
478
+ * @returns {Map<string, string>}
479
+ */
480
+ export function builtTouchTokens(cwd: string, slug: string): Map<string, string>;
316
481
  /**
317
482
  * Record in an editor theme's generated settings that they were built with
318
483
  * its own source as it is now, after `compile` built that source (the
@@ -342,6 +507,27 @@ export function stopsIn(source: string): Record<string, Record<"light" | "dark",
342
507
  stop: number;
343
508
  alpha?: string;
344
509
  }>>;
510
+ /**
511
+ * A size in px: px, rem (16px each), or a calc() of those added and
512
+ * subtracted; null for anything else.
513
+ * @param {string} v
514
+ * @param {Record<string, string>} [vars] values for the tokens a var() may name
515
+ * @returns {number | null}
516
+ */
517
+ export function sizePx(v: string, vars?: Record<string, string>): number | null;
518
+ /**
519
+ * Spacing steps scaled with the spacing dial, kept in order around the
520
+ * steps the theme keeps exact: each the plain scaled value unless it would
521
+ * meet or pass a kept one; those are spread evenly between the kept one and
522
+ * the nearest step that keeps its place. A step with no room below a kept
523
+ * one takes the value of the one below it.
524
+ * @param {Array<[string, number]>} steps token name and the base value, in px
525
+ * @param {number} f the rung's factor
526
+ * @param {Record<string, number>} kept exact steps the theme keeps, in px
527
+ * @param {string[]} [noRoom] filled with the steps left no room
528
+ * @returns {Array<[string, number]>} every step's new value in px, kept ones as kept
529
+ */
530
+ export function spacingSteps(steps: Array<[string, number]>, f: number, kept: Record<string, number>, noRoom?: string[]): Array<[string, number]>;
345
531
  /**
346
532
  * Control heights scaled with the spacing dial (a denser theme has shorter
347
533
  * controls), each kept distinct and in order: smallest to largest, a
@@ -351,9 +537,13 @@ export function stopsIn(source: string): Record<string, Record<"light" | "dark",
351
537
  * scaled above it.
352
538
  * @param {Array<[string, string]>} sizes token name and the theme's value
353
539
  * @param {number} f the spacing rung's factor
540
+ * @param {Record<string, number>} [kept] exact sizes the theme keeps, in px,
541
+ * which the others stay in order around
542
+ * @param {string[]} [noRoom] filled with the sizes left no room between
543
+ * two kept ones (each then equals the one below it)
354
544
  * @returns {Array<[string, string]>} the tokens it writes, in px
355
545
  */
356
- export function controlSizes(sizes: Array<[string, string]>, f: number): Array<[string, string]>;
546
+ export function controlSizes(sizes: Array<[string, string]>, f: number, kept?: Record<string, number>, noRoom?: string[]): Array<[string, string]>;
357
547
  /**
358
548
  * The settings, as a `defineTheme` object.
359
549
  * @param {Ctx} ctx
@@ -365,6 +555,17 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
365
555
  light: Record<string, string>;
366
556
  dark: Record<string, string>;
367
557
  }): any;
558
+ /**
559
+ * A background shorthand split into its image layers and the color its
560
+ * last layer may carry (the color under every image): a color word beside
561
+ * the last image, or a last layer that is a color alone.
562
+ * @param {string} value
563
+ * @returns {{images: string, color: string | null}}
564
+ */
565
+ export function backgroundColorLayer(value: string): {
566
+ images: string;
567
+ color: string | null;
568
+ };
368
569
  /**
369
570
  * Settings whose effect a later or stronger setting hides, with why: `type`
370
571
  * loses heading weight and tracking to `headings`.
@@ -379,23 +580,32 @@ export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting,
379
580
  * {font-weight}`. Find those rules in the built stylesheet.
380
581
  * @param {string} cssText
381
582
  * @param {any} theme
382
- * @returns {Array<{target: string, key: string, prop: string, value: string}>}
583
+ * @returns {Array<{target: string, key: string, prop: string, value: string, state?: string}>}
383
584
  */
384
585
  export function findOverrides(cssText: string, theme: any): Array<{
385
586
  target: string;
386
587
  key: string;
387
588
  prop: string;
388
589
  value: string;
590
+ state?: string;
389
591
  }>;
390
592
  /**
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.
593
+ * Why a theme's source cannot carry its settings, with the step that puts
594
+ * it right; null when it carries them. The theme is the export a build of
595
+ * the source reads, loaded as the build loads it: it must be named for the
596
+ * theme, and the settings module's own export must be in the chain of
597
+ * themes it extends (after every spread and repeated key), the very object,
598
+ * not a theme named like it. Null for a source that does not parse (its
599
+ * parse error is its own finding), and for one that imports the settings
600
+ * but does not load (outputsDrift and the build report that).
394
601
  * @param {string} cwd
395
602
  * @param {string} slug
396
- * @returns {string | null}
603
+ * @returns {Promise<{problem: string, fix: string} | null>}
397
604
  */
398
- export function themeSourceProblem(cwd: string, slug: string): string | null;
605
+ export function themeSourceProblem(cwd: string, slug: string): Promise<{
606
+ problem: string;
607
+ fix: string;
608
+ } | null>;
399
609
  /**
400
610
  * Why the person's own theme source does not parse (its line and the
401
611
  * parser's message), or null when it parses or is not there.
@@ -418,24 +628,44 @@ export function refuseThemeParse(cwd: string, slug: string): void;
418
628
  * @param {string} cwd
419
629
  * @param {string} slug
420
630
  */
421
- export function refuseThemeSource(cwd: string, slug: string): void;
631
+ export function refuseThemeSource(cwd: string, slug: string): Promise<void>;
632
+ /**
633
+ * The refusal for a theme source that cannot carry the settings (it no
634
+ * longer imports or extends them, or names another theme), naming the
635
+ * lines that put it back; null when it carries them. Every command that
636
+ * builds the theme refuses with it.
637
+ * @param {string} cwd
638
+ * @param {string} slug
639
+ * @returns {Promise<AstryxError | null>}
640
+ */
641
+ export function themeSourceRefusal(cwd: string, slug: string): Promise<AstryxError | null>;
422
642
  /**
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).
643
+ * The input the theme's own source gives `defineTheme()`, evaluated as a
644
+ * build evaluates it, with the theme Core made of it (or Core's error when
645
+ * it refuses the input); null when the source does not load.
428
646
  * @param {Ctx} ctx
429
647
  * @param {string} slug
430
- * @returns {Promise<string[]>}
648
+ * @param {string | null} like the base theme, whose built tokens are `base`
649
+ * @returns {Promise<{input: any, theme: any, error: Error | null, chain: any[], base: Map<string, string | null>} | null>}
431
650
  */
432
- export function builtPairs(ctx: Ctx, slug: string): Promise<string[]>;
651
+ export function ownThemeInput(ctx: Ctx, slug: string, like: string | null): Promise<{
652
+ input: any;
653
+ theme: any;
654
+ error: Error | null;
655
+ chain: any[];
656
+ base: Map<string, string | null>;
657
+ } | null>;
433
658
  /**
434
659
  * The refusal of a [light, dark] pair on tokens that are not colors.
435
660
  * @param {string} slug
436
661
  * @param {string[]} names
437
662
  */
438
663
  export function ownPairMessage(slug: string, names: string[]): string;
664
+ /**
665
+ * Set the check of a theme's own token values run before every build.
666
+ * @param {((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null} fn
667
+ */
668
+ export function setOwnTokenCheck(fn: ((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null): void;
439
669
  /**
440
670
  * Set what runs after every build of a theme.
441
671
  * @param {((ctx: Ctx, slug: string, data: ThemeData) => void) | null} fn
@@ -453,13 +683,23 @@ export function holdAfterBuild(ctx: Ctx): void;
453
683
  * @param {Ctx} ctx
454
684
  * @param {string} slug
455
685
  * @param {ThemeData} data
456
- * @returns {Promise<{warnings: string[], lifted: string[], notes: string[]}>} `notes`: what the color config kept or replaced of a hand edit
686
+ * @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
687
  */
458
688
  export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
459
689
  warnings: string[];
460
690
  lifted: string[];
461
691
  notes: string[];
692
+ removedPictures: string[];
462
693
  }>;
694
+ /**
695
+ * The one color mode of a light-only or dark-only theme, from its settings,
696
+ * for the build to write into the built module (`colorModes`); null for a
697
+ * theme with both modes.
698
+ * @param {string} cwd
699
+ * @param {string} slug
700
+ * @returns {['light'] | ['dark'] | null}
701
+ */
702
+ export function buildColorModes(cwd: string, slug: string): ["light"] | ["dark"] | null;
463
703
  /**
464
704
  * Why the built outputs differ from what the theme builds now: one that is
465
705
  * missing or changed by hand, found the way `compile --check` finds it
@@ -479,6 +719,22 @@ export function resolvedTokens(ctx: Ctx, slug: string): Promise<{
479
719
  light: Record<string, string>;
480
720
  dark: Record<string, string>;
481
721
  }>;
722
+ /**
723
+ * A value as a message names it, whatever it is: text in quotes, a number,
724
+ * a BigInt with its `n`, a symbol, a function, an array or an object as
725
+ * JSON where it has one. Never throws.
726
+ * @param {unknown} value
727
+ * @returns {string}
728
+ */
729
+ export function describeValue(value: unknown): string;
730
+ /**
731
+ * Why a token value is not one, with a value of the token's own type to
732
+ * write instead (a size in px, a weight as a number in quotes), or none.
733
+ * @param {Ctx} ctx
734
+ * @param {string} slug
735
+ * @param {[string, unknown, ('object' | 'pair' | 'unit' | 'value' | 'mode')?]} bad
736
+ */
737
+ export function nonTextMessage(ctx: Ctx, slug: string, [name, value, kind]: [string, unknown, ("object" | "pair" | "unit" | "value" | "mode")?]): string;
482
738
  /**
483
739
  * Contrast problems this theme caused: text below 4.5:1 that was not as low
484
740
  * in the base theme. A part's own color or background setting, or a token
@@ -493,8 +749,63 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
493
749
  dark: Record<string, string>;
494
750
  }): Promise<string[]>;
495
751
  /**
496
- * Whether parsed settings have the shape the editor reads: an object with a
497
- * list of settings.
752
+ * A settings file's or an undo step's text as JSON, a byte-order mark
753
+ * aside; undefined when there is no text or it does not parse. Every reader
754
+ * of settings text reads it here.
755
+ * @param {string | null | undefined} text
756
+ * @returns {any}
757
+ */
758
+ export function settingsJson(text: string | null | undefined): any;
759
+ /**
760
+ * Whether settings data has its shape and every entry is an object with a
761
+ * thing name: what a reader may go through entry by entry. Any other entry
762
+ * (null, a number, text) is damage the file check names.
763
+ * @param {any} data
764
+ */
765
+ export function entriesReadable(data: any): any;
766
+ /**
767
+ * Read a damaged mode or base the way a change reads it, in place: one
768
+ * written in other letters, as a package name, as a mode word or with a
769
+ * typo (`Dark-Only`, `@astryxdesign/theme-neutral`, `light`, `neutrl`) is
770
+ * the value meant, as `set` reads it. Any other is refused for a change
771
+ * (slug given), with the line that sets it; read for an undo step, it goes
772
+ * back to its default. `like: "none"` is no base. The field a command sets
773
+ * itself is left to that command.
774
+ * @param {any} data
775
+ * @param {string} cwd
776
+ * @param {string} [fixing] `mode` or `base` when the command sets it
777
+ * @param {string} [slug] the theme a change is made to
778
+ * @returns {string[]} a note for each field read differently from the file
779
+ */
780
+ export function readFields(data: any, cwd: string, fixing?: string, slug?: string): string[];
781
+ /**
782
+ * Read settings data as a change reads it, in place: entry modes and
783
+ * sources in other words, and a damaged mode or base (see
784
+ * {@link readFields}). The settings file and every undo step are read
785
+ * through here.
786
+ * @param {any} data
787
+ * @param {string} cwd
788
+ * @param {string} [fixing] `mode` or `base` when the command sets it
789
+ * @returns {string[]} a note for each thing read differently from the text
790
+ */
791
+ export function readAsMeant(data: any, cwd: string, fixing?: string): string[];
792
+ /**
793
+ * Whether `new` makes a theme again over these settings, keeping the file
794
+ * aside: text that does not parse, or entries it cannot read (no thing, no
795
+ * value, no source). The one rule both `new` and the refusals that offer
796
+ * it read; any other damage is repaired by the lines its refusal names.
797
+ * @param {unknown} data the parsed file (undefined when it does not parse)
798
+ */
799
+ export function settingsRemade(data: unknown): boolean;
800
+ /**
801
+ * Whether every settings entry has the parts the editor reads (a thing, a
802
+ * value and a source); one without is damage `new` keeps aside.
803
+ * @param {any} data
804
+ */
805
+ export function settingsEntriesOk(data: any): any;
806
+ /**
807
+ * Whether settings data has the shape the editor reads: an object with a
808
+ * settings list.
498
809
  * @param {any} data
499
810
  */
500
811
  export function settingsShapeOk(data: any): boolean;
@@ -525,6 +836,36 @@ export function baseComponent(base: {
525
836
  * @returns {string | null}
526
837
  */
527
838
  export function focusStateOf(ctx: Ctx, part: string): string | null;
839
+ /**
840
+ * The radius token a part's corners follow when Core draws its corners one
841
+ * by one from that token by position (a button squares the joins inside a
842
+ * button group; a button group's outer corners are its end buttons'), or
843
+ * null. A radius for such a part is written as that
844
+ * token on the part, so every position keeps its own corner; a radius
845
+ * written on the part would override Core's per-corner rules.
846
+ * @param {Ctx} ctx
847
+ * @param {string} part
848
+ * @returns {string | null}
849
+ */
850
+ export function positionalCornerToken(ctx: Ctx, part: string): string | null;
851
+ /**
852
+ * The parts that draw a part's corners: the part itself, or, when Core gives
853
+ * it no radius of its own, the parts inside it that it has (a date-time
854
+ * input's date and time boxes).
855
+ * @param {Ctx} ctx
856
+ * @param {string} part
857
+ * @returns {string[]}
858
+ */
859
+ export function cornerParts(ctx: Ctx, part: string): string[];
860
+ /**
861
+ * The parts that take a part's padding: the part itself, or, when Core
862
+ * renders it as a box CSS draws no padding on (a table row) and gives it no
863
+ * other display, the parts inside it with padding of their own (its cells).
864
+ * @param {Ctx} ctx
865
+ * @param {string} part
866
+ * @returns {string[]}
867
+ */
868
+ export function paddedParts(ctx: Ctx, part: string): string[];
528
869
  /**
529
870
  * The radius token a part's resting corners read. A part the census saw
530
871
  * closed (a menu, a popover) has none recorded: a container or menu reads
@@ -555,6 +896,21 @@ export function clearNewMarker(dir: string): void;
555
896
  * @returns {string}
556
897
  */
557
898
  export function stateKey(state: string, wrapsControl?: boolean): string;
899
+ /**
900
+ * The text color tokens Core's elements inside a part read for their own
901
+ * color (a top nav heading's title span reads --color-text-primary itself),
902
+ * so a color set on the part never reaches that text. Only the main and
903
+ * supporting text colors count: the disabled, placeholder and accent ones
904
+ * mark a state or a role, not the part's text. With `deep`, the parts inside
905
+ * it count too (a top nav's heading and items).
906
+ * @param {{MAP: Record<string, any>}} C
907
+ * @param {string} part
908
+ * @param {boolean} [deep]
909
+ * @returns {string[]}
910
+ */
911
+ export function innerTextTokens(C: {
912
+ MAP: Record<string, any>;
913
+ }, part: string, deep?: boolean): string[];
558
914
  /**
559
915
  * The component docs of a part: its own component's, and the one named like
560
916
  * the part (tab is Tab, under TabList), each with its name, for the ones the
@@ -604,6 +960,19 @@ export function radiusAt(base: {
604
960
  * editor's header).
605
961
  * @param {string} file
606
962
  */
963
+ /**
964
+ * Whether the editor made a theme's folder, though its settings may be
965
+ * gone: a stopped `new` left its marker, or the folder holds what only the
966
+ * editor writes (the generated settings module, an undo history, the theme
967
+ * source with the header the editor wrote it with).
968
+ * @param {string} cwd
969
+ * @param {string} slug
970
+ */
971
+ export function editorMadeFolder(cwd: string, slug: string): boolean;
972
+ /**
973
+ * Whether a file carries the editor's generated header.
974
+ * @param {string} file
975
+ */
607
976
  export function madeByEditor(file: string): boolean;
608
977
  /**
609
978
  * Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
@@ -676,18 +1045,43 @@ export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history,
676
1045
  notes: string[];
677
1046
  unchanged: boolean;
678
1047
  }>;
679
- /** @param {Ctx} ctx @param {ThemeData} data */
680
- export function fontPackages(ctx: Ctx, data: ThemeData): {
1048
+ /**
1049
+ * The @fontsource package for a font family: an open font's own package
1050
+ * as the editor's font table names it (Geist is `@fontsource/geist-sans`),
1051
+ * else the family's name in Fontsource's form (`Open Sans` is
1052
+ * `@fontsource/open-sans`).
1053
+ * @param {string} family
1054
+ * @returns {string}
1055
+ */
1056
+ export function fontsourcePackageOf(family: string): string;
1057
+ /**
1058
+ * The font families the theme's last build names (its `--font-family-*`
1059
+ * tokens, every part's `font-family`, and a `font` shorthand's families), by lowercase name; null before the
1060
+ * theme has been built.
1061
+ * @param {Ctx} ctx
1062
+ * @param {string} slug
1063
+ * @returns {Map<string, string> | null}
1064
+ */
1065
+ export function builtFontFamilies(ctx: Ctx, slug: string): Map<string, string> | null;
1066
+ /**
1067
+ * The font packages that load the families the theme builds: a font
1068
+ * setting's package while the build still uses its family, and the
1069
+ * installed @fontsource package of a family the theme's own source sets.
1070
+ * Font notes, the previews and the app copy all load fonts from this list.
1071
+ * For a new app that installs its own packages (`forNewApp`), every built
1072
+ * family that is an open font comes too, installed here or not.
1073
+ * @param {Ctx} ctx
1074
+ * @param {ThemeData} data
1075
+ * @param {{forNewApp?: boolean}} [opts]
1076
+ */
1077
+ export function fontPackages(ctx: Ctx, data: ThemeData, { forNewApp }?: {
1078
+ forNewApp?: boolean;
1079
+ }): {
681
1080
  pkg: string;
682
1081
  family: string;
683
1082
  installed: boolean;
684
- of: Setting;
1083
+ of: Setting | null;
685
1084
  }[];
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
1085
  export function slugOk(s: string): boolean;
692
1086
  export function windowsReserved(s: string): boolean;
693
1087
  export function slugFor(name: unknown): string;
@@ -701,7 +1095,16 @@ export function cornerPx(v: string): number;
701
1095
  export function textPx(v: string): number;
702
1096
  /** The type tokens base themes set again for phones: families and weights. */
703
1097
  export const PHONE_TYPE: RegExp;
1098
+ export namespace PHONE_RULE_WHEN {
1099
+ let pointer: string;
1100
+ namespace width {
1101
+ let below: string;
1102
+ }
1103
+ }
704
1104
  export function themeSource(slug: string): string;
1105
+ export function settingsThemeName(slug: string): string;
1106
+ /** The radius tokens the corners dial moves. */
1107
+ export const DIAL_RADII: string[];
705
1108
  /** The file a `new` keeps beside the files it writes until it is done. */
706
1109
  export const NEW_MARKER: ".astryx-new.json";
707
1110
  /**
@@ -713,6 +1116,34 @@ export const EDITOR_SUFFIXES: string[];
713
1116
  export function isEditorFile(slug: string, n: string): boolean;
714
1117
  /** The undo steps a theme keeps; older ones are dropped. */
715
1118
  export const HISTORY_STEPS: 80;
1119
+ /**
1120
+ * One entry of the top-level `tokens` map in a theme's own source, as
1121
+ * written: its token (null for a computed key no read of the file can
1122
+ * resolve), the key as typed, the line that sets it, and its value's shape.
1123
+ * A `chain` entry is another theme the file defines (`theme`, its name):
1124
+ * its call, or a token its literal tokens map sets. A `scope` entry names
1125
+ * where a scope (`components`, `onDark`, `onLight`, `adaptations`,
1126
+ * `localTokens`) starts; a `scoped` entry is a token one sets, with its
1127
+ * scope path (`components.button.base`). A `duplicate` entry names a
1128
+ * second `tokens` key (with every line); a
1129
+ * `typography` entry is one typography field (its dotted key and value);
1130
+ * an `unresolved` entry says the map holds something only a build reads.
1131
+ */
1132
+ export type OwnTokenEntry = {
1133
+ token: string | null;
1134
+ key: string;
1135
+ line: number | null;
1136
+ kind: "text" | "number" | "pair" | "object" | "other" | "duplicate" | "typography" | "unresolved" | "scope" | "scoped" | "chain";
1137
+ scope?: string;
1138
+ theme?: string;
1139
+ value?: any;
1140
+ halves?: Array<string | number | undefined>;
1141
+ lines?: Array<number | null>;
1142
+ file?: string;
1143
+ overridden?: boolean;
1144
+ expression?: boolean;
1145
+ notToken?: boolean;
1146
+ };
716
1147
  /**
717
1148
  * One setting the CLI owns.
718
1149
  */
@@ -777,6 +1208,8 @@ export type Ctx = {
777
1208
  alpha?: string;
778
1209
  }>> | null;
779
1210
  keepRadii?: Record<string, string> | null;
1211
+ sizeNotes?: string[];
1212
+ compileNotes?: string[];
780
1213
  derived?: Record<string, Array<{
781
1214
  property: string;
782
1215
  vars?: string[];
@@ -786,15 +1219,7 @@ export type Ctx = {
786
1219
  };
787
1220
  export type PaintSide = import("./_parts.mjs").PaintSide;
788
1221
  export type TextPair = import("./_parts.mjs").TextPair;
1222
+ import { AstryxError } from '../error.mjs';
1223
+ import { NAME_RULE } from './_name-rule.mjs';
789
1224
  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 };
1225
+ export { NAME_RULE, modesOf };