@astryxdesign/cli 0.7.16 → 0.7.17-canary.g49a475f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/README.md +76 -86
  2. package/api/build/_adapter.d.mts +12 -0
  3. package/api/build/_adapter.mjs +51 -34
  4. package/api/build/blocks/blocks.d.mts +7 -5
  5. package/api/build/blocks/blocks.mjs +113 -26
  6. package/api/build/build.doc.mjs +4 -3
  7. package/api/build/build.type.d.mts +2 -2
  8. package/api/build/build.type.mjs +3 -3
  9. package/api/build/kit/kind.d.mts +2 -1
  10. package/api/build/kit/kind.mjs +199 -10
  11. package/api/build/kit/kit.mjs +6 -4
  12. package/api/build/kit/rank.d.mts +4 -2
  13. package/api/build/kit/rank.mjs +125 -24
  14. package/api/build/kit/start.d.mts +5 -4
  15. package/api/build/kit/start.mjs +12 -8
  16. package/api/build/kit/weights.d.mts +39 -3
  17. package/api/build/kit/weights.json +1 -1
  18. package/api/build/kit/weights.mjs +340 -43
  19. package/api/build/kit/word-model.d.mts +23 -0
  20. package/api/build/kit/word-model.mjs +46 -0
  21. package/api/build/kit/words.d.mts +48 -0
  22. package/api/build/kit/words.mjs +90 -1
  23. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  24. package/api/component/list/list.d.mts +1 -1
  25. package/api/component/list/list.mjs +48 -6
  26. package/api/discover/_adapter.d.mts +1 -1
  27. package/api/discover/search/search.mjs +3 -2
  28. package/api/docs/_adapter.d.mts +26 -2
  29. package/api/docs/_adapter.mjs +219 -6
  30. package/api/docs/docs.d.mts +3 -0
  31. package/api/docs/docs.doc.mjs +7 -1
  32. package/api/docs/docs.mjs +12 -0
  33. package/api/docs/docs.type.d.mts +5 -0
  34. package/api/docs/docs.type.mjs +2 -0
  35. package/api/docs/node/node.mjs +1 -1
  36. package/api/doctor/_adapter.d.mts +27 -5
  37. package/api/doctor/_adapter.mjs +83 -10
  38. package/api/doctor/built-checks.mjs +40 -14
  39. package/api/doctor/doctor.d.mts +4 -3
  40. package/api/doctor/doctor.mjs +14 -7
  41. package/api/doctor/theme-checks.mjs +121 -17
  42. package/api/icon/_records.mjs +2 -1
  43. package/api/index.d.mts +2 -0
  44. package/api/index.mjs +2 -0
  45. package/api/integration/_adapter.d.mts +44 -0
  46. package/api/integration/_adapter.mjs +77 -1
  47. package/api/integration/authoring-checks.mjs +6 -6
  48. package/api/integration/example-scope.d.mts +14 -0
  49. package/api/integration/example-scope.mjs +44 -0
  50. package/api/integration/example-scope.type.d.mts +29 -0
  51. package/api/integration/example-scope.type.mjs +25 -0
  52. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  53. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  54. package/api/integration/validate-integration.mjs +19 -1
  55. package/api/integration/validate-integration.type.d.mts +9 -0
  56. package/api/integration/validate-integration.type.mjs +1 -1
  57. package/api/integration/validateIntegration.doc.mjs +1 -1
  58. package/api/render/_adapter.mjs +591 -195
  59. package/api/render/render.doc.mjs +11 -3
  60. package/api/render/render.type.d.mts +52 -0
  61. package/api/render/render.type.mjs +31 -1
  62. package/api/search/ORDERING.md +1 -1
  63. package/api/search/_adapter.d.mts +9 -0
  64. package/api/search/_adapter.mjs +85 -0
  65. package/api/search/_candidate-score.mjs +51 -32
  66. package/api/search/_fit-order.mjs +3 -3
  67. package/api/search/_gather-components.d.mts +3 -2
  68. package/api/search/_gather-components.mjs +12 -3
  69. package/api/search/_lexical.d.mts +5 -0
  70. package/api/search/_lexical.mjs +8 -2
  71. package/api/search/_result.d.mts +11 -9
  72. package/api/search/_result.mjs +4 -4
  73. package/api/search/_score.d.mts +6 -1
  74. package/api/search/_score.mjs +15 -3
  75. package/api/search/search-index.mjs +7 -1
  76. package/api/search/search.d.mts +1 -1
  77. package/api/theme/_adapter.mjs +12 -1
  78. package/api/theme/build/build.d.mts +75 -0
  79. package/api/theme/build/build.mjs +243 -58
  80. package/api/theme/build/font-warning.d.mts +7 -0
  81. package/api/theme/build/font-warning.mjs +17 -0
  82. package/api/theme/theme.type.d.mts +10 -0
  83. package/api/theme/theme.type.mjs +7 -1
  84. package/api/theme-edit/_adapter.d.mts +63 -2
  85. package/api/theme-edit/_adapter.mjs +771 -57
  86. package/api/theme-edit/_check.d.mts +40 -22
  87. package/api/theme-edit/_check.mjs +2029 -336
  88. package/api/theme-edit/_color.d.mts +10 -0
  89. package/api/theme-edit/_color.mjs +49 -1
  90. package/api/theme-edit/_compiler.mjs +9 -0
  91. package/api/theme-edit/_context.d.mts +3 -3
  92. package/api/theme-edit/_context.mjs +111 -48
  93. package/api/theme-edit/_css.d.mts +14 -0
  94. package/api/theme-edit/_css.mjs +46 -1
  95. package/api/theme-edit/_edit.d.mts +18 -4
  96. package/api/theme-edit/_edit.mjs +1685 -155
  97. package/api/theme-edit/_how-commands.d.mts +65 -0
  98. package/api/theme-edit/_how-commands.mjs +633 -1
  99. package/api/theme-edit/_how-question.d.mts +84 -0
  100. package/api/theme-edit/_how-question.mjs +5124 -281
  101. package/api/theme-edit/_how.mjs +140 -29
  102. package/api/theme-edit/_marks.d.mts +31 -5
  103. package/api/theme-edit/_marks.mjs +57 -5
  104. package/api/theme-edit/_name-rule.d.mts +11 -0
  105. package/api/theme-edit/_name-rule.mjs +12 -0
  106. package/api/theme-edit/_normal.d.mts +257 -0
  107. package/api/theme-edit/_normal.mjs +1252 -0
  108. package/api/theme-edit/_palette.mjs +10 -4
  109. package/api/theme-edit/_parts.d.mts +10 -1
  110. package/api/theme-edit/_parts.mjs +179 -3
  111. package/api/theme-edit/_preview-app.d.mts +7 -1
  112. package/api/theme-edit/_preview-app.mjs +515 -148
  113. package/api/theme-edit/_preview.d.mts +100 -14
  114. package/api/theme-edit/_preview.mjs +549 -137
  115. package/api/theme-edit/_settings.d.mts +347 -30
  116. package/api/theme-edit/_settings.mjs +2971 -327
  117. package/api/theme-edit/_tables.d.mts +6 -0
  118. package/api/theme-edit/_tables.mjs +44 -1
  119. package/api/theme-edit/_vet.d.mts +18 -0
  120. package/api/theme-edit/_vet.mjs +32 -0
  121. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  122. package/api/theme-edit/theme-edit.type.mjs +4 -1
  123. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  124. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  125. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  126. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  128. package/api/upgrade/run/run.mjs +4 -3
  129. package/assets/codemods/integration-discovery.mjs +2 -1
  130. package/assets/codemods/run-codemod.mjs +87 -7
  131. package/assets/codemods/transforms/next/index.mjs +11 -1
  132. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  133. package/assets/component-list.generated.json +1 -0
  134. package/assets/docs/author-a-theme.doc.mjs +1 -0
  135. package/assets/docs/theme.doc.dense.mjs +2 -2
  136. package/assets/docs/theme.doc.mjs +1 -1
  137. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  138. package/assets/docs/tree/checks.doc.mjs +1 -1
  139. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  140. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  141. package/assets/docs/tree/single-component.doc.mjs +4 -0
  142. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  143. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  144. package/assets/docs/use-a-theme.doc.mjs +1 -1
  145. package/assets/docs.generated.json +2 -2
  146. package/assets/search-catalog.generated.json +2 -0
  147. package/assets/self-audit.generated.json +1 -1
  148. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  149. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  150. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  151. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  152. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  153. package/assets/templates/components.generated.json +1 -1
  154. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  155. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  156. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  157. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  158. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  159. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  160. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  161. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  162. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  163. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  164. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  165. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  166. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  167. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  168. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  169. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  170. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  171. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  172. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  173. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  174. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  175. package/assets/templates/pages/ide/page.tsx +24 -2
  176. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  177. package/assets/templates/pages/library/template.doc.mjs +4 -1
  178. package/assets/templates/pages/login/template.doc.mjs +2 -1
  179. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  180. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  181. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  182. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  183. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  184. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  185. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  186. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  187. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  188. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  189. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  190. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  191. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  192. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  193. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  194. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  195. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  196. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  197. package/assets/theme.template.ts +6 -0
  198. package/authoring/debug/parse.d.mts +3 -3
  199. package/authoring/doctypes/_schema.d.mts +3 -3
  200. package/authoring/doctypes/command/command.doc.mjs +1 -1
  201. package/authoring/doctypes/component/categories.d.mts +37 -0
  202. package/authoring/doctypes/component/categories.mjs +54 -0
  203. package/authoring/doctypes/template/template.doc.mjs +1 -1
  204. package/authoring/doctypes/template/type.ts +9 -0
  205. package/authoring/example/example.doc.d.mts +12 -0
  206. package/authoring/example/example.doc.mjs +69 -0
  207. package/authoring/example/preview.d.mts +92 -0
  208. package/authoring/example/preview.mjs +994 -0
  209. package/authoring/example/type.ts +102 -0
  210. package/authoring/index.d.mts +1 -0
  211. package/authoring/index.d.ts +12 -0
  212. package/authoring/index.mjs +3 -1
  213. package/clients/cli/bin/astryx.mjs +6 -9
  214. package/clients/cli/build-id.generated.json +1 -1
  215. package/clients/cli/commands/component.doc.mjs +1 -1
  216. package/clients/cli/commands/component.mjs +22 -3
  217. package/clients/cli/commands/docs.doc.mjs +7 -1
  218. package/clients/cli/commands/docs.mjs +3 -1
  219. package/clients/cli/commands/doctor.mjs +32 -14
  220. package/clients/cli/commands/experimental/render.mjs +42 -1
  221. package/clients/cli/commands/experimental/theme.mjs +163 -28
  222. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  223. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  224. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  225. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  226. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  227. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  228. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  229. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  230. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  231. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  232. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  233. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  234. package/clients/cli/commands/search.doc.mjs +2 -1
  235. package/clients/cli/commands/search.mjs +6 -1
  236. package/clients/cli/commands/template.mjs +4 -2
  237. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  238. package/clients/cli/commands/theme.doc.mjs +1 -1
  239. package/clients/cli/commands/theme.mjs +209 -8
  240. package/clients/cli/commands/upgrade.mjs +42 -7
  241. package/clients/cli/index.mjs +1 -1
  242. package/clients/cli/lib/cli-error.mjs +2 -1
  243. package/clients/cli/lib/component-format.mjs +205 -98
  244. package/clients/cli/lib/hook-format.mjs +9 -19
  245. package/clients/cli/lib/json-shim.mjs +77 -21
  246. package/clients/cli/lib/manifest.mjs +3 -2
  247. package/clients/cli/manifest.generated.json +1 -1
  248. package/foundation/agent-docs/agent-docs.mjs +1 -1
  249. package/foundation/config/theme-state.d.mts +13 -1
  250. package/foundation/config/theme-state.mjs +47 -7
  251. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  252. package/foundation/discovery/component-discovery.d.mts +11 -0
  253. package/foundation/discovery/component-discovery.mjs +56 -8
  254. package/foundation/discovery/component-replacement.mjs +130 -1
  255. package/foundation/discovery/copied-passages.mjs +2 -1
  256. package/foundation/discovery/doc-types.mjs +4 -3
  257. package/foundation/discovery/entry-name-files.d.mts +43 -0
  258. package/foundation/discovery/entry-name-files.mjs +264 -0
  259. package/foundation/discovery/hook-discovery.d.mts +8 -2
  260. package/foundation/discovery/hook-discovery.mjs +22 -8
  261. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  262. package/foundation/discovery/icon-set-checks.mjs +2 -1
  263. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  264. package/foundation/discovery/integration-doc-files.mjs +2 -1
  265. package/foundation/discovery/package-exports.d.mts +10 -0
  266. package/foundation/discovery/package-exports.mjs +56 -3
  267. package/foundation/discovery/prop-drift.mjs +9 -9
  268. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  269. package/foundation/discovery/runner-allowlist.mjs +2 -0
  270. package/foundation/discovery/stored-component-list.d.mts +43 -0
  271. package/foundation/discovery/stored-component-list.mjs +90 -0
  272. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  273. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  274. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  275. package/foundation/discovery/stored-self-audit.mjs +38 -18
  276. package/foundation/discovery/template-adapter.d.mts +52 -0
  277. package/foundation/discovery/template-adapter.mjs +176 -12
  278. package/foundation/discovery/template-icons.mjs +2 -1
  279. package/foundation/discovery/theme-discovery.mjs +3 -2
  280. package/foundation/discovery/theme-imports.d.mts +14 -0
  281. package/foundation/discovery/theme-imports.mjs +43 -1
  282. package/foundation/discovery/theming-targets.mjs +3 -2
  283. package/foundation/doc-compiler/import.mjs +7 -1
  284. package/foundation/doc-compiler/inputs.mjs +3 -2
  285. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  286. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  287. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  288. package/foundation/env/semver.mjs +3 -1
  289. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  290. package/foundation/fonts/font-stylesheet.mjs +115 -0
  291. package/foundation/fs/cache-eviction.d.mts +21 -0
  292. package/foundation/fs/cache-eviction.mjs +73 -0
  293. package/foundation/fs/file-protection.mjs +4 -3
  294. package/foundation/fs/gather-cache.d.mts +25 -4
  295. package/foundation/fs/gather-cache.mjs +164 -55
  296. package/foundation/fs/jiti-cache.d.mts +19 -1
  297. package/foundation/fs/jiti-cache.mjs +130 -6
  298. package/foundation/fs/kept-tree.d.mts +60 -0
  299. package/foundation/fs/kept-tree.mjs +154 -0
  300. package/foundation/fs/listing-cache.d.mts +7 -0
  301. package/foundation/fs/listing-cache.mjs +10 -0
  302. package/foundation/fs/module-loader.d.mts +24 -2
  303. package/foundation/fs/module-loader.mjs +94 -21
  304. package/foundation/fs/paths.d.mts +18 -0
  305. package/foundation/fs/paths.mjs +15 -2
  306. package/foundation/identity/provider-identity.d.mts +6 -0
  307. package/foundation/identity/provider-identity.mjs +10 -1
  308. package/foundation/integrations/contribution-inventory.mjs +4 -3
  309. package/foundation/integrations/example-code.d.mts +63 -0
  310. package/foundation/integrations/example-code.mjs +416 -0
  311. package/foundation/integrations/public-imports.d.mts +9 -0
  312. package/foundation/integrations/public-imports.mjs +3 -2
  313. package/foundation/integrations/validate-contributions.mjs +17 -45
  314. package/foundation/render/embedded-files.d.mts +6 -0
  315. package/foundation/render/embedded-files.mjs +25 -5
  316. package/foundation/render/embedded-imports.d.mts +39 -7
  317. package/foundation/render/embedded-imports.mjs +66 -27
  318. package/foundation/render/file-header.d.mts +66 -0
  319. package/foundation/render/file-header.mjs +118 -0
  320. package/foundation/render/host-answer.d.mts +18 -0
  321. package/foundation/render/host-answer.mjs +46 -0
  322. package/foundation/render/host-exit.d.mts +1 -0
  323. package/foundation/render/host-exit.mjs +6 -1
  324. package/foundation/render/html-reader.d.mts +55 -2
  325. package/foundation/render/html-reader.mjs +145 -26
  326. package/foundation/render/markup-edits.d.mts +57 -0
  327. package/foundation/render/markup-edits.mjs +182 -0
  328. package/foundation/render/page-host.mjs +29 -12
  329. package/foundation/render/page-worker.mjs +121 -13
  330. package/foundation/render/picture-chrome.d.mts +4 -0
  331. package/foundation/render/picture-chrome.mjs +185 -0
  332. package/foundation/render/picture-playwright.d.mts +4 -0
  333. package/foundation/render/picture-playwright.mjs +34 -0
  334. package/foundation/render/rebuild.mjs +2 -1
  335. package/foundation/render/render-page.d.mts +35 -3
  336. package/foundation/render/render-page.mjs +316 -42
  337. package/foundation/render/source-block.d.mts +85 -6
  338. package/foundation/render/source-block.mjs +211 -20
  339. package/foundation/render/ts-paths.d.mts +69 -6
  340. package/foundation/render/ts-paths.mjs +326 -40
  341. package/foundation/response/error-codes.d.mts +3 -1
  342. package/foundation/response/error-codes.d.ts +1 -0
  343. package/foundation/response/error-codes.doc.mjs +12 -1
  344. package/foundation/response/error-codes.mjs +11 -1
  345. package/foundation/response/response-types.doc.mjs +2 -2
  346. package/foundation/text/compare-text.d.mts +14 -0
  347. package/foundation/text/compare-text.mjs +68 -0
  348. package/foundation/text/string-utils.d.mts +3 -2
  349. package/foundation/text/string-utils.mjs +18 -4
  350. package/foundation/text/suggest-order.d.mts +9 -0
  351. package/foundation/text/suggest-order.mjs +15 -1
  352. package/foundation/xle/expand.mjs +2 -1
  353. package/host/index.mjs +8 -6
  354. package/package.json +7 -6
@@ -30,7 +30,10 @@ import {
30
30
  text,
31
31
  } from '../../formatters/index.mjs';
32
32
  import {cliError} from '../../lib/cli-error.mjs';
33
- import {editorMissingArgument} from '../../lib/json-shim.mjs';
33
+ import {
34
+ editorMissingArgument,
35
+ setEditorThemeList,
36
+ } from '../../lib/json-shim.mjs';
34
37
  import {AstryxError} from '../../../../api/error.mjs';
35
38
  import {defineCommand} from '../../lib/define-command.mjs';
36
39
  import {
@@ -49,6 +52,12 @@ import {
49
52
  dialValueFits,
50
53
  newFlagList,
51
54
  editorCompileProblem,
55
+ editorFollowCompile,
56
+ editorThemesAt,
57
+ typoOf,
58
+ editorBuildExtra,
59
+ editorLoadedFonts,
60
+ editorColorModes,
52
61
  editorThemeHold,
53
62
  editorThemeRefusal,
54
63
  editorMissingSource,
@@ -106,7 +115,6 @@ const cmd = line => {
106
115
  .join(stem);
107
116
  };
108
117
  /** The project's invocation of a command line (cmd, under a name an action's own `cmd` parameter does not hide). */
109
- const cliLine = (/** @type {string} */ line) => cmd(line);
110
118
 
111
119
  /**
112
120
  * Print blocks, a blank line between them, with this project's run prefix
@@ -484,7 +492,16 @@ function flagValues(name) {
484
492
  */
485
493
  function changeBlocks(r) {
486
494
  const d = r.data;
487
- const s = d.setting;
495
+ // The status line names the value as saved, with a quote or space mark
496
+ // the text output would fold written as its CSS escape (\201C), so the
497
+ // text and the JSON name the same value.
498
+ const s = {
499
+ ...d.setting,
500
+ value: String(d.setting.value).replace(
501
+ /[\u00A0\u00AB\u00BB\u2000-\u200B\u2018-\u201F\u2039\u203A\u202F\u3000\u300C-\u300F]/g,
502
+ c => `\\${c.codePointAt(0)?.toString(16).toUpperCase()} `,
503
+ ),
504
+ };
488
505
  const status =
489
506
  d.was != null
490
507
  ? `[ok] ${d.theme}: ${s.thing} ${d.was} -> ${s.value}`
@@ -639,7 +656,14 @@ function strayOption(command, rest) {
639
656
  },
640
657
  );
641
658
  }
642
- const word = rest.find(w => typeof w === 'string' && w.startsWith('--'));
659
+ // A value pasted with a token's label (`'--color-accent: #e11d48'`) is
660
+ // a value, read by the label reader, not an option.
661
+ const word = rest.find(
662
+ w =>
663
+ typeof w === 'string' &&
664
+ w.startsWith('--') &&
665
+ !/^--[a-z0-9-]+\s*:\s*\S/i.test(w),
666
+ );
643
667
  if (word == null) return null;
644
668
  return cliError(
645
669
  `unknown option '${word}': only the thing a change names may start with -- (a design token such as --color-accent).`,
@@ -655,6 +679,42 @@ function strayOption(command, rest) {
655
679
  );
656
680
  }
657
681
 
682
+ /**
683
+ * Refuse an option `show` does not take with a show that works: the same
684
+ * show without it (`--png=false` is no --png, `--png=true` is --png), the
685
+ * nearest option it takes, and its help. Null when there is none.
686
+ * @param {string} name
687
+ * @param {unknown[]} rest the words after the theme
688
+ * @param {{png?: boolean, section?: string}} o the options read
689
+ */
690
+ function showStray(name, rest, o) {
691
+ const stray = rest.map(String).find(w => w.startsWith('-'));
692
+ if (stray == null) return null;
693
+ const [flag, value] = stray.split('=');
694
+ const takes = ['--png', '--section', '--json'];
695
+ const on = value != null && /^(true|yes|1)$/i.test(value);
696
+ const off = value != null && /^(false|no|0)$/i.test(value);
697
+ const near = takes
698
+ .map(t => ({t, d: levenshteinDistance(flag.toLowerCase(), t)}))
699
+ .filter(x => x.d <= 2)
700
+ .sort((a, b) => a.d - b.d)[0]?.t;
701
+ const meant = takes.includes(flag.toLowerCase()) ? flag.toLowerCase() : near;
702
+ const png =
703
+ (o.png && !(meant === '--png' && off)) || (meant === '--png' && on);
704
+ const json = meant === '--json' && on;
705
+ const line = `${EDITOR} show ${name}${o.section ? ` --section ${o.section}` : ''}${png ? ' --png' : ''}${json ? ' --json' : ''}`;
706
+ return cliError(
707
+ `unknown option '${stray}'${meant && meant !== flag ? ` (did you mean ${meant}?)` : value != null && meant === flag ? ` (${flag} takes no value)` : ''}.`,
708
+ {
709
+ suggestions: [
710
+ {name: cmd(line), reason: 'do this instead'},
711
+ {name: cmd(`${EDITOR} show --help`), reason: 'every option it takes'},
712
+ ],
713
+ code: ERROR_CODES.ERR_INVALID_OPTION,
714
+ },
715
+ );
716
+ }
717
+
658
718
  /**
659
719
  * A refusal for words after what a command takes, which would otherwise be
660
720
  * dropped without a word; null when there are none.
@@ -727,18 +787,24 @@ function defineGroup(parent, doc) {
727
787
  if (extras.length > 0) {
728
788
  const word = String(extras[0]).toLowerCase();
729
789
  const group = doc.name.split(' ').at(-1) ?? '';
730
- const moved =
731
- MOVED[group]?.[word] ??
732
- // `preview <theme>`: the pages for a theme.
733
- (group === 'preview' && /^[a-z][a-z0-9-]*$/.test(word)
734
- ? `add --theme ${word}`
735
- : null);
736
790
  const ranked = (cmd.commands ?? [])
737
791
  .map(command => command.name())
738
792
  .sort(
739
793
  (a, b) =>
740
794
  levenshteinDistance(word, a) - levenshteinDistance(word, b),
741
795
  );
796
+ // A typo of a subcommand (lst, remve) is that subcommand; any
797
+ // other word after `preview` that names an editor theme here asks
798
+ // for that theme's pages.
799
+ const typo = typoOf(word, ranked[0] ?? '') ? ranked[0] : null;
800
+ const moved =
801
+ MOVED[group]?.[word] ??
802
+ (typo
803
+ ? null
804
+ : group === 'preview' &&
805
+ editorThemesAt(process.cwd()).includes(word)
806
+ ? `add --theme ${word}`
807
+ : null);
742
808
  return cliError(
743
809
  `unknown subcommand '${doc.name} ${String(extras[0])}'${moved ? `; it is ${here} ${moved}` : ''}`,
744
810
  {
@@ -777,12 +843,32 @@ function defineGroup(parent, doc) {
777
843
  return cmd;
778
844
  }
779
845
 
846
+ /**
847
+ * A preview command's result, once it is in: this client owns its process,
848
+ * so a stop that lands while the result is printed is held, and a printed
849
+ * ok never ends with exit 130. The API itself leaves no listener behind.
850
+ * @template T
851
+ * @param {Promise<T>} result
852
+ * @returns {Promise<T>}
853
+ */
854
+ async function resultStands(result) {
855
+ const r = await result;
856
+ for (const sig of /** @type {const} */ (['SIGINT', 'SIGTERM']))
857
+ if (!process.listeners(sig).includes(heldStop)) process.on(sig, heldStop);
858
+ return r;
859
+ }
860
+
861
+ /** A stop after a preview command finished: its result stands. */
862
+ function heldStop() {}
863
+
780
864
  /**
781
865
  * Register `theme` and its subcommands under the `experimental` group.
782
866
  * @param {import('commander').Command} group the `experimental` command
783
867
  * @param {import('commander').Command} program the root program
784
868
  */
785
869
  export function registerExperimentalTheme(group, program) {
870
+ // A command run with no theme names the app's only theme.
871
+ setEditorThemeList(editorThemesAt);
786
872
  const theme = defineGroup(group, groupDoc);
787
873
  explained(theme, groupDoc);
788
874
  theme.addHelpText(
@@ -824,16 +910,45 @@ export function registerExperimentalTheme(group, program) {
824
910
  (/** @type {string} */ w) =>
825
911
  /^-/.test(w) && !takes.has(w.split('=')[0]),
826
912
  );
913
+ // `--base` is the dial new takes as --like.
914
+ if (stray && stray.split('=')[0] === '--base') {
915
+ const args = (cmd?.args ?? []).slice(1).map(String);
916
+ const at = args.indexOf(stray);
917
+ const value = stray.includes('=')
918
+ ? stray.slice(stray.indexOf('=') + 1)
919
+ : args[at + 1];
920
+ // Thrown, as every refusal inside run is: run prints it once
921
+ // (a refusal printed here and then caught again by run would
922
+ // print twice where exit does not end the process).
923
+ throw new AstryxError(
924
+ `new takes the base theme as --like, not --base.`,
925
+ value
926
+ ? [
927
+ {
928
+ name: `${EDITOR} new ${quoteCommandArgument(name)}${newFlagLine({...o, like: value})}`,
929
+ reason: 'do this instead',
930
+ },
931
+ ]
932
+ : [
933
+ {
934
+ name: `${EDITOR} new --help`,
935
+ reason: 'every option it takes',
936
+ },
937
+ ],
938
+ ERROR_CODES.ERR_INVALID_OPTION,
939
+ );
940
+ }
827
941
  if (stray)
828
- return cliError(`unknown option '${stray}'.`, {
829
- suggestions: [
942
+ throw new AstryxError(
943
+ `unknown option '${stray}'.`,
944
+ [
830
945
  {
831
- name: cliLine(`${EDITOR} new --help`),
946
+ name: `${EDITOR} new --help`,
832
947
  reason: 'every option it takes',
833
948
  },
834
949
  ],
835
- code: ERROR_CODES.ERR_INVALID_OPTION,
836
- });
950
+ ERROR_CODES.ERR_INVALID_OPTION,
951
+ );
837
952
  // A word after the name is never dropped without a word.
838
953
  const extra = (cmd?.args ?? []).slice(1);
839
954
  if (extra.length) {
@@ -908,10 +1023,17 @@ export function registerExperimentalTheme(group, program) {
908
1023
  // A declaration pasted as one argument (`--color-accent: #e11d48`,
909
1024
  // or `--color-accent:#e11d48`) is the token and its value; with no
910
1025
  // value otherwise, the missing-argument error the parser gives.
1026
+ // A pasted JSON object of settings goes to the editor whole, which
1027
+ // gives one set line per entry.
1028
+ if (!value.length && /^\s*\{/.test(thing)) value = [''];
911
1029
  if (!value.length) {
912
1030
  // Any thing, a token or a dial, with `:` or `=` (`accent: red`,
913
1031
  // `--color-accent=#e11d48`).
914
- const pasted = /^(\S+?)\s*[:=]\s*(.+?);?\s*$/.exec(thing);
1032
+ // A thing and its value in one word (`'corners pill'`) are the
1033
+ // same as given apart.
1034
+ const pasted =
1035
+ /^(\S+?)\s*[:=]\s*(.+?);?\s*$/.exec(thing) ??
1036
+ /^\s*(\S+)\s+(.+?)\s*$/.exec(thing);
915
1037
  if (!pasted)
916
1038
  return missingSetValue(
917
1039
  editor.commands.find(c => c.name() === 'set'),
@@ -941,6 +1063,7 @@ export function registerExperimentalTheme(group, program) {
941
1063
  /** @type {any} */ o,
942
1064
  /** @type {any} */ c,
943
1065
  ) =>
1066
+ showStray(name, (c?.args ?? []).slice(1), o) ??
944
1067
  extraWords('show', (c?.args ?? []).slice(1)) ??
945
1068
  // The sheet is limited to one section (the docs say so): a second
946
1069
  // --section is refused, never kept over the first in silence.
@@ -974,6 +1097,8 @@ export function registerExperimentalTheme(group, program) {
974
1097
  ),
975
1098
  }),
976
1099
  showDoc,
1100
+ // An unknown option reaches the action, which names a show that works.
1101
+ {tokens: true},
977
1102
  );
978
1103
 
979
1104
  explained(
@@ -1026,13 +1151,15 @@ export function registerExperimentalTheme(group, program) {
1026
1151
  program,
1027
1152
  () =>
1028
1153
  previewFlagsOnce('add', ['theme', 'template', 'top', 'path']) ??
1029
- themeEditPreviewAdd([words ?? []].flat().join(' ') || undefined, {
1030
- cwd: process.cwd(),
1031
- theme: o.theme,
1032
- template: o.template,
1033
- top: o.top,
1034
- path: o.path,
1035
- }),
1154
+ resultStands(
1155
+ themeEditPreviewAdd([words ?? []].flat().join(' ') || undefined, {
1156
+ cwd: process.cwd(),
1157
+ theme: o.theme,
1158
+ template: o.template,
1159
+ top: o.top,
1160
+ path: o.path,
1161
+ }),
1162
+ ),
1036
1163
  r => {
1037
1164
  const {matched, skipped, ...rest} = r.data;
1038
1165
  return [
@@ -1073,10 +1200,12 @@ export function registerExperimentalTheme(group, program) {
1073
1200
  program,
1074
1201
  () =>
1075
1202
  previewFlagsOnce('app', ['theme']) ??
1076
- themeEditPreviewApp(dir, {
1077
- cwd: process.cwd(),
1078
- theme: o.theme,
1079
- }),
1203
+ resultStands(
1204
+ themeEditPreviewApp(dir, {
1205
+ cwd: process.cwd(),
1206
+ theme: o.theme,
1207
+ }),
1208
+ ),
1080
1209
  r => [
1081
1210
  `[ok] new app in ${r.data.folder} with the theme preview`,
1082
1211
  ...project(/** @type {any} */ (r.data)),
@@ -1157,7 +1286,9 @@ export function registerExperimentalTheme(group, program) {
1157
1286
  program,
1158
1287
  () =>
1159
1288
  previewFlagsOnce('remove', ['path']) ??
1160
- themeEditPreviewRemove(page, {cwd: process.cwd(), path: o.path}),
1289
+ resultStands(
1290
+ themeEditPreviewRemove(page, {cwd: process.cwd(), path: o.path}),
1291
+ ),
1161
1292
  r => [
1162
1293
  r.data.pages.length
1163
1294
  ? `[ok] removed ${page} from the theme preview`
@@ -1303,9 +1434,13 @@ export function registerExperimentalTheme(group, program) {
1303
1434
  build: 'compile',
1304
1435
  explain: editorThemeRefusal,
1305
1436
  preflight: editorCompileProblem,
1437
+ follow: editorFollowCompile,
1306
1438
  missingSource: editorMissingSource,
1307
1439
  template: editorThemeTemplate,
1308
1440
  hold: editorThemeHold,
1441
+ loadedFonts: editorLoadedFonts,
1442
+ extraData: editorBuildExtra,
1443
+ colorModes: editorColorModes,
1309
1444
  },
1310
1445
  );
1311
1446
  }
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary:
17
17
  'Render a page to one self-contained HTML file, or turn one back into a page',
18
18
  description:
19
- "Renders the page's default export with the project's own Astryx components and writes ONE static HTML file that needs nothing beside it: no script runs and nothing loads from the network, so it opens anywhere, including a sandboxed frame with a strict content security policy, and follows the viewer's light or dark scheme. The page's own StyleX compiles, only the Core CSS rules the page uses are inlined, local images become data: URIs, and the page's source is embedded. Warnings name anything that may not look as meant, such as a component that did not render the text it was given (ListItem takes label=, not children). --reverse writes the embedded source back byte for byte; a file with Astryx markup but no embedded source is rebuilt from its components (text and layout only, as a starting point); any other HTML is refused. Experimental: it may change or be removed in a patch release.",
19
+ "Renders the page's default export with the project's own Astryx components and writes ONE static HTML file that needs nothing beside it: no script runs and nothing loads from the network, so it opens anywhere, including a sandboxed frame with a strict content security policy, and follows the viewer's light or dark scheme. The page's own StyleX compiles, only the Core CSS rules the page uses are inlined, local images become data: URIs, and the page's source is embedded. Warnings name anything that may not look as meant, such as a component that did not render the text it was given (ListItem takes label=, not children). The file opens with a plain note for whoever opens it next: the CLI version and render format that made it, the page's path, the files it carries, the packages it rendered with, and the exact commands that give the page back and render it again. --reverse (the way back, or unrender) writes the embedded source back byte for byte and names any text someone changed in the HTML after the render, with the file and line that hold the old text; a file with Astryx markup but no embedded source is rebuilt from its components (text and layout only, as a starting point); any other HTML is refused. Experimental: it may change or be removed in a patch release.",
20
20
  fn: 'render',
21
21
  args: [{name: 'file', param: 'file', required: false}],
22
22
  options: [
@@ -53,7 +53,7 @@ export const doc = {
53
53
  {code: 0, when: 'the file was written (warnings included)'},
54
54
  {
55
55
  code: 1,
56
- when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, crashes Node, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, or HTML that is not an Astryx page',
56
+ when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, crashes Node, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, a file in a newer render format than this CLI reads, or HTML that is not an Astryx page',
57
57
  },
58
58
  ],
59
59
  related: ['template', 'build'],
@@ -14,7 +14,7 @@ export const doc = {
14
14
  stability: 'experimental',
15
15
  summary: 'Compile standalone themes or one keyed theme family',
16
16
  description:
17
- 'Compiles defineTheme() sources through the same theme pipeline into scoped CSS, standard ESM, and type declarations. Ordinary mode writes one complete set per theme. --family combines one selected extension tree into the three files named by the required --family-key, ready for one CSS load and identity-only switching. With --check it writes nothing and reports source drift. --icons-specifier keeps its existing generated-module behavior. It prints one line per built theme and one line naming fonts the themes do not load; --detail full adds the install example and the font recipe, once for a batch.',
17
+ "Compiles defineTheme() sources through the same theme pipeline into scoped CSS, standard ESM, and type declarations. Compiling a theme made by experimental theme editor (themes/<theme>/<theme>.theme.ts) takes that theme's lock and also writes its app copy in src/themes/<theme>/ again; --check fails while that copy is behind or gone. The app copy's own files (src/themes/<theme>/<theme>Theme.ts and the rest) are not compiled: compile the theme itself. With --out somewhere else, compile builds and --check checks only the files --out names: themes/<theme>/ and the app copy are not written or checked, and the result says so (appCopySkipped). An --out in the theme's own folder, other than its default stylesheet, is refused, as one in the app copy is. Ordinary mode writes one complete set per theme. --family combines one selected extension tree into the three files named by the required --family-key, ready for one CSS load and identity-only switching. With --check it writes nothing and reports source drift. --icons-specifier keeps its existing generated-module behavior. It prints one line per built theme and one line naming fonts the themes do not load; --detail full adds the install example and the font recipe, once for a batch.",
18
18
  fn: 'themeBuild',
19
19
  args: [
20
20
  {
@@ -39,7 +39,7 @@ export const doc = {
39
39
  flag: '-o, --out <path>',
40
40
  param: 'options.out',
41
41
  description:
42
- 'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. The path should end in .css; another name still builds, with a warning. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces its own earlier outputs, and the output of another theme source with a warning that names both sources; any other existing file fails with ERR_FILE_EXISTS and nothing is written. Into a folder the theme editor made (folder <slug>/ holds <slug>.settings.json), a source outside that folder builds there too, with a warning; to keep the editor folder to its own theme, build beside the source, or pass an --out outside it. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
42
+ "Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. The path should end in .css; another name still builds, with a warning. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces its own earlier outputs, and the output of another theme source with a warning that names both sources; any other existing file fails with ERR_FILE_EXISTS and nothing is written. Into a folder the theme editor made (folder <slug>/ holds <slug>.settings.json), a source outside that folder builds there too, with a warning; to keep the editor folder to its own theme, build beside the source, or pass an --out outside it. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID) An --out in an editor theme's app copy folder (src/themes/<theme>/, the folder itself too) is refused (ERR_INVALID_ARGUMENT): the editor writes that folder after every build",
43
43
  },
44
44
  {
45
45
  flag: '--icons-specifier <specifier>',
@@ -89,7 +89,7 @@ export const doc = {
89
89
  },
90
90
  {
91
91
  code: 1,
92
- when: 'a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false, the stale files and code ERR_THEME_STALE, is still printed: it is a result, not an error). One exception: an editor theme whose settings changed after its build is refused (ERR_THEME_INVALID, an error envelope) before any file is checked, with `editor show <theme>` to build it again. An editor theme run from a folder other than its app root is refused (ERR_INVALID_ARGUMENT) with the `cd` to the root and the same command; `--family` does not take an editor theme (ERR_INVALID_ARGUMENT); its damaged or unbuildable settings are refused (ERR_THEME_INVALID)',
92
+ when: "a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false, the stale files and code ERR_THEME_STALE, is still printed: it is a result, not an error). One exception: an editor theme whose settings changed after its build is refused (ERR_THEME_INVALID, an error envelope) before any file is checked, with `editor show <theme>` to build it again. An editor theme run from a folder other than its app root is refused (ERR_INVALID_ARGUMENT) with the `cd` to the root and the same command; `--family` does not take an editor theme (ERR_INVALID_ARGUMENT); its damaged or unbuildable settings are refused (ERR_THEME_INVALID). An editor theme's compile also writes its app copy in src/themes/<theme>/ from what it just built (its font stylesheet from the fonts the theme loads now), and --check also compares that copy once the theme's outputs are current: a copy that is kept back, missing a file or not the current build fails the check with the same check result (upToDate false, code ERR_THEME_STALE) and appCopyStale naming why. The copy's own files, its source included, are not compile targets (ERR_INVALID_ARGUMENT, naming the theme to compile). With --out outside the theme's folder neither themes/<theme>/ nor the copy is written or checked, and the result says so in appCopySkipped; an --out in the theme's own folder, other than its default stylesheet, is refused (ERR_INVALID_ARGUMENT)",
93
93
  },
94
94
  ],
95
95
  related: ['experimental theme add', 'experimental theme list'],
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  "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",
14
14
  description:
15
- 'One command for every question. With nothing named, it prints its usage and examples. 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.',
15
+ 'One command for every question. With nothing named, it prints its usage and examples. 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 first of them this help, whose examples labeled "Asks how understands" list the kinds of ask it answers. 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
16
  fn: 'themeEditHow',
17
17
  args: [
18
18
  {
@@ -79,9 +79,95 @@ export const doc = {
79
79
  label: 'Accent tokens',
80
80
  cli: 'astryx experimental theme editor how accent --list tokens',
81
81
  },
82
+ {
83
+ label: 'Asks how understands: change a dial',
84
+ cli: 'astryx experimental theme editor how "make everything more compact"',
85
+ },
86
+ {
87
+ label: 'Asks how understands: change a dial',
88
+ cli: 'astryx experimental theme editor how "make it more colorful"',
89
+ },
90
+ {
91
+ label: "Asks how understands: a part's property, by an amount or a value",
92
+ cli: 'astryx experimental theme editor how "card padding 2 steps more"',
93
+ },
94
+ {
95
+ label: "Asks how understands: a part's property, by an amount or a value",
96
+ cli: 'astryx experimental theme editor how "card padding 24x24px"',
97
+ },
98
+ {
99
+ label: 'Asks how understands: a direction, with or without a reference',
100
+ cli: 'astryx experimental theme editor how "make the card background lighter"',
101
+ },
102
+ {
103
+ label: 'Asks how understands: a direction, with or without a reference',
104
+ cli: 'astryx experimental theme editor how "make the card padding bigger than 24px"',
105
+ },
106
+ {
107
+ label: 'Asks how understands: comparisons with another part',
108
+ cli: 'astryx experimental theme editor how "make primary buttons as round as cards"',
109
+ },
110
+ {
111
+ label: 'Asks how understands: comparisons with another part',
112
+ cli: 'astryx experimental theme editor how "make cards 4px rounder than buttons"',
113
+ },
114
+ {
115
+ label:
116
+ 'Asks how understands: everything except some parts, or keeping a part',
117
+ cli: 'astryx experimental theme editor how "make everything rounder except buttons and cards"',
118
+ },
119
+ {
120
+ label:
121
+ 'Asks how understands: everything except some parts, or keeping a part',
122
+ cli: 'astryx experimental theme editor how "make everything rounder but keep cards as they are"',
123
+ },
124
+ {
125
+ label: 'Asks how understands: prohibitions',
126
+ cli: 'astryx experimental theme editor how "make everything rounder; never round the inputs"',
127
+ },
128
+ {
129
+ label: 'Asks how understands: prohibitions',
130
+ cli: 'astryx experimental theme editor how "never use pure black for text"',
131
+ },
132
+ {
133
+ label: 'Asks how understands: one mode',
134
+ cli: 'astryx experimental theme editor how "make shadows darker in dark mode"',
135
+ },
136
+ {
137
+ label: 'Asks how understands: one mode',
138
+ cli: 'astryx experimental theme editor how "in dark mode, cards should be #1c1c1e"',
139
+ },
140
+ {
141
+ label: 'Asks how understands: removals',
142
+ cli: 'astryx experimental theme editor how "no shadow and no border on dialogs"',
143
+ },
144
+ {
145
+ label: 'Asks how understands: removals',
146
+ cli: 'astryx experimental theme editor how "remove the card background"',
147
+ },
148
+ {
149
+ label: 'Asks how understands: several changes in one ask',
150
+ cli: 'astryx experimental theme editor how "cards: 8px radius; buttons: 4px"',
151
+ },
152
+ {
153
+ label: 'Asks how understands: several changes in one ask',
154
+ cli: 'astryx experimental theme editor how "rounder cards without shadows"',
155
+ },
156
+ {
157
+ label: 'Asks how understands: value questions',
158
+ cli: 'astryx experimental theme editor how "what is the padding of buttons"',
159
+ },
160
+ {
161
+ label: 'Asks how understands: value questions',
162
+ cli: 'astryx experimental theme editor how "how round are the cards now?"',
163
+ },
82
164
  ],
83
165
  outsideProject: 'refuse',
84
166
  notes: [
167
+ {
168
+ type: 'prose',
169
+ text: 'The examples labeled "Asks how understands" list the kinds of ask a question in plain words can be, each with examples it answers with commands: a dial for the whole theme, a part\'s property by an amount or a value, a direction (lighter, darker, bigger, smaller, with or without a reference), a comparison with another part, everything except some parts or keeping a part, a prohibition (never …), one mode (in dark mode), a removal (no shadow, remove …), several changes in one ask, and a question about a value. An ask of another kind may still be answered; one it cannot answer says so and points here.',
170
+ },
85
171
  {
86
172
  type: 'prose',
87
173
  text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme editor how writes nothing and stops with `ERR_PROJECT_REQUIRED`; run it in the app project. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
@@ -2,6 +2,8 @@
2
2
 
3
3
  /** @file CommandDoc for `astryx experimental theme editor new`. */
4
4
 
5
+ import {NAME_RULE} from '../../../api/theme-edit/_name-rule.mjs';
6
+
5
7
  /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
8
  export const doc = {
7
9
  type: 'command',
@@ -11,7 +13,9 @@ export const doc = {
11
13
  stability: 'experimental',
12
14
  summary: 'Start a theme in themes/<theme>/, optionally on a built-in theme',
13
15
  description:
14
- '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, or with --like none, the theme starts from Astryx defaults. Any `set` dial can be a flag too (--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, starts with a letter, has 64 characters at most, and is not the name of a built-in theme or a name Windows reserves for a device (con, prn, aux, nul, com1-com9, lpt1-lpt9). Experimental: it may change or be removed in a patch release. The result ends with `wiring`: `astryx theme add <theme>` for the app copy of the theme (src/themes/<theme>/, a standard local theme every build writes), the `mode` of a one-mode theme for the `<Theme>`, and what builds it; only when a folder of yours holds src/themes/<theme>/ does it give the imports in the root file and the `<Theme>` by hand.',
16
+ '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, or with --like none, the theme starts from Astryx defaults. Any `set` dial except base (that is --like) can be a flag too (--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 ' +
17
+ NAME_RULE +
18
+ ', and not the name of a built-in theme. Experimental: it may change or be removed in a patch release. The result ends with `wiring`: `astryx theme add <theme>` for the app copy of the theme (src/themes/<theme>/, a standard local theme every build writes), the `mode` of a one-mode theme for the `<Theme>`, and what builds it; only when a folder of yours holds src/themes/<theme>/ does it give the imports in the root file and the `<Theme>` by hand.',
15
19
  fn: 'themeEditNew',
16
20
  args: [
17
21
  {
@@ -31,7 +35,7 @@ export const doc = {
31
35
  flag: '--png',
32
36
  param: 'options.png',
33
37
  description:
34
- 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
38
+ 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
35
39
  },
36
40
  {
37
41
  flag: '--corners <rung>',
@@ -158,7 +162,10 @@ export const doc = {
158
162
  },
159
163
  {
160
164
  code: 1,
161
- when: 'a name that is not lowercase letters, digits and dashes starting with a letter (64 at most) or is the name of a built-in theme, a theme that already exists, a --like that is not a built-in theme or is not installed, a setting flag that `set` would refuse, no Core installed in the folder, or a build failure (nothing is left behind)',
165
+ when:
166
+ 'a name that breaks the theme-name rule (' +
167
+ NAME_RULE +
168
+ ') or is the name of a built-in theme, a theme that already exists, a --like that is not a built-in theme or is not installed, a setting flag that `set` would refuse, no Core installed in the folder, or a build failure (nothing is left behind)',
162
169
  },
163
170
  ],
164
171
  related: ['experimental theme editor', 'experimental theme compile'],
@@ -67,7 +67,7 @@ export const doc = {
67
67
  flag: '--png',
68
68
  param: 'options.png',
69
69
  description:
70
- 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
70
+ 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
71
71
  },
72
72
  ],
73
73
  examples: [
@@ -32,7 +32,7 @@ export const doc = {
32
32
  flag: '--png',
33
33
  param: 'options.png',
34
34
  description:
35
- 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
35
+ 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file. Taking pictures changes nothing in the app, except that show first brings the app copy (src/themes/<theme>/) and an in-app preview up to date after a hand edit to <theme>.theme.ts',
36
36
  },
37
37
  ],
38
38
  examples: [
@@ -54,7 +54,7 @@ export const doc = {
54
54
  flag: '--mode <mode>',
55
55
  param: 'options.mode',
56
56
  description:
57
- 'light or dark: only that color mode. Colors only; sizes, numbers, fonts and shadows are the same in both modes, and a light-only or dark-only theme takes no --mode',
57
+ 'light or dark: only that color mode. Colors only; sizes, numbers, fonts and shadows are the same in both modes. In a light-only or dark-only theme, it removes a setting saved for one mode (one made before the theme became one-mode)',
58
58
  },
59
59
  {
60
60
  flag: '--only',
@@ -66,7 +66,7 @@ export const doc = {
66
66
  flag: '--png',
67
67
  param: 'options.png',
68
68
  description:
69
- 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
69
+ 'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts (a browser that takes longer than 60 seconds is stopped, and the result says so); without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
70
70
  },
71
71
  ],
72
72
  examples: [
@@ -15,7 +15,7 @@ export const doc = {
15
15
  summary:
16
16
  'Make and change a theme one checked change at a time (dials, tokens, part styles), with previews',
17
17
  description:
18
- "A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it; build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor's settings first. Every build also writes the theme's app copy, src/themes/<theme>/: a standard local theme (descriptor, source, built module and stylesheets), never edited by hand, so `astryx theme add <theme>` puts the theme into the app and `theme use`, `remove` and `list` take it as they take any local theme. A folder there that is not the editor's copy is left alone, and `new` and `show` then print the import lines by hand instead (`wiring`). Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. Commands on one theme run one after the other, through a lock in node_modules/.cache/astryx-theme/ of the project; when node_modules cannot be written (a read-only install), changes are refused and `show` still reads the last build. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
18
+ "A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it; build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor's settings first. Every build also writes the theme's app copy, src/themes/<theme>/: a standard local theme (descriptor, source, built module and stylesheets), never edited by hand, so `astryx theme add <theme>` puts the theme into the app and `theme use`, `remove` and `list` take it as they take any local theme. Your own files in that folder are left as they are and the copy is written around them; a file, folder or link of yours at one of the copy's names, a link on the way to it, or a folder that cannot be written stops it, and every set, undo, show and compile says so (`appCopyStale`), with `compile --check` failing while the copy is behind or gone. Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. Commands on one theme run one after the other, through a lock in node_modules/.cache/astryx-theme/ of the project; when node_modules cannot be written (a read-only install), changes are refused and `show` still reads the last build. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
19
19
  subcommands: ['new', 'set', 'undo', 'show', 'how'],
20
20
  examples: [
21
21
  {
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  'Make a new starter app with the theme preview inside, ready to install and run',
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: it prints the install and dev commands and the page to open. <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. Later pages go in with `experimental theme preview add`, run in the new app. 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. It takes one folder; more arguments are refused. 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: it prints the install and dev commands and the page to open. <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. Later pages go in with `experimental theme preview add`, run in the new app. 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. It takes one folder; more arguments are refused. 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
  fn: 'themeEditPreviewApp',
17
17
  args: [
18
18
  {