@astryxdesign/cli 0.7.18-canary.gfca8508 → 0.7.18

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 (341) hide show
  1. package/CHANGELOG.md +185 -19
  2. package/README.md +19 -19
  3. package/api/component/_adapter.d.mts +2 -1
  4. package/api/component/_adapter.mjs +2 -1
  5. package/api/docs/_adapter.d.mts +6 -5
  6. package/api/docs/_adapter.mjs +36 -5
  7. package/api/doctor/_adapter.d.mts +6 -3
  8. package/api/doctor/_adapter.mjs +13 -5
  9. package/api/doctor/doctor.mjs +2 -2
  10. package/api/doctor/font-packages.d.mts +36 -0
  11. package/api/doctor/font-packages.mjs +124 -0
  12. package/api/doctor/theme-checks.mjs +110 -49
  13. package/api/experimental.d.mts +0 -2
  14. package/api/experimental.mjs +0 -12
  15. package/api/icon/_adapter.d.mts +1 -1
  16. package/api/icon/_adapter.mjs +1 -0
  17. package/api/icon/_authoring.mjs +17 -8
  18. package/api/icon/_default-look.mjs +15 -15
  19. package/api/icon/add/add.mjs +9 -4
  20. package/api/icon/exportIconIndex.doc.mjs +1 -1
  21. package/api/icon/icon.doc.mjs +1 -1
  22. package/api/icon/icon.type.d.mts +33 -33
  23. package/api/icon/icon.type.mjs +45 -45
  24. package/api/icon/iconAdd.doc.mjs +1 -1
  25. package/api/icon/iconNewSet.doc.mjs +3 -3
  26. package/api/icon/iconUse.doc.mjs +5 -5
  27. package/api/icon/rankIconIndex.doc.mjs +1 -1
  28. package/api/icon/use/use.mjs +4 -4
  29. package/api/init/run/run.mjs +0 -1
  30. package/api/integration/add-helpers.mjs +1 -1
  31. package/api/render/_adapter.mjs +7 -1
  32. package/api/search/ORDERING.md +1 -1
  33. package/api/search/_candidate-score.mjs +20 -0
  34. package/api/search/_words.d.mts +8 -0
  35. package/api/search/_words.mjs +15 -0
  36. package/api/template/template.type.d.mts +2 -2
  37. package/api/template/template.type.mjs +2 -2
  38. package/api/theme/_adapter.mjs +19 -11
  39. package/api/theme/build/build.d.mts +19 -51
  40. package/api/theme/build/build.mjs +195 -189
  41. package/api/theme/build/font-warning.d.mts +19 -2
  42. package/api/theme/build/font-warning.mjs +46 -5
  43. package/api/theme/generateTonalPalette.doc.mjs +1 -1
  44. package/api/theme/palette/generate/derive-look.mjs +108 -37
  45. package/api/theme/palette/generate/mapping.mjs +2 -0
  46. package/api/theme/template/template.d.mts +0 -17
  47. package/api/theme/template/template.mjs +1 -42
  48. package/api/theme/theme.type.d.mts +5 -4
  49. package/api/theme/theme.type.mjs +5 -4
  50. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  51. package/api/theme/themeRemove.doc.mjs +1 -1
  52. package/assets/codemods/transforms/v0.7.0/preserve-bottom-sheet-content-padding.mjs +3 -1
  53. package/assets/component-list.generated.json +1 -1
  54. package/assets/discover/official-packages.json +26 -2
  55. package/assets/docs/author-a-theme.doc.mjs +6 -5
  56. package/assets/docs/browser-support.doc.mjs +1 -0
  57. package/assets/docs/icons.doc.mjs +8 -7
  58. package/assets/docs/motion.doc.mjs +46 -0
  59. package/assets/docs/theme.doc.dense.mjs +6 -17
  60. package/assets/docs/theme.doc.mjs +6 -16
  61. package/assets/docs/theme.doc.zh.mjs +6 -16
  62. package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
  63. package/assets/docs/tree/font-setup.doc.mjs +30 -0
  64. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  65. package/assets/docs/tree/template-icons.doc.mjs +3 -3
  66. package/assets/docs/tree/tokens-color.doc.mjs +5 -0
  67. package/assets/docs/tree/tokens.doc.mjs +4 -3
  68. package/assets/docs/tree/updates.doc.mjs +1 -1
  69. package/assets/docs-routes.generated.json +1 -1
  70. package/assets/docs.generated.json +2 -2
  71. package/assets/icons/definitions/drag.doc.mjs +1 -0
  72. package/assets/search-catalog.generated.json +2 -2
  73. package/assets/self-audit.generated.json +1 -1
  74. package/assets/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +1 -1
  75. package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +20 -10
  76. package/assets/templates/blocks/components/Card/SelectableCardShowcase.doc.mjs +1 -1
  77. package/assets/templates/blocks/components/Card/SelectableCardShowcase.tsx +36 -16
  78. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +6 -0
  79. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +6 -0
  80. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.tsx +63 -0
  82. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.doc.mjs +29 -0
  83. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.tsx +237 -0
  84. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +10 -72
  85. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.doc.mjs +1 -1
  86. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +7 -7
  87. package/assets/templates/blocks/components/Table/TableCustomRowTable.doc.mjs +14 -0
  88. package/assets/templates/blocks/components/Table/TableCustomRowTable.tsx +96 -0
  89. package/assets/templates/components.generated.json +1 -1
  90. package/assets/templates/pages/ai-chat-landing/page.tsx +4 -0
  91. package/assets/templates/pages/dashboard-scorecard/page.tsx +26 -7
  92. package/assets/templates/pages/editor/page.tsx +13 -3
  93. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +2 -2
  94. package/assets/templates/themes/butter/butterTheme.ts +12 -10
  95. package/assets/templates/themes/butter/icons.tsx +2 -0
  96. package/assets/templates/themes/chocolate/chocolateTheme.ts +1 -0
  97. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  98. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
  99. package/assets/templates/themes/gothic/gothicTheme.ts +1 -0
  100. package/assets/templates/themes/gothic/icons.tsx +2 -0
  101. package/assets/templates/themes/matcha/icons.tsx +2 -0
  102. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +2 -2
  103. package/assets/templates/themes/matcha/matchaTheme.ts +1 -0
  104. package/assets/templates/themes/neutral/icons.tsx +2 -0
  105. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +2 -2
  106. package/assets/templates/themes/neutral/neutralTheme.ts +1 -0
  107. package/assets/templates/themes/stone/icons.tsx +2 -0
  108. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +1 -1
  109. package/assets/templates/themes/stone/stoneTheme.ts +1 -0
  110. package/assets/templates/themes/y2k/icons.tsx +2 -0
  111. package/assets/templates/themes/y2k/y2kTheme.ts +1 -0
  112. package/assets/theme.template.ts +9 -5
  113. package/authoring/config/parse.mjs +1 -1
  114. package/authoring/doctypes/base/type.ts +2 -3
  115. package/authoring/doctypes/component/component.doc.mjs +1 -1
  116. package/authoring/doctypes/icon-set/icon-names.mjs +1 -0
  117. package/authoring/integration/integration.doc.mjs +1 -1
  118. package/authoring/integration/type.ts +1 -1
  119. package/clients/cli/build-id.generated.json +1 -1
  120. package/clients/cli/commands/experimental/icon.mjs +7 -7
  121. package/clients/cli/commands/experimental/index.mjs +0 -5
  122. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  123. package/clients/cli/commands/experimental-icon-use.doc.mjs +4 -4
  124. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  125. package/clients/cli/commands/experimental.doc.mjs +2 -6
  126. package/clients/cli/commands/template.mjs +1 -1
  127. package/clients/cli/commands/theme-build.doc.mjs +8 -1
  128. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -1
  129. package/clients/cli/commands/theme-remove.doc.mjs +1 -1
  130. package/clients/cli/commands/theme.doc.mjs +1 -11
  131. package/clients/cli/commands/theme.mjs +110 -475
  132. package/clients/cli/commands.generated.json +1 -1
  133. package/clients/cli/index.mjs +4 -34
  134. package/clients/cli/lib/base-gate.mjs +2 -3
  135. package/clients/cli/lib/cli-error.mjs +8 -72
  136. package/clients/cli/lib/define-command.mjs +0 -19
  137. package/clients/cli/lib/json-shim.mjs +11 -633
  138. package/clients/cli/lib/manifest.mjs +0 -4
  139. package/clients/cli/lib/stray-option.mjs +1 -2
  140. package/clients/cli/manifest.generated.json +1 -1
  141. package/foundation/agent-docs/agent-docs.mjs +1 -1
  142. package/foundation/color/css-color.mjs +2 -3
  143. package/foundation/discovery/app-layout.d.mts +13 -0
  144. package/foundation/discovery/app-layout.mjs +35 -0
  145. package/foundation/discovery/fixture-refs.d.mts +51 -0
  146. package/foundation/discovery/fixture-refs.mjs +351 -0
  147. package/foundation/discovery/icon-definition-discovery.mjs +1 -1
  148. package/foundation/discovery/icon-ranking.mjs +2 -2
  149. package/foundation/discovery/icon-set-checks.mjs +1 -1
  150. package/foundation/discovery/icon-set-discovery.mjs +1 -1
  151. package/foundation/discovery/icon-set-writer.d.mts +24 -7
  152. package/foundation/discovery/icon-set-writer.mjs +66 -22
  153. package/foundation/discovery/static-descriptor.d.mts +49 -0
  154. package/foundation/discovery/static-descriptor.mjs +548 -0
  155. package/foundation/discovery/template-adapter.d.mts +0 -47
  156. package/foundation/discovery/template-adapter.mjs +1 -333
  157. package/foundation/discovery/theme-discovery.d.mts +6 -47
  158. package/foundation/discovery/theme-discovery.mjs +15 -537
  159. package/foundation/doc-compiler/import.mjs +1 -1
  160. package/foundation/env/user-dirs.d.mts +5 -2
  161. package/foundation/env/user-dirs.mjs +12 -5
  162. package/foundation/fonts/next-font.d.mts +26 -0
  163. package/foundation/fonts/next-font.mjs +149 -0
  164. package/foundation/fs/empty-folder.mjs +2 -2
  165. package/foundation/fs/read-record.mjs +11 -4
  166. package/foundation/pictures/pictures.d.mts +1 -45
  167. package/foundation/pictures/pictures.mjs +8 -8
  168. package/foundation/release/folder-lock.mjs +3 -2
  169. package/foundation/render/cut-short.d.mts +2 -2
  170. package/foundation/render/cut-short.mjs +2 -2
  171. package/foundation/render/drawn-contrast.d.mts +2 -2
  172. package/foundation/render/drawn-contrast.mjs +2 -2
  173. package/foundation/render/font-probe.d.mts +2 -2
  174. package/foundation/render/font-probe.mjs +2 -2
  175. package/foundation/render/layers.mjs +1 -2
  176. package/foundation/render/package-resolve-hooks.d.mts +25 -5
  177. package/foundation/render/package-resolve-hooks.mjs +77 -14
  178. package/foundation/render/page-worker.mjs +24 -12
  179. package/foundation/render/part-boxes.d.mts +2 -3
  180. package/foundation/render/part-boxes.mjs +2 -3
  181. package/foundation/render/picture-chrome.mjs +5 -0
  182. package/foundation/render/render-page.d.mts +1 -1
  183. package/foundation/render/render-page.mjs +4 -5
  184. package/foundation/render/single-copy-hooks.d.mts +2 -0
  185. package/foundation/render/single-copy-hooks.mjs +2 -0
  186. package/foundation/response/error-codes.doc.mjs +14 -14
  187. package/foundation/response/error-codes.mjs +13 -13
  188. package/foundation/response/response-types.doc.mjs +7 -68
  189. package/foundation/runtime/css-tree.mjs +2 -2
  190. package/foundation/runtime/word-table.d.mts +1 -1
  191. package/foundation/runtime/word-table.mjs +1 -1
  192. package/foundation/suggest/other-command.d.mts +52 -15
  193. package/foundation/suggest/other-command.mjs +168 -45
  194. package/foundation/text/suggest-order.d.mts +7 -0
  195. package/foundation/text/suggest-order.mjs +1 -1
  196. package/package.json +7 -8
  197. package/api/theme-edit/_adapter.d.mts +0 -228
  198. package/api/theme-edit/_adapter.mjs +0 -2025
  199. package/api/theme-edit/_catalog.d.mts +0 -172
  200. package/api/theme-edit/_catalog.mjs +0 -806
  201. package/api/theme-edit/_check.d.mts +0 -391
  202. package/api/theme-edit/_check.mjs +0 -9370
  203. package/api/theme-edit/_color.d.mts +0 -135
  204. package/api/theme-edit/_color.mjs +0 -480
  205. package/api/theme-edit/_compiler.d.mts +0 -77
  206. package/api/theme-edit/_compiler.mjs +0 -1053
  207. package/api/theme-edit/_context.d.mts +0 -399
  208. package/api/theme-edit/_context.mjs +0 -1778
  209. package/api/theme-edit/_css.d.mts +0 -169
  210. package/api/theme-edit/_css.mjs +0 -1167
  211. package/api/theme-edit/_edit.d.mts +0 -167
  212. package/api/theme-edit/_edit.mjs +0 -11220
  213. package/api/theme-edit/_how-commands.d.mts +0 -315
  214. package/api/theme-edit/_how-commands.mjs +0 -1664
  215. package/api/theme-edit/_how-question.d.mts +0 -341
  216. package/api/theme-edit/_how-question.mjs +0 -33339
  217. package/api/theme-edit/_how-sides.d.mts +0 -22
  218. package/api/theme-edit/_how-sides.mjs +0 -173
  219. package/api/theme-edit/_how-steps.d.mts +0 -42
  220. package/api/theme-edit/_how-steps.mjs +0 -208
  221. package/api/theme-edit/_how-values.d.mts +0 -29
  222. package/api/theme-edit/_how-values.mjs +0 -111
  223. package/api/theme-edit/_how-words.d.mts +0 -15
  224. package/api/theme-edit/_how-words.mjs +0 -239
  225. package/api/theme-edit/_how.d.mts +0 -55
  226. package/api/theme-edit/_how.mjs +0 -2388
  227. package/api/theme-edit/_importers.d.mts +0 -38
  228. package/api/theme-edit/_importers.mjs +0 -188
  229. package/api/theme-edit/_marks.d.mts +0 -39
  230. package/api/theme-edit/_marks.mjs +0 -67
  231. package/api/theme-edit/_missed.d.mts +0 -56
  232. package/api/theme-edit/_missed.mjs +0 -1128
  233. package/api/theme-edit/_name-rule.d.mts +0 -11
  234. package/api/theme-edit/_name-rule.mjs +0 -12
  235. package/api/theme-edit/_normal.d.mts +0 -365
  236. package/api/theme-edit/_normal.mjs +0 -1978
  237. package/api/theme-edit/_overview.d.mts +0 -9
  238. package/api/theme-edit/_overview.mjs +0 -293
  239. package/api/theme-edit/_palette.d.mts +0 -616
  240. package/api/theme-edit/_palette.mjs +0 -2776
  241. package/api/theme-edit/_part-pieces.d.mts +0 -54
  242. package/api/theme-edit/_part-pieces.mjs +0 -179
  243. package/api/theme-edit/_part-words.d.mts +0 -39
  244. package/api/theme-edit/_part-words.mjs +0 -242
  245. package/api/theme-edit/_parts.d.mts +0 -402
  246. package/api/theme-edit/_parts.mjs +0 -2322
  247. package/api/theme-edit/_picture-traits.d.mts +0 -259
  248. package/api/theme-edit/_picture-traits.mjs +0 -1030
  249. package/api/theme-edit/_png.d.mts +0 -94
  250. package/api/theme-edit/_png.mjs +0 -479
  251. package/api/theme-edit/_preview-app.d.mts +0 -172
  252. package/api/theme-edit/_preview-app.mjs +0 -6430
  253. package/api/theme-edit/_preview.d.mts +0 -484
  254. package/api/theme-edit/_preview.mjs +0 -2775
  255. package/api/theme-edit/_project.d.mts +0 -207
  256. package/api/theme-edit/_project.mjs +0 -643
  257. package/api/theme-edit/_resolved.d.mts +0 -46
  258. package/api/theme-edit/_resolved.mjs +0 -800
  259. package/api/theme-edit/_set-line.d.mts +0 -29
  260. package/api/theme-edit/_set-line.mjs +0 -100
  261. package/api/theme-edit/_settings.d.mts +0 -2426
  262. package/api/theme-edit/_settings.mjs +0 -18449
  263. package/api/theme-edit/_tables.d.mts +0 -227
  264. package/api/theme-edit/_tables.mjs +0 -1128
  265. package/api/theme-edit/_text-looks.d.mts +0 -78
  266. package/api/theme-edit/_text-looks.mjs +0 -376
  267. package/api/theme-edit/_vet.d.mts +0 -50
  268. package/api/theme-edit/_vet.mjs +0 -166
  269. package/api/theme-edit/how/how.d.mts +0 -17
  270. package/api/theme-edit/how/how.mjs +0 -28
  271. package/api/theme-edit/new/new.d.mts +0 -11
  272. package/api/theme-edit/new/new.mjs +0 -22
  273. package/api/theme-edit/preview-add/preview-add.d.mts +0 -14
  274. package/api/theme-edit/preview-add/preview-add.mjs +0 -25
  275. package/api/theme-edit/preview-app/preview-app.d.mts +0 -13
  276. package/api/theme-edit/preview-app/preview-app.mjs +0 -24
  277. package/api/theme-edit/preview-list/preview-list.d.mts +0 -10
  278. package/api/theme-edit/preview-list/preview-list.mjs +0 -21
  279. package/api/theme-edit/preview-remove/preview-remove.d.mts +0 -12
  280. package/api/theme-edit/preview-remove/preview-remove.mjs +0 -23
  281. package/api/theme-edit/set/set.d.mts +0 -13
  282. package/api/theme-edit/set/set.mjs +0 -24
  283. package/api/theme-edit/show/show.d.mts +0 -13
  284. package/api/theme-edit/show/show.mjs +0 -24
  285. package/api/theme-edit/theme-edit.d.mts +0 -12
  286. package/api/theme-edit/theme-edit.mjs +0 -36
  287. package/api/theme-edit/theme-edit.type.d.mts +0 -730
  288. package/api/theme-edit/theme-edit.type.mjs +0 -342
  289. package/api/theme-edit/themeEditHow.doc.d.mts +0 -6
  290. package/api/theme-edit/themeEditHow.doc.mjs +0 -105
  291. package/api/theme-edit/themeEditNew.doc.d.mts +0 -5
  292. package/api/theme-edit/themeEditNew.doc.mjs +0 -112
  293. package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +0 -6
  294. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +0 -121
  295. package/api/theme-edit/themeEditPreviewApp.doc.d.mts +0 -6
  296. package/api/theme-edit/themeEditPreviewApp.doc.mjs +0 -87
  297. package/api/theme-edit/themeEditPreviewList.doc.d.mts +0 -6
  298. package/api/theme-edit/themeEditPreviewList.doc.mjs +0 -62
  299. package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +0 -6
  300. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +0 -96
  301. package/api/theme-edit/themeEditSet.doc.d.mts +0 -6
  302. package/api/theme-edit/themeEditSet.doc.mjs +0 -175
  303. package/api/theme-edit/themeEditShow.doc.d.mts +0 -6
  304. package/api/theme-edit/themeEditShow.doc.mjs +0 -118
  305. package/api/theme-edit/themeEditUndo.doc.d.mts +0 -6
  306. package/api/theme-edit/themeEditUndo.doc.mjs +0 -133
  307. package/api/theme-edit/undo/undo.d.mts +0 -13
  308. package/api/theme-edit/undo/undo.mjs +0 -24
  309. package/assets/preview-app/README.md +0 -6
  310. package/assets/preview-app/css.d.ts +0 -5
  311. package/assets/preview-app/gitignore +0 -4
  312. package/assets/preview-app/next.config.mjs +0 -12
  313. package/assets/preview-app/package.json +0 -24
  314. package/assets/preview-app/src/app/globals.css +0 -6
  315. package/assets/preview-app/src/app/layout.tsx +0 -21
  316. package/assets/preview-app/src/app/page.tsx +0 -94
  317. package/assets/preview-app/src/app/providers.tsx +0 -16
  318. package/assets/preview-app/tsconfig.json +0 -27
  319. package/clients/cli/commands/experimental/theme.mjs +0 -2990
  320. package/clients/cli/commands/experimental-theme-add.doc.mjs +0 -80
  321. package/clients/cli/commands/experimental-theme-compile.doc.mjs +0 -98
  322. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +0 -196
  323. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -174
  324. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +0 -139
  325. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +0 -77
  326. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +0 -105
  327. package/clients/cli/commands/experimental-theme-editor.doc.mjs +0 -49
  328. package/clients/cli/commands/experimental-theme-eject.doc.mjs +0 -72
  329. package/clients/cli/commands/experimental-theme-list.doc.mjs +0 -49
  330. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +0 -88
  331. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +0 -61
  332. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +0 -48
  333. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +0 -59
  334. package/clients/cli/commands/experimental-theme-preview.doc.mjs +0 -41
  335. package/clients/cli/commands/experimental-theme-remove.doc.mjs +0 -57
  336. package/clients/cli/commands/experimental-theme-targets.doc.mjs +0 -62
  337. package/clients/cli/commands/experimental-theme-template.doc.mjs +0 -63
  338. package/clients/cli/commands/experimental-theme-use.doc.mjs +0 -57
  339. package/clients/cli/commands/experimental-theme.doc.mjs +0 -60
  340. package/foundation/fonts/fontsource-families.generated.d.mts +0 -5
  341. package/foundation/fonts/fontsource-families.generated.mjs +0 -2110
@@ -1,2426 +0,0 @@
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
- * The CSS property a name typed or saved in another form names: camel case,
6
- * other letters, or `_` or spaces for its dashes (backgroundColor,
7
- * Background-Color, font_size, "border radius"); null when it names none.
8
- * The one property-name reader, for `set` and the settings file alike.
9
- * @param {string} thing
10
- * @returns {string | null}
11
- */
12
- export function propertySpelling(thing: string): string | null;
13
- /**
14
- * The files of one theme, absolute.
15
- * @param {string} cwd
16
- * @param {string} slug
17
- */
18
- export function themeFiles(cwd: string, slug: string): {
19
- root: string;
20
- dir: string;
21
- settings: string;
22
- ts: string;
23
- settingsTs: string;
24
- js: string;
25
- css: string;
26
- history: string;
27
- preview: string;
28
- sheet: string;
29
- previewPng: string;
30
- pictures: string;
31
- sheetPng: string;
32
- };
33
- /**
34
- * Whether `dir` holds nothing of anyone's: absent, empty, or only system
35
- * files (what `git rm -r` or a branch switch leaves). A path that is not a
36
- * folder, or one that does not read, is not empty.
37
- * @param {string} dir
38
- * @returns {boolean}
39
- */
40
- export function folderIsEmpty(dir: string): boolean;
41
- /**
42
- * Whether a dial takes a value of its own kind beside its named words (a
43
- * size, a color, a family, a number: its list of values holds a `<…>`), so
44
- * a value of several words can be one value of it (`Open Sans`, `dark
45
- * blue`). A dial of named words only (mode, spacing) takes one word.
46
- * @param {string} dial
47
- */
48
- export function dialTakesText(dial: string): boolean;
49
- /**
50
- * Whether a value fits what a dial takes, read from the dial's own list of
51
- * values: a named rung in any case, or a value of the kind it names (a size,
52
- * a color, a number). `set` still checks the value in full.
53
- * @param {string} dial
54
- * @param {string} value
55
- */
56
- export function dialValueFits(dial: string, value: string): boolean;
57
- /**
58
- * A dial's number as the dial takes it: for a dial whose number is in a
59
- * unit (text-size's pixels), the number typed with that unit, in any case
60
- * and with a space before it (`24px`, `24 PX`), is that number; any other
61
- * value is returned as it is. The one reader for typed and saved values.
62
- * @param {string} dial
63
- * @param {string} value
64
- * @returns {string}
65
- */
66
- export function dialNumber(dial: string, value: string): string;
67
- /**
68
- * Record files the editor just wrote into a theme folder.
69
- * @param {string} cwd
70
- * @param {string} slug
71
- * @param {string[]} files
72
- */
73
- export function recordWritten(cwd: string, slug: string, files: string[]): void;
74
- /**
75
- * Whether the editor wrote this file in the theme folder and it is
76
- * unchanged since.
77
- * @param {string} cwd
78
- * @param {string} slug
79
- * @param {string} file
80
- */
81
- export function editorWrote(cwd: string, slug: string, file: string): boolean;
82
- /**
83
- * Whether the pictures record names this file and it is unchanged since the
84
- * editor wrote it. Only such a file is ever deleted: a stamp alone is not
85
- * enough, since a byte copy of a picture (preview-before.png) carries the
86
- * same stamp and is the person's.
87
- * @param {string} cwd
88
- * @param {string} slug
89
- * @param {string} file
90
- */
91
- export function editorRecorded(cwd: string, slug: string, file: string): boolean;
92
- /**
93
- * A name `new` takes, for a suggestion: `name` itself when it is valid, not a
94
- * built-in theme and its folder is free; `my-<name>` for a built-in theme's
95
- * name; else the first free numbered name.
96
- * @param {string} cwd
97
- * @param {string} name
98
- */
99
- export function usableNewName(cwd: string, name: string): string;
100
- /**
101
- * A theme name near `name` that is valid and whose folder is free: `name-2`,
102
- * `name-3`, …, shortened to fit the name's length limit.
103
- * @param {string} cwd
104
- * @param {string} name
105
- */
106
- export function freeThemeName(cwd: string, name: string): string;
107
- /**
108
- * Why the editor cannot read one of its files, or null when it can (or the
109
- * file is not there): a folder in the file's place, or no permission to read
110
- * it. Bad content is a different problem, judged where the file is parsed.
111
- * @param {string} file
112
- * @returns {string | null}
113
- */
114
- export function unreadableReason(file: string): string | null;
115
- /**
116
- * The names of a theme's app copy files.
117
- * @param {string} slug
118
- * @returns {Set<string>}
119
- */
120
- export function appCopyNames(slug: string): Set<string>;
121
- /**
122
- * Refuse, by name, when a file of the theme is a folder or cannot be read:
123
- * every command reads them, and none should crash on one. The fix is to
124
- * look at the file and give it back its place; a file is never deleted.
125
- * @param {string} cwd
126
- * @param {string} slug
127
- */
128
- export function refuseUnreadableFiles(cwd: string, slug: string): void;
129
- /**
130
- * Refuse when the app's themes/ is a file or a link to something other
131
- * than a folder: every editor theme lives in themes/<name>/. The run lists
132
- * what is there; the message says to rename or move it.
133
- * @param {string} cwd
134
- */
135
- export function refuseThemesNotFolder(cwd: string): void;
136
- /**
137
- * Whether a word names a setting: a dial, a token or a CSS property, in
138
- * any letters. Such a word is never a theme's name to make or look at.
139
- * @param {string} word
140
- */
141
- export function namesSetting(word: string): boolean;
142
- /**
143
- * Whether a word names a CSS property, which `set` writes only on a part
144
- * (`--on`): a theme a `new` makes takes no value for it, so its line comes
145
- * after the theme is made, with a part named.
146
- * @param {string} word
147
- */
148
- export function needsPart(word: string): boolean;
149
- /**
150
- * Whether text typed where a theme goes names settings, in any form set
151
- * reads them: a setting's name (`corners`, `--color-accent`), with its value
152
- * (`corners pill`, `corners:pill`, `corners=pill`, `accent: red`), a list of
153
- * them (`corners, accent`), or a pasted JSON object (`{"corners":"pill"}`).
154
- * Such text is never a theme to make or a list of themes.
155
- * @param {unknown} text
156
- */
157
- export function namesSettingAsTyped(text: unknown): boolean;
158
- /**
159
- * The dial settings text holds, in any form set reads them: a JSON object
160
- * (`{"accent":"red"}`), `key=value` or `key: value` pairs apart at `;`
161
- * (`corners: pill; accent: red`), or `dial value` items apart at `,`
162
- * (`accent red, corners pill`); null when it holds none, or anything else.
163
- * @param {unknown} text
164
- * @returns {Array<[string, string]> | null}
165
- */
166
- export function dialSettingsInText(text: unknown): Array<[string, string]> | null;
167
- /**
168
- * The themes the editor made in the app (a settings file of its own), by
169
- * name, or with `changed` the one an editor command changed last first: the
170
- * undo history is written only by an editor command, so its time is the
171
- * last change made there.
172
- * @param {string} cwd
173
- * @param {'name' | 'changed'} [order]
174
- * @returns {string[]}
175
- */
176
- export function editedThemes(cwd: string, order?: "name" | "changed"): string[];
177
- /**
178
- * Up to `n` names close to `x`.
179
- * @param {string} x
180
- * @param {Iterable<string>} list
181
- * @param {number} [n]
182
- */
183
- export function nearest(x: string, list: Iterable<string>, n?: number): string[];
184
- /**
185
- * The readings of a typo among `list`: every name at the smallest edit
186
- * distance, within the one typo limit (nearest's rule). One name is the
187
- * reading; two or more equally near (`tightr`: tight and tighter) are each
188
- * a reading, and none of them is chosen over the others.
189
- * @param {string} x
190
- * @param {Iterable<string>} list
191
- * @returns {string[]}
192
- */
193
- export function closestOf(x: string, list: Iterable<string>): string[];
194
- /**
195
- * Whether typed words negate what they name (`not round`, `no caps`,
196
- * `anything but blue`, `unbold`, `non-bold`, `rounded-none`).
197
- * @param {string} x
198
- */
199
- export function negates(x: string): boolean;
200
- /**
201
- * A refusal: nothing was changed, and the suggestions lead with the command
202
- * that does what the person wanted.
203
- * @param {string} code
204
- * @param {string} message
205
- * @param {{run?: Array<string | {name: string, reason: string}>, didYouMean?: string[], fix?: string, also?: string[]}} [extra]
206
- * @returns {never}
207
- */
208
- export function refuse(code: string, message: string, extra?: {
209
- run?: Array<string | {
210
- name: string;
211
- reason: string;
212
- }>;
213
- didYouMean?: string[];
214
- fix?: string;
215
- also?: string[];
216
- }): never;
217
- /**
218
- * A theme name without a pasted label: `theme: t`, `name=t`, `--theme t`
219
- * and `slug: "t"` name t; quotes and backticks around it go. Case is kept.
220
- * A space is no label separator without dashes: "Theme Park" stays.
221
- * The one reader of such labels, for --theme and every editor command.
222
- * @param {unknown} s
223
- * @returns {string}
224
- */
225
- export function unlabeledThemeName(s: unknown): string;
226
- /**
227
- * A theme name as typed, read the way the editor reads it: a path to its
228
- * folder or a file in it (t.theme.ts, Brand.settings.json), in any case,
229
- * or a pasted label (`theme: t`, `name: t`), names the theme. The result may still need slugFor.
230
- * @param {unknown} s
231
- * @returns {string}
232
- */
233
- export function typedThemeName(s: unknown): string;
234
- /**
235
- * The theme names a name typed the way the app shows it may mean, most
236
- * likely first: a path with doubled slashes or `../` (`themes//t`), a file
237
- * name with or without its folder (`brand.theme.ts`, `tTheme.ts`), the app
238
- * copy's export (`tTheme`), camelCase (`brandDark`) and spaces
239
- * (`Brand Dark`) each read as dashes. The caller picks the first that
240
- * exists, else the first.
241
- * @param {string} s
242
- * @returns {string[]}
243
- */
244
- export function themeNameReadings(s: string): string[];
245
- /**
246
- * A vibrancy written as set reads typed input: a share of one (0.5) or a
247
- * percent (50%) is that much of the 0-100 scale, as a whole number. Any
248
- * other dial's value, or a vibrancy that is no such number, comes back as
249
- * it was.
250
- * @param {string} dial
251
- * @param {string} v
252
- * @returns {string}
253
- */
254
- export function vibrancyMeant(dial: string, v: string): string;
255
- /**
256
- * The mode and base a damaged theme file meant, read the way typed input
257
- * is: other letters, stray spaces, `_` or a space for a dash (`Dark-Only`,
258
- * ` Neutral`), and a base written as its package name
259
- * (`@astryxdesign/theme-neutral`). Each is the cleaned text even when it is
260
- * no value the editor takes; the caller checks it.
261
- * @param {any} data
262
- * @returns {{mode: string, like: string}}
263
- */
264
- export function fieldsMeant(data: any): {
265
- mode: string;
266
- like: string;
267
- };
268
- /**
269
- * The settings of a theme, or a refusal naming the command that makes it.
270
- * @param {string} cwd
271
- * @param {string} slug
272
- * @param {string | Partial<Setting>} [skip] the thing (or the one setting)
273
- * a command changes or removes: its value is not checked, so a value made
274
- * under looser rules can be fixed
275
- * @returns {ThemeData}
276
- */
277
- export function loadTheme(cwd: string, slug: string, skip?: string | Partial<Setting>): ThemeData;
278
- /**
279
- * A command that builds on a built-in theme, as it runs here: after the
280
- * line that installs that theme's package when the project does not have
281
- * it, so the first line offered always works.
282
- * @param {string} cwd
283
- * @param {string} base a built-in theme
284
- * @param {string} line the command on that base
285
- * @returns {string[]}
286
- */
287
- export function onBuiltIn(cwd: string, base: string, line: string): string[];
288
- /**
289
- * {@link onBuiltIn} with what each line is for: the install first, then
290
- * the line, which works once it is installed (never offered as working
291
- * now).
292
- * @param {string} cwd
293
- * @param {string} base
294
- * @param {string} line
295
- * @returns {Array<{name: string, reason: string}>}
296
- */
297
- export function onBuiltInSteps(cwd: string, base: string, line: string): Array<{
298
- name: string;
299
- reason: string;
300
- }>;
301
- /**
302
- * What is wrong with settings data, or null: its shape, and each value with
303
- * the same rules `set` checks it by (without the installed Core), so a value
304
- * edited by hand never reaches the build.
305
- * @param {any} data
306
- * @param {string | Partial<Setting>} [skip] a thing or setting whose value is not checked (the one a
307
- * command is about to change or remove)
308
- * @returns {string | null}
309
- */
310
- export function settingsProblem(data: any, skip?: string | Partial<Setting>): string | null;
311
- /**
312
- * The built-in base the editor last built a theme on, read from the
313
- * generated module's header (`// Built on @astryxdesign/theme-neutral …`),
314
- * else from the newest undo step, or null when neither can be read. What a damaged base in
315
- * the settings file is put back to, and what a theme made again keeps.
316
- * @param {string} cwd
317
- * @param {string} slug
318
- * @returns {string | null}
319
- */
320
- export function builtOnBase(cwd: string, slug: string): string | null;
321
- /**
322
- * The `new` that makes a theme again in place, on the base it was built on
323
- * as far as can still be read: the settings file's base (in any case), else
324
- * the base the generated module was built on. With none, it says the theme
325
- * starts on no base.
326
- * @param {string} cwd
327
- * @param {string} slug
328
- * @returns {{lines: string[], base: string | null}}
329
- */
330
- export function remakeLines(cwd: string, slug: string): {
331
- lines: string[];
332
- base: string | null;
333
- };
334
- /**
335
- * A dial's own word typed in any case (ROOMY, MORE, Both, NONE): the word,
336
- * or null when the value is no word of that dial. The one case rule for
337
- * every dial, typed or saved. On the font dial several words are a family
338
- * list, whose names keep their letters; one word is the preset.
339
- * @param {string} thing
340
- * @param {string} value
341
- * @returns {string | null}
342
- */
343
- export function dialWordOf(thing: string, value: string): string | null;
344
- /**
345
- * The keys of an entry that write a field it writes another way too
346
- * (`Value` beside `value`, `On` beside `--on`, `setting` beside `thing`),
347
- * each with that field and the key that is read: the editor's own
348
- * spelling, else the first written.
349
- * @param {any} entry
350
- * @returns {Array<{key: string, field: string, read: string}>}
351
- */
352
- export function entryFieldTwins(entry: any): Array<{
353
- key: string;
354
- field: string;
355
- read: string;
356
- }>;
357
- /**
358
- * An entry with its own fields in other letters (`Thing`, `VALUE`, `On`)
359
- * or spelled as their flags (`--on`) read as those fields, as setting
360
- * names are read in any case; a field written several ways is read once,
361
- * from the key entryFieldTwins names, and the others are dropped.
362
- * Anything else as it is. The one reader for a typed entry and a saved one.
363
- * @param {any} entry
364
- * @returns {any}
365
- */
366
- export function entryFieldNames(entry: any): any;
367
- /**
368
- * An entry that names its thing under `setting`, as the editor's own
369
- * results print it (`{"setting": "accent", "value": "red"}`), as the entry
370
- * it is; anything else as it is. The one reader for a typed entry and a
371
- * saved one.
372
- * @param {any} entry
373
- * @returns {any}
374
- */
375
- export function printedEntry(entry: any): any;
376
- /**
377
- * What loading read differently from the file in the theme's entries (a
378
- * mode or source in other letters, a missing source): one note each.
379
- * @param {object} data the theme as {@link loadTheme} returned it
380
- * @returns {string[]}
381
- */
382
- export function entryNotes(data: object): string[];
383
- /**
384
- * Which part of an entry means nothing after reading: its source, a scope
385
- * that is not text (`"when": 5`, `"on": {}`) or a part named by no text
386
- * (`"on": ""`), its mode or `only`, or null. The one typed reader of a
387
- * saved scope: a damaged one is never read as a flag.
388
- * @param {any} s
389
- * @returns {'mode' | 'source' | 'only' | 'on' | 'when' | 'state' | null}
390
- */
391
- export function entryDamage(s: any): "mode" | "source" | "only" | "on" | "when" | "state" | null;
392
- /**
393
- * Whether `only` fits a setting, as `set --only` takes it and the settings
394
- * reader keeps it ({@link onlyMeans}): it names one member of a group that
395
- * spreads (a text input of inputs), or it keeps a control's height on that
396
- * one control, where a height is every control's height at its size. A
397
- * bar's height or padding spreads through no group, so `only` changes
398
- * nothing there.
399
- * @param {any} s
400
- * @param {Ctx} [ctx]
401
- */
402
- export function onlyFits(s: any, ctx?: Ctx): boolean;
403
- /**
404
- * Whether a setting has the shape of a control's own height, the part of
405
- * {@link onlyFits} that needs no Core: a height (or min-height) on a part,
406
- * in no state, at the default size or one size. The settings reader, which
407
- * runs before Core is read, keeps a saved `only` of this shape, as `set`
408
- * keeps it on a control; `set` and the checks hold the rest of the rule.
409
- * @param {any} s
410
- */
411
- export function onlyHeightShape(s: any): boolean;
412
- /**
413
- * Whether a setting is the one a command changes or removes: by thing, or
414
- * by the whole identity (part, variant, state, mode) when one is given.
415
- * @param {any} s
416
- * @param {string | Partial<Setting> | undefined} skip
417
- */
418
- export function skips(s: any, skip: string | Partial<Setting> | undefined): boolean;
419
- /**
420
- * Every setting whose only problem is its value or scope, each with the
421
- * command that removes it.
422
- * @param {any} data
423
- * @returns {Setting[]}
424
- */
425
- export function badSettings(data: any): Setting[];
426
- /**
427
- * What is wrong with one saved setting among the others, or null: its
428
- * value (valueProblem), or a rule set checks against the theme's other
429
- * settings: a vibrancy saturates the colors the color dials make, so with
430
- * no color dial set it does nothing, and set refuses it.
431
- * @param {any} s
432
- * @param {any} data
433
- * @returns {string | null}
434
- */
435
- export function entryProblem(s: any, data: any): string | null;
436
- /**
437
- * The words that name a setting for `undo`.
438
- * @param {import('./_settings.mjs').Setting} x
439
- */
440
- export function undoArgs(x: import("./_settings.mjs").Setting): string;
441
- /**
442
- * The words of a `set` that gives a setting's scope a value: set reads a
443
- * headings half from its word, so no half is named.
444
- * @param {import('./_settings.mjs').Setting} x
445
- * @param {string} value
446
- */
447
- export function setArgs(x: import("./_settings.mjs").Setting, value: string): string;
448
- /**
449
- * The first setting whose only problem is its value (made under looser
450
- * rules): `undo <theme> <undoArgs>` removes it.
451
- * @param {any} data
452
- * @returns {Setting | null}
453
- */
454
- export function badSetting(data: any): Setting | null;
455
- /**
456
- * The settings without those whose only problem is their value (made under
457
- * looser rules), and the ones left out.
458
- * @param {ThemeData} data
459
- * @returns {{data: ThemeData, dropped: Setting[]}}
460
- */
461
- export function withoutBadValues(data: ThemeData): {
462
- data: ThemeData;
463
- dropped: Setting[];
464
- };
465
- /**
466
- * What is wrong with a setting's value, or null.
467
- * @param {any} s
468
- * @returns {string | null}
469
- */
470
- export function valueProblem(s: any): string | null;
471
- /**
472
- * One entry of the top-level `tokens` map in a theme's own source, as
473
- * written: its token (null for a computed key no read of the file can
474
- * resolve), the key as typed, the line that sets it, and its value's shape.
475
- * A `chain` entry is another theme the file defines (`theme`, its name):
476
- * its call, or a token its literal tokens map sets. A `scope` entry names
477
- * where a scope (`components`, `onDark`, `onLight`, `adaptations`,
478
- * `localTokens`) starts; a `scoped` entry is a token one sets, with its
479
- * scope path (`components.button.base`). A `duplicate` entry names a
480
- * second `tokens` key (with every line); a
481
- * `typography` entry is one typography field (its dotted key and value;
482
- * `block` when it holds fields); a `field` entry is a field the theme
483
- * gives defineTheme; a `key` entry is a block's own key in a scope (a
484
- * style key, a pseudo-class, a surface's tokens), with its scope path;
485
- * an `unresolved` entry says the map holds something only a build reads.
486
- * A chain theme defined in another file carries that `file`.
487
- * @typedef {{token: string | null, key: string, line: number | null, kind: 'text' | 'number' | 'pair' | 'object' | 'other' | 'duplicate' | 'typography' | 'unresolved' | 'scope' | 'scoped' | 'chain' | 'field' | 'key', scope?: string, theme?: string, value?: any, halves?: Array<string | number | undefined>, lines?: Array<number | null>, file?: string, overridden?: boolean, expression?: boolean, notToken?: boolean, block?: boolean}} OwnTokenEntry
488
- */
489
- /**
490
- * The entries of the top-level `tokens` map in a theme's own source, read
491
- * from its syntax tree, each with the line that sets it. Entries read from
492
- * the file the source re-exports its theme from name that file.
493
- * @param {string} cwd
494
- * @param {string} slug
495
- * @returns {OwnTokenEntry[]}
496
- */
497
- export function ownTokenEntries(cwd: string, slug: string): OwnTokenEntry[];
498
- /**
499
- * The base rule block of a part that a census rule (its attributes,
500
- * `variant=neutral,size=md`) falls under, most specific first: `base`, or a
501
- * block keyed by conditions (`variant:neutral`) every one of which the rule
502
- * has. Null when the base sets none.
503
- * @param {Record<string, any> | undefined} blocks the base's blocks for the part
504
- * @param {string} rule
505
- * @returns {{key: string, block: Record<string, any>}[]}
506
- */
507
- export function baseBlocksFor(blocks: Record<string, any> | undefined, rule: string): {
508
- key: string;
509
- block: Record<string, any>;
510
- }[];
511
- /**
512
- * Where a base theme draws a property a token feeds in Core with something
513
- * else: each part and condition at rest under which Core reads the token for
514
- * a property but the base theme's own rule for the part sets that property
515
- * to another value (neutral's neutral badge fills with
516
- * --color-background-gray, not --color-neutral), with the base's value. The
517
- * token never reaches those.
518
- * @param {any} C the part data
519
- * @param {any} base the base theme, with its part blocks (`components`)
520
- * @param {string} token
521
- * @returns {Array<{part: string, when: string | null, prop: string, value: string}>}
522
- */
523
- export function baseRedraws(C: any, base: any, token: string): Array<{
524
- part: string;
525
- when: string | null;
526
- prop: string;
527
- value: string;
528
- }>;
529
- /**
530
- * The tokens a base theme's own component rules for a part read through
531
- * var() (neutral's progress-bar reads --color-border-emphasized), from its
532
- * built module; an empty set when it is not installed.
533
- * @param {string} cwd
534
- * @param {string | null | undefined} like
535
- * @param {string} target
536
- * @returns {Set<string>}
537
- */
538
- export function baseComponentReads(cwd: string, like: string | null | undefined, target: string): Set<string>;
539
- /**
540
- * The top-level tokens a base theme's built module gives (what the
541
- * editor's settings extend), or an empty map when it is not installed.
542
- * @param {string} cwd
543
- * @param {string | null | undefined} like
544
- * @returns {Map<string, string | null>}
545
- */
546
- export function baseTopTokens(cwd: string, like: string | null | undefined): Map<string, string | null>;
547
- /**
548
- * A module's syntax tree, parsed once for each text.
549
- * @param {string} source
550
- * @returns {any}
551
- */
552
- export function parsedModule(source: string): any;
553
- /**
554
- * What a part's plain rule (its `base` block) holds in the theme as built
555
- * (the base theme's, the settings' and the own source's together), else in
556
- * the base theme alone when there is no build: tokens and properties by
557
- * name. Kebab-case property names, as the editor names them.
558
- * @param {string} cwd
559
- * @param {string} slug
560
- * @param {string | null | undefined} like
561
- * @param {string} part
562
- * @returns {Map<string, string | null>}
563
- */
564
- export function partRuleTokens(cwd: string, slug: string, like: string | null | undefined, part: string): Map<string, string | null>;
565
- /**
566
- * The tokens and properties a theme's own source sets on a part's plain
567
- * rule, read from the build as ownTokens reads page-wide ones: what the
568
- * built rule holds that the settings module and the base theme do not give
569
- * as they are, and that the person's files name.
570
- * @param {string} cwd
571
- * @param {string} slug
572
- * @param {string} part
573
- * @param {string} [scope] the rule: `base` (the plain one), or a variant
574
- * such as `variant:primary`
575
- * @param {string | null} [state] a state block inside that rule (`:hover`)
576
- * @returns {Map<string, string | null>}
577
- */
578
- export function ownPartTokens(cwd: string, slug: string, part: string, scope?: string, state?: string | null): Map<string, string | null>;
579
- /**
580
- * The page-wide tokens a theme's own source sets itself (see ownTokens):
581
- * they win over the settings it extends.
582
- * @param {string} cwd
583
- * @param {string} slug
584
- * @returns {string[]}
585
- */
586
- export function ownSourceTokens(cwd: string, slug: string): string[];
587
- /**
588
- * The values a theme's own source gives page-wide tokens as plain text, by
589
- * token (see ownTokens).
590
- * @param {string} cwd
591
- * @param {string} slug
592
- * @returns {Record<string, string>}
593
- */
594
- export function ownSourceTokenValues(cwd: string, slug: string): Record<string, string>;
595
- /** One line for a setting. @param {Setting} s */
596
- export function describe(s: Setting): string;
597
- /**
598
- * Every group `--on` takes, by name: the editor's own groups (inputs,
599
- * menus, …) and the family roles the census shows (button-like, overlays,
600
- * option-rows, selected-items, accent-fills, inset-fields, status-surfaces,
601
- * overlay-headers, controls), each read from the parts' structure.
602
- * Without a census (no context), the editor's own groups alone.
603
- * @param {{project?: any, C?: any} | null | undefined} ctx
604
- * @returns {Record<string, string[]>}
605
- */
606
- export function groupsOf(ctx: {
607
- project?: any;
608
- C?: any;
609
- } | null | undefined): Record<string, string[]>;
610
- /**
611
- * What each Badge variant draws in a badge style, as the badge's own rule
612
- * for that variant, in the theme's status and category colors. Each
613
- * variant takes the first pair of colors that reads in every mode, measured
614
- * on the colors given (the base theme's); a pair that reads nowhere is the
615
- * preferred one, and `show` names it. The neutral badge keeps Core's look.
616
- * (A badge without a solid fill takes a filled button's colors inside that
617
- * button: {@link BADGE_IN_BUTTON}.)
618
- * @param {string} style solid, soft or outline
619
- * @param {{light: Record<string, string>, dark: Record<string, string>} | null} [colors]
620
- * @returns {Record<string, Record<string, string>>}
621
- */
622
- export function badgeLooks(style: string, colors?: {
623
- light: Record<string, string>;
624
- dark: Record<string, string>;
625
- } | null): Record<string, Record<string, string>>;
626
- /**
627
- * The variants a badge style cannot draw in its own colors on these colors,
628
- * each drawn in its fallback pair instead: a solid one keeps Core's tint, an
629
- * outline one draws the primary text inside a line of its hue.
630
- * @param {string} style solid, soft or outline
631
- * @param {{light: Record<string, string>, dark: Record<string, string>} | null} [colors]
632
- * @returns {string[]}
633
- */
634
- export function badgeKept(style: string, colors?: {
635
- light: Record<string, string>;
636
- dark: Record<string, string>;
637
- } | null): string[];
638
- /**
639
- * A part name or a group's members.
640
- * @param {{project: any, C?: any}} ctx
641
- * @param {string} name
642
- */
643
- export function membersOf(ctx: {
644
- project: any;
645
- C?: any;
646
- }, name: string): string[];
647
- /**
648
- * Whether a control grows with its content: its height is a least height
649
- * read from a size token (a selector, whose box holds its chosen values),
650
- * where a fixed height (a text input) holds whatever pads it.
651
- * @param {Ctx} ctx
652
- * @param {string} part
653
- * @param {string | null} [when] the variant a setting is for (`mode:dropzone`)
654
- */
655
- export function growsWithContent(ctx: Ctx, part: string, when?: string | null): boolean;
656
- /**
657
- * The variants of a control that grows with its content in which it is
658
- * drawn without growing (a file input's drop zone, which pads itself), when
659
- * it is drawn both ways; none otherwise. A padding set on the whole part
660
- * keeps its top and bottom sides there.
661
- * @param {Ctx} ctx
662
- * @param {string} part
663
- * @returns {string[]} each as a `--when` names it (`mode:dropzone`)
664
- */
665
- export function variantsNotGrowing(ctx: Ctx, part: string): string[];
666
- /**
667
- * The `--when` values under which a padding set with `when` reaches a part
668
- * drawn without growing: each variant `variantsNotGrowing` names, joined to
669
- * `when` when it names another axis (`status:error+mode:dropzone`).
670
- * @param {Ctx} ctx
671
- * @param {string} part
672
- * @param {string} [when]
673
- * @returns {string[]}
674
- */
675
- export function notGrowingWhens(ctx: Ctx, part: string, when?: string): string[];
676
- /**
677
- * Whether a setting's property is the height of the controls it is set on:
678
- * a height or a block size, or a least height on controls that grow with
679
- * their content, whose least height is their height. A least height on a
680
- * control of fixed height (a button) only floors it, so it stays that
681
- * part's own property.
682
- * @param {Ctx} ctx
683
- * @param {{thing?: unknown, on?: unknown, when?: unknown}} s
684
- */
685
- export function isControlHeight(ctx: Ctx, s: {
686
- thing?: unknown;
687
- on?: unknown;
688
- when?: unknown;
689
- }): boolean;
690
- /**
691
- * A height set on a control is the height every control takes at that
692
- * size: buttons, inputs, selectors and input groups share one height at
693
- * each size. So the setting a `set` of a height on controls writes is the
694
- * size's token on the controls group, at the size its `--when` names (the
695
- * default size without one). Null for any other setting: one with
696
- * `--only` or a state, on a part that is not a control, or with a variant
697
- * that is not a size.
698
- * @param {Ctx} ctx
699
- * @param {Setting} s
700
- * @returns {{setting: Setting, size: 'sm' | 'md' | 'lg', token: string, own: boolean} | null}
701
- */
702
- export function sharedControlHeight(ctx: Ctx, s: Setting): {
703
- setting: Setting;
704
- size: "sm" | "md" | "lg";
705
- token: string;
706
- own: boolean;
707
- } | null;
708
- /**
709
- * Whether a value can be a control's height: a size as every size token
710
- * takes it (isSize: a length in any CSS unit, a variable, env(), or a CSS
711
- * function that gives a length), with no percentage. A word (auto,
712
- * fit-content) or a percentage cannot be a size token, which Core reads
713
- * inside its own sums.
714
- * @param {string} v
715
- */
716
- export function controlHeightValue(v: string): boolean;
717
- /**
718
- * Whether `--on` names controls: a control, the controls group, or a group
719
- * whose members are controls (inputs, whose text area sizes itself by its
720
- * rows, holds controls too).
721
- * @param {Ctx} ctx
722
- * @param {string} on
723
- */
724
- export function namesControls(ctx: Ctx, on: string): boolean;
725
- /**
726
- * Whether a height saved with --only on one control of a group is the
727
- * group's plain height, narrowed off a control kept apart: the narrowing
728
- * marks each copy it writes on the group's other members (`narrowed`). A
729
- * height kept on one control, with --only, carries no mark.
730
- * @param {Setting} x
731
- */
732
- export function narrowedGroupHeight(x: Setting): boolean;
733
- /**
734
- * Whether a saved setting sets the height of some controls at a size:
735
- * a height (not in a state, and with `--only` only as a group's narrowed
736
- * height) that reaches a control, for that
737
- * size or for every size, or that size's token on controls. A height on
738
- * another part reaches controls when it spreads to them (a text area's
739
- * height reaches the inputs drawn alike).
740
- * @param {Ctx} ctx
741
- * @param {Setting} x
742
- * @param {'sm' | 'md' | 'lg'} size
743
- */
744
- export function setsControlHeight(ctx: Ctx, x: Setting, size: "sm" | "md" | "lg"): boolean;
745
- /**
746
- * The saved settings that give some controls a height at a size the other
747
- * controls do not take: a height on one control (a button 31px tall at
748
- * every size while the inputs follow the size tokens), or a size token on
749
- * some controls only. Each with its controls' height at each size it
750
- * splits and the other controls' heights there, and the line that makes it
751
- * every control's height at its size.
752
- * @param {Ctx} ctx
753
- * @param {ThemeData} data
754
- * @param {Record<string, string>} resolved the theme's resolved tokens (one mode)
755
- * @returns {Array<{setting: Setting, part: string, reaches: string[], at: Array<{size: string, value: string, others: string[]}>, line: Setting}>}
756
- */
757
- export function controlHeightSplits(ctx: Ctx, data: ThemeData, resolved: Record<string, string>): Array<{
758
- setting: Setting;
759
- part: string;
760
- reaches: string[];
761
- at: Array<{
762
- size: string;
763
- value: string;
764
- others: string[];
765
- }>;
766
- line: Setting;
767
- }>;
768
- /**
769
- * Whether a part has the variant values a `--when` names: every term of it
770
- * (`variant:secondary`, joined with `+`) is a value of that part's axis.
771
- * No `--when` fits every part.
772
- * @param {Ctx} ctx
773
- * @param {string} part
774
- * @param {string | null | undefined} when
775
- * @param {RegExp} [sep] what joins the terms (a comma list or + by default)
776
- */
777
- export function partHasWhen(ctx: Ctx, part: string, when: string | null | undefined, sep?: RegExp): boolean;
778
- /**
779
- * The parts a setting styles: the group when `--on` names one, the whole
780
- * group of an always-alike member unless `--only`, else the one part.
781
- * @param {Ctx} ctx
782
- * @param {Pick<Setting, 'on' | 'only' | 'thing'> & {when?: string | null}} s
783
- * @returns {string[]}
784
- */
785
- export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing"> & {
786
- when?: string | null;
787
- }): string[];
788
- /**
789
- * The parts that draw a part's border: the part itself, or, when it draws
790
- * none of its own and its edges are the borders of parts inside it (a date
791
- * and time field's date and time boxes), those parts. Only pieces that draw
792
- * a border of their own are its edges: a top nav's items are rounded but
793
- * draw none, so the top nav's border is the bar's own.
794
- * @param {Ctx} ctx
795
- * @param {string} part
796
- * @returns {string[]}
797
- */
798
- export function borderParts(ctx: Ctx, part: string): string[];
799
- /**
800
- * The parts that paint a part's box (a text input itself; a date and time
801
- * field's two boxes, where the row around them paints none).
802
- * @param {Ctx} ctx
803
- * @param {string} part
804
- * @returns {string[]}
805
- */
806
- export function fillParts(ctx: Ctx, part: string): string[];
807
- /**
808
- * A corners value in the plain form the editor saves, typed or saved: a
809
- * rung in any case is that rung; a size in px or rem, any way a CSS number
810
- * is written, is that many px (a rem is 16px; 1000px and more is pill).
811
- * Null for any other value.
812
- * @param {string} v
813
- * @returns {string | null}
814
- */
815
- export function cornersPlain(v: string): string | null;
816
- /**
817
- * A length in pixels: px as given, rem and em at 16px; null for anything
818
- * else (a percentage, calc(), a word).
819
- * @param {string} v
820
- * @returns {number | null}
821
- */
822
- export function lengthPx(v: string): number | null;
823
- /**
824
- * The base theme's body text size in px, read back from its built base
825
- * size (14 when it writes none).
826
- * @param {{light: Record<string, string>}} base
827
- */
828
- export function baseTextPx(base: {
829
- light: Record<string, string>;
830
- }): number;
831
- /**
832
- * The family and fallbacks a font value means: a preset, an open font, a
833
- * whole stack with commas, or one family name.
834
- * @param {string} value
835
- * @returns {{family: string, fallbacks: string, pkg: string | null}}
836
- */
837
- export function fontOf(value: string): {
838
- family: string;
839
- fallbacks: string;
840
- pkg: string | null;
841
- };
842
- /**
843
- * Spacing in a font family name as CSS reads a bare name: every Unicode
844
- * space (a no-break space, a thin space, a tab) is one space, a run of them
845
- * one, and zero-width and format characters (zero-width space, joiners,
846
- * word joiner, byte-order mark) are dropped.
847
- * @param {string} v
848
- */
849
- export function familySpaces(v: string): string;
850
- /**
851
- * A font family name as CSS reads it. A name that is a sequence of CSS
852
- * identifiers stays bare; any other is quoted, or the browser drops the
853
- * whole font (`3Dumb`, `My/Font`, `a.b`). Core quotes a family that has
854
- * a space itself, so such a name is quoted here only as a fallback
855
- * (`spaced`), where Core writes the list as given.
856
- * @param {string} name without quotes
857
- * @param {boolean} [spaced]
858
- */
859
- export function cssFamily(name: string, spaced?: boolean): string;
860
- /**
861
- * The staleness reason for an own source changed since the editor's build.
862
- * @param {string} slug
863
- */
864
- export function sourceChangedReason(slug: string): string;
865
- /**
866
- * The tokens the theme's last build sets for touch screens (in its rules
867
- * for a coarse pointer), each with the last value it is given there.
868
- * @param {string} cwd
869
- * @param {string} slug
870
- * @returns {Map<string, string>}
871
- */
872
- export function builtTouchTokens(cwd: string, slug: string): Map<string, string>;
873
- /**
874
- * Record in an editor theme's generated settings that they were built with
875
- * its own source as it is now, after `compile` built that source (the
876
- * settings do not depend on what the source sets), only in a module as the
877
- * editor wrote it.
878
- * @param {string} cwd
879
- * @param {string} slug
880
- * @returns {boolean} whether it was recorded
881
- */
882
- export function refreshSourceStamp(cwd: string, slug: string): boolean;
883
- /**
884
- * Whether a generated module is as the editor wrote it: true, false for a
885
- * hand edit, null for a module with no hash (an earlier editor's).
886
- * @param {string} text
887
- * @returns {boolean | null}
888
- */
889
- export function moduleUnedited(text: string): boolean | null;
890
- /**
891
- * One half of a palette token in a generated settings module: a palette
892
- * stop (`family` and `stop`, with `alpha` for a see-through one), white or
893
- * black, a color written out (`family: 'literal'`), or the base theme's
894
- * own value (`family: 'literal', base: true`).
895
- * @typedef {{family: string, stop: number, alpha?: string, color?: string, base?: true}} KeptHalf
896
- */
897
- /**
898
- * The palette stops each token reads in a generated settings module, as
899
- * written there (`palette.accent.light[85]`, with ` + 'aa'` for a
900
- * see-through one): `[light, dark]` per token. A token with one mode drawn
901
- * from the palette keeps its other half as written: a color, or the base
902
- * theme's value (`baseIn(...)`). A token drawn from the palette in neither
903
- * mode is not a palette token, except for a palette kept as saved
904
- * (`literals`), whose module's tokens are the whole mapping.
905
- * @param {string} source
906
- * @param {boolean} [literals] keep a token written as colors in both modes
907
- * @returns {Record<string, Record<'light' | 'dark', KeptHalf>>}
908
- */
909
- export function stopsIn(source: string, literals?: boolean): Record<string, Record<"light" | "dark", KeptHalf>>;
910
- /**
911
- * The edges the fields draw: for each token the census reads for an input
912
- * group member's border color at rest, with the token it reads for its fill
913
- * there (the ground the edge must read on). Read from the census, so a Core
914
- * that moves the field edge to another token is followed.
915
- * @param {Ctx} ctx
916
- * @returns {Array<{token: string, fill: string}>}
917
- */
918
- export function fieldEdgeTokens(ctx: Ctx): Array<{
919
- token: string;
920
- fill: string;
921
- }>;
922
- /**
923
- * A color itself where it reads at `min` on the ground, else the nearest
924
- * shade of it (its hue and chroma, its lightness stepped away from the
925
- * ground) that does; null when none does.
926
- * @param {string} color @param {string} ground @param {number} min
927
- * @returns {string | null}
928
- */
929
- export function shadeAt(color: string, ground: string, min: number): string | null;
930
- /**
931
- * A size in px: px, rem (16px each), or a calc() of those added and
932
- * subtracted; null for anything else.
933
- * @param {string} v
934
- * @param {Record<string, string>} [vars] values for the tokens a var() may name
935
- * @returns {number | null}
936
- */
937
- export function sizePx(v: string, vars?: Record<string, string>): number | null;
938
- /**
939
- * Spacing steps scaled with the spacing dial, kept in order around the
940
- * steps the theme keeps exact: each the plain scaled value unless it would
941
- * meet or pass a kept one; those are spread evenly between the kept one and
942
- * the nearest step that keeps its place. A step with no room below a kept
943
- * one takes the value of the one below it.
944
- * @param {Array<[string, number]>} steps token name and the base value, in px
945
- * @param {number} f the rung's factor
946
- * @param {Record<string, number>} kept exact steps the theme keeps, in px
947
- * @param {string[]} [noRoom] filled with the steps left no room
948
- * @returns {Array<[string, number]>} every step's new value in px, kept ones as kept
949
- */
950
- export function spacingSteps(steps: Array<[string, number]>, f: number, kept: Record<string, number>, noRoom?: string[]): Array<[string, number]>;
951
- /**
952
- * Control heights scaled with the spacing dial (a denser theme has shorter
953
- * controls), each kept distinct and in order: smallest to largest, a
954
- * control never under 24px (the smallest target a pointer can use
955
- * comfortably, unless the theme starts below it), each the plain scaled
956
- * value unless it would meet the one below, which then keeps its own step
957
- * scaled above it.
958
- * @param {Array<[string, string]>} sizes token name and the theme's value
959
- * @param {number} f the spacing rung's factor
960
- * @param {Record<string, number>} [kept] exact sizes the theme keeps, in px,
961
- * which the others stay in order around
962
- * @param {string[]} [noRoom] filled with the sizes left no room between
963
- * two kept ones (each then equals the one below it)
964
- * @returns {Array<[string, string]>} the tokens it writes, in px
965
- */
966
- export function controlSizes(sizes: Array<[string, string]>, f: number, kept?: Record<string, number>, noRoom?: string[]): Array<[string, string]>;
967
- /**
968
- * Where a role color the theme sets (a role dial, or a whole-theme role
969
- * token) must be written onto a part for it to show, because the base theme
970
- * draws that role there on its own:
971
- * - a variant named for the role in a color of the base's palette written
972
- * out (butter's success badge) points at
973
- * the role's token, as Core draws that variant;
974
- * - a role token the base points at another token on a part (stone's
975
- * success banner at its green) takes the theme's own value there
976
- * (`value` null: the theme's token);
977
- * - a color the base gives a part as its own accent, written as the color
978
- * itself (butter's nav links and outline buttons in its blue), points at
979
- * the accent token.
980
- * Each comes once, and never where the theme sets that property on the
981
- * part itself. The compiler writes them; the missed list leaves them out.
982
- * @param {Ctx} ctx
983
- * @param {ThemeData} data
984
- * @param {any} base the base theme resolved: its tokens per mode and its components
985
- * @returns {Array<{part: string, when: string | undefined, prop: string, value: string | null}>}
986
- */
987
- export function roleReach(ctx: Ctx, data: ThemeData, base: any): Array<{
988
- part: string;
989
- when: string | undefined;
990
- prop: string;
991
- value: string | null;
992
- }>;
993
- /**
994
- * The settings, as a `defineTheme` object.
995
- * @param {Ctx} ctx
996
- * @param {ThemeData} data
997
- * @param {{light: Record<string, string>, dark: Record<string, string>}} base
998
- * @returns {any}
999
- */
1000
- export function compileTheme(ctx: Ctx, data: ThemeData, base: {
1001
- light: Record<string, string>;
1002
- dark: Record<string, string>;
1003
- }): any;
1004
- /**
1005
- * A background shorthand split into its image layers and the color its
1006
- * last layer may carry (the color under every image): a color word beside
1007
- * the last image, or a last layer that is a color alone.
1008
- * @param {string} value
1009
- * @returns {{images: string, color: string | null}}
1010
- */
1011
- export function backgroundColorLayer(value: string): {
1012
- images: string;
1013
- color: string | null;
1014
- };
1015
- /**
1016
- * Settings whose effect a later or stronger setting hides, with why: `type`
1017
- * loses heading weight and tracking to `headings`.
1018
- * @param {ThemeData} data
1019
- * @param {Ctx | null} [ctx] with it, a later setting that reaches the parts through a spread counts too
1020
- * @returns {Map<Setting, string>}
1021
- */
1022
- export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting, string>;
1023
- /**
1024
- * A plain part setting can lose to a more specific rule for the same part
1025
- * and property, such as a base theme's `.astryx-heading[data-level="1"]
1026
- * {font-weight}` or the theme's own fill on a selected tab. Find those rules
1027
- * in the built stylesheet. A setting made for one mode (`@light`) is found
1028
- * with its mode, and only where a rule holds in that mode: a fill a variant
1029
- * has in dark mode only beats nothing in light.
1030
- * @param {string} cssText
1031
- * @param {any} theme
1032
- * @returns {Array<{target: string, key: string, prop: string, value: string, state?: string, mode?: 'light' | 'dark'}>}
1033
- */
1034
- export function findOverrides(cssText: string, theme: any): Array<{
1035
- target: string;
1036
- key: string;
1037
- prop: string;
1038
- value: string;
1039
- state?: string;
1040
- mode?: "light" | "dark";
1041
- }>;
1042
- /**
1043
- * The file a relative import names, resolved as TypeScript resolves it: a
1044
- * JavaScript extension names its TypeScript source (`.js` → `.ts`/`.tsx`,
1045
- * `.jsx` → `.tsx`/`.ts`, `.mjs` → `.mts`, `.cjs` → `.cts`), then the path as
1046
- * written, with each module extension, and as a folder's index file.
1047
- * @param {string} dir
1048
- * @param {string} spec
1049
- * @returns {string | undefined}
1050
- */
1051
- export function localModuleFile(dir: string, spec: string): string | undefined;
1052
- /**
1053
- * Why a theme's source cannot carry its settings, with the step that puts
1054
- * it right; null when it carries them. The theme is the export a build of
1055
- * the source reads, loaded as the build loads it: it must be named for the
1056
- * theme, and the settings module's own export must be in the chain of
1057
- * themes it extends (after every spread and repeated key), the very object,
1058
- * not a theme named like it. Null for a source that does not parse (its
1059
- * parse error is its own finding), and for one that imports the settings
1060
- * but does not load (outputsDrift and the build report that).
1061
- * @param {string} cwd
1062
- * @param {string} slug
1063
- * @returns {Promise<{problem: string, fix: string} | null>}
1064
- */
1065
- export function themeSourceProblem(cwd: string, slug: string): Promise<{
1066
- problem: string;
1067
- fix: string;
1068
- } | null>;
1069
- /**
1070
- * Why the person's own theme source does not parse (its line and the
1071
- * parser's message), or null when it parses or is not there.
1072
- * @param {string} cwd
1073
- * @param {string} slug
1074
- * @returns {string | null}
1075
- */
1076
- export function themeSourceParseError(cwd: string, slug: string): string | null;
1077
- /**
1078
- * Refuse, before anything is written or removed, a command whose build
1079
- * would load the person's own theme source when it does not parse: the
1080
- * build would fail part way.
1081
- * @param {string} cwd
1082
- * @param {string} slug
1083
- */
1084
- export function refuseThemeParse(cwd: string, slug: string): void;
1085
- /**
1086
- * Refuse a build whose theme source cannot carry the settings, naming the
1087
- * lines that put it back.
1088
- * @param {string} cwd
1089
- * @param {string} slug
1090
- */
1091
- export function refuseThemeSource(cwd: string, slug: string): Promise<void>;
1092
- /**
1093
- * The refusal for a theme source that cannot carry the settings (it no
1094
- * longer imports or extends them, or names another theme), naming the
1095
- * lines that put it back; null when it carries them. Every command that
1096
- * builds the theme refuses with it.
1097
- * @param {string} cwd
1098
- * @param {string} slug
1099
- * @returns {Promise<AstryxError | null>}
1100
- */
1101
- export function themeSourceRefusal(cwd: string, slug: string): Promise<AstryxError | null>;
1102
- /**
1103
- * The input the theme's own source gives `defineTheme()`, evaluated as a
1104
- * build evaluates it, with the theme Core made of it (or Core's error when
1105
- * it refuses the input); null when the source does not load.
1106
- * @param {Ctx} ctx
1107
- * @param {string} slug
1108
- * @param {string | null} like the base theme, whose built tokens are `base`
1109
- * @returns {Promise<{input: any, theme: any, error: Error | null, chain: any[], base: Map<string, string | null>} | null>}
1110
- */
1111
- export function ownThemeInput(ctx: Ctx, slug: string, like: string | null): Promise<{
1112
- input: any;
1113
- theme: any;
1114
- error: Error | null;
1115
- chain: any[];
1116
- base: Map<string, string | null>;
1117
- } | null>;
1118
- /**
1119
- * The refusal of a [light, dark] pair on tokens that are not colors.
1120
- * @param {string} slug
1121
- * @param {string[]} names
1122
- */
1123
- export function ownPairMessage(slug: string, names: string[]): string;
1124
- /**
1125
- * Set the check of a theme's own token values run before every build.
1126
- * @param {((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null} fn
1127
- */
1128
- export function setOwnTokenCheck(fn: ((ctx: Ctx, slug: string, data: ThemeData) => Promise<void>) | null): void;
1129
- /**
1130
- * Set what runs after every build of a theme.
1131
- * @param {((ctx: Ctx, slug: string, data: ThemeData) => void) | null} fn
1132
- */
1133
- export function setAfterBuild(fn: ((ctx: Ctx, slug: string, data: ThemeData) => void) | null): void;
1134
- /**
1135
- * Hold the after-build hook for this command's builds: the command writes
1136
- * the app copy itself once it succeeds (show).
1137
- * @param {Ctx} ctx
1138
- */
1139
- export function holdAfterBuild(ctx: Ctx): void;
1140
- /**
1141
- * Generate the theme source, build it with the theme build, then repeat any
1142
- * part setting a more specific rule would beat and build again.
1143
- * @param {Ctx} ctx
1144
- * @param {string} slug
1145
- * @param {ThemeData} data
1146
- * @returns {Promise<{warnings: string[], lifted: string[], notes: string[], removedPictures: string[]}>} `notes`: what the color config kept or replaced of a hand edit; `removedPictures`: the editor's pictures of the look before, removed
1147
- */
1148
- export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
1149
- warnings: string[];
1150
- lifted: string[];
1151
- notes: string[];
1152
- removedPictures: string[];
1153
- }>;
1154
- /**
1155
- * {@link buildTheme}, with a way to put back what it wrote: a command that
1156
- * builds first and refuses later (a preview app whose copy checks fail)
1157
- * leaves the theme as it found it.
1158
- * @param {Ctx} ctx
1159
- * @param {string} slug
1160
- * @param {ThemeData} data
1161
- * @returns {Promise<{built: Awaited<ReturnType<typeof buildThemeSteps>>, undo: () => void}>}
1162
- */
1163
- export function buildThemeHeld(ctx: Ctx, slug: string, data: ThemeData): Promise<{
1164
- built: Awaited<ReturnType<typeof buildThemeSteps>>;
1165
- undo: () => void;
1166
- }>;
1167
- /**
1168
- * The one color mode of a light-only or dark-only theme, from its settings,
1169
- * for the build to write into the built module (`colorModes`); null for a
1170
- * theme with both modes.
1171
- * @param {string} cwd
1172
- * @param {string} slug
1173
- * @returns {['light'] | ['dark'] | null}
1174
- */
1175
- export function buildColorModes(cwd: string, slug: string): ["light"] | ["dark"] | null;
1176
- /**
1177
- * Why the built outputs differ from what the theme builds now: one that is
1178
- * missing or changed by hand, found the way `compile --check` finds it
1179
- * (the same build, compared and not written), or null when they match.
1180
- * @param {Ctx} ctx
1181
- * @param {string} slug
1182
- * @param {string[]} [warnings] takes the warnings of that build
1183
- * @returns {Promise<string | null>}
1184
- */
1185
- export function outputsDrift(ctx: Ctx, slug: string, warnings?: string[]): Promise<string | null>;
1186
- /**
1187
- * Whether Core's media surface inside a part follows what is painted behind
1188
- * it (`MediaTheme mode="auto"`): a part that paints the inverted surface
1189
- * and holds one (a toast), where Core measures the fill to pick the side
1190
- * (and falls back from the inverted token). A surface on any other ground
1191
- * (a lightbox's or a scrim's dark overlay) keeps its one side.
1192
- * @param {Ctx} ctx
1193
- * @param {string} part
1194
- */
1195
- export function autoMediaPart(ctx: Ctx, part: string): boolean;
1196
- /**
1197
- * The side Core's auto media surface takes on a fill, by Core's own rule
1198
- * (useAutoMediaMode's resolveBackdrop and pickMediaMode, and a toast's
1199
- * fallback when the backdrop cannot be read): `'off'` when the theme's own
1200
- * text reads at 3:1 on the backdrop, else whichever on-color reads better.
1201
- * The backdrop is the fill composited onto the page when it is
1202
- * see-through; a gradient or an image cannot be read, and the fallback is
1203
- * taken from the inverted surface token (the error one for an error toast)
1204
- * the same way with no ambient text, else from the mode. The pictures and
1205
- * the contrast checks both take the side from here.
1206
- * @param {string | null | undefined} fill the fill as a color value in the mode
1207
- * @param {Record<string, string>} tokens the theme's resolved tokens in the mode
1208
- * @param {{mode: string, error?: boolean}} o
1209
- * @returns {'off' | 'dark' | 'light'}
1210
- */
1211
- export function autoMediaSide(fill: string | null | undefined, tokens: Record<string, string>, o: {
1212
- mode: string;
1213
- error?: boolean;
1214
- }): "off" | "dark" | "light";
1215
- /**
1216
- * The side Core's auto media surface takes inside each part that holds one
1217
- * (a toast), by `autoMediaSide`, for each mode the theme draws and each type
1218
- * the part is drawn in (`type=error`, '' for none), on the fill the part
1219
- * draws there: the fill a setting gives it, else the token it reads. A
1220
- * static render takes Core's fallback from the inverted token, where the
1221
- * app measures the painted fill: the pictures take this side instead.
1222
- * @param {Ctx} ctx
1223
- * @param {string} slug
1224
- * @param {ThemeData} data
1225
- * @returns {Promise<Record<string, Record<string, Record<string, 'off' | 'light' | 'dark'>>>>} part -> condition -> mode -> side
1226
- */
1227
- export function mediaSurfaceSides(ctx: Ctx, slug: string, data: ThemeData): Promise<Record<string, Record<string, Record<string, "off" | "light" | "dark">>>>;
1228
- /**
1229
- * Each auto media surface inside a part in a rendered page set to the side
1230
- * `sides` gives it for the type the part is drawn in and the mode it is
1231
- * drawn in (the page's mode, or the light or dark copy it sits in).
1232
- * @param {string} html
1233
- * @param {Record<string, Record<string, Record<string, 'off' | 'light' | 'dark'>>>} sides
1234
- * @param {string} mode the page's mode: light, dark or system
1235
- * @returns {string}
1236
- */
1237
- export function settleMediaSides(html: string, sides: Record<string, Record<string, Record<string, "off" | "light" | "dark">>>, mode: string): string;
1238
- /**
1239
- * Resolved tokens of the built theme in both modes.
1240
- * @param {Ctx} ctx
1241
- * @param {string} slug
1242
- * @returns {Promise<{light: Record<string, string>, dark: Record<string, string>}>}
1243
- */
1244
- export function resolvedTokens(ctx: Ctx, slug: string): Promise<{
1245
- light: Record<string, string>;
1246
- dark: Record<string, string>;
1247
- }>;
1248
- /**
1249
- * A value as a message names it, whatever it is: text in quotes, a number,
1250
- * a BigInt with its `n`, a symbol, a function, an array or an object as
1251
- * JSON where it has one. Never throws.
1252
- * @param {unknown} value
1253
- * @returns {string}
1254
- */
1255
- export function describeValue(value: unknown): string;
1256
- /**
1257
- * Why a token value is not one, with a value of the token's own type to
1258
- * write instead (a size in px, a weight as a number in quotes), or none.
1259
- * @param {Ctx} ctx
1260
- * @param {string} slug
1261
- * @param {[string, unknown, ('object' | 'pair' | 'unit' | 'value' | 'mode')?]} bad
1262
- */
1263
- export function nonTextMessage(ctx: Ctx, slug: string, [name, value, kind]: [string, unknown, ("object" | "pair" | "unit" | "value" | "mode")?]): string;
1264
- /**
1265
- * Contrast problems this theme caused: text below 4.5:1 that was not as low
1266
- * in the base theme. A part's own color or background setting, or a token
1267
- * set on that part or on the part the text sits on, counts for that part.
1268
- * Each comes with the set line that fixes it, when one color does: the text
1269
- * token set where the text sits, for its mode, to the black or white that
1270
- * reads on what it sits on.
1271
- * @param {Ctx} ctx
1272
- * @param {ThemeData} data
1273
- * @param {{light: Record<string, string>, dark: Record<string, string>}} res
1274
- * @returns {Promise<ThemeProblem[]>}
1275
- */
1276
- export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
1277
- light: Record<string, string>;
1278
- dark: Record<string, string>;
1279
- }): Promise<ThemeProblem[]>;
1280
- /**
1281
- * Whether a check is a note rather than a problem: what could not be
1282
- * measured, a failure the base theme draws itself (no line of the theme's
1283
- * makes it, and the base's own fix is its maker's), or a look worth a word
1284
- * that fails nothing (a check marked `note`).
1285
- * @param {{text: string, note?: boolean}} x
1286
- */
1287
- export function isCheckNote(x: {
1288
- text: string;
1289
- note?: boolean;
1290
- }): boolean;
1291
- /**
1292
- * A settings file's or an undo step's text as JSON, a byte-order mark
1293
- * aside; undefined when there is no text or it does not parse. Every reader
1294
- * of settings text reads it here.
1295
- * @param {string | null | undefined} text
1296
- * @returns {any}
1297
- */
1298
- export function settingsJson(text: string | null | undefined): any;
1299
- /**
1300
- * Whether settings data has its shape and every entry is an object with a
1301
- * thing name: what a reader may go through entry by entry. Any other entry
1302
- * (null, a number, text) is damage the file check names.
1303
- * @param {any} data
1304
- */
1305
- export function entriesReadable(data: any): any;
1306
- /**
1307
- * What a refusal of a damaged saved mode or base says: the value it reads
1308
- * as when there is one (installed, or to install first), else that no
1309
- * reader reads it. One text for show, compile and every change.
1310
- * @param {string} slug
1311
- * @param {any} data
1312
- * @param {'mode' | 'base'} field
1313
- * @param {ReturnType<typeof savedFieldRepairs>} fix
1314
- */
1315
- export function savedFieldText(slug: string, data: any, field: "mode" | "base", fix: ReturnType<typeof savedFieldRepairs>): string;
1316
- /**
1317
- * The lines that set a damaged saved mode or base again: the one repair
1318
- * every command gives that damage (show, compile and each change). The
1319
- * value it reads as when there is one, else each value it can be (each
1320
- * mode; the base the theme was built on, when its module or history still
1321
- * says it, else each installed base), never a default that would drop what
1322
- * the file held. A built-in base not installed comes after its install.
1323
- * @param {any} data
1324
- * @param {string} cwd
1325
- * @param {string} slug
1326
- * @param {'mode' | 'base'} field
1327
- * @returns {{values: string[], uninstalled: string | null, readsAs: string | null, run: Array<{name: string, reason: string}>}}
1328
- * `readsAs`: the one value the saved text reads as (a base in other
1329
- * letters or with a typo), which every reader takes
1330
- */
1331
- export function savedFieldRepairs(data: any, cwd: string, slug: string, field: "mode" | "base"): {
1332
- values: string[];
1333
- uninstalled: string | null;
1334
- readsAs: string | null;
1335
- run: Array<{
1336
- name: string;
1337
- reason: string;
1338
- }>;
1339
- };
1340
- /**
1341
- * Read a damaged mode or base the way a change reads it, in place: one
1342
- * written in other letters, as a package name, as a mode word or with a
1343
- * typo (`Dark-Only`, `@astryxdesign/theme-neutral`, `light`, `neutrl`) is
1344
- * the value meant, as `set` reads it. Any other is refused for a change
1345
- * (slug given), with the line that sets it; read for an undo step, it goes
1346
- * back to its default. `like: "none"` is no base. The field a command sets
1347
- * itself is left to that command.
1348
- * @param {any} data
1349
- * @param {string} cwd
1350
- * @param {string} [fixing] `mode` or `base` when the command sets it
1351
- * @param {string} [slug] the theme a change is made to
1352
- * @returns {string[]} a note for each field read differently from the file
1353
- */
1354
- export function readFields(data: any, cwd: string, fixing?: string, slug?: string): string[];
1355
- /**
1356
- * Read settings data as a change reads it, in place: entry modes and
1357
- * sources in other words, and a damaged mode or base (see
1358
- * {@link readFields}). The settings file and every undo step are read
1359
- * through here.
1360
- * @param {any} data
1361
- * @param {string} cwd
1362
- * @param {string} [fixing] `mode` or `base` when the command sets it
1363
- * @returns {string[]} a note for each thing read differently from the text
1364
- */
1365
- export function readAsMeant(data: any, cwd: string, fixing?: string): string[];
1366
- /**
1367
- * Whether `new` makes a theme again over these settings, keeping the file
1368
- * aside: text that does not parse, or entries it cannot read (no thing, no
1369
- * value, no source). The one rule both `new` and the refusals that offer
1370
- * it read; any other damage is repaired by the lines its refusal names.
1371
- * @param {unknown} data the parsed file (undefined when it does not parse)
1372
- */
1373
- export function settingsRemade(data: unknown): boolean;
1374
- /**
1375
- * Whether every settings entry has the parts the editor reads (a thing, a
1376
- * value and a source); one without is damage `new` keeps aside.
1377
- * @param {any} data
1378
- */
1379
- export function settingsEntriesOk(data: any): any;
1380
- /**
1381
- * Whether settings data has the shape the editor reads: an object with a
1382
- * settings list.
1383
- * @param {any} data
1384
- */
1385
- export function settingsShapeOk(data: any): boolean;
1386
- /**
1387
- * A setting as the file keeps it: its `note` and `stateNote` are what the
1388
- * command that made it says in its result, not part of the setting.
1389
- * @template {Record<string, any> | null | undefined} S
1390
- * @param {S} s
1391
- * @returns {S}
1392
- */
1393
- export function savedSetting<S extends Record<string, any> | null | undefined>(s: S): S;
1394
- /**
1395
- * The value the base theme itself gives a part's property where a setting
1396
- * applies (its variant and state), as the build keys part styles; null
1397
- * when the base theme leaves it to Core.
1398
- * @param {{light: Record<string, string>, components?: Record<string, any>}} base
1399
- * @param {Ctx} ctx
1400
- * @param {string} target
1401
- * @param {string} prop camelCase
1402
- * @param {{when?: string, state?: string}} s
1403
- * @returns {string | null}
1404
- */
1405
- export function baseComponent(base: {
1406
- light: Record<string, string>;
1407
- components?: Record<string, any>;
1408
- }, ctx: Ctx, target: string, prop: string, s: {
1409
- when?: string;
1410
- state?: string;
1411
- }): string | null;
1412
- /**
1413
- * The focus state a part's own styles key on: a part whose styled element
1414
- * is a wrapper (a text input's box) shows focus only through
1415
- * `focus-within`; null when it keys on none.
1416
- * @param {Ctx} ctx
1417
- * @param {string} part
1418
- * @returns {string | null}
1419
- */
1420
- export function focusStateOf(ctx: Ctx, part: string): string | null;
1421
- /**
1422
- * The radius token a part's corners follow when Core draws its corners one
1423
- * by one from that token by position (a button squares the joins inside a
1424
- * button group; a button group's outer corners are its end buttons'), or
1425
- * null. A radius for such a part is written as that
1426
- * token on the part, so every position keeps its own corner; a radius
1427
- * written on the part would override Core's per-corner rules.
1428
- * @param {Ctx} ctx
1429
- * @param {string} part
1430
- * @returns {string | null}
1431
- */
1432
- export function positionalCornerToken(ctx: Ctx, part: string): string | null;
1433
- /**
1434
- * The parts that draw a part's corners: the part itself, or, when Core gives
1435
- * it no radius of its own, the parts inside it that it has (a date-time
1436
- * input's date and time boxes).
1437
- * @param {Ctx} ctx
1438
- * @param {string} part
1439
- * @returns {string[]}
1440
- */
1441
- export function cornerParts(ctx: Ctx, part: string): string[];
1442
- /**
1443
- * The parts that take a part's padding: the part itself, or, when Core
1444
- * renders it as a box CSS draws no padding on (a table row) and gives it no
1445
- * other display, the parts inside it with padding of their own (its cells).
1446
- * @param {Ctx} ctx
1447
- * @param {string} part
1448
- * @returns {string[]}
1449
- */
1450
- export function paddedParts(ctx: Ctx, part: string): string[];
1451
- /**
1452
- * The square a member of the checks group sizes itself (a checkbox's box, a
1453
- * radio's circle), at a size: its width and height in px, from the theme's
1454
- * latest plain setting of each on the part or a group it is in (a setting
1455
- * for that size counts too), else what the part data records Core drawing at
1456
- * that size. Null for a part outside the checks group, one that reads a size
1457
- * token or sets no width and height of its own, and for a size neither the
1458
- * theme nor the part data gives in px.
1459
- * @param {Ctx} ctx the editor's context (its part census, ctx.C)
1460
- * @param {Setting[]} settings the theme's settings, in order
1461
- * @param {string} part
1462
- * @param {string} [size] the size value (`md`); none: the size drawn
1463
- * @returns {{w: number, h: number} | null}
1464
- */
1465
- export function selfSizedBox(ctx: Ctx, settings: Setting[], part: string, size?: string): {
1466
- w: number;
1467
- h: number;
1468
- } | null;
1469
- /**
1470
- * Why a part that sizes its own square ({@link sizesItsOwnBox}) has no box
1471
- * the editor can step at a size: the theme's own width or height is not in
1472
- * px, or neither the theme nor the part data gives one at that size. Null
1473
- * when it has one.
1474
- * @param {Ctx} ctx the editor's context (its part census, ctx.C)
1475
- * @param {Setting[]} settings the theme's settings, in order
1476
- * @param {string} part
1477
- * @param {string} [size]
1478
- * @returns {string | null}
1479
- */
1480
- export function selfSizedWhy(ctx: Ctx, settings: Setting[], part: string, size?: string): string | null;
1481
- /**
1482
- * The width and height lines that give a part or group its new box, from
1483
- * each member's own box (selfSizedBox) at each size: one line for the
1484
- * group where its members agree, else a line per member (with only, where
1485
- * the member's group spreads), and a size condition when `bySize`. A size
1486
- * a member has no box for is named in `unknown`, never given another's.
1487
- * @param {Ctx} ctx
1488
- * @param {Setting[]} settings the theme's settings, in order
1489
- * @param {string} on the part or group asked
1490
- * @param {Array<string | undefined>} sizes the sizes to write
1491
- * @param {(box: {w: number, h: number}) => {w: number, h: number} | null} next
1492
- * the new box for an old one; null skips it
1493
- * @param {boolean} bySize whether each line names its size
1494
- */
1495
- export function selfSizedBoxLines(ctx: Ctx, settings: Setting[], on: string, sizes: Array<string | undefined>, next: (box: {
1496
- w: number;
1497
- h: number;
1498
- }) => {
1499
- w: number;
1500
- h: number;
1501
- } | null, bySize: boolean): {
1502
- lines: {
1503
- sz: string | undefined;
1504
- m: string;
1505
- box: {
1506
- w: number;
1507
- h: number;
1508
- };
1509
- next: {
1510
- w: number;
1511
- h: number;
1512
- };
1513
- flags: {
1514
- on: string;
1515
- only?: true;
1516
- when?: string;
1517
- };
1518
- }[];
1519
- unknown: {
1520
- sz: string | undefined;
1521
- why: string;
1522
- }[];
1523
- members: string[];
1524
- };
1525
- /**
1526
- * Whether a part sizes its own square, the way a member of the checks group
1527
- * does: it sets its own width and height and reads no size token.
1528
- * @param {any} C the part census
1529
- * @param {string} part
1530
- * @returns {boolean}
1531
- */
1532
- export function sizesItsOwnBox(C: any, part: string): boolean;
1533
- /**
1534
- * Whether a part is drawn as a radio's mark, as the part data records it:
1535
- * a part with a checked state and a square box of a fixed size.
1536
- * @param {any} C the part census
1537
- * @param {string} part
1538
- * @returns {boolean}
1539
- */
1540
- export function radioMark(C: any, part: string): boolean;
1541
- /**
1542
- * Whether a part is a radio's circle: a radio's mark (radioMark) whose
1543
- * corners are 50% that no token reaches, in it and in every part inside it
1544
- * (its dot). The circle marks a radio; it is no corner, so the corners
1545
- * dial leaves it.
1546
- * @param {any} C the part census
1547
- * @param {string} part
1548
- * @returns {boolean}
1549
- */
1550
- export function radioCircle(C: any, part: string): boolean;
1551
- /**
1552
- * The parts drawn round with the pill token (--radius-full) as a styling
1553
- * choice: a pill whose box follows its content or its track (a badge, a
1554
- * progress track, a switch's track, an indicator line), never a circle.
1555
- * A part is a circle, and keeps its round shape, where in a rule its corners
1556
- * read the pill token its box is square (its width and height, or its
1557
- * minimum width and height or height, are one value: a switch's thumb, a
1558
- * calendar day, a numbered citation) or a visual prop names its shape a
1559
- * circle (an avatar's shape=circle), and so is a radio's mark. By the
1560
- * census, never by name.
1561
- * @param {{MAP: Record<string, any>}} C
1562
- * @returns {{pills: string[], circles: string[]}}
1563
- */
1564
- export function pillShapes(C: {
1565
- MAP: Record<string, any>;
1566
- }): {
1567
- pills: string[];
1568
- circles: string[];
1569
- };
1570
- /**
1571
- * The radius token a part's resting corners read. A part the census saw
1572
- * closed (a menu, a popover) has none recorded: a container or menu reads
1573
- * the container radius, like every Core surface; any other part reads the
1574
- * element radius.
1575
- * @param {Ctx} ctx
1576
- * @param {string} part
1577
- * @param {string} [when]
1578
- * @returns {string}
1579
- */
1580
- export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
1581
- /**
1582
- * Remove a `new` marker from a theme folder whose settings are whole: the
1583
- * `new` that left it made the theme, and nothing is left to finish.
1584
- * @param {string} dir
1585
- */
1586
- export function clearNewMarker(dir: string): void;
1587
- /**
1588
- * The pseudo key a state writes in a part's styles. Core marks a disabled
1589
- * button, link or tab with aria-disabled (it stays focusable). A form
1590
- * control styled on a wrapper (a typeahead, a complex selector) has its
1591
- * input or button inside marked, so it also matches a disabled form
1592
- * control inside it (never a list row); an action part that holds
1593
- * children (a button group, a segmented control) never does, so one
1594
- * disabled child never makes the whole part look disabled.
1595
- * A moment state on a part drawn under an invisible input lands on the
1596
- * part holding that input, and the part shows it from there.
1597
- * @param {string} state
1598
- * @param {boolean | Control} [control] whether it wraps one control, or
1599
- * its control (`controlOf`)
1600
- * @returns {string}
1601
- */
1602
- export function stateKey(state: string, control?: boolean | Control): string;
1603
- /**
1604
- * A part's control, as `stateSlot` takes it.
1605
- * @param {Ctx} ctx
1606
- * @param {string} target
1607
- * @returns {Control}
1608
- */
1609
- export function controlOf(ctx: Ctx, target: string): Control;
1610
- /**
1611
- * The ARIA states a part is painted in (any condition the part data holds
1612
- * for it names the attribute).
1613
- * @param {{MAP: Record<string, any>}} C
1614
- * @param {string} part
1615
- * @returns {string[]}
1616
- */
1617
- export function ariaStates(C: {
1618
- MAP: Record<string, any>;
1619
- }, part: string): string[];
1620
- /**
1621
- * The states `set` takes on a part, before any is tested: its doc's, the
1622
- * ones every part takes, and the ARIA states the part data paints it in
1623
- * (less one its doc names as its own: a toggle button's isPressed is its
1624
- * pressed state).
1625
- * @param {Ctx} ctx
1626
- * @param {string} part
1627
- * @returns {string[]}
1628
- */
1629
- export function partStates(ctx: Ctx, part: string): string[];
1630
- /**
1631
- * A state as typed, each of its `+` pieces read as the part's own name for
1632
- * it (any case or dashes).
1633
- * @param {Ctx} ctx
1634
- * @param {string} part
1635
- * @param {string} state
1636
- * @returns {string}
1637
- */
1638
- export function partState(ctx: Ctx, part: string, state: string): string;
1639
- /**
1640
- * A saved entry's state on a part as `set` reads a typed one: each of its
1641
- * pieces in the part's own spelling (toggle-button's `is-pressed` or
1642
- * `ispressed` is its isPressed), or null when it reads as no state of the
1643
- * part or as itself. The census half of the one state reader (the loader
1644
- * reads what needs no census: case, a colon, a CSS state's words): the
1645
- * saved-setting check and the build read the state through it, and leave
1646
- * the entry as saved, so a build stamped from the settings matches the
1647
- * file; a change saves the read state (readSavedStates).
1648
- * @param {Ctx} ctx
1649
- * @param {any} s
1650
- * @returns {string | null}
1651
- */
1652
- export function savedStateRead(ctx: Ctx, s: any): string | null;
1653
- /**
1654
- * Read each saved entry's state on a part in place, as savedStateRead
1655
- * reads it, with a note: what a change does before it saves the settings,
1656
- * so the file then holds the part's own spelling. A saved `only` is read
1657
- * by the whole --only rule first (readSavedOnly).
1658
- * @param {Ctx} ctx
1659
- * @param {ThemeData} data
1660
- */
1661
- export function readSavedStates(ctx: Ctx, data: ThemeData): void;
1662
- /**
1663
- * Where a setting's state goes in the built theme: the style key (its
1664
- * variant and every state Core writes as a key of its own, `checked+disabled`)
1665
- * and the pseudo-class key under it for the rest, joined (`:hover`, an ARIA
1666
- * state's attribute), or null for none.
1667
- * @param {string[]} own the states Core writes as keys on the part
1668
- * @param {string | undefined} state
1669
- * @param {string | undefined} when
1670
- * @param {boolean | Control} [wrapsControl] whether it wraps one control,
1671
- * or its control (`controlOf`)
1672
- * @param {Record<string, string>} [values] the value Core writes for each
1673
- * own state: a state that names a boolean prop is written `state:true`
1674
- * @param {string[]} [census] the part's states from the census alone
1675
- * @returns {{key: string, pseudo: string | null}}
1676
- */
1677
- export function stateSlot(own: string[], state: string | undefined, when: string | undefined, wrapsControl?: boolean | Control, values?: Record<string, string>, census?: string[]): {
1678
- key: string;
1679
- pseudo: string | null;
1680
- };
1681
- /**
1682
- * The text color tokens Core's elements inside a part read for their own
1683
- * color (a top nav heading's title span reads --color-text-primary itself),
1684
- * so a color set on the part never reaches that text. Only the main and
1685
- * supporting text colors count: the disabled, placeholder and accent ones
1686
- * mark a state or a role, not the part's text. With `deep`, the parts inside
1687
- * it count too (a top nav's heading and items).
1688
- * @param {{MAP: Record<string, any>}} C
1689
- * @param {string} part
1690
- * @param {boolean} [deep]
1691
- * @param {(part: string) => boolean} [keep] which contained parts count, when deep
1692
- * @returns {string[]}
1693
- */
1694
- export function innerTextTokens(C: {
1695
- MAP: Record<string, any>;
1696
- }, part: string, deep?: boolean, keep?: (part: string) => boolean): string[];
1697
- /**
1698
- * The text color tokens a text, heading or link part's color prop reads, so a
1699
- * color set on that part goes into them there: the token of the color named
1700
- * with --when color:<name>; a heading's main and supporting text tokens; else
1701
- * the tokens of the colors the prop shows by default (colorPropDefaults: a
1702
- * link's accent). Empty for any other part.
1703
- * @param {Ctx} ctx
1704
- * @param {string} part
1705
- * @param {string | null} [when]
1706
- * @returns {string[]}
1707
- */
1708
- export function colorPropTokens(ctx: Ctx, part: string, when?: string | null): string[];
1709
- /**
1710
- * The tokens elements inside a part read for a text property the part does
1711
- * not set itself (a top nav heading's title size, --text-large-size), so
1712
- * the property set on the part never reaches that text; or, for a part
1713
- * whose own box reads no tokens and holds only parts that each set the
1714
- * property, the tokens those parts read (a dialog's title block). Empty
1715
- * when the part sets the property itself.
1716
- * @param {{MAP: Record<string, any>}} C
1717
- * @param {string} part
1718
- * @param {string} prop
1719
- * @returns {string[]}
1720
- */
1721
- export function innerPropTokens(C: {
1722
- MAP: Record<string, any>;
1723
- }, part: string, prop: string): string[];
1724
- /**
1725
- * The size token of a part's main text, when the part draws no size of its
1726
- * own and the elements inside it read several text size tokens: the
1727
- * largest as the sizes resolve (a top nav heading's title, --text-large-size,
1728
- * over its supporting line). Null for a text column, whose lines each take a
1729
- * size said for the part, for a tie or a size that cannot be read, and when
1730
- * the sizes come from the parts it holds (a heading drawn at any level, an
1731
- * icon sized by spacing): no one main text can be told there.
1732
- * @param {{MAP: Record<string, any>}} C
1733
- * @param {string} part
1734
- * @param {Record<string, string>} tokens Core's token defaults
1735
- * @returns {string | null}
1736
- */
1737
- export function mainTextSizeToken(C: {
1738
- MAP: Record<string, any>;
1739
- }, part: string, tokens: Record<string, string>): string | null;
1740
- /**
1741
- * Whether a value names a token (written into that token, it would read
1742
- * itself).
1743
- * @param {unknown} value @param {string} token
1744
- */
1745
- export function namesToken(value: unknown, token: string): boolean;
1746
- /**
1747
- * The one text size token the parts a part holds read (a tab list's tabs,
1748
- * --text-label-size), for a text size token said of that part alone, with
1749
- * no state, that set's token check refused: the part reads none and draws
1750
- * no text of its own (no element inside it sets a text property). Read from that refusal's own list, so the
1751
- * refusal and the accept never differ. Null otherwise, and for a value that
1752
- * names that token (it would read itself).
1753
- * @param {{MAP: Record<string, any>}} C
1754
- * @param {{state?: string}} s
1755
- * @param {string} part
1756
- * @param {string} thing
1757
- * @param {unknown} value
1758
- * @param {{held?: string[], soft?: boolean} | null | undefined} refused
1759
- * @returns {string | null}
1760
- */
1761
- export function heldSizeTokenFor(C: {
1762
- MAP: Record<string, any>;
1763
- }, s: {
1764
- state?: string;
1765
- }, part: string, thing: string, value: unknown, refused: {
1766
- held?: string[];
1767
- soft?: boolean;
1768
- } | null | undefined): string | null;
1769
- /**
1770
- * The tokens of the lines in a part's text column, when its text sits in one
1771
- * column part of its own that holds no text itself (a banner's message
1772
- * column: its title, --text-label-size, and description,
1773
- * --text-supporting-size), each line a leaf part of its own that sets the
1774
- * property. A text property set on the part goes into each of them there:
1775
- * it means all of the part's text. Empty for any other part.
1776
- * @param {{MAP: Record<string, any>}} C
1777
- * @param {string} part
1778
- * @param {string} prop
1779
- * @returns {string[]}
1780
- */
1781
- export function columnLineTokens(C: {
1782
- MAP: Record<string, any>;
1783
- }, part: string, prop: string): string[];
1784
- /**
1785
- * The text color tokens a color set on a part also goes into, so the text
1786
- * it means shows that color: the tokens Core's elements inside the part read
1787
- * (innerTextTokens). A part that draws no text of its own (an app shell
1788
- * header, a top nav) holds only parts with their own text, which read these
1789
- * tokens and not the inherited color; there the tokens of the parts inside
1790
- * it count, on the part alone.
1791
- * @param {{MAP: Record<string, any>}} C
1792
- * @param {string} part
1793
- * @param {{target?: Map<string, {component?: string}>}} [project]
1794
- * @param {Array<{text: string, within?: string[]}>} [pairs] the census's text pairs
1795
- * @returns {string[]}
1796
- */
1797
- export function colorTokensReached(C: {
1798
- MAP: Record<string, any>;
1799
- }, part: string, project?: {
1800
- target?: Map<string, {
1801
- component?: string;
1802
- }>;
1803
- }, pairs?: Array<{
1804
- text: string;
1805
- within?: string[];
1806
- }>): string[];
1807
- /**
1808
- * The component docs of a part: its own component's, and the one named like
1809
- * the part (tab is Tab, under TabList), each with its name, for the ones the
1810
- * project has.
1811
- * @param {Ctx} ctx
1812
- * @param {string} part
1813
- * @returns {Array<{name: string, doc: any}>}
1814
- */
1815
- export function partComponentDocs(ctx: Ctx, part: string): Array<{
1816
- name: string;
1817
- doc: any;
1818
- }>;
1819
- /**
1820
- * Whether a part's styled element wraps one control: its component (or the
1821
- * one named like the part) is a form control (Core's own category) that
1822
- * takes a disabled prop. An action part that holds children (a button
1823
- * group) never does.
1824
- * @param {Ctx} ctx
1825
- * @param {string} target
1826
- */
1827
- export function wrapsOneControl(ctx: Ctx, target: string): boolean;
1828
- /**
1829
- * The whole-theme radius tokens a generated settings module writes, or null
1830
- * when it writes none.
1831
- * @param {string} source
1832
- * @returns {Record<string, string> | null}
1833
- */
1834
- export function radiiIn(source: string): Record<string, string> | null;
1835
- /**
1836
- * The radius, in px, the build writes for a radius token at a corners value
1837
- * (a rung, or a size). The derived radii keep the base theme's own
1838
- * proportions to the element radius (matcha's page is 3.5 times it), so a
1839
- * bigger element radius never makes them smaller; a checkbox stays a
1840
- * rounded square at pill, and a container or page at pill is half again as
1841
- * round as at `round` (a fully round card is a capsule). Past 1000px a
1842
- * radius is fully round.
1843
- * @param {{light: Record<string, string>}} base the base theme's tokens
1844
- * @param {string} value
1845
- * @param {string} token
1846
- * @returns {number}
1847
- */
1848
- export function radiusAt(base: {
1849
- light: Record<string, string>;
1850
- }, value: string, token: string): number;
1851
- /**
1852
- * The base theme's chat and container radii in px, when the base pins a
1853
- * chat radius other than its container radius. Null when the base sets no
1854
- * length for either, has square containers, or gives both the same radius:
1855
- * then the chat radius is the container radius. (The two stay a fraction,
1856
- * so the base's own corners give its chat radius exactly.)
1857
- * @param {{light: Record<string, string>}} base
1858
- * @returns {{chat: number, container: number, cap: number} | null}
1859
- */
1860
- export function chatRatio(base: {
1861
- light: Record<string, string>;
1862
- }): {
1863
- chat: number;
1864
- container: number;
1865
- cap: number;
1866
- } | null;
1867
- /**
1868
- * The chat radius the corners dial writes: the container radius at the
1869
- * base's ratio of the two, up to the cap {@link chatRatio} names, or the
1870
- * container radius when the base pins no other. A bound (`at most 8px`)
1871
- * holds it there too, still read from the container radius.
1872
- * @param {{light: Record<string, string>}} base
1873
- * @param {{limit: number, up: boolean} | null} [bound]
1874
- */
1875
- export function chatRadiusValue(base: {
1876
- light: Record<string, string>;
1877
- }, bound?: {
1878
- limit: number;
1879
- up: boolean;
1880
- } | null): string;
1881
- /**
1882
- * Whether a file is a module the editor generated (its first line is the
1883
- * editor's header).
1884
- * @param {string} file
1885
- */
1886
- /**
1887
- * Whether the editor made a theme's folder, though its settings may be
1888
- * gone: a stopped `new` left its marker, or the folder holds what only the
1889
- * editor writes (the generated settings module, an undo history, the theme
1890
- * source with the header the editor wrote it with).
1891
- * @param {string} cwd
1892
- * @param {string} slug
1893
- */
1894
- export function editorMadeFolder(cwd: string, slug: string): boolean;
1895
- /**
1896
- * Whether a file carries the editor's generated header.
1897
- * @param {string} file
1898
- */
1899
- export function madeByEditor(file: string): boolean;
1900
- /**
1901
- * Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
1902
- * theme folder, and every file and folder in it. The editor writes the
1903
- * theme's own files only, never through a link to somewhere else.
1904
- * @param {string} cwd
1905
- * @param {string} slug
1906
- */
1907
- export function refuseLinks(cwd: string, slug: string): void;
1908
- /**
1909
- * What a build was made from: the settings and the CLI that built them, so
1910
- * a build that no longer matches its settings file is found and made again.
1911
- * @param {ThemeData} data
1912
- */
1913
- export function settingsStamp(data: ThemeData): string;
1914
- /**
1915
- * The stamp of a theme's whole-theme color-token settings, as the file
1916
- * keeps them: a module records it, so a hand edit that leaves them as they
1917
- * were is told from one that changes a color the module wrote out.
1918
- * @param {ThemeData} data
1919
- */
1920
- export function colorsStamp(data: ThemeData): string;
1921
- /**
1922
- * Whether the theme's settings module is one a newer CLI wrote for a
1923
- * palette recipe this CLI does not know, and still current: built from
1924
- * these same settings, on the base version installed, by a CLI no older
1925
- * than this one, and not edited by hand. Such a module is kept as written
1926
- * (building it again could only lose what that CLI knows), and a build
1927
- * that keeps it is current.
1928
- * @param {string} cwd
1929
- * @param {string} slug
1930
- * @param {ThemeData} data
1931
- */
1932
- export function moduleKeptAsSaved(cwd: string, slug: string, data: ThemeData): boolean;
1933
- /**
1934
- * Why the theme's build does not match its settings, in words, or null when
1935
- * it does: a file missing, another CLI version, settings changed since the
1936
- * build (a hand edit), or a build left half done (a command stopped).
1937
- * @param {string} cwd
1938
- * @param {string} slug
1939
- * @param {ThemeData} data
1940
- * @returns {string | null}
1941
- */
1942
- export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
1943
- /**
1944
- * Every file the editor's build of a theme writes, the one list staleness
1945
- * reads: the generated settings module, the built stylesheet, module and
1946
- * their types, and, with a color dial set, the generated color files.
1947
- * @param {string} cwd
1948
- * @param {string} slug
1949
- * @param {ThemeData} data
1950
- * @param {boolean} [some] the files a build writes only for some themes
1951
- * (the variants types, for a theme with component variants) instead
1952
- * @returns {string[]}
1953
- */
1954
- export function builtFiles(cwd: string, slug: string, data: ThemeData, some?: boolean): string[];
1955
- /**
1956
- * A theme's undo history: the settings text before each change, oldest
1957
- * first, and how many damaged steps were dropped. Every step after the
1958
- * last damaged one is kept.
1959
- * @param {string} file
1960
- * @returns {{steps: string[], dropped: number}}
1961
- */
1962
- export function readHistory(file: string): {
1963
- steps: string[];
1964
- dropped: number;
1965
- };
1966
- /**
1967
- * Write the settings, build, and on a failed build put back what was there.
1968
- * Returns what changed in the resolved tokens and the lifted keys that are
1969
- * new since the last build.
1970
- * @param {Ctx} ctx
1971
- * @param {string} slug
1972
- * @param {ThemeData} data
1973
- * @param {{history: boolean, historyAfter?: string[], radii?: Record<string, string> | null, stops?: Record<string, any> | null}} options
1974
- * `historyAfter`: the history to write with the change (a step back pops it);
1975
- * `radii`: the whole-theme radii the step being restored was built with;
1976
- * `stops`: the shades the step being restored showed, for a palette kept
1977
- * as saved
1978
- */
1979
- export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter, radii, stops }: {
1980
- history: boolean;
1981
- historyAfter?: string[];
1982
- radii?: Record<string, string> | null;
1983
- stops?: Record<string, any> | null;
1984
- }): Promise<{
1985
- changed: never[];
1986
- changedParts: never[];
1987
- res: {
1988
- light: {};
1989
- dark: {};
1990
- };
1991
- problems: never[];
1992
- problemList: never[];
1993
- newProblems: never[];
1994
- warnings: never[];
1995
- lifted: never[];
1996
- notes: string[];
1997
- unchanged: boolean;
1998
- leftProblems?: undefined;
1999
- before?: undefined;
2000
- resBefore?: undefined;
2001
- } | {
2002
- changed: string[];
2003
- changedParts: string[];
2004
- res: Record<"light" | "dark", Record<string, string>>;
2005
- problems: string[];
2006
- problemList: ThemeProblem[];
2007
- newProblems: ThemeProblem[];
2008
- leftProblems: ThemeProblem[];
2009
- warnings: string[];
2010
- lifted: string[];
2011
- notes: string[];
2012
- unchanged: boolean;
2013
- before: ThemeData | null;
2014
- resBefore: {
2015
- light: Record<string, string>;
2016
- dark: Record<string, string>;
2017
- } | null;
2018
- }>;
2019
- /**
2020
- * The Fontsource package for a font family, in Fontsource's own naming: an
2021
- * open font's own package as the editor's font table names it (Geist is
2022
- * `@fontsource/geist-sans`); a variable family, which Fontsource names
2023
- * `<Name> Variable`, from `@fontsource-variable/<name>`; else the family's
2024
- * name with every run of other characters as one dash (`Open Sans` is
2025
- * `@fontsource/open-sans`, `Mrs. Sheppards` is `@fontsource/mrs-sheppards`).
2026
- * Null when the name gives no such package name (a name with no Latin
2027
- * letters or digits).
2028
- * @param {string} family
2029
- * @returns {string | null}
2030
- */
2031
- export function fontsourcePackageOf(family: string): string | null;
2032
- /**
2033
- * The Fontsource package to suggest installing for a family: an open
2034
- * font's own package (the editor's font table knows it is published); none
2035
- * for a font a system ships (on any platform), which Fontsource does not
2036
- * publish; else the family's package in Fontsource's naming, which
2037
- * Fontsource may or may not publish (`known` false).
2038
- * @param {string} family
2039
- * @returns {{pkg: string, known: boolean} | null}
2040
- */
2041
- export function fontsourceSuggestion(family: string): {
2042
- pkg: string;
2043
- known: boolean;
2044
- } | null;
2045
- /**
2046
- * The custom properties Core's stylesheet sets on a component's own
2047
- * element (not on the page root), once per project: a value a theme gives
2048
- * one of them on the page never reaches the part.
2049
- * @param {Ctx} ctx
2050
- * @returns {Set<string>}
2051
- */
2052
- export function coreElementVars(ctx: Ctx): Set<string>;
2053
- /**
2054
- * The font weights the app's text takes with the theme: Core's weight
2055
- * tokens (`--font-weight-*`, which its components' text reads) as the
2056
- * theme sets them, every `font-weight` and weight token the theme's build
2057
- * writes (a `font` shorthand's weight too), each var() read through the
2058
- * theme's own values and then Core's stylesheet, and the normal weight
2059
- * (400). With `family`, only the weights text in that family takes: the
2060
- * weight tokens, and each weight set beside that family (or, for a family
2061
- * of the theme's font tokens, beside no family), never one only another
2062
- * family's rule sets. Null before the theme has been built.
2063
- * @param {Ctx} ctx
2064
- * @param {string} slug
2065
- * @param {string | null} [family]
2066
- * @returns {number[] | null}
2067
- */
2068
- export function builtFontWeights(ctx: Ctx, slug: string, family?: string | null): number[] | null;
2069
- /**
2070
- * Whether the theme's last build sets italic text anywhere: a
2071
- * `font-style` of italic or oblique, or a `font` shorthand's style, each
2072
- * var() read through the theme's own values. A font package then loads
2073
- * its italic faces beside the upright ones, or the browser draws a slanted
2074
- * copy. False before the theme has been built.
2075
- * @param {Ctx} ctx
2076
- * @param {string} slug
2077
- * @returns {boolean}
2078
- */
2079
- export function builtItalic(ctx: Ctx, slug: string): boolean;
2080
- /**
2081
- * The font families the theme's last build names (its `--font-family-*`
2082
- * tokens, every part's `font-family`, and a `font` shorthand's families), by lowercase name; null before the
2083
- * theme has been built.
2084
- * @param {Ctx} ctx
2085
- * @param {string} slug
2086
- * @returns {Map<string, string> | null}
2087
- */
2088
- export function builtFontFamilies(ctx: Ctx, slug: string): Map<string, string> | null;
2089
- /**
2090
- * Each font stack the theme's build writes, as the families it names in
2091
- * order (see {@link builtFontFamilies}); null when the build is not there.
2092
- * @param {Ctx} ctx
2093
- * @param {string} slug
2094
- * @returns {string[][] | null}
2095
- */
2096
- export function builtFontStacks(ctx: Ctx, slug: string): string[][] | null;
2097
- /**
2098
- * The font packages that load the families the theme builds: a font
2099
- * setting's package while the build still uses its family, and the
2100
- * installed @fontsource package of a family the theme's own source sets.
2101
- * Font notes, the previews and the app copy all load fonts from this list.
2102
- * For a new app that installs its own packages (`forNewApp`), every built
2103
- * family that is an open font comes too, installed here or not.
2104
- * @param {Ctx} ctx
2105
- * @param {ThemeData} data
2106
- * @param {{forNewApp?: boolean}} [opts]
2107
- */
2108
- export function fontPackages(ctx: Ctx, data: ThemeData, { forNewApp }?: {
2109
- forNewApp?: boolean;
2110
- }): {
2111
- pkg: string;
2112
- family: string;
2113
- installed: boolean;
2114
- of: Setting | null;
2115
- }[];
2116
- export function slugOk(s: string): boolean;
2117
- export function windowsReserved(s: string): boolean;
2118
- export function slugFor(name: unknown): string;
2119
- export function kebab(s: string): string;
2120
- export function camel(s: string): string;
2121
- /** Files a system or a tool puts in any folder; a folder of only these is empty. */
2122
- export const FOLDER_JUNK: Set<string>;
2123
- /** The build outputs of a theme, by their ending after `<theme>`. */
2124
- export const APP_COPY_BUILT: string[];
2125
- export function shown(cwd: string, f: string): string;
2126
- export function keyOf(s: Setting): string;
2127
- /**
2128
- * The colors a badge without a solid fill takes inside a filled button, by
2129
- * the button's variant: its fill color as text on its text color, as Core's
2130
- * neutral badge takes them, so the badge reads on the button. The rule
2131
- * selects the badge inside that button.
2132
- */
2133
- /** Where a badge sits inside a secondary button (Button's default). */
2134
- export const BADGE_IN_SECONDARY_BUTTON: ":is(.astryx-button[data-variant=\"secondary\"] *)";
2135
- export const BADGE_IN_BUTTON: {
2136
- readonly ':is(.astryx-button[data-variant="primary"] *)': {
2137
- readonly backgroundColor: "var(--color-on-accent)";
2138
- readonly color: "var(--color-accent)";
2139
- };
2140
- readonly ':is(.astryx-button[data-variant="destructive"] *)': {
2141
- readonly backgroundColor: "var(--color-on-error)";
2142
- readonly color: "var(--color-error)";
2143
- };
2144
- };
2145
- /** The sizes a control has, each with its own height token. */
2146
- export const CONTROL_SIZES: readonly ["sm", "md", "lg"];
2147
- export function cornerPx(v: string): number;
2148
- export function textPx(v: string): number;
2149
- /** The type tokens base themes set again for phones: families and weights. */
2150
- export const PHONE_TYPE: RegExp;
2151
- export namespace PHONE_RULE_WHEN {
2152
- let pointer: string;
2153
- namespace width {
2154
- let below: string;
2155
- }
2156
- }
2157
- /**
2158
- * The tokens that follow another one the theme sets exactly (where it
2159
- * does not set them itself): each with the token it follows.
2160
- */
2161
- export const FOLLOWS: Readonly<Record<string, string>>;
2162
- export function themeSource(slug: string): string;
2163
- export function settingsThemeName(slug: string): string;
2164
- /**
2165
- * The section sheet whose picture shows every overlay open: `--png` takes
2166
- * it beside the sample page's, so plain `show --png` takes it again.
2167
- */
2168
- export const OPEN_SECTION: "overlays";
2169
- /** The radius tokens the corners dial moves. */
2170
- export const DIAL_RADII: string[];
2171
- /** The file a `new` keeps beside the files it writes until it is done. */
2172
- export const NEW_MARKER: ".astryx-new.json";
2173
- /**
2174
- * The states Core paints from an ARIA attribute rather than a data
2175
- * attribute of its own (a pagination's current page, a pressed or open
2176
- * button): set names each as a state, and the build writes it as the
2177
- * attribute.
2178
- */
2179
- /**
2180
- * The states a pointer or the keyboard puts a part in for a moment (hover,
2181
- * focus, a press), as against the conditions a part holds (checked,
2182
- * selected, disabled, invalid, open). Two moment states said together
2183
- * ("hovered and pressed buttons") are each one; a list with a condition in
2184
- * it ("the checked and disabled checkboxes") is the part in all of them at
2185
- * once.
2186
- */
2187
- export const MOMENT_STATES: string[];
2188
- export namespace ARIA_STATES {
2189
- namespace current {
2190
- let attr: string;
2191
- let selector: string;
2192
- }
2193
- namespace pressed {
2194
- let attr_1: string;
2195
- export { attr_1 as attr };
2196
- let selector_1: string;
2197
- export { selector_1 as selector };
2198
- }
2199
- namespace expanded {
2200
- let attr_2: string;
2201
- export { attr_2 as attr };
2202
- let selector_2: string;
2203
- export { selector_2 as selector };
2204
- }
2205
- }
2206
- /**
2207
- * The files the editor writes for a theme, after `<slug>.`: the only ones a
2208
- * change reads, hashes or puts back, and the only ones a stopped `new`
2209
- * leaves (a designer's `<slug>.design.psd` beside them is never touched).
2210
- */
2211
- export const EDITOR_SUFFIXES: string[];
2212
- /**
2213
- * The pages and pictures the editor writes in a theme folder, by exact
2214
- * name: the preview and the sheet, each section's sheet, and a picture of
2215
- * each in each mode. A file of the user's named like one (`sheet-old.png`,
2216
- * `preview-v.html`) is not one of them.
2217
- */
2218
- export const EDITOR_PAGES: Set<string>;
2219
- export function isEditorPage(n: string, recorded?: Record<string, unknown>): boolean;
2220
- export function isEditorFile(slug: string, n: string, recorded?: Record<string, unknown>): boolean;
2221
- /** The undo steps a theme keeps; older ones are dropped. */
2222
- export const HISTORY_STEPS: 80;
2223
- /**
2224
- * One entry of the top-level `tokens` map in a theme's own source, as
2225
- * written: its token (null for a computed key no read of the file can
2226
- * resolve), the key as typed, the line that sets it, and its value's shape.
2227
- * A `chain` entry is another theme the file defines (`theme`, its name):
2228
- * its call, or a token its literal tokens map sets. A `scope` entry names
2229
- * where a scope (`components`, `onDark`, `onLight`, `adaptations`,
2230
- * `localTokens`) starts; a `scoped` entry is a token one sets, with its
2231
- * scope path (`components.button.base`). A `duplicate` entry names a
2232
- * second `tokens` key (with every line); a
2233
- * `typography` entry is one typography field (its dotted key and value;
2234
- * `block` when it holds fields); a `field` entry is a field the theme
2235
- * gives defineTheme; a `key` entry is a block's own key in a scope (a
2236
- * style key, a pseudo-class, a surface's tokens), with its scope path;
2237
- * an `unresolved` entry says the map holds something only a build reads.
2238
- * A chain theme defined in another file carries that `file`.
2239
- */
2240
- export type OwnTokenEntry = {
2241
- token: string | null;
2242
- key: string;
2243
- line: number | null;
2244
- kind: "text" | "number" | "pair" | "object" | "other" | "duplicate" | "typography" | "unresolved" | "scope" | "scoped" | "chain" | "field" | "key";
2245
- scope?: string;
2246
- theme?: string;
2247
- value?: any;
2248
- halves?: Array<string | number | undefined>;
2249
- lines?: Array<number | null>;
2250
- file?: string;
2251
- overridden?: boolean;
2252
- expression?: boolean;
2253
- notToken?: boolean;
2254
- block?: boolean;
2255
- };
2256
- /**
2257
- * The colors a badge style draws a status or category variant in, from the
2258
- * first pair that reads in every mode: text at 4.5:1 on its fill, the fill
2259
- * over the page. The fill is null where the badge has no fill of its own.
2260
- * `kept` marks the pair a variant falls back to when no color of the style
2261
- * reads: Core's own tint (solid), or the primary text inside a line of its
2262
- * hue (outline).
2263
- */
2264
- export type BadgePair = {
2265
- fill: string | null;
2266
- text: string;
2267
- line?: boolean;
2268
- kept?: boolean;
2269
- };
2270
- /**
2271
- * One half of a palette token in a generated settings module: a palette
2272
- * stop (`family` and `stop`, with `alpha` for a see-through one), white or
2273
- * black, a color written out (`family: 'literal'`), or the base theme's
2274
- * own value (`family: 'literal', base: true`).
2275
- */
2276
- export type KeptHalf = {
2277
- family: string;
2278
- stop: number;
2279
- alpha?: string;
2280
- color?: string;
2281
- base?: true;
2282
- };
2283
- /**
2284
- * One problem the theme has, with the command that fixes it, or null when
2285
- * no one command does. `key` names the problem whatever its ratio (what
2286
- * is drawn, on what, in which variant and mode), so a change that only
2287
- * moves a ratio makes no new problem.
2288
- */
2289
- export type ThemeProblem = {
2290
- text: string;
2291
- fix: string | null;
2292
- key: string;
2293
- note?: boolean;
2294
- };
2295
- /**
2296
- * A part's control: whether it wraps one control (its disabled state is
2297
- * the control's too), and the part holding the invisible input it is drawn
2298
- * under, if any.
2299
- */
2300
- export type Control = {
2301
- wraps: boolean;
2302
- under: string | null;
2303
- };
2304
- export type DirSnapshot = {
2305
- /**
2306
- * each regular file, with its bytes and times (ms)
2307
- */
2308
- files: Map<string, {
2309
- bytes: Buffer;
2310
- atime: number;
2311
- mtime: number;
2312
- }>;
2313
- /**
2314
- * the folder
2315
- * and each folder those files are in, with its times (ms)
2316
- */
2317
- folders: Map<string, {
2318
- atime: number;
2319
- mtime: number;
2320
- }>;
2321
- };
2322
- /**
2323
- * One setting the CLI owns.
2324
- */
2325
- export type Setting = {
2326
- /**
2327
- * - A dial, a token (`--color-accent`), or a CSS property.
2328
- */
2329
- thing: string;
2330
- value: string;
2331
- source: "dial" | "token" | "property";
2332
- /**
2333
- * - A part, a group, or a typography role (font).
2334
- */
2335
- on?: string | undefined;
2336
- /**
2337
- * - `<prop>:<value>`.
2338
- */
2339
- when?: string | undefined;
2340
- state?: string | undefined;
2341
- mode?: "light" | "dark" | undefined;
2342
- only?: boolean | undefined;
2343
- /**
2344
- * - A group's height the narrowing copied onto
2345
- * this member, with only, when one control of the group took its own.
2346
- */
2347
- narrowed?: boolean | undefined;
2348
- /**
2349
- * - For the `headings` dial: `weight` or `tracking`.
2350
- */
2351
- axis?: string | undefined;
2352
- note?: string | undefined;
2353
- /**
2354
- * - The state word a command wrote as another state, said in its result.
2355
- */
2356
- stateNote?: string | undefined;
2357
- /**
2358
- * - A box shorthand's sides, each checked, which set writes in its place (never saved).
2359
- */
2360
- sides?: Setting[] | undefined;
2361
- };
2362
- /**
2363
- * The settings file.
2364
- */
2365
- export type ThemeData = {
2366
- name: string;
2367
- /**
2368
- * - The built-in theme it builds on.
2369
- */
2370
- like?: string | undefined;
2371
- mode: "both" | "light-only" | "dark-only";
2372
- settings: Setting[];
2373
- /**
2374
- * - Variant keys the last build repeated a part setting on.
2375
- */
2376
- lifted?: string[] | undefined;
2377
- /**
2378
- * - The hash of the palette.config.json the editor last wrote.
2379
- */
2380
- palette?: string | undefined;
2381
- };
2382
- export type Ctx = {
2383
- project: import("./_project.mjs").ThemeProject;
2384
- C: import("./_compiler.mjs").Compiler;
2385
- unchecked?: string | null;
2386
- uncheckedCode?: string | null;
2387
- wrote?: Map<string, string | null>;
2388
- base?: {
2389
- light: Record<string, string>;
2390
- dark: Record<string, string>;
2391
- components?: Record<string, any>;
2392
- };
2393
- keepStops?: ReturnType<typeof stopsIn> | null;
2394
- keepRadii?: Record<string, string> | null;
2395
- sizeNotes?: string[];
2396
- compileNotes?: string[];
2397
- derived?: Record<string, Array<{
2398
- property: string;
2399
- vars?: string[];
2400
- replaces?: boolean;
2401
- expand?: string;
2402
- corners?: boolean;
2403
- }>>;
2404
- takesPictures?: {
2405
- sheet: string | null;
2406
- } | null;
2407
- };
2408
- export type PaintSide = import("./_parts.mjs").PaintSide;
2409
- export type TextPair = import("./_parts.mjs").TextPair;
2410
- import { AstryxError } from '../error.mjs';
2411
- /**
2412
- * {@link buildTheme}'s steps, each write recorded in `ctx.wrote`.
2413
- * @param {Ctx} ctx
2414
- * @param {string} slug
2415
- * @param {ThemeData} data
2416
- */
2417
- declare function buildThemeSteps(ctx: Ctx, slug: string, data: ThemeData): Promise<{
2418
- warnings: string[];
2419
- lifted: string[];
2420
- notes: string[];
2421
- removedPictures: string[];
2422
- }>;
2423
- import { NAME_RULE } from './_name-rule.mjs';
2424
- import { GROUP_ROLES } from './_tables.mjs';
2425
- import { modesOf } from './_palette.mjs';
2426
- export { NAME_RULE, GROUP_ROLES, modesOf };