@astryxdesign/cli 0.7.14 → 0.7.15-canary.g06b7e61

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 (203) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +63 -63
  3. package/api/build/_adapter.d.mts +4 -0
  4. package/api/build/_adapter.mjs +28 -2
  5. package/api/build/blocks/blocks.d.mts +10 -1
  6. package/api/build/blocks/blocks.mjs +84 -7
  7. package/api/build/build.mjs +6 -1
  8. package/api/build/tree.d.mts +4 -0
  9. package/api/build/tree.mjs +9 -2
  10. package/api/doctor/_adapter.d.mts +3 -1
  11. package/api/doctor/_adapter.mjs +14 -1
  12. package/api/doctor/_authoring-audit.d.mts +42 -0
  13. package/api/doctor/_authoring-audit.mjs +106 -0
  14. package/api/doctor/doctor.d.mts +7 -0
  15. package/api/doctor/doctor.mjs +24 -39
  16. package/api/doctor/theme-checks.mjs +56 -21
  17. package/api/integration/add-helpers.mjs +5 -0
  18. package/api/integration/add-theme.mjs +15 -110
  19. package/api/integration/validate-integration.mjs +17 -3
  20. package/api/integration/validateIntegration.doc.mjs +1 -1
  21. package/api/search/_adapter.mjs +124 -3
  22. package/api/search/_candidate-score.mjs +63 -9
  23. package/api/search/_entries.d.mts +10 -0
  24. package/api/search/_entries.mjs +68 -1
  25. package/api/search/_gather-templates.d.mts +11 -0
  26. package/api/search/_gather-templates.mjs +22 -2
  27. package/api/search/_words.mjs +26 -6
  28. package/api/swizzle/copy/copy.mjs +1 -1
  29. package/api/theme/_adapter.d.mts +37 -5
  30. package/api/theme/_adapter.mjs +381 -57
  31. package/api/theme/_fork.d.mts +90 -0
  32. package/api/theme/_fork.mjs +246 -0
  33. package/api/theme/build/build.d.mts +40 -2
  34. package/api/theme/build/build.mjs +477 -66
  35. package/api/theme/eject/eject.mjs +36 -15
  36. package/api/theme/list/list.mjs +3 -6
  37. package/api/theme/palette/generate/generator.d.mts +13 -0
  38. package/api/theme/palette/generate/generator.mjs +32 -2
  39. package/api/theme/targets/targets.d.mts +8 -0
  40. package/api/theme/targets/targets.mjs +24 -4
  41. package/api/theme/template/template.mjs +48 -2
  42. package/api/theme/theme.type.d.mts +8 -0
  43. package/api/theme/theme.type.mjs +5 -1
  44. package/api/theme/themeBuild.doc.mjs +7 -4
  45. package/api/theme/themeEject.doc.mjs +3 -3
  46. package/api/theme/themeRemove.doc.mjs +5 -2
  47. package/api/theme/themeTargets.doc.mjs +1 -1
  48. package/api/theme/themeTemplate.doc.mjs +2 -2
  49. package/api/theme/themeUse.doc.mjs +8 -2
  50. package/api/theme-edit/_adapter.d.mts +46 -3
  51. package/api/theme-edit/_adapter.mjs +496 -112
  52. package/api/theme-edit/_catalog.d.mts +1 -6
  53. package/api/theme-edit/_catalog.mjs +5 -268
  54. package/api/theme-edit/_check.d.mts +9 -4
  55. package/api/theme-edit/_check.mjs +1232 -229
  56. package/api/theme-edit/_color.d.mts +19 -0
  57. package/api/theme-edit/_color.mjs +280 -34
  58. package/api/theme-edit/_compiler.d.mts +3 -1
  59. package/api/theme-edit/_compiler.mjs +52 -13
  60. package/api/theme-edit/_context.d.mts +4 -1
  61. package/api/theme-edit/_context.mjs +126 -13
  62. package/api/theme-edit/_css.d.mts +84 -0
  63. package/api/theme-edit/_css.mjs +700 -0
  64. package/api/theme-edit/_edit.d.mts +9 -3
  65. package/api/theme-edit/_edit.mjs +806 -103
  66. package/api/theme-edit/_how-commands.d.mts +38 -7
  67. package/api/theme-edit/_how-commands.mjs +64 -45
  68. package/api/theme-edit/_how-question.d.mts +33 -0
  69. package/api/theme-edit/_how-question.mjs +2553 -381
  70. package/api/theme-edit/_how.mjs +402 -31
  71. package/api/theme-edit/_overview.mjs +2 -7
  72. package/api/theme-edit/_palette.d.mts +60 -13
  73. package/api/theme-edit/_palette.mjs +826 -295
  74. package/api/theme-edit/_parts.d.mts +42 -10
  75. package/api/theme-edit/_parts.mjs +280 -69
  76. package/api/theme-edit/_png.d.mts +4 -4
  77. package/api/theme-edit/_png.mjs +4 -2
  78. package/api/theme-edit/_preview-app.d.mts +14 -0
  79. package/api/theme-edit/_preview-app.mjs +1675 -235
  80. package/api/theme-edit/_preview.d.mts +7 -16
  81. package/api/theme-edit/_preview.mjs +79 -86
  82. package/api/theme-edit/_project.d.mts +32 -2
  83. package/api/theme-edit/_project.mjs +80 -19
  84. package/api/theme-edit/_settings.d.mts +199 -52
  85. package/api/theme-edit/_settings.mjs +1422 -217
  86. package/api/theme-edit/_tables.d.mts +19 -6
  87. package/api/theme-edit/_tables.mjs +150 -92
  88. package/api/theme-edit/theme-edit.type.d.mts +20 -1
  89. package/api/theme-edit/theme-edit.type.mjs +6 -3
  90. package/api/theme-edit/themeEditHow.doc.mjs +6 -0
  91. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  92. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
  93. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  94. package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
  95. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
  96. package/api/theme-edit/themeEditSet.doc.mjs +1 -1
  97. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  98. package/api/upgrade/_adapter.d.mts +1 -0
  99. package/assets/codemods/run-codemod.mjs +61 -0
  100. package/assets/codemods/runner.mjs +5 -4
  101. package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
  102. package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
  103. package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
  104. package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
  105. package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
  106. package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
  107. package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
  108. package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
  109. package/assets/docs/tree/calendars.doc.mjs +1 -3
  110. package/assets/docs/tree/checks.doc.mjs +22 -1
  111. package/assets/docs/tree/publishing.doc.mjs +1 -0
  112. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  113. package/assets/docs.generated.json +2 -1
  114. package/assets/preview-app/next.config.mjs +7 -1
  115. package/assets/self-audit.generated.json +1 -0
  116. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
  117. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
  118. package/assets/templates/components.generated.json +1 -1
  119. package/authoring/integration/integration.doc.mjs +8 -0
  120. package/authoring/integration/schema.d.mts +8 -0
  121. package/authoring/integration/schema.mjs +1 -0
  122. package/authoring/integration/type.ts +9 -0
  123. package/clients/cli/bin/astryx.mjs +19 -15
  124. package/clients/cli/build-id.generated.json +1 -0
  125. package/clients/cli/commands/ensure-core-built.mjs +12 -5
  126. package/clients/cli/commands/experimental/index.mjs +10 -10
  127. package/clients/cli/commands/experimental/theme.mjs +200 -81
  128. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  129. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
  130. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
  131. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
  132. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  133. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  134. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  135. package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
  136. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  137. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  138. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
  139. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
  140. package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
  141. package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
  142. package/clients/cli/commands/integration.mjs +8 -0
  143. package/clients/cli/commands/manifest.mjs +5 -2
  144. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  145. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  146. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  147. package/clients/cli/commands/theme.mjs +439 -66
  148. package/clients/cli/index.mjs +27 -6
  149. package/clients/cli/lib/cli-error.mjs +118 -3
  150. package/clients/cli/lib/manifest.mjs +37 -0
  151. package/clients/cli/lib/resolve-theme.mjs +2 -1
  152. package/clients/cli/manifest.generated.json +1 -0
  153. package/foundation/config/project.mjs +34 -8
  154. package/foundation/config/theme-state.d.mts +16 -0
  155. package/foundation/config/theme-state.mjs +84 -13
  156. package/foundation/discovery/module-exports.mjs +16 -2
  157. package/foundation/discovery/stored-self-audit.d.mts +31 -0
  158. package/foundation/discovery/stored-self-audit.mjs +119 -0
  159. package/foundation/discovery/template-adapter.d.mts +48 -2
  160. package/foundation/discovery/template-adapter.mjs +51 -19
  161. package/foundation/discovery/template-needs.d.mts +19 -0
  162. package/foundation/discovery/template-needs.mjs +50 -16
  163. package/foundation/discovery/template-source-tree.d.mts +7 -0
  164. package/foundation/discovery/template-source-tree.mjs +15 -0
  165. package/foundation/discovery/theme-discovery.d.mts +2 -1
  166. package/foundation/discovery/theme-discovery.mjs +16 -10
  167. package/foundation/discovery/theme-imports.d.mts +16 -0
  168. package/foundation/discovery/theme-imports.mjs +30 -2
  169. package/foundation/discovery/theme-module-extensions.d.mts +18 -0
  170. package/foundation/discovery/theme-module-extensions.mjs +30 -0
  171. package/foundation/doc-compiler/import.mjs +22 -15
  172. package/foundation/doc-compiler/stored-docs.d.mts +18 -12
  173. package/foundation/doc-compiler/stored-docs.mjs +52 -19
  174. package/foundation/env/private-dir.d.mts +17 -0
  175. package/foundation/env/private-dir.mjs +42 -0
  176. package/foundation/fs/gather-cache.d.mts +108 -0
  177. package/foundation/fs/gather-cache.mjs +783 -0
  178. package/foundation/fs/jiti-cache.d.mts +21 -0
  179. package/foundation/fs/jiti-cache.mjs +66 -0
  180. package/foundation/fs/module-loader.mjs +14 -3
  181. package/foundation/fs/read-record.d.mts +31 -1
  182. package/foundation/fs/read-record.mjs +100 -7
  183. package/foundation/integrations/autolink.d.mts +1 -24
  184. package/foundation/integrations/autolink.mjs +7 -60
  185. package/foundation/integrations/declared-dependencies.d.mts +27 -0
  186. package/foundation/integrations/declared-dependencies.mjs +73 -0
  187. package/foundation/integrations/integrations.d.mts +8 -0
  188. package/foundation/integrations/integrations.mjs +4 -0
  189. package/foundation/integrations/may-have-integrations.d.mts +8 -0
  190. package/foundation/integrations/may-have-integrations.mjs +47 -0
  191. package/foundation/integrations/validate-contributions.d.mts +62 -1
  192. package/foundation/integrations/validate-contributions.mjs +476 -40
  193. package/foundation/release/cache.d.mts +32 -4
  194. package/foundation/release/cache.mjs +105 -16
  195. package/foundation/release/folder-lock.d.mts +28 -0
  196. package/foundation/release/folder-lock.mjs +205 -0
  197. package/foundation/release/lock-lease.d.mts +2 -1
  198. package/foundation/release/lock-lease.mjs +7 -2
  199. package/foundation/response/error-codes.doc.mjs +1 -1
  200. package/foundation/response/response-types.doc.mjs +5 -5
  201. package/package.json +8 -6
  202. package/api/theme-edit/_css-properties.d.mts +0 -10
  203. package/api/theme-edit/_css-properties.mjs +0 -556
@@ -1,6 +1,32 @@
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
+ * One change a command makes.
6
+ * @typedef {object} Step
7
+ * @property {'set' | 'undo'} verb
8
+ * @property {string} thing
9
+ * @property {string} [value]
10
+ * @property {string} [on]
11
+ * @property {string} [when]
12
+ * @property {string} [state]
13
+ * @property {string} [mode]
14
+ */
15
+ /**
16
+ * The theme the commands of one answer are for, and the checks they pass.
17
+ * @typedef {object} HowTheme
18
+ * @property {string} slug
19
+ * @property {boolean} exists - false when the app has no theme: the commands name {@link EXAMPLE_THEME} and the answer starts with `new`.
20
+ * @property {string | null} previewDamage - why the in-app preview's record is damaged and how to fix it, or null.
21
+ * @property {string[]} themes - Every theme the editor made in the app.
22
+ * @property {string | null} note - Which theme the commands are for when the app has several, or that it has none.
23
+ * @property {'named' | 'only' | 'last-changed' | 'none'} chosenBy - How the theme was picked.
24
+ * @property {number} undoSteps - How many changes `undo` can step back.
25
+ * @property {boolean} bodyFontReachesHeadings - Whether `font X --on body` also changes the heading font in this release.
26
+ * @property {import('./_settings.mjs').ThemeData} data
27
+ * @property {{light: Record<string, string>, dark: Record<string, string>}} base
28
+ * @property {(steps: Step[]) => {ok: true} | {ok: false, why: string}} check
29
+ */
4
30
  /**
5
31
  * The theme an answer's commands are for: the one named, the only one, or
6
32
  * the one changed last; with none, a theme the answer first makes.
@@ -10,13 +36,6 @@
10
36
  * @returns {Promise<HowTheme>}
11
37
  */
12
38
  export function howTheme(ctx: import("./_settings.mjs").Ctx, cwd: string, name: string | undefined): Promise<HowTheme>;
13
- /**
14
- * One word of a command as a shell takes it: plain when it is only safe
15
- * characters, otherwise in double quotes with the characters a shell
16
- * expands escaped.
17
- * @param {string} v
18
- */
19
- export function shellWord(v: string): string;
20
39
  /**
21
40
  * A step as the command a person runs.
22
41
  * @param {Step} st
@@ -65,6 +84,10 @@ export type HowTheme = {
65
84
  * - false when the app has no theme: the commands name {@link EXAMPLE_THEME} and the answer starts with `new`.
66
85
  */
67
86
  exists: boolean;
87
+ /**
88
+ * - why the in-app preview's record is damaged and how to fix it, or null.
89
+ */
90
+ previewDamage: string | null;
68
91
  /**
69
92
  * - Every theme the editor made in the app.
70
93
  */
@@ -77,6 +100,14 @@ export type HowTheme = {
77
100
  * - How the theme was picked.
78
101
  */
79
102
  chosenBy: "named" | "only" | "last-changed" | "none";
103
+ /**
104
+ * - How many changes `undo` can step back.
105
+ */
106
+ undoSteps: number;
107
+ /**
108
+ * - Whether `font X --on body` also changes the heading font in this release.
109
+ */
110
+ bodyFontReachesHeadings: boolean;
80
111
  data: import("./_settings.mjs").ThemeData;
81
112
  base: {
82
113
  light: Record<string, string>;
@@ -8,14 +8,20 @@
8
8
  * @position api/theme-edit — imported by _how.mjs and _how-question.mjs
9
9
  */
10
10
 
11
- import * as fs from 'node:fs';
12
- import * as path from 'node:path';
13
11
  import {AstryxError} from '../error.mjs';
14
12
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
15
13
  import {checkSetting} from './_check.mjs';
16
14
  import {baseResolved} from './_project.mjs';
17
- import {compileTheme, keyOf, loadTheme, themeFiles} from './_settings.mjs';
15
+ import {
16
+ compileTheme,
17
+ editedThemes,
18
+ keyOf,
19
+ loadTheme,
20
+ readHistory,
21
+ themeFiles,
22
+ } from './_settings.mjs';
18
23
  import {LIKE, P} from './_tables.mjs';
24
+ import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
19
25
 
20
26
  /** The theme name commands use when the app has no theme yet. */
21
27
  export const EXAMPLE_THEME = 'my-theme';
@@ -37,42 +43,17 @@ export const EXAMPLE_THEME = 'my-theme';
37
43
  * @typedef {object} HowTheme
38
44
  * @property {string} slug
39
45
  * @property {boolean} exists - false when the app has no theme: the commands name {@link EXAMPLE_THEME} and the answer starts with `new`.
46
+ * @property {string | null} previewDamage - why the in-app preview's record is damaged and how to fix it, or null.
40
47
  * @property {string[]} themes - Every theme the editor made in the app.
41
48
  * @property {string | null} note - Which theme the commands are for when the app has several, or that it has none.
42
49
  * @property {'named' | 'only' | 'last-changed' | 'none'} chosenBy - How the theme was picked.
50
+ * @property {number} undoSteps - How many changes `undo` can step back.
51
+ * @property {boolean} bodyFontReachesHeadings - Whether `font X --on body` also changes the heading font in this release.
43
52
  * @property {import('./_settings.mjs').ThemeData} data
44
53
  * @property {{light: Record<string, string>, dark: Record<string, string>}} base
45
54
  * @property {(steps: Step[]) => {ok: true} | {ok: false, why: string}} check
46
55
  */
47
56
 
48
- /**
49
- * The themes the editor made in the app, the one an editor command changed
50
- * last first.
51
- * @param {string} cwd
52
- * @returns {string[]}
53
- */
54
- function editorThemes(cwd) {
55
- const root = path.join(cwd, 'themes');
56
- if (!fs.existsSync(root)) return [];
57
- return (
58
- fs
59
- .readdirSync(root)
60
- .filter(d => fs.existsSync(themeFiles(cwd, d).settings))
61
- // The undo history is written only by an editor command, so its time is
62
- // the last change made here; a checkout or touch of the settings file
63
- // does not move it.
64
- .map(d => {
65
- const f = themeFiles(cwd, d);
66
- const t =
67
- [f.history, f.settingsTs, f.settings].find(x => fs.existsSync(x)) ??
68
- f.settings;
69
- return {d, t: fs.statSync(t).mtimeMs};
70
- })
71
- .sort((a, b) => b.t - a.t || a.d.localeCompare(b.d))
72
- .map(x => x.d)
73
- );
74
- }
75
-
76
57
  /**
77
58
  * The theme an answer's commands are for: the one named, the only one, or
78
59
  * the one changed last; with none, a theme the answer first makes.
@@ -82,7 +63,7 @@ function editorThemes(cwd) {
82
63
  * @returns {Promise<HowTheme>}
83
64
  */
84
65
  export async function howTheme(ctx, cwd, name) {
85
- const themes = editorThemes(cwd);
66
+ const themes = editedThemes(cwd, 'changed');
86
67
  /** @type {import('./_settings.mjs').ThemeData | null} */
87
68
  let data = null;
88
69
  let slug = name ?? themes[0] ?? EXAMPLE_THEME;
@@ -115,11 +96,56 @@ export async function howTheme(ctx, cwd, name) {
115
96
  const compiled = (/** @type {import('./_settings.mjs').ThemeData} */ d) =>
116
97
  JSON.stringify([d.mode, compileTheme(ctx, d, base)]);
117
98
  const before = compiled(theme);
99
+ // Whether a body font setting also moves the heading font: Core gives
100
+ // headings the body family when a theme names no heading family, so it is
101
+ // read from Core, and stays right when that changes.
102
+ const {core} = ctx.project;
103
+ /** @param {any} typography */
104
+ const headingOf = typography => {
105
+ try {
106
+ return core.resolveThemeTokens(
107
+ core.defineTheme({
108
+ name: 'how-probe',
109
+ ...(typography ? {typography} : {}),
110
+ }),
111
+ {mode: 'light'},
112
+ )['--font-family-heading'];
113
+ } catch {
114
+ return null;
115
+ }
116
+ };
117
+ const fontless = {
118
+ ...theme,
119
+ settings: theme.settings.filter(
120
+ x => x.thing !== 'font' || x.on === 'heading',
121
+ ),
122
+ };
123
+ const withBody = compileTheme(
124
+ ctx,
125
+ {
126
+ ...fontless,
127
+ settings: [
128
+ ...fontless.settings,
129
+ {thing: 'font', value: 'courier', on: 'body', source: 'dial'},
130
+ ],
131
+ },
132
+ base,
133
+ ).typography;
134
+ // The editor writes the base theme's heading font beside a body font of
135
+ // its own; only a build that writes none leaves headings to Core.
136
+ const bodyFontReachesHeadings =
137
+ !withBody?.heading &&
138
+ headingOf(compileTheme(ctx, fontless, base).typography) !==
139
+ headingOf(withBody);
140
+ // A damaged preview record refuses every preview command, so an answer
141
+ // names its fix instead of a preview command.
142
+ const {previewRecordProblem} = await import('./_preview-app.mjs');
118
143
  return {
119
144
  slug,
120
145
  exists,
121
146
  themes,
122
147
  note,
148
+ previewDamage: previewRecordProblem(cwd),
123
149
  chosenBy: name
124
150
  ? 'named'
125
151
  : !themes.length
@@ -129,6 +155,10 @@ export async function howTheme(ctx, cwd, name) {
129
155
  : 'last-changed',
130
156
  data: theme,
131
157
  base,
158
+ undoSteps: exists
159
+ ? readHistory(themeFiles(cwd, slug).history).steps.length
160
+ : 0,
161
+ bodyFontReachesHeadings,
132
162
  check(steps) {
133
163
  /** @type {import('./_settings.mjs').ThemeData} */
134
164
  const d = JSON.parse(JSON.stringify(theme));
@@ -194,17 +224,6 @@ function apply(ctx, slug, d, st) {
194
224
  else d.settings.push(s);
195
225
  }
196
226
 
197
- /**
198
- * One word of a command as a shell takes it: plain when it is only safe
199
- * characters, otherwise in double quotes with the characters a shell
200
- * expands escaped.
201
- * @param {string} v
202
- */
203
- export function shellWord(v) {
204
- if (/^[A-Za-z0-9_.,:%+\-/=@]+$/.test(v)) return v;
205
- return `"${v.replace(/["\\$`]/g, c => `\\${c}`)}"`;
206
- }
207
-
208
227
  /**
209
228
  * A step as the command a person runs.
210
229
  * @param {Step} st
@@ -215,8 +234,8 @@ export function render(st, slug) {
215
234
  P,
216
235
  st.verb,
217
236
  slug,
218
- shellWord(st.thing),
219
- ...(st.value != null ? [shellWord(st.value)] : []),
237
+ quoteCommandArgument(st.thing),
238
+ ...(st.value != null ? [quoteCommandArgument(st.value)] : []),
220
239
  ...(st.on ? ['--on', st.on] : []),
221
240
  ...(st.when ? ['--when', st.when] : []),
222
241
  ...(st.state ? ['--state', st.state] : []),
@@ -1,6 +1,21 @@
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
+ * A CSS property the clause names, with its value kept whole ("caret-color
6
+ * #2563eb", "transition: background-color 150ms ease", "border-radius 12px
7
+ * 12px 0 0"). The value runs to the end of the clause or the part it is
8
+ * for, and is the longest start of it the property's grammar accepts.
9
+ * Plain words that are also properties ("color", "padding") count only
10
+ * with a colon; the aspect words read those.
11
+ * @param {string} text
12
+ * @returns {{prop: string, value: string, bad?: string} | null}
13
+ */
14
+ export function namedProperty(text: string): {
15
+ prop: string;
16
+ value: string;
17
+ bad?: string;
18
+ } | null;
4
19
  /**
5
20
  * Answer a plain-words question with drafts of commands.
6
21
  * @param {import('./_settings.mjs').Ctx} ctx
@@ -43,6 +58,18 @@ export type Clause = {
43
58
  * - CSS written as `prop: value`
44
59
  */
45
60
  decl: Record<string, string>;
61
+ /**
62
+ * - family names the clause writes in quotes
63
+ */
64
+ quoted?: string[] | undefined;
65
+ /**
66
+ * - a CSS property the clause names, with its value as typed
67
+ */
68
+ named: {
69
+ prop: string;
70
+ value: string;
71
+ bad?: string;
72
+ } | null;
46
73
  };
47
74
  export type Step = import("./_how-commands.mjs").Step;
48
75
  /**
@@ -55,3 +82,9 @@ export type Draft = {
55
82
  sequence?: boolean;
56
83
  lookup?: string;
57
84
  };
85
+ export type PartRef = {
86
+ on: string;
87
+ when?: string;
88
+ role?: string;
89
+ level?: string;
90
+ };