@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
@@ -2,12 +2,38 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * @file The markers the theme editor writes at the top of the files it
6
- * generates, in one place for the editor and for doctor.
5
+ * The marks a file's leading comment can carry, and the command it names:
6
+ * `kind` is `build` for a theme build's output, `editor` for a file the theme
7
+ * editor writes (its settings module or app copy); `command` is the words in
8
+ * backquotes after "Written by" or "Generated by" (for a build, the build
9
+ * command). Null for a file without one. One reader for every caller.
10
+ * A mark written before files named their exact command carries the editor
11
+ * group's words alone, which only print its help: given the file's path,
12
+ * the command is the one that writes that theme's files again (`show`, with
13
+ * the theme its folder is named for).
14
+ * @param {string} source the start of the file
15
+ * @param {string} buildMarker the theme build's own marker
16
+ * @param {string} [file] the file's path
17
+ * @returns {{kind: 'build' | 'editor', command: string} | null}
18
+ */
19
+ export function generatedMark(source: string, buildMarker: string, file?: string): {
20
+ kind: "build" | "editor";
21
+ command: string;
22
+ } | null;
23
+ /**
24
+ * @file The marks the theme editor writes at the top of the files it
25
+ * generates, and the one reader of every generated mark (a theme build's
26
+ * included) that the editor, `theme build` and doctor share.
7
27
  *
8
28
  * @position api/theme-edit — internal
9
29
  */
10
30
  /** The first words of a generated settings module the editor writes. */
11
- export const EDITOR_GENERATED_MARK: "Generated by `astryx experimental theme editor`";
12
- /** The words on every file of a theme's app copy (src/themes/<theme>/). */
13
- export const APP_COPY_MARK: "Written by `astryx experimental theme editor`";
31
+ export const EDITOR_GENERATED_MARK: "Generated by `astryx experimental theme editor";
32
+ /**
33
+ * The words on every file of a theme's app copy (src/themes/<theme>/): the
34
+ * start of "Written by `<the command that writes it>`", which a reader takes
35
+ * whole. A copy written before the command was named carries the group's
36
+ * words alone; both begin so.
37
+ */
38
+ export const APP_COPY_MARK: "Written by `astryx experimental theme editor";
39
+ export function appCopyMark(slug: string): string;
@@ -1,15 +1,67 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file The markers the theme editor writes at the top of the files it
5
- * generates, in one place for the editor and for doctor.
4
+ * @file The marks the theme editor writes at the top of the files it
5
+ * generates, and the one reader of every generated mark (a theme build's
6
+ * included) that the editor, `theme build` and doctor share.
6
7
  *
7
8
  * @position api/theme-edit — internal
8
9
  */
9
10
 
10
11
  /** The first words of a generated settings module the editor writes. */
11
12
  export const EDITOR_GENERATED_MARK =
12
- 'Generated by `astryx experimental theme editor`';
13
+ 'Generated by `astryx experimental theme editor';
13
14
 
14
- /** The words on every file of a theme's app copy (src/themes/<theme>/). */
15
- export const APP_COPY_MARK = 'Written by `astryx experimental theme editor`';
15
+ /**
16
+ * The words on every file of a theme's app copy (src/themes/<theme>/): the
17
+ * start of "Written by `<the command that writes it>`", which a reader takes
18
+ * whole. A copy written before the command was named carries the group's
19
+ * words alone; both begin so.
20
+ */
21
+ export const APP_COPY_MARK = 'Written by `astryx experimental theme editor';
22
+
23
+ /**
24
+ * The mark an app copy's files carry, naming the command that writes them.
25
+ * @param {string} slug
26
+ */
27
+ export const appCopyMark = slug =>
28
+ `Written by \`astryx experimental theme editor show ${slug}\``;
29
+
30
+ /**
31
+ * The marks a file's leading comment can carry, and the command it names:
32
+ * `kind` is `build` for a theme build's output, `editor` for a file the theme
33
+ * editor writes (its settings module or app copy); `command` is the words in
34
+ * backquotes after "Written by" or "Generated by" (for a build, the build
35
+ * command). Null for a file without one. One reader for every caller.
36
+ * A mark written before files named their exact command carries the editor
37
+ * group's words alone, which only print its help: given the file's path,
38
+ * the command is the one that writes that theme's files again (`show`, with
39
+ * the theme its folder is named for).
40
+ * @param {string} source the start of the file
41
+ * @param {string} buildMarker the theme build's own marker
42
+ * @param {string} [file] the file's path
43
+ * @returns {{kind: 'build' | 'editor', command: string} | null}
44
+ */
45
+ export function generatedMark(source, buildMarker, file) {
46
+ const leading =
47
+ /^\s*(?:\/\*[\s\S]*?\*\/|(?:\/\/[^\n]*(?:\n|$)\s*)+)/.exec(source)?.[0] ??
48
+ '';
49
+ if (leading.includes(buildMarker))
50
+ return {kind: 'build', command: 'astryx theme build'};
51
+ if (![APP_COPY_MARK, EDITOR_GENERATED_MARK].some(m => leading.includes(m)))
52
+ return null;
53
+ const named = /(?:Written|Generated) by `([^`]+)`/.exec(leading)?.[1];
54
+ const group = 'astryx experimental theme editor';
55
+ if (named && named.trim() !== group) return {kind: 'editor', command: named};
56
+ // A group-only mark: the theme's own command, from its folder's name.
57
+ const slug = file
58
+ ? String(file).split(/[\\/]/).filter(Boolean).slice(-2)[0]
59
+ : null;
60
+ return {
61
+ kind: 'editor',
62
+ command:
63
+ slug && /^[a-z0-9][a-z0-9-]*$/.test(slug)
64
+ ? `${group} show ${slug}`
65
+ : 'the command that made it',
66
+ };
67
+ }
@@ -0,0 +1,11 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file What a theme name may be, in words: the one text every theme-name
6
+ * refusal, the help of `new` and its API docs state.
7
+ *
8
+ * @position api/theme-edit — imported by _settings.mjs and the `new` docs
9
+ */
10
+ /** What a theme name may be, in words. */
11
+ export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, a dash only between letters or digits (no two in a row, none at the end), 64 characters at most, and not a name Windows reserves (con, prn, aux, nul, com0-com9, lpt0-lpt9, and com\u00B9-com\u00B3, lpt\u00B9-lpt\u00B3)";
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file What a theme name may be, in words: the one text every theme-name
5
+ * refusal, the help of `new` and its API docs state.
6
+ *
7
+ * @position api/theme-edit — imported by _settings.mjs and the `new` docs
8
+ */
9
+
10
+ /** What a theme name may be, in words. */
11
+ export const NAME_RULE =
12
+ 'lowercase letters, digits and dashes, starting with a letter, a dash only between letters or digits (no two in a row, none at the end), 64 characters at most, and not a name Windows reserves (con, prn, aux, nul, com0-com9, lpt0-lpt9, and com¹-com³, lpt¹-lpt³)';
@@ -0,0 +1,303 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * A value as CSS reads it, for every value type: every Unicode space
6
+ * (no-break, thin, ideographic…) a plain space and zero-width and format
7
+ * characters dropped, and quotes that delimit a value (curly ones, «», ‹›,
8
+ * full-width, backticks) straight. A straight-quoted CSS string keeps what
9
+ * it holds as written (`content: "it’s"`). Curly quotes pair by kind
10
+ * (double with double, single with single, in any of their shapes: „Inter“,
11
+ * ‚Inter‘); one left unpaired is read as the straight quote it stands for.
12
+ * @param {string} v
13
+ * @returns {string}
14
+ */
15
+ export function normalValueText(v: string): string;
16
+ /**
17
+ * A value as meant when typed with escapes or in another notation: CSS
18
+ * function names in lower case (`LIGHT-DARK(` is `light-dark(`, as CSS reads
19
+ * it); a shell or JSON backslash before `#`, a quote or a space taken off;
20
+ * a JavaScript escape in a `content` string written as CSS writes it
21
+ * (`\u2022` is `\2022 `, `\n` a line break, `\t` a tab); and the JSON
22
+ * shapes a design-tokens file or an array writes (`{"$value": "#e11d48"}`,
23
+ * `{"value": 18, "unit": "px"}`, `["#e11d48"]`, `["Inter", "sans-serif"]`).
24
+ * @param {string} thing
25
+ * @param {string} value
26
+ * @returns {string}
27
+ */
28
+ export function escapesMeant(thing: string, value: string): string;
29
+ /**
30
+ * The thing and value a setting was typed as, put right before any check: a
31
+ * declaration pasted whole or split (`accent: #e11d48`, `--color-accent=red`,
32
+ * `font:inter`, `accent:` with the value next), a token typed with an em or
33
+ * en dash (`—color-accent`) or as `var(--color-accent)`, and the value's
34
+ * Unicode spaces. A thing it cannot read is left as typed.
35
+ * @param {string} thing
36
+ * @param {string | undefined} value
37
+ * @returns {{thing: string, value: string | undefined, dropped?: string}} `dropped`: a second declaration pasted after the first, which is not set
38
+ */
39
+ export function normalizeEntry(thing: string, value: string | undefined): {
40
+ thing: string;
41
+ value: string | undefined;
42
+ dropped?: string;
43
+ };
44
+ /**
45
+ * A font stack's pieces, split on the commas outside quotes, with each
46
+ * piece's name and whether it was quoted; null when a quote is left open.
47
+ * @param {string} v
48
+ * @returns {Array<{name: string, quoted: boolean}> | null}
49
+ */
50
+ export function familyPieces(v: string): Array<{
51
+ name: string;
52
+ quoted: boolean;
53
+ }> | null;
54
+ /**
55
+ * The families a typed font stack names: a trailing comma and empty pieces
56
+ * dropped, and a stack wrapped in one more pair of the quotes it uses
57
+ * inside (`""SF Mono", Monaco, monospace"`, as a JSON string) unwrapped.
58
+ * Null when the stack does not read.
59
+ * @param {string} v
60
+ * @returns {string[] | null}
61
+ */
62
+ export function familiesOf(v: string): string[] | null;
63
+ /**
64
+ * A value with the debris of a bad copy taken off: a leading `=` or `:`, a
65
+ * trailing comma (a JSON or CSS list), and a quote or a closing bracket left
66
+ * over at either end. A value without any is returned as it was.
67
+ * @param {string} v
68
+ * @returns {string}
69
+ */
70
+ export function withoutDebris(v: string): string;
71
+ /**
72
+ * A value without a second declaration pasted after it (`#e11d48;
73
+ * text-size: 18`): cut at the first `;` outside quotes that a `name:`
74
+ * follows. A `;` inside a quoted string (`"Tip; note: x"`) is the string's.
75
+ * @param {string} v
76
+ * @returns {string}
77
+ */
78
+ export function withoutSecondDeclaration(v: string): string;
79
+ /**
80
+ * A saved dial value read as typed input is (invisible or stray spaces,
81
+ * quotes around it, a pasted `corners: pill`, a trailing `;`, other
82
+ * letters): the value the dial may have meant.
83
+ * @param {string} dial
84
+ * @param {string} value
85
+ * @returns {string}
86
+ */
87
+ export function cleanDialValue(dial: string, value: string): string;
88
+ /**
89
+ * A value with the spaces just inside each straight-quoted string taken off
90
+ * (`" Inter "` is "Inter"), for a font family, whose name holds none there.
91
+ * @param {string} v
92
+ * @returns {string}
93
+ */
94
+ export function trimInsideQuotes(v: string): string;
95
+ /**
96
+ * The other setting a dial's value is labeled with, when pasted with a
97
+ * label that names a different dial or a token (`neutral: #64748b` given
98
+ * to accent): that label and the value after it, else null. A label that
99
+ * names this dial, or a CSS property (`color: #e11d48`), is no other
100
+ * setting.
101
+ * @param {string} dial
102
+ * @param {string} value
103
+ * @returns {{thing: string, value: string} | null}
104
+ */
105
+ export function otherSettingLabel(dial: string, value: string): {
106
+ thing: string;
107
+ value: string;
108
+ } | null;
109
+ /**
110
+ * A light and a dark color typed as a pair: labeled (`light: red; dark:
111
+ * blue`), a JSON object (`{"light": "red", "dark": "blue"}`), or two colors
112
+ * with a slash or a comma between (`red / blue`, `red, blue`). Null when the
113
+ * value is no such pair; the caller checks that both are colors.
114
+ * @param {string} value
115
+ * @returns {{light: string, dark: string} | null}
116
+ */
117
+ export function colorPair(value: string): {
118
+ light: string;
119
+ dark: string;
120
+ } | null;
121
+ /**
122
+ * A value without the debris a copy brings along: a trailing `;`, a
123
+ * `!important`, a comment. One of the exact cleanups a repair may offer.
124
+ * @param {string} v
125
+ * @returns {string}
126
+ */
127
+ export function withoutCopyDebris(v: string): string;
128
+ /**
129
+ * A whole number as typed: digits with any white space at the ends and a
130
+ * zero fraction (`" 3"`, `"3.0"`), or a number word (`"three"`); else null.
131
+ * @param {unknown} text
132
+ * @returns {number | null}
133
+ */
134
+ export function wholeNumberOf(text: unknown): number | null;
135
+ /**
136
+ * A typed value as the repair gate reads it, in one reading: escapes and
137
+ * full-width characters as the characters they are, a letter O inside a
138
+ * number as a zero, a comma between digits as a decimal point (or before
139
+ * exactly three digits, after a whole number other than 0, a thousands
140
+ * mark), and without what is not the value: quotes and braces around it, a
141
+ * label before it (`accent: red`), a flag inside it (`--mode dark`) or a
142
+ * flag's label after it (`mode: dark`), copy debris (`;`, `!important`,
143
+ * comments), and the axes of a Google Fonts family spec (`Inter:wght@400`
144
+ * is the family Inter).
145
+ * @param {string} typed
146
+ * @param {{thousands?: boolean}} [opts] `thousands` for a setting whose
147
+ * numbers are weights (see commaNumbers)
148
+ * @returns {string}
149
+ */
150
+ export function typedReading(typed: string, { thousands }?: {
151
+ thousands?: boolean;
152
+ }): string;
153
+ /**
154
+ * A text with each comma between digits, outside parentheses, read as a
155
+ * number mark: a decimal point (`1,5rem`, `1,125rem`, `0,500`), or, only
156
+ * where the setting's numbers are whole thousands (a weight, 1 to 1000), a
157
+ * thousands mark before exactly three digits after a whole number other
158
+ * than 0 (`1,000`). Inside a function (`rgb(255,0,0)`) a comma separates
159
+ * arguments.
160
+ * @param {string} text
161
+ * @param {boolean} [thousands] whether the setting's numbers are weights
162
+ * @returns {string}
163
+ */
164
+ export function commaNumbers(text: string, thousands?: boolean): string;
165
+ /**
166
+ * The one mode a word names, or null: light or dark, written as a mode
167
+ * value names one (`dark-only`), with the word mode (`darkmode`, `dark
168
+ * mode`, `mode dark`), or as a word for it (MODE_WORDS: night, day). The
169
+ * one mode reader: the `--mode` flag, a mode label in a value, a saved
170
+ * entry's mode and the settings file's mode all read it.
171
+ * @param {unknown} text
172
+ * @returns {'light' | 'dark' | null}
173
+ */
174
+ export function modeWord(text: unknown): "light" | "dark" | null;
175
+ /**
176
+ * A base as written in any of its names: its package (`@astryxdesign/
177
+ * theme-neutral`, `theme-neutral`), its export (`neutralTheme`), or with
178
+ * the word theme (`neutral-theme`, `neutral theme`), in any case. The one
179
+ * reading `set`, `new` and the settings file share; the word as read (a
180
+ * base name or not).
181
+ * @param {unknown} v
182
+ * @returns {string}
183
+ */
184
+ export function baseWord(v: unknown): string;
185
+ /**
186
+ * The one reading of a yes/no word, for a flag given a value (`--only=on`)
187
+ * and a saved `only`: the documented spellings of yes and no, or a typo of
188
+ * one of them (`ture`); null for any other word, which is neither.
189
+ * @param {unknown} word
190
+ * @returns {boolean | null}
191
+ */
192
+ export function booleanWord(word: unknown): boolean | null;
193
+ /**
194
+ * Register a documented table's readings with the repair allowlist.
195
+ * @param {Iterable<[string, string]>} pairs typed word, value it means
196
+ */
197
+ export function documentReadings(pairs: Iterable<[string, string]>): void;
198
+ /**
199
+ * Register a documented numeric table with the repair allowlist.
200
+ * @param {string[]} things the settings whose values the table reads (a
201
+ * name ending in `*` names every setting it starts)
202
+ * @param {Array<[string, number]>} table
203
+ * @param {[number, number]} [domain] the numbers the table reads (by
204
+ * default every number)
205
+ */
206
+ export function documentNumericTable(things: string[], table: Array<[string, number]>, domain?: [number, number]): void;
207
+ /**
208
+ * Register documented words a typed list item may be a typo of.
209
+ * @param {Iterable<string>} words
210
+ */
211
+ export function documentTypoWords(words: Iterable<string>): void;
212
+ /**
213
+ * Register a setting's documented range with the repair allowlist.
214
+ * @param {string[]} things as for documentNumericTable
215
+ * @param {number} min
216
+ * @param {number} max
217
+ */
218
+ export function documentRange(things: string[], min: number, max: number): void;
219
+ /**
220
+ * What a suggested value reads of the typed value: `true` when it is the
221
+ * whole value under one of the gate's declared sources, an array of the
222
+ * typed tokens it carries when it carries only part of them (one setting
223
+ * of a value that holds several, as `Inter 600` holds a family and a
224
+ * weight), or `false` when it reads nothing typed.
225
+ *
226
+ * The declared sources: (1) the value typed, under the exact readings of
227
+ * typedReading, sameToken and numbersEqual, the words joined into a CSS
228
+ * color name (`dark red` is darkred), or the color the typed color is
229
+ * (rgb() as its hex, a see-through color opaque); (2) a documented table
230
+ * registered with documentReadings, documentNumericTable or documentRange;
231
+ * (3) the theme's own saved value of the line's setting, for a setting
232
+ * other than the one typed (a keep or unlock line); (4) the setting's
233
+ * documented fallback, or a step (`more`, `less`) on a dial with a scale,
234
+ * offered for that dial or one of its tokens; (5) the correction of a
235
+ * typo (typoOf). Several values of one kind typed for a setting that takes
236
+ * one (`1.5 2`) may be read as the first.
237
+ * @param {{offered: string, typed: string, thing?: string, typedThing?: string, saved?: Map<string, string[]>, mode?: string}} line
238
+ * @returns {true | number[] | {oneOf: number[]} | false}
239
+ */
240
+ export function readsTyped({ offered, typed, thing, typedThing, saved, mode, }: {
241
+ offered: string;
242
+ typed: string;
243
+ thing?: string;
244
+ typedThing?: string;
245
+ saved?: Map<string, string[]>;
246
+ mode?: string;
247
+ }): true | number[] | {
248
+ oneOf: number[];
249
+ } | false;
250
+ /**
251
+ * Whether the lines of one refusal, taken together, carry the whole typed
252
+ * value: each reads it whole, or the parts they carry cover every typed
253
+ * token. A part alone (`all` for `all 200`, `bold` for `extra bold`) is not
254
+ * offered.
255
+ * @param {Array<true | number[] | {oneOf: number[]} | false>} reads
256
+ * @param {string} typed
257
+ * @param {string} [thing] the setting typed (its numbers' reading)
258
+ */
259
+ export function coversTyped(reads: Array<true | number[] | {
260
+ oneOf: number[];
261
+ } | false>, typed: string, thing?: string): boolean;
262
+ /**
263
+ * Whether a typed word is a typo of a word: both words of four letters or
264
+ * more, within one edit for a typed word of five letters or fewer and two
265
+ * for a longer one (`nnone` is none, `normall` normal; `line` is no none).
266
+ * @param {string} typed
267
+ * @param {string} word
268
+ */
269
+ export function typoOf(typed: string, word: string): boolean;
270
+ /**
271
+ * Whether `word` is within the typo limit of `typed` (two letters swapped
272
+ * count as one edit, as typed: flxe is flex).
273
+ * @param {string} typed
274
+ * @param {string} word
275
+ */
276
+ export function typoNear(typed: string, word: string): boolean;
277
+ /** Number words, longest phrase first. */
278
+ export const NUMBER_WORDS: Record<string, number>;
279
+ /**
280
+ * Words with a documented reading on a CSS property: the exact value each
281
+ * one means. A repair may offer these for the word typed.
282
+ * @type {Record<string, Record<string, string>>}
283
+ */
284
+ export const PROPERTY_WORDS: Record<string, Record<string, string>>;
285
+ /** Weight words beyond the headings dial's, as their numbers. */
286
+ export const WEIGHT_WORDS: Record<string, string>;
287
+ /**
288
+ * Tailwind's radius classes, as the corners value each one is.
289
+ * @type {Record<string, string>}
290
+ */
291
+ export const TAILWIND_RADIUS: Record<string, string>;
292
+ /** Words for more or less room, as the spacing rung each one means. */
293
+ export const DENSITY_WORDS: Record<string, string>;
294
+ export function weightSetting(thing: string): boolean;
295
+ export function allowedLine(line: {
296
+ offered: string;
297
+ typed: string;
298
+ thing?: string;
299
+ typedThing?: string;
300
+ saved?: Map<string, string[]>;
301
+ mode?: string;
302
+ }): boolean;
303
+ export function typoLimit(typed: string): 0 | 1 | 2;