@astryxdesign/cli 0.7.17 → 0.7.18-canary.g6dfc0b6

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 (213) 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/doctor/_adapter.d.mts +11 -62
  5. package/api/doctor/_adapter.mjs +242 -472
  6. package/api/doctor/doctor.d.mts +1 -1
  7. package/api/doctor/doctor.mjs +1 -1
  8. package/api/doctor/theme-checks.mjs +37 -45
  9. package/api/error.d.mts +21 -0
  10. package/api/error.mjs +89 -0
  11. package/api/hook/list/list.d.mts +1 -1
  12. package/api/icon/icon.doc.mjs +1 -1
  13. package/api/icon/icon.type.mjs +1 -1
  14. package/api/icon/search/search.d.mts +4 -1
  15. package/api/icon/search/search.mjs +41 -4
  16. package/api/render/_adapter.mjs +233 -40
  17. package/api/render/render.type.d.mts +1 -1
  18. package/api/render/render.type.mjs +1 -1
  19. package/api/search/ORDERING.md +2 -2
  20. package/api/search/_candidate-score.mjs +32 -8
  21. package/api/search/_cards.json +1 -1
  22. package/api/search/_compound.d.mts +0 -1
  23. package/api/search/_compound.mjs +93 -2
  24. package/api/search/_lexical.mjs +177 -17
  25. package/api/search/_order.d.mts +3 -1
  26. package/api/search/_order.mjs +16 -5
  27. package/api/search/_result.d.mts +9 -0
  28. package/api/search/_result.mjs +10 -0
  29. package/api/search/_score.mjs +21 -3
  30. package/api/swizzle/_moduleGraph.d.mts +8 -0
  31. package/api/swizzle/_moduleGraph.mjs +61 -3
  32. package/api/template/copy/copy.mjs +5 -3
  33. package/api/theme/_adapter.mjs +48 -12
  34. package/api/theme/build/build.d.mts +4 -0
  35. package/api/theme/build/build.mjs +69 -18
  36. package/api/theme/build/style-keys.mjs +4 -5
  37. package/api/theme/build/theme-object.mjs +5 -0
  38. package/api/theme/palette/generate/color.d.mts +47 -0
  39. package/api/theme/palette/generate/color.mjs +58 -1
  40. package/api/theme/palette/generate/derive-look.d.mts +293 -0
  41. package/api/theme/palette/generate/derive-look.mjs +1362 -0
  42. package/api/theme/palette/generate/editor-look.d.mts +62 -0
  43. package/api/theme/palette/generate/editor-look.mjs +550 -0
  44. package/api/theme/palette/generate/mapping.d.mts +94 -9
  45. package/api/theme/palette/generate/mapping.mjs +94 -22
  46. package/api/theme-edit/_adapter.mjs +10 -1
  47. package/api/theme-edit/_catalog.d.mts +13 -13
  48. package/api/theme-edit/_catalog.mjs +38 -16
  49. package/api/theme-edit/_check.d.mts +82 -6
  50. package/api/theme-edit/_check.mjs +1230 -223
  51. package/api/theme-edit/_color.d.mts +74 -0
  52. package/api/theme-edit/_color.mjs +168 -3
  53. package/api/theme-edit/_compiler.d.mts +3 -5
  54. package/api/theme-edit/_compiler.mjs +122 -23
  55. package/api/theme-edit/_context.d.mts +46 -5
  56. package/api/theme-edit/_context.mjs +97 -49
  57. package/api/theme-edit/_css.d.mts +11 -0
  58. package/api/theme-edit/_css.mjs +40 -0
  59. package/api/theme-edit/_edit.d.mts +13 -0
  60. package/api/theme-edit/_edit.mjs +1450 -128
  61. package/api/theme-edit/_how-commands.d.mts +12 -0
  62. package/api/theme-edit/_how-commands.mjs +96 -14
  63. package/api/theme-edit/_how-question.d.mts +73 -29
  64. package/api/theme-edit/_how-question.mjs +8131 -1209
  65. package/api/theme-edit/_how-sides.d.mts +22 -0
  66. package/api/theme-edit/_how-sides.mjs +173 -0
  67. package/api/theme-edit/_how-steps.d.mts +42 -0
  68. package/api/theme-edit/_how-steps.mjs +208 -0
  69. package/api/theme-edit/_how-values.d.mts +29 -0
  70. package/api/theme-edit/_how-values.mjs +111 -0
  71. package/api/theme-edit/_how-words.d.mts +15 -0
  72. package/api/theme-edit/_how-words.mjs +239 -0
  73. package/api/theme-edit/_how.d.mts +1 -1
  74. package/api/theme-edit/_how.mjs +412 -37
  75. package/api/theme-edit/_missed.d.mts +2 -1
  76. package/api/theme-edit/_missed.mjs +125 -13
  77. package/api/theme-edit/_normal.d.mts +5 -3
  78. package/api/theme-edit/_normal.mjs +54 -14
  79. package/api/theme-edit/_palette.d.mts +204 -4
  80. package/api/theme-edit/_palette.mjs +901 -25
  81. package/api/theme-edit/_part-pieces.d.mts +54 -0
  82. package/api/theme-edit/_part-pieces.mjs +179 -0
  83. package/api/theme-edit/_part-words.mjs +33 -5
  84. package/api/theme-edit/_parts.d.mts +133 -0
  85. package/api/theme-edit/_parts.mjs +599 -10
  86. package/api/theme-edit/_picture-traits.d.mts +259 -0
  87. package/api/theme-edit/_picture-traits.mjs +1030 -0
  88. package/api/theme-edit/_preview.d.mts +84 -4
  89. package/api/theme-edit/_preview.mjs +260 -24
  90. package/api/theme-edit/_project.d.mts +14 -4
  91. package/api/theme-edit/_project.mjs +95 -26
  92. package/api/theme-edit/_set-line.d.mts +29 -0
  93. package/api/theme-edit/_set-line.mjs +100 -0
  94. package/api/theme-edit/_settings.d.mts +625 -28
  95. package/api/theme-edit/_settings.mjs +4587 -880
  96. package/api/theme-edit/_tables.d.mts +25 -1
  97. package/api/theme-edit/_tables.mjs +115 -11
  98. package/api/theme-edit/_text-looks.d.mts +78 -0
  99. package/api/theme-edit/_text-looks.mjs +376 -0
  100. package/api/theme-edit/_vet.d.mts +3 -26
  101. package/api/theme-edit/_vet.mjs +5 -89
  102. package/api/theme-edit/how/how.d.mts +1 -1
  103. package/api/theme-edit/how/how.mjs +1 -1
  104. package/api/theme-edit/theme-edit.type.d.mts +54 -1
  105. package/api/theme-edit/theme-edit.type.mjs +17 -2
  106. package/api/theme-edit/themeEditHow.doc.mjs +3 -3
  107. package/api/theme-edit/themeEditNew.doc.mjs +4 -0
  108. package/api/theme-edit/themeEditSet.doc.mjs +6 -2
  109. package/api/theme-edit/themeEditShow.doc.mjs +4 -0
  110. package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
  111. package/assets/component-list.generated.json +1 -1
  112. package/assets/docs/author-a-theme.doc.mjs +7 -4
  113. package/assets/docs/tree/export-pages.doc.mjs +1 -1
  114. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  115. package/assets/docs/use-a-theme.doc.mjs +89 -17
  116. package/assets/docs-routes.generated.json +1 -1
  117. package/assets/docs.generated.json +2 -2
  118. package/assets/icons/definitions/article.doc.mjs +9 -0
  119. package/assets/icons/template-icons.json +5 -0
  120. package/assets/search-catalog.generated.json +2 -2
  121. package/assets/self-audit.generated.json +1 -1
  122. package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
  123. package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
  124. package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
  125. package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
  126. package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
  127. package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
  128. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
  129. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
  130. package/assets/templates/components.generated.json +1 -1
  131. package/assets/templates/pages/ide/page.tsx +5 -10
  132. package/assets/templates/pages/payment-form/page.tsx +16 -60
  133. package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
  134. package/authoring/debug/parse.d.mts +1 -1
  135. package/authoring/doctypes/_schema.d.mts +13 -13
  136. package/authoring/gap-report/parse.d.mts +1 -1
  137. package/clients/cli/build-id.generated.json +1 -1
  138. package/clients/cli/commands/ensure-core-built.mjs +17 -10
  139. package/clients/cli/commands/experimental/theme.mjs +46 -6
  140. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  141. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  142. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
  143. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
  144. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  145. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  146. package/clients/cli/commands/hook.mjs +7 -0
  147. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  148. package/clients/cli/index.mjs +6 -2
  149. package/clients/cli/lib/hook-format.mjs +41 -1
  150. package/clients/cli/lib/json-shim.mjs +34 -14
  151. package/clients/cli/lib/other-cli-words.mjs +7 -0
  152. package/clients/cli/lib/unknown-command.mjs +345 -46
  153. package/clients/cli/manifest.generated.json +1 -1
  154. package/foundation/agent-docs/agent-docs.d.mts +11 -2
  155. package/foundation/agent-docs/agent-docs.mjs +51 -8
  156. package/foundation/config/project.d.mts +11 -1
  157. package/foundation/config/project.mjs +11 -2
  158. package/foundation/discovery/component-replacement.d.mts +5 -8
  159. package/foundation/discovery/component-replacement.mjs +12 -14
  160. package/foundation/discovery/core-augmentation-points.d.mts +35 -0
  161. package/foundation/discovery/core-augmentation-points.mjs +410 -9
  162. package/foundation/discovery/core-elements.d.mts +6 -0
  163. package/foundation/discovery/core-elements.mjs +10 -2
  164. package/foundation/discovery/core-prop-types.d.mts +5 -0
  165. package/foundation/discovery/core-prop-types.mjs +10 -3
  166. package/foundation/discovery/core-props.d.mts +8 -0
  167. package/foundation/discovery/core-props.mjs +29 -13
  168. package/foundation/discovery/official-list.d.mts +17 -0
  169. package/foundation/discovery/official-list.mjs +77 -0
  170. package/foundation/discovery/unknown-core-props.d.mts +130 -0
  171. package/foundation/discovery/unknown-core-props.mjs +601 -0
  172. package/foundation/discovery/written-prop-values.d.mts +35 -0
  173. package/foundation/discovery/written-prop-values.mjs +258 -0
  174. package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
  175. package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
  176. package/foundation/fs/package-name.d.mts +10 -0
  177. package/foundation/fs/package-name.mjs +37 -0
  178. package/foundation/fs/project-source-files.d.mts +27 -0
  179. package/foundation/fs/project-source-files.mjs +115 -0
  180. package/foundation/fs/project-sources.d.mts +25 -0
  181. package/foundation/fs/project-sources.mjs +83 -0
  182. package/foundation/fs/read-record.d.mts +18 -0
  183. package/foundation/fs/read-record.mjs +36 -2
  184. package/foundation/integrations/integration-warnings.d.mts +39 -7
  185. package/foundation/integrations/integration-warnings.mjs +141 -19
  186. package/foundation/integrations/missing-dependency.d.mts +11 -0
  187. package/foundation/integrations/missing-dependency.mjs +20 -5
  188. package/foundation/release/folder-lock.d.mts +5 -2
  189. package/foundation/release/folder-lock.mjs +9 -3
  190. package/foundation/release/notices.mjs +2 -8
  191. package/foundation/render/cut-short.d.mts +8 -2
  192. package/foundation/render/cut-short.mjs +50 -5
  193. package/foundation/render/drawn-contrast.d.mts +38 -0
  194. package/foundation/render/drawn-contrast.mjs +237 -0
  195. package/foundation/render/file-header.mjs +4 -0
  196. package/foundation/render/layers.d.mts +2 -1
  197. package/foundation/render/layers.mjs +22 -1
  198. package/foundation/render/page-worker.mjs +83 -18
  199. package/foundation/render/part-boxes.d.mts +27 -0
  200. package/foundation/render/part-boxes.mjs +45 -0
  201. package/foundation/render/picture-chrome.mjs +36 -4
  202. package/foundation/render/picture-playwright.mjs +26 -2
  203. package/foundation/render/picture-window.d.mts +29 -2
  204. package/foundation/render/picture-window.mjs +99 -1
  205. package/foundation/render/render-page.d.mts +39 -6
  206. package/foundation/render/render-page.mjs +26 -10
  207. package/foundation/render/ts-paths.mjs +2 -1
  208. package/foundation/response/error-codes.doc.mjs +1 -1
  209. package/foundation/response/error-codes.mjs +1 -1
  210. package/foundation/response/response-types.doc.mjs +1 -1
  211. package/foundation/text/written-string.d.mts +4 -1
  212. package/foundation/text/written-string.mjs +4 -1
  213. package/package.json +8 -7
@@ -10,6 +10,14 @@
10
10
  * @returns {Promise<HowTheme>}
11
11
  */
12
12
  export function howTheme(ctx: import("./_settings.mjs").Ctx, cwd: string, name: string | undefined): Promise<HowTheme>;
13
+ /**
14
+ * Apply one step to theme data in memory, as `set` and `undo` do.
15
+ * @param {import('./_settings.mjs').Ctx} ctx
16
+ * @param {string} slug
17
+ * @param {import('./_settings.mjs').ThemeData} d
18
+ * @param {Step} st
19
+ */
20
+ export function apply(ctx: import("./_settings.mjs").Ctx, slug: string, d: import("./_settings.mjs").ThemeData, st: Step): void;
13
21
  /**
14
22
  * A step as the command a person runs.
15
23
  * @param {Step} st
@@ -94,9 +102,13 @@ export type HowTheme = {
94
102
  */
95
103
  bodyFontReachesHeadings: boolean;
96
104
  data: import("./_settings.mjs").ThemeData;
105
+ /**
106
+ * - `onDark`: the tokens the base's dark media rule replaces
107
+ */
97
108
  base: {
98
109
  light: Record<string, string>;
99
110
  dark: Record<string, string>;
111
+ onDark?: Record<string, string>;
100
112
  };
101
113
  /**
102
114
  * - The theme's own values: the base's with its settings applied.
@@ -10,7 +10,14 @@
10
10
 
11
11
  import {AstryxError} from '../error.mjs';
12
12
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
13
- import {checkSetting, indicatorLines, pillDrawnRadios} from './_check.mjs';
13
+ import {
14
+ BORDER_COLOR_PROP,
15
+ borderFor,
16
+ broughtBorderAt,
17
+ checkSetting,
18
+ indicatorLines,
19
+ pillDrawnRadios,
20
+ } from './_check.mjs';
14
21
  import {baseResolved} from './_project.mjs';
15
22
  import {readThemeListState} from '../theme/_adapter.mjs';
16
23
  import {
@@ -20,8 +27,9 @@ import {
20
27
  loadTheme,
21
28
  readHistory,
22
29
  themeFiles,
30
+ groupsOf,
23
31
  } from './_settings.mjs';
24
- import {FAMILIES, GROUPS, LIKE, P} from './_tables.mjs';
32
+ import {GROUPS, LIKE, P} from './_tables.mjs';
25
33
  import {hexToOklch} from '../theme/palette/generate/color.mjs';
26
34
  import {
27
35
  COLOR_IN_VALUE,
@@ -63,7 +71,7 @@ export const EXAMPLE_THEME = 'my-theme';
63
71
  * @property {number} undoSteps - How many changes `undo` can step back.
64
72
  * @property {boolean} bodyFontReachesHeadings - Whether `font X --on body` also changes the heading font in this release.
65
73
  * @property {import('./_settings.mjs').ThemeData} data
66
- * @property {{light: Record<string, string>, dark: Record<string, string>}} base
74
+ * @property {{light: Record<string, string>, dark: Record<string, string>, onDark?: Record<string, string>}} base - `onDark`: the tokens the base's dark media rule replaces
67
75
  * @property {{light: Record<string, string>, dark: Record<string, string>}} [own] - The theme's own values: the base's with its settings applied.
68
76
  * @property {(steps: Step[]) => {ok: true} | {ok: false, why: string, run?: string[]}} check
69
77
  * @property {(steps: Step[], part: string, prop: string) => {light: string, dark: string} | null} valueAfter what a part shows for a property at rest after the steps, in each mode, or null when it reads none
@@ -74,12 +82,37 @@ export const EXAMPLE_THEME = 'my-theme';
74
82
  * The theme's own token values in each mode: the base theme's, with the
75
83
  * theme's settings applied (a whole-theme corners setting, an exact
76
84
  * token), as `compile` builds them.
85
+ * A type scale the theme writes (the text-size and type dials write one)
86
+ * is expanded the way Core expands it, so a heading size reads as the
87
+ * scale draws it, not as the base theme's.
77
88
  * @param {any} compiled
78
89
  * @param {{light: Record<string, string>, dark: Record<string, string>}} base
90
+ * @param {any} [core] the project's Core module, which expands the scale
79
91
  * @returns {{light: Record<string, string>, dark: Record<string, string>}}
80
92
  */
81
- function ownTokens(compiled, base) {
93
+ function ownTokens(compiled, base, core) {
82
94
  const out = {light: {...base.light}, dark: {...base.dark}};
95
+ const scale = compiled?.typography?.scale;
96
+ if (
97
+ scale &&
98
+ typeof scale.base === 'number' &&
99
+ typeof scale.ratio === 'number' &&
100
+ typeof core?.expandTypeScale === 'function'
101
+ ) {
102
+ try {
103
+ const expanded = core.expandTypeScale({
104
+ base: scale.base,
105
+ ratio: scale.ratio,
106
+ });
107
+ for (const [k, v] of Object.entries(expanded ?? {}))
108
+ if (typeof v === 'string' && /^--font-size-|^--text-.*-size$/.test(k)) {
109
+ out.light[k] = v;
110
+ out.dark[k] = v;
111
+ }
112
+ } catch {
113
+ // (A Core that cannot expand the scale leaves the base sizes.)
114
+ }
115
+ }
83
116
  for (const [k, v] of Object.entries(compiled?.tokens ?? {})) {
84
117
  const pair = Array.isArray(v)
85
118
  ? v
@@ -209,7 +242,7 @@ export async function howTheme(ctx, cwd, name) {
209
242
  : 'last-changed',
210
243
  data: theme,
211
244
  base,
212
- own: ownTokens(compileTheme(ctx, theme, base), base),
245
+ own: ownTokens(compileTheme(ctx, theme, base), base, ctx.project?.core),
213
246
  undoSteps: exists
214
247
  ? readHistory(themeFiles(cwd, slug).history).steps.length
215
248
  : 0,
@@ -260,7 +293,7 @@ export async function howTheme(ctx, cwd, name) {
260
293
  return null;
261
294
  }
262
295
  const now = compileTheme(ctx, d, base);
263
- const toks = ownTokens(now, base);
296
+ const toks = ownTokens(now, base, ctx.project?.core);
264
297
  const camel = prop.replace(/-([a-z])/g, (_m, x) => x.toUpperCase());
265
298
  /** @type {Record<string, any>} */
266
299
  const rules = {
@@ -565,9 +598,10 @@ function ruleValue(compiled, part, render, prop) {
565
598
  * @param {Step[]} steps
566
599
  * @param {MeasureIntent} intent
567
600
  * @param {'light' | 'dark' | null} visible
601
+ * @param {Record<string, string[]>} groups the family groups `--on` takes, read from the census
568
602
  * @returns {string | null}
569
603
  */
570
- function lineWay(C, was, now, tw, tn, steps, intent, visible) {
604
+ function lineWay(C, was, now, tw, tn, steps, intent, visible, groups) {
571
605
  const fainter = Boolean(intent.fainter) || intent.zero;
572
606
  // (A dial set to a named look, "the buttons dial, outline", draws that
573
607
  // look's lines: a line it adds is the look asked.)
@@ -587,7 +621,7 @@ function lineWay(C, was, now, tw, tn, steps, intent, visible) {
587
621
  steps
588
622
  .map(st => st.on)
589
623
  .filter(Boolean)
590
- .flatMap(x => FAMILIES[String(x)] ?? [String(x)]),
624
+ .flatMap(x => groups[String(x)] ?? [String(x)]),
591
625
  );
592
626
  if (changedTokens.size)
593
627
  for (const [part, info] of Object.entries(C.MAP ?? {}))
@@ -788,11 +822,11 @@ const luminance = c => c[0] * 0.299 + c[1] * 0.587 + c[2] * 0.114;
788
822
  * @param {'light' | 'dark' | null} [visible] the one mode a one-mode theme shows
789
823
  */
790
824
  function measureFit(ctx, base, was, now, intent, steps, visible = null) {
791
- const tw = ownTokens(was, base);
792
- const tn = ownTokens(now, base);
825
+ const tw = ownTokens(was, base, ctx.project?.core);
826
+ const tn = ownTokens(now, base, ctx.project?.core);
793
827
  const C = ctx.C;
794
828
  /** @param {string} part */
795
- const members = part => FAMILIES[part] ?? [part];
829
+ const members = part => groupsOf(ctx)[part] ?? [part];
796
830
  // A kept part, or one state or variant of it (`part@when|state|`).
797
831
  /** @type {Array<{part: string, prefix: string}>} */
798
832
  const keeps = intent.keep.flatMap(k => {
@@ -1090,7 +1124,17 @@ function measureFit(ctx, base, was, now, intent, steps, visible = null) {
1090
1124
  (Boolean(intent.dir) &&
1091
1125
  intent.families.some(f => f === 'border' || f === 'shadow'));
1092
1126
  if (lineAsk) {
1093
- const why = lineWay(C, was, now, tw, tn, steps, intent, visible);
1127
+ const why = lineWay(
1128
+ C,
1129
+ was,
1130
+ now,
1131
+ tw,
1132
+ tn,
1133
+ steps,
1134
+ intent,
1135
+ visible,
1136
+ groupsOf(ctx),
1137
+ );
1094
1138
  if (why) return why;
1095
1139
  }
1096
1140
  const typed = new Set(intent.typed.map(x => x.toLowerCase()));
@@ -1148,6 +1192,15 @@ function measureFit(ctx, base, was, now, intent, steps, visible = null) {
1148
1192
  ? a.get('base||border-width')
1149
1193
  : a.get(`base||${prop}`));
1150
1194
  if (o && o.light === v.light && o.dark === v.dark) continue;
1195
+ // The see-through border a border color brings to a part that draws
1196
+ // none (set writes it with the color) is that color's line: asked
1197
+ // with it, never a change of its own.
1198
+ if (
1199
+ prop === 'border' &&
1200
+ /\btransparent\b/.test(`${v.light} ${v.dark}`) &&
1201
+ steps.some(st => BORDER_COLOR_PROP.test(String(st.thing)))
1202
+ )
1203
+ continue;
1151
1204
  const fam = familyOf(prop);
1152
1205
  if (!fam) continue;
1153
1206
  // A property a typed value writes is asked: the question wrote it.
@@ -1447,7 +1500,7 @@ function measureFit(ctx, base, was, now, intent, steps, visible = null) {
1447
1500
  * @param {import('./_settings.mjs').ThemeData} d
1448
1501
  * @param {Step} st
1449
1502
  */
1450
- function apply(ctx, slug, d, st) {
1503
+ export function apply(ctx, slug, d, st) {
1451
1504
  const unset = st.verb === 'undo';
1452
1505
  const s = checkSetting(
1453
1506
  ctx,
@@ -1455,9 +1508,28 @@ function apply(ctx, slug, d, st) {
1455
1508
  d,
1456
1509
  st.thing,
1457
1510
  st.value,
1458
- {on: st.on, when: st.when, state: st.state, mode: st.mode, only: st.only},
1511
+ {
1512
+ on: st.on,
1513
+ when: st.when,
1514
+ state: st.state,
1515
+ mode: st.mode,
1516
+ only: st.only,
1517
+ // A box shorthand `set` writes as its sides is checked the same way.
1518
+ ...(unset ? {} : {sides: true}),
1519
+ },
1459
1520
  unset,
1460
1521
  );
1522
+ // The sides replace the typed shorthand and each its own earlier entry,
1523
+ // as set writes them.
1524
+ if (!unset && s.sides?.length) {
1525
+ const typed = keyOf(s);
1526
+ d.settings = d.settings.filter(x => keyOf(x) !== typed);
1527
+ for (const side of s.sides) {
1528
+ d.settings = d.settings.filter(x => keyOf(x) !== keyOf(side));
1529
+ d.settings.push(side);
1530
+ }
1531
+ return;
1532
+ }
1461
1533
  if (!unset && s.thing === 'mode') {
1462
1534
  d.mode = /** @type {'both' | 'light-only' | 'dark-only'} */ (s.value);
1463
1535
  return;
@@ -1468,7 +1540,17 @@ function apply(ctx, slug, d, st) {
1468
1540
  [],
1469
1541
  ERROR_CODES.ERR_INVALID_ARGUMENT,
1470
1542
  );
1543
+ // A border color on a part that draws no border brings the border it
1544
+ // needs, as set writes it.
1545
+ const edge = unset ? null : borderFor(ctx, slug, d, s);
1471
1546
  const k = keyOf(s);
1547
+ // (With a border brought, the color goes after it, as set writes them:
1548
+ // a color the theme saves already moves last, never stays before the
1549
+ // border, whose shorthand would reset it.)
1550
+ if (edge) {
1551
+ d.settings = d.settings.filter(x => keyOf(x) !== k);
1552
+ d.settings.splice(broughtBorderAt(ctx, d.settings, edge), 0, edge);
1553
+ }
1472
1554
  const i = d.settings.findIndex(x => keyOf(x) === k);
1473
1555
  if (unset) {
1474
1556
  if (i < 0)
@@ -1,6 +1,25 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The corners of a box a clause names, as the logical longhands' keys
6
+ * (start-start is top-left in a left-to-right page): "the top corners",
7
+ * "rounded on top", "the top-left corner", "on the right side", "except
8
+ * the bottom". The words of the part the clause is about are left out
9
+ * first, so "bottom sheet" or "top nav" names no corner. `only` is true
10
+ * when the clause says the other corners are not to be rounded ("only",
11
+ * "just", "except"); `except` when the named corners are the ones left out.
12
+ * Null when it names none.
13
+ * @param {string} text
14
+ * @param {string | null} [part] the part (or group) the clause is about
15
+ * @param {RegExp[]} [names] the part's other names the clause can say
16
+ * @returns {{corners: string[], only: boolean, except: boolean} | null}
17
+ */
18
+ export function cornersNamed(text: string, part?: string | null, names?: RegExp[]): {
19
+ corners: string[];
20
+ only: boolean;
21
+ except: boolean;
22
+ } | null;
4
23
  /**
5
24
  * Warmer or cooler: mix in a warm (amber) or cool (blue) tint and keep the
6
25
  * color's lightness, so the hue moves and the light/dark does not.
@@ -14,27 +33,12 @@ export function tempShift(color: string, way: "warm" | "cool", amount: number):
14
33
  * @param {string} color @param {number} amount 0 to 1
15
34
  */
16
35
  export function calmShift(color: string, amount: number): string | null;
17
- /**
18
- * A box-shadow with each layer's blur scaled (the third length); offsets,
19
- * spread, inset and color stay. Null when no layer has a blur to scale.
20
- * @param {string} shadow @param {number} f
21
- */
22
- export function blurScaled(shadow: string, f: number): string | null;
23
36
  /**
24
37
  * The share a color amount gives ("30% lighter", "half as dark"): a
25
38
  * number from 0 to 0.9, or the fallback.
26
39
  * @param {string} text @param {number} fallback
27
40
  */
28
41
  export function colorAmount(text: string, fallback: number): number;
29
- /**
30
- * {@link shift} that keeps a see-through color see-through: its alpha
31
- * stays, only its hue moves. A see-through ink paints over the page, so
32
- * whether more of it is lighter is read against that page's color.
33
- * @param {string} color @param {number} amount
34
- * @param {string | null} [page] the page color it paints over (white when
35
- * not given)
36
- */
37
- export function shiftKeepAlpha(color: string, amount: number, page?: string | null): string | null;
38
42
  /**
39
43
  * The color token a part reads at rest for a group (its fill or its text):
40
44
  * the variant asked for, else its main variant (primary, accent), else any
@@ -65,15 +69,6 @@ export function hueOf(color: string): number | null;
65
69
  * @param {number} step degrees
66
70
  */
67
71
  export function hueToward(color: string, target: number, step: number): string | null;
68
- /**
69
- * A shadow with the alpha of each of its colors scaled (clamped to 0–1),
70
- * layers, offsets and blur kept; with a mode, only that half of each
71
- * light-dark() color.
72
- * @param {string} value
73
- * @param {number} k
74
- * @param {'light' | 'dark' | null} [mode]
75
- */
76
- export function shadowAlphaScaled(value: string, k: number, mode?: "light" | "dark" | null): string;
77
72
  /**
78
73
  * A shadow with each of its colors at one alpha, layers, offsets and blur
79
74
  * kept: a see-through layer (a ring Core keeps transparent) stays so.
@@ -113,6 +108,26 @@ export function partLexicon(ctx: import("./_settings.mjs").Ctx): {
113
108
  parts: Array<[RegExp, PartRef]>;
114
109
  vocab: string[];
115
110
  };
111
+ /**
112
+ * The every-word gate's patterns for `lex` (see gatePatterns).
113
+ * @param {{parts: Array<[RegExp, unknown]>}} lex
114
+ * @returns {{parts: RegExp[], states: Array<[RegExp, string]>}}
115
+ */
116
+ export function gatePatternsOf(lex: {
117
+ parts: Array<[RegExp, unknown]>;
118
+ }): {
119
+ parts: RegExp[];
120
+ states: Array<[RegExp, string]>;
121
+ };
122
+ /**
123
+ * `text` with each part name the global patterns find blanked out, in their
124
+ * order. A made pattern finds nothing in a text without its word, so it is
125
+ * not run there.
126
+ * @param {string} text
127
+ * @param {RegExp[]} parts
128
+ * @returns {string}
129
+ */
130
+ export function blankParts(text: string, parts: RegExp[]): string;
116
131
  /**
117
132
  * A CSS property the clause names, with its value kept whole ("caret-color
118
133
  * #2563eb", "transition: background-color 150ms ease", "border-radius 12px
@@ -141,12 +156,21 @@ export function draftAnswer(ctx: import("./_settings.mjs").Ctx, env: import("./_
141
156
  drafts: Draft[];
142
157
  };
143
158
  /**
144
- * The property a question asks the value of ("how much padding …", "how
145
- * rounded are …", "what color is …"), or null when it is not one.
146
- * @param {string} q
147
- * @returns {string | null}
159
+ * A made lexicon pattern. A text without its word holds no match, so `exec`,
160
+ * and with it `test`, `match`, `matchAll`, `replace` and `split`, answers at
161
+ * once there without running the pattern, or compiling it first: an ask runs
162
+ * every lexicon pattern, and most never need compiling.
148
163
  */
149
- export function valueAsked(q: string): string | null;
164
+ export class NeedRegExp extends RegExp {
165
+ /**
166
+ * @param {string | RegExp} pattern
167
+ * @param {string} [flags]
168
+ * @param {string} [need]
169
+ */
170
+ constructor(pattern: string | RegExp, flags?: string, need?: string);
171
+ /** @type {string | undefined} */
172
+ need: string | undefined;
173
+ }
150
174
  /**
151
175
  * One clause, read.
152
176
  */
@@ -162,6 +186,7 @@ export type Clause = {
162
186
  role?: string;
163
187
  level?: string;
164
188
  missing?: string;
189
+ plural?: boolean;
165
190
  }>;
166
191
  aspects: string[];
167
192
  neg: boolean;
@@ -198,6 +223,10 @@ export type Clause = {
198
223
  * - "but not on X": X keeps what the clause before does
199
224
  */
200
225
  except: boolean;
226
+ /**
227
+ * - the one list item an except keeps a state of ("gray text on the rest" keeps the selected tab's text): it belongs to that item only
228
+ */
229
+ exceptOf?: Clause | undefined;
201
230
  /**
202
231
  * - CSS written as `prop: value`
203
232
  */
@@ -222,6 +251,14 @@ export type Clause = {
222
251
  * - an elided clause whose subject is no part ("and the gizmo red")
223
252
  */
224
253
  unknownSubject?: boolean | undefined;
254
+ /**
255
+ * - a compound subject a part word begins, which names no part ("radio station")
256
+ */
257
+ compound?: string | undefined;
258
+ /**
259
+ * - the part said before a look that names none of its own, out of the binder's reach: the look is named, never written
260
+ */
261
+ unbound?: string | undefined;
225
262
  /**
226
263
  * - where the clause names its reference, with its own word ("the muted card")
227
264
  */
@@ -233,6 +270,10 @@ export type Clause = {
233
270
  holder: string;
234
271
  part: string;
235
272
  } | undefined;
273
+ /**
274
+ * - the place is a colon list's head, not said with the part: an answer that cannot be kept there is the part's own
275
+ */
276
+ placeGuessed?: boolean | undefined;
236
277
  /**
237
278
  * - a possessive owner's element it does not have ("the date picker's days")
238
279
  */
@@ -286,6 +327,8 @@ export type Draft = {
286
327
  smallest?: boolean;
287
328
  modeInValue?: boolean;
288
329
  unmet?: string;
330
+ offer?: boolean;
331
+ already?: boolean;
289
332
  };
290
333
  export type PartRef = {
291
334
  on: string;
@@ -293,4 +336,5 @@ export type PartRef = {
293
336
  role?: string;
294
337
  level?: string;
295
338
  missing?: string;
339
+ plural?: boolean;
296
340
  };