@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
@@ -34,14 +34,15 @@ import {
34
34
  loadTheme,
35
35
  nearest,
36
36
  refuse,
37
+ themeSourceParseError,
37
38
  themeSourceProblem,
38
39
  } from './_settings.mjs';
39
- import {ASPECTS, checkSetting} from './_check.mjs';
40
+ import {ASPECTS, settableStates} from './_check.mjs';
40
41
  import {MODAL} from './_compiler.mjs';
41
42
  import {PALETTE_DIALS, mappingRows, paletteFiles} from './_palette.mjs';
42
43
  import {requireProject, context} from './_context.mjs';
43
44
  import {checked, exampleStep, howTheme, render} from './_how-commands.mjs';
44
- import {draftAnswer} from './_how-question.mjs';
45
+ import {draftAnswer, partLexicon, valueAsked} from './_how-question.mjs';
45
46
  import {
46
47
  getCliInvocation,
47
48
  quoteCommandArgument,
@@ -191,6 +192,16 @@ async function answer(subject, options, cwd) {
191
192
  // "½rem": a fraction is a number before anything reads the question.
192
193
  const t = (subject ?? '')
193
194
  .trim()
195
+ // "corners:", "var(--radius-element)": a setting pasted as written is
196
+ // a lookup of it.
197
+ .replace(/^([a-z][a-z -]*):\s*$/i, '$1')
198
+ .replace(/^var\(\s*(--[a-z0-9-]+)\s*\)$/i, '$1')
199
+ // A lone "½" with no unit after it is a share of now ("card padding
200
+ // ½"), never 0.5px.
201
+ .replace(
202
+ /(\d*)(?:½|1\u20442)(?!\s*(?:rem|px|em|%|x\b|×|times\b))/g,
203
+ (_, n) => (n ? `${n}½` : ' half '),
204
+ )
194
205
  .replace(/(\d*)(?:½|1\u20442)/g, (_, n) => `${n ? Number(n) + 0.5 : '0.5'}`)
195
206
  .replace(
196
207
  /(\d*)(?:¼|1\u20444)/g,
@@ -200,6 +211,12 @@ async function answer(subject, options, cwd) {
200
211
  /(\d*)(?:¾|3\u20444)/g,
201
212
  (_, n) => `${n ? Number(n) + 0.75 : '0.75'}`,
202
213
  );
214
+ // "paddingLeft", "borderRadius": a property as JavaScript spells it is
215
+ // that CSS property, as set takes it.
216
+ if (/^[a-z]+(?:[A-Z][a-z]+)+$/.test(t)) {
217
+ const kebab = t.replace(/[A-Z]/g, ch => `-${ch.toLowerCase()}`);
218
+ if (cssProperties().has(kebab)) return answer(kebab, options, cwd);
219
+ }
203
220
  // "explain spacing", "tell me about the accent": the lookup of what is
204
221
  // named, never a change.
205
222
  const explain =
@@ -214,10 +231,28 @@ async function answer(subject, options, cwd) {
214
231
  run: [`${HOW} ${t ? JSON.stringify(t) : 'card'}`],
215
232
  });
216
233
  if (options.theme != null) {
217
- loadTheme(cwd, options.theme);
234
+ try {
235
+ loadTheme(cwd, options.theme);
236
+ } catch (e) {
237
+ // A theme name near the one typed: the same question for it, never
238
+ // only `show` (the question is kept).
239
+ const err = /** @type {any} */ (e);
240
+ // (A name typed in another case or as a path too.)
241
+ if (err?.suggestions)
242
+ for (const s of err.suggestions) {
243
+ const near = / show ([a-z][a-z0-9-]*)$/.exec(
244
+ String(s.name ?? ''),
245
+ )?.[1];
246
+ if (near)
247
+ s.name = `${HOW} ${quoteCommandArgument(t || 'card')} --theme ${near}`;
248
+ }
249
+ throw e;
250
+ }
218
251
  // A theme whose source no longer extends its settings takes no setting:
219
252
  // an answer would suggest commands that cannot run.
220
- const broken = themeSourceProblem(cwd, options.theme);
253
+ const broken =
254
+ themeSourceParseError(cwd, options.theme) ??
255
+ (await themeSourceProblem(cwd, options.theme));
221
256
  if (broken)
222
257
  refuse(
223
258
  E.ERR_THEME_INVALID,
@@ -430,9 +465,31 @@ async function answer(subject, options, cwd) {
430
465
  // "What does --color-accent do", "what's the variable for card padding":
431
466
  // "--focus-outline-width: 3px": a token typed with a value is set exactly,
432
467
  // or refused with the nearest names; never another token.
468
+ // "cards: --color-border red", "--color-border red on inputs": the token
469
+ // on that part.
470
+ const scopeLead = /^\s*([a-z][a-z -]*?)\s*:\s*(?=--)/i.exec(t)?.[1];
471
+ const scopeTail =
472
+ /\s+(?:on|for)\s+(?:the |my |all )?([a-z][a-z -]*?)\s*$/i.exec(t)?.[1];
473
+ const scopeWord = scopeLead ?? scopeTail;
474
+ const scopeOn = scopeWord
475
+ ? (() => {
476
+ const w = ` ${scopeWord.trim().toLowerCase()} `;
477
+ return (
478
+ partLexicon(ctx).parts.find(([re]) => re.test(w))?.[1].on ?? null
479
+ );
480
+ })()
481
+ : null;
433
482
  const typedToken =
434
483
  /^\s*(--[a-z][a-z0-9-]*)\s*(?::|\s+to\s+|\s+)\s*([^;]+?)\s*;?\s*(?:\bin (light|dark) mode\b.*)?$/i.exec(
435
- t.replace(/^\s*(?:change|set|make|token)\s+/i, ' '),
484
+ t
485
+ .replace(/^\s*(?:change|set|make|token)\s+/i, ' ')
486
+ .replace(/^\s*[a-z][a-z -]*?\s*:\s*(?=--)/i, ' ')
487
+ .replace(
488
+ scopeOn && scopeTail
489
+ ? /\s+(?:on|for)\s+(?:the |my |all )?[a-z][a-z -]*?\s*$/i
490
+ : /$^/,
491
+ '',
492
+ ),
436
493
  );
437
494
  if (
438
495
  typedToken &&
@@ -471,6 +528,7 @@ async function answer(subject, options, cwd) {
471
528
  verb: 'set',
472
529
  thing: token,
473
530
  value,
531
+ ...(scopeOn ? {on: scopeOn} : {}),
474
532
  ...(mode && env.data.mode === 'both' ? {mode} : {}),
475
533
  },
476
534
  ],
@@ -510,8 +568,10 @@ async function answer(subject, options, cwd) {
510
568
  results: tool,
511
569
  ...unknown,
512
570
  };
513
- // a question about what something is gets the lookup, not a change.
571
+ // a question about what something is gets the lookup, not a change; a
572
+ // question about a part's value now gets the value (draftAnswer).
514
573
  if (
574
+ !valueAsked(t) &&
515
575
  (/^\s*(what|which|where)\b.*\b(variables?|tokens?|do|does|means?|controls?|for)\b|^\s*what('s| is) the (css )?(variable|token|property)/i.test(
516
576
  t,
517
577
  ) ||
@@ -578,10 +638,13 @@ async function answer(subject, options, cwd) {
578
638
  ...unknown,
579
639
  ...(empty
580
640
  ? {
581
- hint: results.length
582
- ? `No command does all of "${t}" on ${env.slug}; the lines above say why.`
583
- : `No match for "${t}". Name the part (header, nav links, card, button, banner, input...) and what to change (text color, background, gradient, corners, border, shadow, spacing, bold), in English.`,
641
+ hint: `${
642
+ results.length
643
+ ? `No command does all of "${t}" on ${env.slug}; the lines above say why.`
644
+ : `No match for "${t}". Name the part (header, nav links, card, button, banner, input...) and what to change (text color, background, gradient, corners, border, shadow, spacing, bold), in English.`
645
+ } See ${HOW} --help for the asks it understands.`,
584
646
  run: [
647
+ `${HOW} --help`,
585
648
  `${HOW} --list parts`,
586
649
  `${HOW} "rounder buttons"`,
587
650
  `${HOW} colors`,
@@ -600,9 +663,74 @@ async function answer(subject, options, cwd) {
600
663
  function finish(env, drafts) {
601
664
  /** @type {Array<{text: string, commands: string[], sequence?: boolean, refused?: Array<{command: string, why: string}>}>} */
602
665
  const out = [];
666
+ // The measured check runs first on the drafts that carry what their
667
+ // clause asks; a draft that joins them ("all of it, in order") then keeps
668
+ // only the steps some kept option still has, so it never brings back a
669
+ // step the check left out.
670
+ const key = (/** @type {import('./_how-commands.mjs').Step} */ st) =>
671
+ JSON.stringify([
672
+ st.verb,
673
+ st.thing,
674
+ st.value,
675
+ st.on,
676
+ st.when,
677
+ st.state,
678
+ st.mode,
679
+ ]);
680
+ /** @type {Set<string>} */
681
+ const dropped = new Set();
682
+ /** @type {Set<string>} */
683
+ const kept = new Set();
684
+ /** @type {Map<object, string[]>} */
685
+ const unmetOf = new Map();
686
+ if (typeof env.measure === 'function')
687
+ for (const d of drafts) {
688
+ if (!d.intent) continue;
689
+ const intent = d.intent;
690
+ /** @type {string[]} */
691
+ const unmet = [];
692
+ d.options = d.options.filter(o => {
693
+ const why = env.measure(o, intent);
694
+ for (const st of o) (why ? dropped : kept).add(key(st));
695
+ if (why) unmet.push(why);
696
+ return !why;
697
+ });
698
+ unmetOf.set(d, unmet);
699
+ }
603
700
  for (const d of drafts) {
701
+ if (!d.intent && dropped.size) {
702
+ d.options = d.options
703
+ .map(o => o.filter(st => !dropped.has(key(st)) || kept.has(key(st))))
704
+ .filter(o => o.length);
705
+ // A joined answer left holding what another answer already says is
706
+ // that answer: it is not given twice (and never as "all of it").
707
+ const same = (/** @type {import('./_how-commands.mjs').Step[]} */ o) =>
708
+ drafts.some(
709
+ x =>
710
+ x !== d &&
711
+ x.options.some(
712
+ y =>
713
+ y.length === o.length &&
714
+ y.every((st, i) => key(st) === key(o[i])),
715
+ ),
716
+ );
717
+ if (d.options.length && d.options.every(same)) continue;
718
+ }
719
+ // The measured check: an option whose built result does not do what
720
+ // the question asks is left out, with a plain line saying why.
721
+ const unmet = unmetOf.get(d) ?? [];
722
+ if (unmet.length) {
723
+ if (unmet.length && !d.options.length)
724
+ d.text = `couldn't work out a command that does "${d.text}" as asked: ${[...new Set(unmet)].join('; ')}`;
725
+ else if (unmet.length)
726
+ d.text = `${d.text} (left out: ${[...new Set(unmet)].join('; ')})`;
727
+ }
604
728
  const {commands, refused} = checked(env, d.options);
605
729
  const lookups = d.lookup ? [d.lookup] : [];
730
+ if (!commands.length && !d.options.length && unmet.length) {
731
+ out.push({text: d.text, commands: lookups});
732
+ continue;
733
+ }
606
734
  if (!commands.length && d.options.length && !lookups.length) {
607
735
  out.push({
608
736
  text: `${d.text}: no command does it on ${env.slug}${refused[0] ? `: ${refused[0].why}` : ''}`,
@@ -682,25 +810,7 @@ function partAnswer(ctx, env, subject, key, unknown, themeFields) {
682
810
  ctx.project.target.get(key)
683
811
  );
684
812
  const group = familyOf(key);
685
- // Only the states set takes on this part (it refuses one that never
686
- // applies there).
687
- // Only the states set takes on this part: a state is dropped when the
688
- // same change without it passes and with it is refused.
689
- const takes = (/** @type {string | undefined} */ st) => {
690
- try {
691
- checkSetting(ctx, env.slug, env.data, 'opacity', '1', {
692
- on: key,
693
- ...(st ? {state: st} : {}),
694
- });
695
- return true;
696
- } catch {
697
- return false;
698
- }
699
- };
700
- const plainOk = takes(undefined);
701
- const states = [...new Set([...target.states, ...COMMON_STATES])].filter(
702
- st => !plainOk || takes(st),
703
- );
813
+ const states = settableStates(ctx, env.slug, env.data, key);
704
814
  const reads = Object.fromEntries(
705
815
  Object.keys(GROUPS).map(g => [
706
816
  g,
@@ -1094,7 +1204,8 @@ function toolAnswer(t, env, targets) {
1094
1204
  },
1095
1205
  ];
1096
1206
  if (
1097
- asks ||
1207
+ // A question about a part's value now is answered with that value.
1208
+ (asks && !valueAsked(q)) ||
1098
1209
  /^which parts (are|does|do)\b/.test(q) ||
1099
1210
  (/^why (is|are|does|do)\b/.test(q) && !/\bnot\b|n'?t\b/.test(q))
1100
1211
  ) {
@@ -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,257 @@
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 typed value as the repair gate reads it, in one reading: escapes and
130
+ * full-width characters as the characters they are, a letter O inside a
131
+ * number as a zero, a comma between digits as a decimal point (or before
132
+ * exactly three digits, after a whole number other than 0, a thousands
133
+ * mark), and without what is not the value: quotes and braces around it, a
134
+ * label before it (`accent: red`), a flag inside it (`--mode dark`) or a
135
+ * flag's label after it (`mode: dark`), copy debris (`;`, `!important`,
136
+ * comments), and the axes of a Google Fonts family spec (`Inter:wght@400`
137
+ * is the family Inter).
138
+ * @param {string} typed
139
+ * @returns {string}
140
+ */
141
+ export function typedReading(typed: string): string;
142
+ /**
143
+ * A text with each comma between digits, outside parentheses, read as a
144
+ * number mark: before exactly three digits after a whole number other than
145
+ * 0 (`1,000`), a thousands mark; otherwise (`1,5`, `0,500`) a decimal
146
+ * point. Inside a function (`rgb(255,0,0)`) a comma separates arguments.
147
+ * @param {string} text
148
+ * @returns {string}
149
+ */
150
+ export function commaNumbers(text: string): string;
151
+ /**
152
+ * Register a documented table's readings with the repair allowlist.
153
+ * @param {Iterable<[string, string]>} pairs typed word, value it means
154
+ */
155
+ export function documentReadings(pairs: Iterable<[string, string]>): void;
156
+ /**
157
+ * Register a documented numeric table with the repair allowlist.
158
+ * @param {string[]} things the settings whose values the table reads (a
159
+ * name ending in `*` names every setting it starts)
160
+ * @param {Array<[string, number]>} table
161
+ * @param {[number, number]} [domain] the numbers the table reads (by
162
+ * default every number)
163
+ */
164
+ export function documentNumericTable(things: string[], table: Array<[string, number]>, domain?: [number, number]): void;
165
+ /**
166
+ * Register a setting's documented range with the repair allowlist.
167
+ * @param {string[]} things as for documentNumericTable
168
+ * @param {number} min
169
+ * @param {number} max
170
+ */
171
+ export function documentRange(things: string[], min: number, max: number): void;
172
+ /**
173
+ * What a suggested value reads of the typed value: `true` when it is the
174
+ * whole value under one of the gate's declared sources, an array of the
175
+ * typed tokens it carries when it carries only part of them (one setting
176
+ * of a value that holds several, as `Inter 600` holds a family and a
177
+ * weight), or `false` when it reads nothing typed.
178
+ *
179
+ * The declared sources: (1) the value typed, under the exact readings of
180
+ * typedReading, sameToken and numbersEqual, the words joined into a CSS
181
+ * color name (`dark red` is darkred), or the color the typed color is
182
+ * (rgb() as its hex, a see-through color opaque); (2) a documented table
183
+ * registered with documentReadings, documentNumericTable or documentRange;
184
+ * (3) the theme's own saved value of the line's setting, for a setting
185
+ * other than the one typed (a keep or unlock line); (4) the setting's
186
+ * documented fallback, or a step (`more`, `less`) on a dial with a scale,
187
+ * offered for that dial or one of its tokens; (5) the correction of a
188
+ * typo (typoOf). Several values of one kind typed for a setting that takes
189
+ * one (`1.5 2`) may be read as the first.
190
+ * @param {{offered: string, typed: string, thing?: string, typedThing?: string, saved?: Map<string, string[]>, mode?: string}} line
191
+ * @returns {true | number[] | false}
192
+ */
193
+ export function readsTyped({ offered, typed, thing, typedThing, saved, mode, }: {
194
+ offered: string;
195
+ typed: string;
196
+ thing?: string;
197
+ typedThing?: string;
198
+ saved?: Map<string, string[]>;
199
+ mode?: string;
200
+ }): true | number[] | false;
201
+ /**
202
+ * Whether the lines of one refusal, taken together, carry the whole typed
203
+ * value: each reads it whole, or the parts they carry cover every typed
204
+ * token. A part alone (`all` for `all 200`, `bold` for `extra bold`) is not
205
+ * offered.
206
+ * @param {Array<true | number[] | false>} reads
207
+ * @param {string} typed
208
+ */
209
+ export function coversTyped(reads: Array<true | number[] | false>, typed: string): boolean;
210
+ /**
211
+ * Whether the values a refusal offers for one setting carry what was typed
212
+ * (see readsTyped and coversTyped).
213
+ * @param {string[]} offered
214
+ * @param {string} typed
215
+ */
216
+ export function offersAllTyped(offered: string[], typed: string): boolean;
217
+ /**
218
+ * Whether a typed word is a typo of a word: both words of four letters or
219
+ * more, within one edit for a typed word of five letters or fewer and two
220
+ * for a longer one (`nnone` is none, `normall` normal; `line` is no none).
221
+ * @param {string} typed
222
+ * @param {string} word
223
+ */
224
+ export function typoOf(typed: string, word: string): boolean;
225
+ /**
226
+ * Whether `word` is within the typo limit of `typed` (two letters swapped
227
+ * count as one edit, as typed: flxe is flex).
228
+ * @param {string} typed
229
+ * @param {string} word
230
+ */
231
+ export function typoNear(typed: string, word: string): boolean;
232
+ /**
233
+ * Words with a documented reading on a CSS property: the exact value each
234
+ * one means. A repair may offer these for the word typed.
235
+ * @type {Record<string, Record<string, string>>}
236
+ */
237
+ export const PROPERTY_WORDS: Record<string, Record<string, string>>;
238
+ /** Weight words beyond the headings dial's, as their numbers. */
239
+ export const WEIGHT_WORDS: Record<string, string>;
240
+ /**
241
+ * Tailwind's radius classes, as the corners value each one is.
242
+ * @type {Record<string, string>}
243
+ */
244
+ export const TAILWIND_RADIUS: Record<string, string>;
245
+ /** Words for more or less room, as the spacing rung each one means. */
246
+ export const DENSITY_WORDS: Record<string, string>;
247
+ export function offersTyped(offered: string, typed: string): boolean;
248
+ export function carriesTyped(offered: string, typed: string): boolean;
249
+ export function allowedLine(line: {
250
+ offered: string;
251
+ typed: string;
252
+ thing?: string;
253
+ typedThing?: string;
254
+ saved?: Map<string, string[]>;
255
+ mode?: string;
256
+ }): boolean;
257
+ export function typoLimit(typed: string): 0 | 1 | 2;