@astryxdesign/cli 0.7.17 → 0.7.18-canary.g32556bb

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 (261) hide show
  1. package/README.md +1 -1
  2. package/api/discover/_adapter.d.mts +7 -5
  3. package/api/discover/_adapter.mjs +12 -11
  4. package/api/docs/_adapter.d.mts +19 -2
  5. package/api/docs/_adapter.mjs +66 -5
  6. package/api/doctor/_adapter.d.mts +11 -62
  7. package/api/doctor/_adapter.mjs +242 -472
  8. package/api/doctor/doctor.d.mts +1 -1
  9. package/api/doctor/doctor.mjs +3 -3
  10. package/api/doctor/theme-checks.mjs +37 -45
  11. package/api/error.d.mts +21 -0
  12. package/api/error.mjs +89 -0
  13. package/api/hook/list/list.d.mts +1 -1
  14. package/api/icon/_adapter.d.mts +8 -0
  15. package/api/icon/_adapter.mjs +17 -0
  16. package/api/icon/_authoring.mjs +6 -6
  17. package/api/icon/_default-look.mjs +16 -16
  18. package/api/icon/add/add.mjs +3 -3
  19. package/api/icon/exportIconIndex.doc.mjs +2 -2
  20. package/api/icon/icon.doc.mjs +2 -2
  21. package/api/icon/icon.type.d.mts +4 -0
  22. package/api/icon/icon.type.mjs +2 -1
  23. package/api/icon/search/icon-index.mjs +16 -3
  24. package/api/icon/search/search.d.mts +15 -5
  25. package/api/icon/search/search.mjs +74 -16
  26. package/api/icon/use/use.mjs +4 -4
  27. package/api/render/_adapter.mjs +233 -40
  28. package/api/render/render.type.d.mts +1 -1
  29. package/api/render/render.type.mjs +1 -1
  30. package/api/search/ORDERING.md +2 -2
  31. package/api/search/_adapter.mjs +4 -0
  32. package/api/search/_candidate-score.mjs +32 -8
  33. package/api/search/_cards.json +1 -1
  34. package/api/search/_compound.d.mts +0 -1
  35. package/api/search/_compound.mjs +93 -2
  36. package/api/search/_icons.d.mts +4 -2
  37. package/api/search/_icons.mjs +4 -2
  38. package/api/search/_lexical.mjs +177 -17
  39. package/api/search/_order.d.mts +3 -1
  40. package/api/search/_order.mjs +16 -5
  41. package/api/search/_result.d.mts +9 -0
  42. package/api/search/_result.mjs +10 -0
  43. package/api/search/_score.mjs +21 -3
  44. package/api/swizzle/_moduleGraph.d.mts +8 -0
  45. package/api/swizzle/_moduleGraph.mjs +61 -3
  46. package/api/template/copy/copy.mjs +5 -3
  47. package/api/template/template.type.d.mts +3 -3
  48. package/api/template/template.type.mjs +3 -3
  49. package/api/theme/_adapter.mjs +48 -12
  50. package/api/theme/build/build.d.mts +4 -0
  51. package/api/theme/build/build.mjs +69 -18
  52. package/api/theme/build/style-keys.mjs +4 -5
  53. package/api/theme/build/theme-object.mjs +5 -0
  54. package/api/theme/palette/generate/color.d.mts +47 -0
  55. package/api/theme/palette/generate/color.mjs +58 -1
  56. package/api/theme/palette/generate/derive-look.d.mts +293 -0
  57. package/api/theme/palette/generate/derive-look.mjs +1362 -0
  58. package/api/theme/palette/generate/editor-look.d.mts +62 -0
  59. package/api/theme/palette/generate/editor-look.mjs +550 -0
  60. package/api/theme/palette/generate/mapping.d.mts +94 -9
  61. package/api/theme/palette/generate/mapping.mjs +94 -22
  62. package/api/theme-edit/_adapter.mjs +13 -2
  63. package/api/theme-edit/_catalog.d.mts +13 -13
  64. package/api/theme-edit/_catalog.mjs +66 -28
  65. package/api/theme-edit/_check.d.mts +82 -6
  66. package/api/theme-edit/_check.mjs +1270 -238
  67. package/api/theme-edit/_color.d.mts +74 -0
  68. package/api/theme-edit/_color.mjs +168 -3
  69. package/api/theme-edit/_compiler.d.mts +3 -5
  70. package/api/theme-edit/_compiler.mjs +122 -23
  71. package/api/theme-edit/_context.d.mts +55 -12
  72. package/api/theme-edit/_context.mjs +114 -60
  73. package/api/theme-edit/_css.d.mts +11 -0
  74. package/api/theme-edit/_css.mjs +40 -0
  75. package/api/theme-edit/_edit.d.mts +15 -2
  76. package/api/theme-edit/_edit.mjs +1469 -133
  77. package/api/theme-edit/_how-commands.d.mts +116 -0
  78. package/api/theme-edit/_how-commands.mjs +227 -115
  79. package/api/theme-edit/_how-question.d.mts +74 -29
  80. package/api/theme-edit/_how-question.mjs +8514 -1256
  81. package/api/theme-edit/_how-sides.d.mts +22 -0
  82. package/api/theme-edit/_how-sides.mjs +173 -0
  83. package/api/theme-edit/_how-steps.d.mts +42 -0
  84. package/api/theme-edit/_how-steps.mjs +208 -0
  85. package/api/theme-edit/_how-values.d.mts +29 -0
  86. package/api/theme-edit/_how-values.mjs +111 -0
  87. package/api/theme-edit/_how-words.d.mts +15 -0
  88. package/api/theme-edit/_how-words.mjs +239 -0
  89. package/api/theme-edit/_how.d.mts +1 -1
  90. package/api/theme-edit/_how.mjs +422 -37
  91. package/api/theme-edit/_missed.d.mts +2 -1
  92. package/api/theme-edit/_missed.mjs +125 -13
  93. package/api/theme-edit/_normal.d.mts +5 -3
  94. package/api/theme-edit/_normal.mjs +54 -14
  95. package/api/theme-edit/_palette.d.mts +204 -4
  96. package/api/theme-edit/_palette.mjs +901 -25
  97. package/api/theme-edit/_part-pieces.d.mts +54 -0
  98. package/api/theme-edit/_part-pieces.mjs +179 -0
  99. package/api/theme-edit/_part-words.mjs +33 -5
  100. package/api/theme-edit/_parts.d.mts +133 -0
  101. package/api/theme-edit/_parts.mjs +599 -10
  102. package/api/theme-edit/_picture-traits.d.mts +259 -0
  103. package/api/theme-edit/_picture-traits.mjs +1030 -0
  104. package/api/theme-edit/_preview.d.mts +95 -4
  105. package/api/theme-edit/_preview.mjs +284 -31
  106. package/api/theme-edit/_project.d.mts +14 -4
  107. package/api/theme-edit/_project.mjs +95 -26
  108. package/api/theme-edit/_resolved.d.mts +46 -0
  109. package/api/theme-edit/_resolved.mjs +800 -0
  110. package/api/theme-edit/_set-line.d.mts +29 -0
  111. package/api/theme-edit/_set-line.mjs +100 -0
  112. package/api/theme-edit/_settings.d.mts +625 -28
  113. package/api/theme-edit/_settings.mjs +4867 -888
  114. package/api/theme-edit/_tables.d.mts +25 -1
  115. package/api/theme-edit/_tables.mjs +115 -11
  116. package/api/theme-edit/_text-looks.d.mts +78 -0
  117. package/api/theme-edit/_text-looks.mjs +376 -0
  118. package/api/theme-edit/_vet.d.mts +3 -26
  119. package/api/theme-edit/_vet.mjs +5 -89
  120. package/api/theme-edit/how/how.d.mts +1 -1
  121. package/api/theme-edit/how/how.mjs +1 -1
  122. package/api/theme-edit/show/show.d.mts +4 -3
  123. package/api/theme-edit/show/show.mjs +3 -2
  124. package/api/theme-edit/theme-edit.type.d.mts +117 -1
  125. package/api/theme-edit/theme-edit.type.mjs +46 -3
  126. package/api/theme-edit/themeEditHow.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditNew.doc.mjs +4 -0
  128. package/api/theme-edit/themeEditSet.doc.mjs +6 -2
  129. package/api/theme-edit/themeEditShow.doc.mjs +22 -3
  130. package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
  131. package/assets/component-list.generated.json +1 -1
  132. package/assets/docs/author-a-theme.doc.mjs +7 -4
  133. package/assets/docs/icons.doc.mjs +7 -6
  134. package/assets/docs/theme.doc.dense.mjs +10 -0
  135. package/assets/docs/theme.doc.mjs +10 -0
  136. package/assets/docs/theme.doc.zh.mjs +10 -0
  137. package/assets/docs/tree/export-pages.doc.mjs +1 -1
  138. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  139. package/assets/docs/use-a-theme.doc.mjs +89 -17
  140. package/assets/docs-routes.generated.json +1 -1
  141. package/assets/docs.generated.json +2 -2
  142. package/assets/icons/definitions/article.doc.mjs +9 -0
  143. package/assets/icons/template-icons.json +5 -0
  144. package/assets/search-catalog.generated.json +2 -2
  145. package/assets/self-audit.generated.json +1 -1
  146. package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
  147. package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
  148. package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
  149. package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
  150. package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
  151. package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
  152. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
  153. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
  154. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +9 -1
  155. package/assets/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonShowcase.doc.mjs +9 -2
  156. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.doc.mjs +3 -2
  157. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -1
  158. package/assets/templates/blocks/components/SideNavItem/SideNavItemShowcase.doc.mjs +3 -2
  159. package/assets/templates/blocks/components/SideNavSection/SideNavSectionShowcase.doc.mjs +2 -1
  160. package/assets/templates/components.generated.json +1 -1
  161. package/assets/templates/pages/ide/page.tsx +5 -10
  162. package/assets/templates/pages/payment-form/page.tsx +16 -60
  163. package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
  164. package/authoring/config/parse.mjs +1 -1
  165. package/authoring/debug/parse.d.mts +1 -1
  166. package/authoring/doctypes/_schema.d.mts +13 -13
  167. package/authoring/doctypes/icon-definition/parse.mjs +2 -2
  168. package/authoring/doctypes/icon-set/parse.mjs +1 -1
  169. package/authoring/doctypes/template/parse.mjs +1 -4
  170. package/authoring/gap-report/parse.d.mts +1 -1
  171. package/clients/cli/build-id.generated.json +1 -1
  172. package/clients/cli/commands/ensure-core-built.mjs +17 -10
  173. package/clients/cli/commands/experimental/icon.mjs +7 -7
  174. package/clients/cli/commands/experimental/theme.mjs +175 -13
  175. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  176. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  177. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
  178. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
  179. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
  180. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  181. package/clients/cli/commands/hook.mjs +7 -0
  182. package/clients/cli/commands/template.mjs +1 -1
  183. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  184. package/clients/cli/index.mjs +6 -2
  185. package/clients/cli/lib/hook-format.mjs +41 -1
  186. package/clients/cli/lib/json-shim.mjs +34 -14
  187. package/clients/cli/lib/other-cli-words.mjs +7 -0
  188. package/clients/cli/lib/unknown-command.mjs +345 -46
  189. package/clients/cli/manifest.generated.json +1 -1
  190. package/foundation/agent-docs/agent-docs.d.mts +11 -2
  191. package/foundation/agent-docs/agent-docs.mjs +51 -8
  192. package/foundation/config/project.d.mts +11 -1
  193. package/foundation/config/project.mjs +11 -2
  194. package/foundation/discovery/component-replacement.d.mts +5 -8
  195. package/foundation/discovery/component-replacement.mjs +12 -14
  196. package/foundation/discovery/core-augmentation-points.d.mts +35 -0
  197. package/foundation/discovery/core-augmentation-points.mjs +410 -9
  198. package/foundation/discovery/core-elements.d.mts +6 -0
  199. package/foundation/discovery/core-elements.mjs +10 -2
  200. package/foundation/discovery/core-prop-types.d.mts +5 -0
  201. package/foundation/discovery/core-prop-types.mjs +10 -3
  202. package/foundation/discovery/core-props.d.mts +8 -0
  203. package/foundation/discovery/core-props.mjs +29 -13
  204. package/foundation/discovery/icon-ranking.d.mts +5 -2
  205. package/foundation/discovery/icon-ranking.mjs +101 -18
  206. package/foundation/discovery/icon-set-checks.mjs +1 -1
  207. package/foundation/discovery/icon-set-writer.mjs +1 -1
  208. package/foundation/discovery/official-list.d.mts +17 -0
  209. package/foundation/discovery/official-list.mjs +77 -0
  210. package/foundation/discovery/template-icon-notes.mjs +3 -3
  211. package/foundation/discovery/template-icons.mjs +2 -2
  212. package/foundation/discovery/template-placeholders.mjs +1 -1
  213. package/foundation/discovery/unknown-core-props.d.mts +130 -0
  214. package/foundation/discovery/unknown-core-props.mjs +601 -0
  215. package/foundation/discovery/written-prop-values.d.mts +35 -0
  216. package/foundation/discovery/written-prop-values.mjs +258 -0
  217. package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
  218. package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
  219. package/foundation/fs/package-name.d.mts +10 -0
  220. package/foundation/fs/package-name.mjs +37 -0
  221. package/foundation/fs/project-source-files.d.mts +27 -0
  222. package/foundation/fs/project-source-files.mjs +115 -0
  223. package/foundation/fs/project-sources.d.mts +25 -0
  224. package/foundation/fs/project-sources.mjs +83 -0
  225. package/foundation/fs/read-record.d.mts +18 -0
  226. package/foundation/fs/read-record.mjs +36 -2
  227. package/foundation/integrations/integration-warnings.d.mts +39 -7
  228. package/foundation/integrations/integration-warnings.mjs +141 -19
  229. package/foundation/integrations/missing-dependency.d.mts +11 -0
  230. package/foundation/integrations/missing-dependency.mjs +20 -5
  231. package/foundation/release/folder-lock.d.mts +5 -2
  232. package/foundation/release/folder-lock.mjs +9 -3
  233. package/foundation/release/notices.mjs +2 -8
  234. package/foundation/render/cut-short.d.mts +8 -2
  235. package/foundation/render/cut-short.mjs +50 -5
  236. package/foundation/render/drawn-contrast.d.mts +40 -0
  237. package/foundation/render/drawn-contrast.mjs +355 -0
  238. package/foundation/render/file-header.mjs +4 -0
  239. package/foundation/render/layers.d.mts +2 -1
  240. package/foundation/render/layers.mjs +22 -1
  241. package/foundation/render/package-resolve-hooks.d.mts +38 -9
  242. package/foundation/render/package-resolve-hooks.mjs +124 -32
  243. package/foundation/render/page-worker.mjs +95 -23
  244. package/foundation/render/part-boxes.d.mts +27 -0
  245. package/foundation/render/part-boxes.mjs +45 -0
  246. package/foundation/render/picture-chrome.mjs +36 -4
  247. package/foundation/render/picture-playwright.mjs +26 -2
  248. package/foundation/render/picture-window.d.mts +29 -2
  249. package/foundation/render/picture-window.mjs +99 -1
  250. package/foundation/render/render-page.d.mts +39 -6
  251. package/foundation/render/render-page.mjs +26 -10
  252. package/foundation/render/ts-paths.mjs +2 -1
  253. package/foundation/response/error-codes.doc.mjs +1 -1
  254. package/foundation/response/error-codes.mjs +1 -1
  255. package/foundation/response/response-types.doc.mjs +9 -5
  256. package/foundation/suggest/other-command.mjs +25 -1
  257. package/foundation/text/icon-set-next.d.mts +1 -1
  258. package/foundation/text/icon-set-next.mjs +2 -2
  259. package/foundation/text/written-string.d.mts +4 -1
  260. package/foundation/text/written-string.mjs +4 -1
  261. package/package.json +8 -7
@@ -0,0 +1,54 @@
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
+ * Every value of a numbered look family a part draws ("display headings":
6
+ * display-1 to display-3): the values its prop takes, as its component's
7
+ * doc types them, and any more Core's data saw it drawn in. Sorted.
8
+ * @param {string} family the value without its number, "display"
9
+ * @param {string[]} typed the values the prop's documented type lists
10
+ * @param {string[]} drawn the values Core's data saw
11
+ * @returns {string[]}
12
+ */
13
+ export function numberedLookValues(family: string, typed: string[], drawn: string[]): string[];
14
+ /**
15
+ * A clause on a plural family ("heavy display headings", and "make them
16
+ * blue" after it) is one answer: its drafts, one per look, become the
17
+ * first one, a sequence of each look's first option, in order, with
18
+ * repeated steps said once; the looks' other options (a whole-theme dial
19
+ * offered beside a look's own line) stay out of it, so it changes only the
20
+ * family. The text names each look. A size said for
21
+ * the family is the largest look's: the others scale by the steps between
22
+ * their sizes now (`sizeOf`), so the type scale keeps its shape.
23
+ * Changes `drafts` in place.
24
+ * @template {{text: string, options: object[][], sequence?: boolean}} D
25
+ * @template {{parts: Array<{on: string, when?: string}>, aspects?: string[], colors?: unknown[], lengths?: string[], mode?: string | null}} C
26
+ * @param {D[]} drafts
27
+ * @param {(d: D) => C | undefined} clauseOf
28
+ * @param {C[]} clauses
29
+ * @param {Array<{on: string, whens: string[]}>} families
30
+ * @param {(when: string, on: string) => number | null} sizeOf a look's size
31
+ * now on the family's part, in px
32
+ * @returns {Array<{clause: C, text: string}>} the clauses on a family no
33
+ * look of which writes anything and no draft holds, with what to say
34
+ */
35
+ export function oneAnswerPerFamily<D extends {
36
+ text: string;
37
+ options: object[][];
38
+ sequence?: boolean;
39
+ }, C extends {
40
+ parts: Array<{
41
+ on: string;
42
+ when?: string;
43
+ }>;
44
+ aspects?: string[];
45
+ colors?: unknown[];
46
+ lengths?: string[];
47
+ mode?: string | null;
48
+ }>(drafts: D[], clauseOf: (d: D) => C | undefined, clauses: C[], families: Array<{
49
+ on: string;
50
+ whens: string[];
51
+ }>, sizeOf: (when: string, on: string) => number | null): Array<{
52
+ clause: C;
53
+ text: string;
54
+ }>;
@@ -0,0 +1,179 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file A part's own looks and pieces, read from what Core documents about
5
+ * its components: the values of a numbered look ("display headings"), and
6
+ * one answer for a clause on that whole family.
7
+ * @position api/theme-edit — read by _how-question.mjs; reads lengths with
8
+ * _settings.mjs's lengthPx
9
+ */
10
+
11
+ import {lengthPx} from './_settings.mjs';
12
+
13
+ /**
14
+ * Every value of a numbered look family a part draws ("display headings":
15
+ * display-1 to display-3): the values its prop takes, as its component's
16
+ * doc types them, and any more Core's data saw it drawn in. Sorted.
17
+ * @param {string} family the value without its number, "display"
18
+ * @param {string[]} typed the values the prop's documented type lists
19
+ * @param {string[]} drawn the values Core's data saw
20
+ * @returns {string[]}
21
+ */
22
+ export function numberedLookValues(family, typed, drawn) {
23
+ return [...new Set([...typed, ...drawn])]
24
+ .filter(v => v.startsWith(`${family}-`) && /-\d+$/.test(v))
25
+ .sort((a, b) => Number(/\d+$/.exec(a)?.[0]) - Number(/\d+$/.exec(b)?.[0]));
26
+ }
27
+
28
+ /**
29
+ * A clause on a plural family ("heavy display headings", and "make them
30
+ * blue" after it) is one answer: its drafts, one per look, become the
31
+ * first one, a sequence of each look's first option, in order, with
32
+ * repeated steps said once; the looks' other options (a whole-theme dial
33
+ * offered beside a look's own line) stay out of it, so it changes only the
34
+ * family. The text names each look. A size said for
35
+ * the family is the largest look's: the others scale by the steps between
36
+ * their sizes now (`sizeOf`), so the type scale keeps its shape.
37
+ * Changes `drafts` in place.
38
+ * @template {{text: string, options: object[][], sequence?: boolean}} D
39
+ * @template {{parts: Array<{on: string, when?: string}>, aspects?: string[], colors?: unknown[], lengths?: string[], mode?: string | null}} C
40
+ * @param {D[]} drafts
41
+ * @param {(d: D) => C | undefined} clauseOf
42
+ * @param {C[]} clauses
43
+ * @param {Array<{on: string, whens: string[]}>} families
44
+ * @param {(when: string, on: string) => number | null} sizeOf a look's size
45
+ * now on the family's part, in px
46
+ * @returns {Array<{clause: C, text: string}>} the clauses on a family no
47
+ * look of which writes anything and no draft holds, with what to say
48
+ */
49
+ export function oneAnswerPerFamily(drafts, clauseOf, clauses, families, sizeOf) {
50
+ /** @type {Array<{clause: C, text: string}>} */
51
+ const unanswered = [];
52
+ for (const c of clauses) {
53
+ const fam = families.find(
54
+ f => c.parts.filter(p => p.on === f.on && f.whens.includes(p.when ?? '')).length > 1,
55
+ );
56
+ if (!fam) continue;
57
+ // (Each draft's look, from its own lines; a look with no draft that
58
+ // writes anything, "bigger" from a clamp() size, is left out and said.)
59
+ const lookOf = (/** @type {D} */ d) =>
60
+ /** @type {any[]} */ (d.options[0] ?? []).find(st => fam.whens.includes(st?.when))?.when;
61
+ const kept = fam.whens.filter(w =>
62
+ drafts.some(d => clauseOf(d) === c && d.options.length && lookOf(d) === w),
63
+ );
64
+ const mine = kept.map(
65
+ w => /** @type {D} */ (drafts.find(d => clauseOf(d) === c && d.options.length && lookOf(d) === w)),
66
+ );
67
+ const level = (/** @type {string} */ w) => w.split(':')[1];
68
+ const left = fam.whens.filter(w => !kept.includes(w));
69
+ const noLength = left.every(w => !sizeOf(w, fam.on));
70
+ const leftNote = left.length
71
+ ? `${left.map(level).join(', ')} not changed${noLength ? `: ${left.length > 1 ? 'their sizes are' : 'its size is'} no length now (a clamp() or calc() size), so no step can be taken from ${left.length > 1 ? 'them' : 'it'}` : ''}`
72
+ : '';
73
+ if (mine.length === 0) {
74
+ // (No look writes anything because none has a length size now: one
75
+ // answer names them all, never a "say it as a part and a look". The
76
+ // caller adds it for the clause. Any other ask no look takes keeps
77
+ // the usual answer.)
78
+ // (Only a step ask about size alone, "display headings bigger": a
79
+ // font, an alignment, a color, a size or a mode said with it keeps
80
+ // its own answers, and a draft that writes anything is never
81
+ // dropped.)
82
+ const sizeOnly =
83
+ (c.aspects ?? []).length > 0 &&
84
+ (c.aspects ?? []).every(a => a === 'fontsize') &&
85
+ !(c.colors ?? []).length &&
86
+ !(c.lengths ?? []).length &&
87
+ !c.mode;
88
+ const own = drafts.filter(d => clauseOf(d) === c);
89
+ if (!noLength || !sizeOnly || own.some(d => d.options.length)) continue;
90
+ const text = `${fam.whens.map(level).join(', ')} not changed: their sizes are no length now (a clamp() or calc() size), so no step can be taken from them; say a size for them instead ("${level(fam.whens[0]).replace(/-\d+$/, '')} headings 72px")`;
91
+ if (!own.length) unanswered.push({clause: c, text});
92
+ else {
93
+ own[0].text = text;
94
+ drafts.splice(
95
+ 0,
96
+ drafts.length,
97
+ ...drafts.filter(d => clauseOf(d) !== c || d === own[0]),
98
+ );
99
+ }
100
+ continue;
101
+ }
102
+ if (mine.length === 1) {
103
+ if (leftNote) mine[0].text += `; ${leftNote}`;
104
+ continue;
105
+ }
106
+ const [head, ...rest] = mine;
107
+ const scaled = scaleFamilySizes(mine, kept, w => sizeOf(w, fam.on));
108
+ const seen = new Set();
109
+ head.options = [
110
+ mine
111
+ .flatMap(d => d.options[0] ?? [])
112
+ .filter(st => !seen.has(JSON.stringify(st)) && seen.add(JSON.stringify(st))),
113
+ ];
114
+ head.sequence = true;
115
+ const [attr] = kept[0].split(':');
116
+ head.text = head.text.replace(
117
+ `(${kept[0].replace(':', ' ')})`,
118
+ `(${attr} ${kept.map(level).join(', ')})`,
119
+ );
120
+ if (scaled) head.text += `; ${scaled}`;
121
+ if (leftNote) head.text += `; ${leftNote}`;
122
+ drafts.splice(0, drafts.length, ...drafts.filter(d => !rest.includes(d)));
123
+ }
124
+ return unanswered;
125
+ }
126
+
127
+ /** A step's size in px, or null. @param {unknown} v */
128
+ const pxOf = v => lengthPx(String(v));
129
+
130
+ /**
131
+ * A size in px written in the unit of `like` (px, rem or em).
132
+ * @param {number} px
133
+ * @param {unknown} like
134
+ */
135
+ const inUnitOf = (px, like) => {
136
+ const unit = /(rem|em)\s*$/i.exec(String(like))?.[1]?.toLowerCase();
137
+ return unit ? `${Number((px / 16).toFixed(3))}${unit}` : `${Math.round(px)}px`;
138
+ };
139
+
140
+ /**
141
+ * Scale the size steps of a family's drafts, one draft per look in the
142
+ * order of `whens`: the size said is the largest look's, and every other
143
+ * look's size is that size times the ratio of its size now to the largest
144
+ * look's size now, in the unit said. Says what it wrote, or that the steps
145
+ * cannot be kept when a look's size now is unknown; null when no size is
146
+ * said.
147
+ * @param {Array<{options: object[][]}>} drafts
148
+ * @param {string[]} whens
149
+ * @param {(when: string) => number | null} sizeOf
150
+ * @returns {string | null}
151
+ */
152
+ function scaleFamilySizes(drafts, whens, sizeOf) {
153
+ const isSize = (/** @type {any} */ st) =>
154
+ (st.thing === 'font-size' || /^--text-[\w-]+-size$/.test(st.thing)) && pxOf(st.value) != null;
155
+ const now = whens.map(w => sizeOf(w));
156
+ if (!drafts.some(d => d.options.flat().some(isSize))) return null;
157
+ const level = (/** @type {string} */ w) => w.split(':')[1];
158
+ // (A look whose size now is no length, a clamp() or calc(), leaves the
159
+ // steps unknown: each look takes the size said, and the answer says so.)
160
+ const unknown = whens.filter((_, i) => !now[i]);
161
+ if (unknown.length)
162
+ return `each look takes the size said: the steps between them cannot be kept, since ${unknown
163
+ .map(level)
164
+ .join(', ')}'s size now is no length (a clamp() or calc() size)`;
165
+ const top = now.indexOf(Math.max(.../** @type {number[]} */ (now)));
166
+ const said = drafts[top]?.options.flat().find(isSize);
167
+ if (!said) return null;
168
+ const value = /** @type {any} */ (said).value;
169
+ const px = /** @type {number} */ (pxOf(value));
170
+ const sizes = now.map(n => (px * /** @type {number} */ (n)) / /** @type {number} */ (now[top]));
171
+ const written = sizes.map(v => inUnitOf(v, value));
172
+ drafts.forEach((d, i) => {
173
+ for (const o of d.options) for (const st of o) if (isSize(st)) /** @type {any} */ (st).value = written[i];
174
+ });
175
+ return `${level(whens[top])} ${written[top]}, the others scaled to keep the steps between them (${whens
176
+ .map((w, i) => (i === top ? '' : `${level(w)} ${written[i]}`))
177
+ .filter(Boolean)
178
+ .join(', ')})`;
179
+ }
@@ -16,7 +16,21 @@
16
16
  * @type {Array<[RegExp, {on: string, when?: string, role?: string, level?: string, missing?: string}]>}
17
17
  */
18
18
  export const OVERRIDES = [
19
+ // (Design systems' names for parts Core has under another name: an
20
+ // underline nav is a row of tabs; a navigation rail is the side nav.)
21
+ [/\bunderline[- ]?navs?\b/, {on: 'tab'}],
22
+ [/\b(?:navigation|nav) rails?\b/, {on: 'side-nav'}],
23
+ // (A page's title is its top heading, never the page.)
24
+ [/\bpage (?:titles?|headings?|headers?)\b/, {on: 'heading', level: '1'}],
19
25
  [/\b(?:dividers?|separators?)\b/, {on: 'divider'}],
26
+ // (An action, "a toast's action", is the button it holds: before
27
+ // "button" or at the end of a phrase only. "Action items", "the actions
28
+ // column" and "an actions menu" are other parts. A call to action is the
29
+ // primary button, below.)
30
+ [
31
+ /(?<!\bcalls? to )\bactions?(?:\s+buttons?\b|(?=\s*(?:$|[,.;:!?)])))/,
32
+ {on: 'button'},
33
+ ],
20
34
  // (The page's main panel, the area its content sits in.)
21
35
  [
22
36
  /\b(?:main\s+)?content\s+(?:area|panel|region|pane)s?\b|\bmain\s+(?:area|panel|pane)s?\b/,
@@ -53,7 +67,7 @@ export const OVERRIDES = [
53
67
  [/\b(status dots?)\b/, {on: 'status-dot'}],
54
68
  // (Its indicator too: "the progress indicator".)
55
69
  [
56
- /\b(progress( bar)?( fill| indicators?)?|loading bar)\b/,
70
+ /\b(progress( bars?)?( fill| indicators?)?|loading bar)\b/,
57
71
  {on: 'progress-bar-fill'},
58
72
  ],
59
73
  [
@@ -64,7 +78,12 @@ export const OVERRIDES = [
64
78
  /\b((dropdown |context )?menu (items?|options?|entries)|dropdown items?)\b/,
65
79
  {on: 'dropdown-menu-item'},
66
80
  ],
67
- [/\b(nav(igation)? (links?|items?))\b/, {on: 'top-nav-item'}],
81
+ // (A top nav's or a navbar's links are its items, never the top nav and
82
+ // every link.)
83
+ [
84
+ /\b((?:top )?(?:nav(igation)?(?: ?bar)?|navbar) (links?|items?))\b/,
85
+ {on: 'top-nav-item'},
86
+ ],
68
87
  // A context menu is its own part in Core (its items are the dropdown
69
88
  // menu's items, which it reuses).
70
89
  [/\b(context ?menus?|right[- ]click menus?)\b/, {on: 'context-menu'}],
@@ -84,14 +103,19 @@ export const OVERRIDES = [
84
103
  {on: 'top-nav-heading'},
85
104
  ],
86
105
  [
87
- /(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\b(header|top ?bar|title ?bar|nav ?bar|app ?bar|masthead)\b/,
106
+ /(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\b(header|top ?bar|title ?bar|nav(?:igation)? ?bar|app ?bar|masthead)\b/,
88
107
  {on: 'app-shell-header'},
89
108
  ],
90
109
  [/\b(page|app background|whole background|body background)\b/, {on: 'page'}],
91
110
  // A radio's dot is its own part (the mark a checked radio shows).
92
111
  [/\bradio( button)?s?'?\s+dots?\b/, {on: 'radio-indicator-dot'}],
93
112
  [/\b(radio( buttons?)?|radios)\b/, {on: 'radio-indicator'}],
94
- [/\b(primary|main) buttons?\b/, {on: 'button', when: 'variant:primary'}],
113
+ // (The accent buttons and the call to action are the primary button:
114
+ // the one the accent fills.)
115
+ [
116
+ /\b(primary|main|accent) buttons?\b|\b(?:ctas?|calls? to action)(?: buttons?)?\b/,
117
+ {on: 'button', when: 'variant:primary'},
118
+ ],
95
119
  [/\bsecondary buttons?\b/, {on: 'button', when: 'variant:secondary'}],
96
120
  [/\bghost buttons?\b/, {on: 'button', when: 'variant:ghost'}],
97
121
  [
@@ -160,13 +184,17 @@ export const OVERRIDES = [
160
184
  [/\bkey badges?\b/, {on: 'kbd-key'}],
161
185
  [/\b(badges?|chips?|tags?|lozenges?)\b/, {on: 'badge'}],
162
186
  [/\bh([1-6])\b/, {on: 'heading'}],
187
+ // (A large title, the biggest title a screen has, is its top heading.)
188
+ [/\blarge titles?\b/, {on: 'heading', level: '1'}],
189
+ // (A display heading is the heading's largest display look.)
190
+ [/\bdisplay (?:headings?|titles?|text)\b/, {on: 'heading', when: 'type:display-1'}],
163
191
  [/\b(headings?|titles?)\b/, {on: 'heading'}],
164
192
  [/\b(modals?|popups?)\b/, {on: 'dialog'}],
165
193
  [/\bcode\b/, {on: 'code', role: 'code'}],
166
194
  // Small, secondary and supporting text, captions and fine print: the
167
195
  // supporting text style, not the base size.
168
196
  [
169
- /\b((?:small|secondary|supporting|helper|hint|caption|muted) (?:text|copy)|fine print|captions?)\b/,
197
+ /\b((?:small|secondary|supporting|helper|hint|caption|muted) (?:text|copy)|fine print|captions?|footnotes?)\b/,
170
198
  {on: 'body', role: 'supporting'},
171
199
  ],
172
200
  [/\bbody( text)?\b/, {on: 'body', role: 'body'}],
@@ -94,6 +94,33 @@ export function renderGenerated(project: import("./_project.mjs").ThemeProject,
94
94
  html: string;
95
95
  markup: string;
96
96
  }>;
97
+ /**
98
+ * The runtime states the census finds a part's own element marked with
99
+ * that its doc does not list (a list item rides an Item, whose
100
+ * `data-selected` marks it selected): each `name=name` condition the part
101
+ * reads under, less its visual props. Added to the part's states, so set
102
+ * names them and the build writes them as the data attribute Core marks.
103
+ * @param {{target: Map<string, {props: string[], states: string[]}>}} project
104
+ * @param {PartData} parts
105
+ */
106
+ export function addCensusStates(project: {
107
+ target: Map<string, {
108
+ props: string[];
109
+ states: string[];
110
+ }>;
111
+ }, parts: PartData): void;
112
+ /**
113
+ * A part's states that came from the census alone, not its doc: states
114
+ * Core's theme takes no style key for on that part (a list item rides an
115
+ * Item, whose own `selected` it shows), which the build writes as the
116
+ * attribute Core marks.
117
+ * @param {{target: Map<string, any>}} project
118
+ * @param {string} part
119
+ * @returns {string[]}
120
+ */
121
+ export function censusStatesOf(project: {
122
+ target: Map<string, any>;
123
+ }, part: string): string[];
97
124
  /**
98
125
  * The part data for the installed Core, from the cache or built now.
99
126
  * @param {import('./_project.mjs').ThemeProject} project
@@ -174,7 +201,101 @@ export function walkMarkup(html: string, decls: ReturnType<typeof declarations>,
174
201
  map: Record<string, PartRecord>;
175
202
  pairs: TextPair[];
176
203
  };
204
+ /**
205
+ * The family roles the census shows, each read from the parts' own
206
+ * structure (their tags, states, resting fills, press overlays and their
207
+ * component's doc category), never from their names: a look set on one
208
+ * member of a role reaches the others.
209
+ * - `button-like`: drawn as a <button> with a press overlay and a box of
210
+ * its own (a fill at rest in some variant, or a pressed state), never a
211
+ * selectable item;
212
+ * - `overlays`: an Overlay component's own surface, filled with the
213
+ * surface or popover color;
214
+ * - `option-rows`: a row (a <div> or <li>) clear at rest that is
215
+ * highlighted as you move through a list, or pressed without being
216
+ * selectable;
217
+ * - `selected-items`: a part with a selected (or active) state whose
218
+ * selected look fills it;
219
+ * - `accent-fills`: a part filled with the accent at rest;
220
+ * - `inset-fields`: the inputs and the parts filled with the track color;
221
+ * - `status-surfaces`: a part holding a message with a control of its own
222
+ * whose fill follows a prop whose values name the theme's status roles
223
+ * (info, success, warning, error);
224
+ * - `overlay-headers`: an Overlay component's part, not its surface, that
225
+ * holds a heading and a control (its title and its close button);
226
+ * - `controls`: the parts that take their height from the control size
227
+ * tokens (`--size-element-sm`, `-md`, `-lg`) and are a button, an input,
228
+ * or a form control's own part (an input group): at each size they share
229
+ * one height.
230
+ * @param {{MAP: Record<string, any>}} C
231
+ * @param {{target: Map<string, any>, components: Record<string, any>}} project
232
+ * @param {string[]} inputs the inputs group's members
233
+ * @param {string[]} statusWords the theme's status role words
234
+ * @returns {Record<'button-like' | 'overlays' | 'option-rows' | 'selected-items' | 'accent-fills' | 'inset-fields' | 'status-surfaces' | 'overlay-headers' | 'controls', string[]>}
235
+ */
236
+ export function familyRoles(C: {
237
+ MAP: Record<string, any>;
238
+ }, project: {
239
+ target: Map<string, any>;
240
+ components: Record<string, any>;
241
+ }, inputs?: string[], statusWords?: string[]): Record<"button-like" | "overlays" | "option-rows" | "selected-items" | "accent-fills" | "inset-fields" | "status-surfaces" | "overlay-headers" | "controls", string[]>;
242
+ /**
243
+ * The value a part draws a property with as the census saw it: the one it
244
+ * always has, else the one every condition it was drawn in agrees on; null
245
+ * when it sets none (or conditions differ).
246
+ * @param {PartRecord | undefined} rec
247
+ * @param {string} prop
248
+ * @returns {string | null}
249
+ */
250
+ export function drawnValue(rec: PartRecord | undefined, prop: string): string | null;
251
+ /**
252
+ * The bar rows a part holds, from the part map's `contains` relation: the
253
+ * parts drawn inside it that lay their own children out in one row,
254
+ * centered across its whole width (display flex, align-items center, width
255
+ * 100%: the top nav in the app's header) and holding items of more than
256
+ * one kind, drawn there once (a part listed inside it is a list's item,
257
+ * never its bar's row: a menu's items, a side nav's items), neither of them
258
+ * drawn as a control (a collapsible's trigger, an avatar's button), reached
259
+ * through frames that draw no box of their own (a layout region). A part
260
+ * holding such a row is laid out as a bar:
261
+ * a height or a vertical padding set on it makes the bar that row fills.
262
+ * @param {Record<string, PartRecord>} map
263
+ * @param {string} holder
264
+ * @returns {string[]}
265
+ */
266
+ export function barRows(map: Record<string, PartRecord>, holder: string): string[];
267
+ /**
268
+ * A pair of block-direction sides (top and bottom) one family of
269
+ * properties gives, read from `get(prop)`: the longhands win over
270
+ * `<family>-block`, which wins over the shorthand. Null sides are unset.
271
+ * @param {(prop: string) => string | null} get
272
+ * @param {'padding' | 'border-width'} family
273
+ * @returns {[string | null, string | null]}
274
+ */
275
+ export function blockSides(get: (prop: string) => string | null, family: "padding" | "border-width"): [string | null, string | null];
276
+ /**
277
+ * A part's measured height as it is drawn, in px: its own height or
278
+ * min-height when it gives one in px, else its vertical padding and
279
+ * borders around one line of its text (its line height: a length, or a
280
+ * number times its font size). The theme's own values (`own(prop)`) win
281
+ * over the ones Core draws it with (the part map's); `px(value)` reads a
282
+ * length, tokens resolved (null when the value is no length). Null when
283
+ * neither a height nor a line height reads.
284
+ * @param {Record<string, PartRecord>} map
285
+ * @param {string} part
286
+ * @param {(prop: string) => string | null} own
287
+ * @param {Record<string, unknown>} tokens the token values a var() reads
288
+ * @param {(value: string) => number | null} pxOf
289
+ * @returns {number | null}
290
+ */
291
+ export function partHeightPx(map: Record<string, PartRecord>, part: string, own: (prop: string) => string | null, tokens: Record<string, unknown>, pxOf: (value: string) => number | null): number | null;
292
+ /** Text properties CSS inherits, which a part passes to the text inside it. */
293
+ export const INHERITED_TEXT: RegExp;
177
294
  export function renderDir(project: import("./_project.mjs").ThemeProject): string;
295
+ /** The properties a control's height is set by. */
296
+ export const CONTROL_HEIGHT_PROPS: RegExp;
297
+ /** The tokens that hold a control's height at each size. */
298
+ export const CONTROL_SIZE_TOKEN: RegExp;
178
299
  export type PartRecord = {
179
300
  /**
180
301
  * - property -> tokens (with conditions) and raw values
@@ -191,6 +312,10 @@ export type PartRecord = {
191
312
  * - tokens read by unnamed elements inside the part -> properties
192
313
  */
193
314
  inside: Record<string, string[]>;
315
+ /**
316
+ * - inherited text properties a visible unnamed element inside the part that holds text sets to values of its own -> those values (a code block's lines: white-space pre or pre-wrap)
317
+ */
318
+ innerSets?: Record<string, string[]> | undefined;
194
319
  /**
195
320
  * - data attributes seen on the part
196
321
  */
@@ -199,10 +324,18 @@ export type PartRecord = {
199
324
  * - parts rendered inside it
200
325
  */
201
326
  contains: string[];
327
+ /**
328
+ * - the other parts drawn on the same element (a select's option is drawn as an Item)
329
+ */
330
+ drawnAs?: string[] | undefined;
202
331
  /**
203
332
  * - parts it holds more than one of side by side, as the nearest part around them (a shortcut's keys, a button group's buttons)
204
333
  */
205
334
  repeats?: string[] | undefined;
335
+ /**
336
+ * - the parts inside it drawn more than once in one of its elements (a menu's items), unlike a part drawn there once (a header's nav)
337
+ */
338
+ listed?: string[] | undefined;
206
339
  /**
207
340
  * - for a part rendered inside it, the variants it is drawn in there (a toast's close button: ghost)
208
341
  */