@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
@@ -10,6 +10,15 @@
10
10
  * @returns {T}
11
11
  */
12
12
  export function wordTable<T>(table: T): T;
13
+ /**
14
+ * The CSS font-family stack a font dial word stands for (a preset such as
15
+ * mono, or an open font such as inter): its family, quoted when it holds a
16
+ * space, then its fallbacks. Null for any other word. A part's font-family
17
+ * takes this stack, never the word itself, which names no family.
18
+ * @param {string} word
19
+ * @returns {string | null}
20
+ */
21
+ export function fontStack(word: string): string | null;
13
22
  /** The command prefix every suggested command starts with. */
14
23
  export const P: "astryx experimental theme editor";
15
24
  /**
@@ -35,6 +44,12 @@ export const AUTO_SPREAD: string[];
35
44
  export function familyOf(target: string): string | null;
36
45
  /** @type {Array<[string, number]>} */
37
46
  export const CORNERS: Array<[string, number]>;
47
+ export namespace DENSITY {
48
+ let roomy: readonly ["airy", "airier", "spacious", "roomy", "roomier", "loose", "looser", "relaxed", "comfortable", "sparse", "generous", "spread out"];
49
+ let dense: readonly ["dense", "denser", "compact", "tight", "tighter", "condensed"];
50
+ let crowded: readonly ["cramped", "crowded", "packed"];
51
+ }
52
+ export function densityWords(...kinds: (keyof typeof DENSITY)[]): string;
38
53
  /** @type {Array<[string, number]>} */
39
54
  export const SPACING: Array<[string, number]>;
40
55
  /** @type {Array<[string, number]>} */
@@ -129,6 +144,12 @@ export const WRAPPED_PARTS: Record<string, {
129
144
  }>;
130
145
  /** States every part takes, beyond the ones its doc lists. */
131
146
  export const COMMON_STATES: string[];
147
+ /**
148
+ * Words for a mode, and the mode each means, beside the mode's own name in
149
+ * its written forms (dark-only, darkmode, mode dark), which modeWord reads:
150
+ * the table of the one mode reader.
151
+ */
152
+ export const MODE_WORDS: Record<string, "light" | "dark">;
132
153
  export type Dial = {
133
154
  /**
134
155
  * - What the dial does, its rungs, and where it applies.
@@ -115,6 +115,39 @@ export const CORNERS = [
115
115
  ['round', 16],
116
116
  ['pill', 9999],
117
117
  ];
118
+ /**
119
+ * The density words, the one table every reading of room uses: words for
120
+ * more room (roomy), for less (dense), and complaints that there is too
121
+ * little (crowded). An ask names the density it wants; after "too" the
122
+ * word names the density there is, so the change goes the other way.
123
+ */
124
+ export const DENSITY = /** @type {const} */ ({
125
+ roomy: [
126
+ 'airy',
127
+ 'airier',
128
+ 'spacious',
129
+ 'roomy',
130
+ 'roomier',
131
+ 'loose',
132
+ 'looser',
133
+ 'relaxed',
134
+ 'comfortable',
135
+ 'sparse',
136
+ 'generous',
137
+ 'spread out',
138
+ ],
139
+ dense: ['dense', 'denser', 'compact', 'tight', 'tighter', 'condensed'],
140
+ crowded: ['cramped', 'crowded', 'packed'],
141
+ });
142
+
143
+ /**
144
+ * The density words of the kinds given, as one alternation for a regular
145
+ * expression.
146
+ * @param {...keyof typeof DENSITY} kinds
147
+ */
148
+ export const densityWords = (...kinds) =>
149
+ kinds.flatMap(k => DENSITY[k]).join('|');
150
+
118
151
  /** @type {Array<[string, number]>} */
119
152
  export const SPACING = [
120
153
  ['tight', 0.75],
@@ -201,6 +234,10 @@ const ONE_SYSTEM_FAMILIES = new Map(
201
234
  'segoe ui',
202
235
  'segoe ui emoji',
203
236
  'segoe ui symbol',
237
+ 'segoe ui light',
238
+ 'segoe ui semilight',
239
+ 'segoe ui semibold',
240
+ 'segoe ui black',
204
241
  'consolas',
205
242
  'cambria',
206
243
  'calibri',
@@ -300,6 +337,25 @@ export const OPEN_FONTS = wordTable(
300
337
  ),
301
338
  );
302
339
 
340
+ /**
341
+ * The CSS font-family stack a font dial word stands for (a preset such as
342
+ * mono, or an open font such as inter): its family, quoted when it holds a
343
+ * space, then its fallbacks. Null for any other word. A part's font-family
344
+ * takes this stack, never the word itself, which names no family.
345
+ * @param {string} word
346
+ * @returns {string | null}
347
+ */
348
+ export function fontStack(word) {
349
+ const w = String(word).trim().toLowerCase();
350
+ const [family, fallbacks] = FONTS[w]
351
+ ? FONTS[w]
352
+ : OPEN_FONTS[w]
353
+ ? [OPEN_FONTS[w].family.replace(/"/g, ''), OPEN_FONTS[w].fallbacks]
354
+ : [null, null];
355
+ if (!family) return null;
356
+ return `${/\s/.test(family) ? `"${family}"` : family}, ${fallbacks}`;
357
+ }
358
+
303
359
  /**
304
360
  * Brand fonts no package loads, and the closest open font, for the warning
305
361
  * a theme that names one gets.
@@ -436,8 +492,7 @@ export const DIALS = wordTable({
436
492
  'set my spacing more',
437
493
  'set my spacing roomy --on card',
438
494
  ],
439
- words:
440
- 'spacing space room roomy airy dense density compact tight padding gap gaps margin breathing cramped spread spacious',
495
+ words: `spacing space room density padding gap gaps margin breathing spread ${densityWords('roomy', 'dense', 'crowded').replace(/\|/g, ' ')}`,
441
496
  },
442
497
  accent: {
443
498
  help: 'The main brand color: primary buttons, links, selection and the focus ring. From the one color the editor generates its shades, light and dark, and points the accent tokens at them: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. The fill keeps the exact color you gave in light, and in dark too when text on it reads at 4.5:1 and it stands out from the dark page at 3:1; otherwise dark mode uses shade 70, where the official themes put a dark fill, or the shade nearest it that passes both, and the result says so. Text on the fill is the neutral color\'s white or near-black (pure white or black without a neutral color), whichever reads on it. The fill never moves: when no text reads on it, or a pale fill does not stand out from the light page, the result says so. Other tokens move to a nearby shade when they must read: text at 4.5:1, the focus ring at 3:1. `how colors` explains it; the Colors preview page (`preview add`) shows every shade. For an exact color, set the token itself (set my --color-accent "#7c3aed"): an exact token always wins over the generated colors.',
@@ -607,6 +662,14 @@ export const GROUPS = wordTable(
607
662
  'margin',
608
663
  'margin-block',
609
664
  'margin-inline',
665
+ 'margin-top',
666
+ 'margin-bottom',
667
+ 'margin-left',
668
+ 'margin-right',
669
+ 'margin-block-start',
670
+ 'margin-block-end',
671
+ 'margin-inline-start',
672
+ 'margin-inline-end',
610
673
  ],
611
674
  font: [
612
675
  'font-family',
@@ -712,7 +775,25 @@ export const THING_HINTS = wordTable({
712
775
  `${P} set <theme> spacing roomy${on ? ` --on ${on}` : ''}`,
713
776
  `${P} set <theme> padding 12px --on ${on ?? '<part>'}`,
714
777
  ],
715
- density: () => [`${P} set <theme> spacing compact`],
778
+ // The density named carries over: a spacing rung as it is, a word for
779
+ // more or less room as the rung that way; else how spacing.
780
+ density: (v, on) => {
781
+ const w = v.trim().toLowerCase();
782
+ const rung = SPACING.some(([n]) => n === w)
783
+ ? w
784
+ : new RegExp(`^(?:${densityWords('roomy')})$`).test(w)
785
+ ? 'roomy'
786
+ : new RegExp(
787
+ `^(?:${densityWords('dense', 'crowded')}|small|less)$`,
788
+ ).test(w)
789
+ ? 'compact'
790
+ : null;
791
+ return [
792
+ rung
793
+ ? `${P} set <theme> spacing ${rung}${on ? ` --on ${on}` : ''}`
794
+ : `${HOW} spacing`,
795
+ ];
796
+ },
716
797
  bold: (v, on) => [
717
798
  `${P} set <theme> font-weight ${/^(none|false|off|no|normal)$/i.test(v.trim()) ? 'normal' : 'bold'} --on ${on ?? '<part>'}`,
718
799
  ],
@@ -758,6 +839,18 @@ export const COMMON_STATES = [
758
839
  'disabled',
759
840
  ];
760
841
 
842
+ /**
843
+ * Words for a mode, and the mode each means, beside the mode's own name in
844
+ * its written forms (dark-only, darkmode, mode dark), which modeWord reads:
845
+ * the table of the one mode reader.
846
+ */
847
+ export const MODE_WORDS = /** @type {Record<string, 'light' | 'dark'>} */ ({
848
+ day: 'light',
849
+ daytime: 'light',
850
+ night: 'dark',
851
+ nighttime: 'dark',
852
+ });
853
+
761
854
  // These tables are looked up by words people type: with no prototype,
762
855
  // `constructor` or `__proto__` is never found in them.
763
856
  for (const table of [
@@ -774,5 +867,6 @@ for (const table of [
774
867
  DIRECT,
775
868
  THING_HINTS,
776
869
  DESIGN,
870
+ MODE_WORDS,
777
871
  ])
778
872
  Object.setPrototypeOf(table, null);
@@ -40,3 +40,34 @@ export function readSetLine(name: string, slug: string): {
40
40
  * @returns {T}
41
41
  */
42
42
  export function vetSuggestions<T>(e: T, ctx: import("./_settings.mjs").Ctx | null | undefined, slug: string, data: import("./_settings.mjs").ThemeData | null | undefined): T;
43
+ /**
44
+ * Whether a line a refusal offers is a repair of the line refused, by the
45
+ * one input gate: the same command and theme, no scope that was not typed
46
+ * (never a stock part), and a value in place of the one typed only as an
47
+ * exact reading of it.
48
+ * @param {'set' | 'undo'} sub
49
+ * @param {string} slug
50
+ * @param {string} line the line refused
51
+ * @param {string} name the line offered
52
+ */
53
+ export function repairGate(sub: "set" | "undo", slug: string, line: string, name: string): boolean;
54
+ /**
55
+ * Follow a suggested command before it is offered: `check` runs the line as
56
+ * its command would (in memory, nothing written) and gives null when it
57
+ * runs, else the refusal. The refusal's own repair (its first suggestion
58
+ * `isRepair` takes that was not tried) replaces the line, until the line
59
+ * runs or no repair is offered; `why` then names what is still refused.
60
+ * Every refusal-suggested `set`, `undo`, `new` and `compile` that is a
61
+ * repair of a typed command goes through here.
62
+ * @param {string} line
63
+ * @param {(line: string) => Promise<AstryxError | null> | AstryxError | null} check
64
+ * @param {(name: string) => boolean} isRepair
65
+ * @returns {Promise<{line: string, why: string | null, next?: import("../../foundation/response/base").Suggestion[]}>}
66
+ * `next`: the commands the last refusal offers (an install before the line, a look at the theme)
67
+ */
68
+ export function followLine(line: string, check: (line: string) => Promise<AstryxError | null> | AstryxError | null, isRepair: (name: string) => boolean): Promise<{
69
+ line: string;
70
+ why: string | null;
71
+ next?: import("../../foundation/response/base").Suggestion[];
72
+ }>;
73
+ import { AstryxError } from '../error.mjs';
@@ -11,6 +11,7 @@
11
11
 
12
12
  import {AstryxError} from '../error.mjs';
13
13
  import {checkSetting} from './_check.mjs';
14
+ import {allowedLine} from './_normal.mjs';
14
15
  import {P} from './_tables.mjs';
15
16
 
16
17
  /**
@@ -118,9 +119,10 @@ export function vetSuggestions(e, ctx, slug, data) {
118
119
  if (!(e instanceof AstryxError) || !ctx || !data) return e;
119
120
  const list = e.suggestions ?? [];
120
121
  if (!list.length) return e;
121
- const kept = list.filter(s => {
122
- const line = readSetLine(s.name, slug);
123
- if (!line) return true;
122
+ /** The refusal set gives a line, or null when it takes it. @param {string} name */
123
+ const refusal = name => {
124
+ const line = readSetLine(name, slug);
125
+ if (!line) return null;
124
126
  try {
125
127
  checkSetting(
126
128
  ctx,
@@ -131,14 +133,118 @@ export function vetSuggestions(e, ctx, slug, data) {
131
133
  line.flags,
132
134
  false,
133
135
  );
134
- return true;
135
- } catch {
136
- return false;
136
+ return null;
137
+ } catch (err) {
138
+ if (err instanceof AstryxError) return err;
139
+ throw err;
140
+ }
141
+ };
142
+ // A refused line is followed through each repair its refusal offers that
143
+ // passes the one gate (every case fix of one line in one pass: a part
144
+ // and its variant), and offered as the line that works; a line its own
145
+ // refusal offers again after a step (an install) works once that step
146
+ // is done.
147
+ /** @type {typeof list} */
148
+ const kept = [];
149
+ for (const s of list) {
150
+ if (!readSetLine(s.name, slug)) {
151
+ kept.push(s);
152
+ continue;
137
153
  }
138
- });
139
- if (kept.length === list.length) return e;
154
+ const tried = new Set([s.name]);
155
+ let now = s.name;
156
+ for (;;) {
157
+ const err = refusal(now);
158
+ if (!err) {
159
+ if (!kept.some(k => k.name === now)) kept.push({...s, name: now});
160
+ break;
161
+ }
162
+ if ((err.suggestions ?? []).some(x => x.name === now)) {
163
+ kept.push({...s, name: now});
164
+ break;
165
+ }
166
+ const next = (err.suggestions ?? []).find(
167
+ x => !tried.has(x.name) && repairGate('set', slug, s.name, x.name),
168
+ );
169
+ if (!next) break;
170
+ now = next.name;
171
+ tried.add(now);
172
+ }
173
+ }
174
+ if (
175
+ kept.length === list.length &&
176
+ kept.every((k, i) => k.name === list[i].name)
177
+ )
178
+ return e;
140
179
  e.suggestions = kept.length
141
180
  ? kept
142
181
  : [{name: `${P} set --help`, reason: 'see what set takes'}];
143
182
  return e;
144
183
  }
184
+
185
+ /**
186
+ * Whether a line a refusal offers is a repair of the line refused, by the
187
+ * one input gate: the same command and theme, no scope that was not typed
188
+ * (never a stock part), and a value in place of the one typed only as an
189
+ * exact reading of it.
190
+ * @param {'set' | 'undo'} sub
191
+ * @param {string} slug
192
+ * @param {string} line the line refused
193
+ * @param {string} name the line offered
194
+ */
195
+ export function repairGate(sub, slug, line, name) {
196
+ if (!name.startsWith(`${P} ${sub} ${slug} `)) return false;
197
+ const toSet = (/** @type {string} */ l) =>
198
+ sub === 'undo' ? l.replace(`${P} undo `, `${P} set `) : l;
199
+ const was = readSetLine(toSet(line), slug);
200
+ const next = readSetLine(toSet(name), slug);
201
+ if (!was || !next) return true;
202
+ const scopes = /** @type {const} */ (['on', 'when', 'state', 'mode']);
203
+ if (scopes.some(k => next.flags[k] != null && was.flags[k] == null))
204
+ return false;
205
+ return (
206
+ sub === 'undo' ||
207
+ next.value === was.value ||
208
+ allowedLine({offered: next.value, typed: was.value, thing: next.thing})
209
+ );
210
+ }
211
+
212
+ /**
213
+ * Follow a suggested command before it is offered: `check` runs the line as
214
+ * its command would (in memory, nothing written) and gives null when it
215
+ * runs, else the refusal. The refusal's own repair (its first suggestion
216
+ * `isRepair` takes that was not tried) replaces the line, until the line
217
+ * runs or no repair is offered; `why` then names what is still refused.
218
+ * Every refusal-suggested `set`, `undo`, `new` and `compile` that is a
219
+ * repair of a typed command goes through here.
220
+ * @param {string} line
221
+ * @param {(line: string) => Promise<AstryxError | null> | AstryxError | null} check
222
+ * @param {(name: string) => boolean} isRepair
223
+ * @returns {Promise<{line: string, why: string | null, next?: import("../../foundation/response/base").Suggestion[]}>}
224
+ * `next`: the commands the last refusal offers (an install before the line, a look at the theme)
225
+ */
226
+ export async function followLine(line, check, isRepair) {
227
+ const tried = new Set([line]);
228
+ let now = line;
229
+ for (;;) {
230
+ const refused = await check(now);
231
+ if (!refused) return {line: now, why: null};
232
+ // A refusal that offers the line itself after another step (an
233
+ // install) says the line works once that is done: no other line is
234
+ // followed in its place.
235
+ const again = (refused.suggestions ?? []).some(x => x.name === now);
236
+ const next = again
237
+ ? undefined
238
+ : (refused.suggestions ?? []).find(
239
+ x => isRepair(x.name) && !tried.has(x.name),
240
+ );
241
+ if (!next)
242
+ return {
243
+ line: now,
244
+ why: refused.message.replace(/\s*Nothing was changed\.$/, ''),
245
+ next: refused.suggestions ?? [],
246
+ };
247
+ now = next.name;
248
+ tried.add(now);
249
+ }
250
+ }
@@ -104,7 +104,7 @@ export type ThemeEditPreviewFields = {
104
104
  */
105
105
  pictures: string[];
106
106
  /**
107
- * - Why no picture was taken, and how to get a browser for it.
107
+ * - Why a picture was not taken (when some were, which were and which were not), and how to get a browser for it.
108
108
  */
109
109
  pictureProblem: string | null;
110
110
  /**
@@ -123,7 +123,7 @@ export type ThemeEditPreviewFields = {
123
123
  */
124
124
  previewStale?: string[] | undefined;
125
125
  /**
126
- * - One line on how to see the change: first a look that changes nothing in the app (the editor's preview.html, current after the change, and `png`, which takes pictures with no dev server), then the in-app preview page most about it (Colors for a color, Components for a part, else Overview) at its own URL when there is a preview, and adding one to the app last, as an option. When the change could not be rendered, it names why instead of the editor's page.
126
+ * - One line on how to see the change: first a look that changes nothing in the app (the editor's preview.html, current after the change, and `png`, which takes pictures with no dev server; when this result's own picture run was blocked, what blocked it instead), then the in-app preview page most about it (Colors for a color, Components for a part, else Overview) at its own URL when there is a preview, and adding one to the app last, as an option. When the change could not be rendered, it names why instead of the editor's page.
127
127
  */
128
128
  see: string;
129
129
  /**
@@ -132,6 +132,10 @@ export type ThemeEditPreviewFields = {
132
132
  appCopy?: {
133
133
  wrote: string[];
134
134
  } | undefined;
135
+ /**
136
+ * - Set when the app copy (src/themes/<theme>/) was not written: a file, folder or link of yours at one of its names; a link on the way to it (src/, src/themes/ or the copy's folder; the editor writes nothing through one); a file where src/, src/themes/ or the copy's folder goes; or a folder that cannot be written, or a write that failed (with the system's reason, such as not writable or the disk is full). The app keeps the theme as it was, and this says what is in the way and why.
137
+ */
138
+ appCopyStale?: string | undefined;
135
139
  };
136
140
  /**
137
141
  * `astryx --json experimental theme editor new <theme>`.
@@ -249,6 +253,10 @@ export type ThemeEditChangeData = {
249
253
  * - Set when sheet.html shows the theme as it was before this change: see ThemeEditPreviewFields.
250
254
  */
251
255
  sheetStale?: string | undefined;
256
+ /**
257
+ * - Set when the app copy could not be written (something of yours at a copy name or on the way, or a write that failed): see ThemeEditPreviewFields.
258
+ */
259
+ appCopyStale?: string | undefined;
252
260
  /**
253
261
  * - Only the first time the theme's app copy is written: see ThemeEditPreviewFields.
254
262
  */
@@ -305,6 +313,7 @@ export type ThemeEditShowResponse = {
305
313
  appCopy?: {
306
314
  wrote: string[];
307
315
  } | undefined;
316
+ appCopyStale?: string | undefined;
308
317
  wiring: string[];
309
318
  };
310
319
  };
@@ -369,9 +378,14 @@ export type ThemeEditUndoOptions = {
369
378
  */
370
379
  export type ThemeEditUndoResponse = {
371
380
  type: "themeEdit.undo";
381
+ /**
382
+ * - `undid` names what the step took back (each setting, base and mode, in one line); `refusedBefore` says a change command refused since the last change changed nothing, so the step took back the change before it.
383
+ */
372
384
  data: {
373
385
  theme: string;
374
386
  action: "step";
387
+ undid: string;
388
+ refusedBefore?: string;
375
389
  undone: string[];
376
390
  settings: number;
377
391
  stepsLeft: number;
@@ -49,12 +49,13 @@
49
49
  * @typedef {object} ThemeEditPreviewFields
50
50
  * @property {string | null} preview - The sample app page with the theme, one self-contained HTML file; null when the components could not be rendered.
51
51
  * @property {string[]} pictures - PNG pictures taken (only with `png`).
52
- * @property {string | null} pictureProblem - Why no picture was taken, and how to get a browser for it.
52
+ * @property {string | null} pictureProblem - Why a picture was not taken (when some were, which were and which were not), and how to get a browser for it.
53
53
  * @property {{code: string, cause: string} | null} notChecked - Set when the change is saved but the components could not be rendered, so it was not checked and has no preview: the cause, such as two copies of React.
54
54
  * @property {string} [sheetStale] - Set when sheet.html (the sheet of every component, made by `show`) shows the theme as it was before this change: it says so at its top until `show` makes it again.
55
55
  * @property {string[]} [previewStale] - Files of the in-app theme preview that were not written again and still show the theme as it was: changed by hand, or a preview folder where a stopped preview change waits for the next preview command.
56
- * @property {string} see - One line on how to see the change: first a look that changes nothing in the app (the editor's preview.html, current after the change, and `png`, which takes pictures with no dev server), then the in-app preview page most about it (Colors for a color, Components for a part, else Overview) at its own URL when there is a preview, and adding one to the app last, as an option. When the change could not be rendered, it names why instead of the editor's page.
56
+ * @property {string} see - One line on how to see the change: first a look that changes nothing in the app (the editor's preview.html, current after the change, and `png`, which takes pictures with no dev server; when this result's own picture run was blocked, what blocked it instead), then the in-app preview page most about it (Colors for a color, Components for a part, else Overview) at its own URL when there is a preview, and adding one to the app last, as an option. When the change could not be rendered, it names why instead of the editor's page.
57
57
  * @property {{wrote: string[]}} [appCopy] - Only the first time the theme's app copy is written (src/themes/<theme>/, a standard local theme `astryx theme add <theme>` takes, written again after every build): the files written.
58
+ * @property {string} [appCopyStale] - Set when the app copy (src/themes/<theme>/) was not written: a file, folder or link of yours at one of its names; a link on the way to it (src/, src/themes/ or the copy's folder; the editor writes nothing through one); a file where src/, src/themes/ or the copy's folder goes; or a folder that cannot be written, or a write that failed (with the system's reason, such as not writable or the disk is full). The app keeps the theme as it was, and this says what is in the way and why.
58
59
  */
59
60
 
60
61
  /**
@@ -100,6 +101,7 @@
100
101
  * @property {string[]} [previewStale] - In-app preview files changed by hand: see ThemeEditPreviewFields.
101
102
  * @property {string} see - How to see the change: see ThemeEditPreviewFields.
102
103
  * @property {string} [sheetStale] - Set when sheet.html shows the theme as it was before this change: see ThemeEditPreviewFields.
104
+ * @property {string} [appCopyStale] - Set when the app copy could not be written (something of yours at a copy name or on the way, or a write that failed): see ThemeEditPreviewFields.
103
105
  * @property {{wrote: string[]}} [appCopy] - Only the first time the theme's app copy is written: see ThemeEditPreviewFields.
104
106
  */
105
107
 
@@ -137,6 +139,7 @@
137
139
  * @property {string | null} data.pictureProblem
138
140
  * @property {{config: string, module: string, receipt: string} | null} data.colorFiles - The generated color files: the input (in the shape `theme palette generate` reads), the module the theme imports, and the receipt; null when the theme sets no color.
139
141
  * @property {{wrote: string[]}} [data.appCopy] - Only the first time the theme's app copy is written: the files written in src/themes/<theme>/.
142
+ * @property {string} [data.appCopyStale] - Set when the app copy was not written: a file, folder or link of yours at one of its names; a link on the way to it (src/, src/themes/ or the copy's folder; the editor writes nothing through one); a file where src/, src/themes/ or the copy's folder goes; or a folder that cannot be written, or a write that failed (with the system's reason, such as not writable or the disk is full).
140
143
  * @property {string[]} data.wiring - The steps that put the theme into this app: the root file, its imports, the Theme around the app, and what builds it (`theme add <theme>`, for the app copy the editor writes in src/themes/<theme>/; the imports by hand when a folder of yours is there).
141
144
  */
142
145
 
@@ -169,7 +172,7 @@
169
172
  * @experimental May change or be removed in a patch release.
170
173
  * @typedef {object} ThemeEditUndoResponse
171
174
  * @property {'themeEdit.undo'} type
172
- * @property {{theme: string, action: 'step', undone: string[], settings: number, stepsLeft: number, changedTokens: string[], problems: string[]} & ThemeEditPreviewFields} data
175
+ * @property {{theme: string, action: 'step', undid: string, refusedBefore?: string, undone: string[], settings: number, stepsLeft: number, changedTokens: string[], problems: string[]} & ThemeEditPreviewFields} data - `undid` names what the step took back (each setting, base and mode, in one line); `refusedBefore` says a change command refused since the last change changed nothing, so the step took back the change before it.
173
176
  */
174
177
 
175
178
  /**
@@ -13,7 +13,7 @@ export const doc = {
13
13
  summary:
14
14
  "Look up a part, group, setting or aspect; answer a question in plain words; read a picture's colors; or list what you can set.",
15
15
  description:
16
- 'One command for every question. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
16
+ 'One command for every question. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`; the command\'s help (`astryx experimental theme editor how --help`) lists the kinds of ask it understands, with examples. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
17
17
  importPath: '@astryxdesign/cli/api/experimental',
18
18
  signature:
19
19
  'themeEditHow(subject?: string, options?: object): Promise<object>',
@@ -1,6 +1,5 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @file FunctionDoc for `themeEditNew()` / `astryx experimental theme editor new`. */
5
4
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
6
5
  export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
@@ -2,6 +2,8 @@
2
2
 
3
3
  /** @file FunctionDoc for `themeEditNew()` / `astryx experimental theme editor new`. */
4
4
 
5
+ import {NAME_RULE} from './_name-rule.mjs';
6
+
5
7
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
6
8
  export const doc = {
7
9
  type: 'function',
@@ -12,7 +14,9 @@ export const doc = {
12
14
  displayName: 'themeEditNew()',
13
15
  summary: 'Start a theme in themes/<theme>/, optionally on a built-in theme.',
14
16
  description:
15
- 'Makes themes/<theme>/ with <theme>.settings.json (the settings this command owns), the generated <theme>.settings.ts, <theme>.theme.ts (which extends it and is yours), and the built <theme>.css and <theme>.js (build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor settings first), then writes preview.html, the sample app page with the theme. --like builds on a built-in theme (neutral, stone, matcha, y2k, gothic, chocolate, butter; its package must be installed); without it the theme starts from Astryx defaults. `settings` takes any `set` dial by name ({accent: "#7c3aed", font: "inter", corners: "round", vibrancy: "60"}): the same names, values and checks as `set`, all applied in the one build, with one result that lists them. Change the base later with `astryx experimental theme editor set <theme> base <theme|none>`. Afterwards, <theme>.theme.ts is yours: it extends the generated <theme>.settings.ts, and every later change rewrites only the settings files, so your own edits in <theme>.theme.ts survive. A theme name is lowercase letters, digits and dashes. Experimental: it may change or be removed in a patch release.',
17
+ 'Makes themes/<theme>/ with <theme>.settings.json (the settings this command owns), the generated <theme>.settings.ts, <theme>.theme.ts (which extends it and is yours), and the built <theme>.css and <theme>.js (build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor settings first), then writes preview.html, the sample app page with the theme. --like builds on a built-in theme (neutral, stone, matcha, y2k, gothic, chocolate, butter; its package must be installed); without it the theme starts from Astryx defaults. `settings` takes any `set` dial by name ({accent: "#7c3aed", font: "inter", corners: "round", vibrancy: "60"}): the same names, values and checks as `set`, all applied in the one build, with one result that lists them. Change the base later with `astryx experimental theme editor set <theme> base <theme|none>`. Afterwards, <theme>.theme.ts is yours: it extends the generated <theme>.settings.ts, and every later change rewrites only the settings files, so your own edits in <theme>.theme.ts survive. A theme name is ' +
18
+ NAME_RULE +
19
+ '. Experimental: it may change or be removed in a patch release.',
16
20
  importPath: '@astryxdesign/cli/api/experimental',
17
21
  signature: 'themeEditNew(theme: string, options?: object): Promise<object>',
18
22
  keywords: [
@@ -26,8 +30,7 @@ export const doc = {
26
30
  {
27
31
  name: 'theme',
28
32
  type: 'string',
29
- description:
30
- 'The theme name: lowercase letters, digits and dashes, starting with a letter, 64 characters at most, not a name Windows reserves (con, prn, aux, nul, com1-com9, lpt1-lpt9).',
33
+ description: `The theme name: ${NAME_RULE}.`,
31
34
  required: true,
32
35
  },
33
36
  {
@@ -63,7 +66,7 @@ export const doc = {
63
66
  throws: [
64
67
  {
65
68
  code: 'ERR_INVALID_ARGUMENT',
66
- when: 'the name is not lowercase letters, digits and dashes, or `settings` names something that is not a dial',
69
+ when: `the name breaks the theme-name rule (${NAME_RULE}), or \`settings\` names something that is not a dial`,
67
70
  },
68
71
  {
69
72
  code: 'ERR_FILE_EXISTS',
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'themeEditPreviewApp()',
13
13
  summary: 'Make a new starter app with the theme preview inside.',
14
14
  description:
15
- "Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release; with `theme`, Core and the base theme are pinned to the versions this project has, the ones the copied build was made on, with a note), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
15
+ "Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release; with `theme`, Core and the base theme are pinned to the versions this project has, the ones the copied build was made on, with a note), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the project folder (from a subfolder too); a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
16
16
  importPath: '@astryxdesign/cli/api/experimental',
17
17
  signature:
18
18
  'themeEditPreviewApp(dir: string, options?: object): Promise<object>',
@@ -28,7 +28,7 @@ export const doc = {
28
28
  name: 'dir',
29
29
  type: 'string',
30
30
  description:
31
- 'The folder for the new app: new or empty, inside the current folder.',
31
+ 'The folder for the new app: new or empty, inside the project folder.',
32
32
  required: true,
33
33
  },
34
34
  {
@@ -57,7 +57,7 @@ export const doc = {
57
57
  },
58
58
  {
59
59
  code: 'ERR_PATH_TRAVERSAL',
60
- when: '`dir` is outside the current folder, or a file it writes leads outside it through a link',
60
+ when: '`dir` is outside the project folder, or a file it writes leads outside it through a link',
61
61
  },
62
62
  {
63
63
  code: 'ERR_UNKNOWN_THEME',
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'themeEditPreviewRemove()',
13
13
  summary: 'Remove one page from the theme preview, or the whole preview.',
14
14
  description:
15
- 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. A remove deletes only the route file, the record and the page files of recorded pages (in _pages/, or pages/ for an older release), and only when a recorded hash shows they are as the preview wrote them: any other file the record names, and any file with no recorded hash, is kept and named, so a copied or edited record never deletes a project file. A route that stays keeps the pages it imports. Experimental: it may change or be removed in a patch release.',
15
+ 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is dropped from the record and named in a note; nothing outside the folder is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. A remove deletes only the route file, the record and the page files of recorded pages (in _pages/, or pages/ for an older release), and only when a recorded hash shows they are as the preview wrote them: any other file the record names, and any file with no recorded hash, is kept and named, so a copied or edited record never deletes a project file. A route that stays keeps the pages it imports. Experimental: it may change or be removed in a patch release.',
16
16
  importPath: '@astryxdesign/cli/api/experimental',
17
17
  signature:
18
18
  'themeEditPreviewRemove(page?: string, options?: object): Promise<object>',
@@ -46,7 +46,7 @@ export const doc = {
46
46
  throws: [
47
47
  {
48
48
  code: 'ERR_PATH_TRAVERSAL',
49
- when: 'theme-preview.json names a file outside the route folder; nothing is deleted',
49
+ when: '--path leads outside the project; nothing is deleted',
50
50
  },
51
51
  {
52
52
  code: 'ERR_NOT_FOUND',