@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.
- package/CHANGELOG.md +3 -3
- package/README.md +63 -63
- package/api/build/_adapter.d.mts +4 -0
- package/api/build/_adapter.mjs +28 -2
- package/api/build/blocks/blocks.d.mts +10 -1
- package/api/build/blocks/blocks.mjs +84 -7
- package/api/build/build.mjs +6 -1
- package/api/build/tree.d.mts +4 -0
- package/api/build/tree.mjs +9 -2
- package/api/doctor/_adapter.d.mts +3 -1
- package/api/doctor/_adapter.mjs +14 -1
- package/api/doctor/_authoring-audit.d.mts +42 -0
- package/api/doctor/_authoring-audit.mjs +106 -0
- package/api/doctor/doctor.d.mts +7 -0
- package/api/doctor/doctor.mjs +24 -39
- package/api/doctor/theme-checks.mjs +56 -21
- package/api/integration/add-helpers.mjs +5 -0
- package/api/integration/add-theme.mjs +15 -110
- package/api/integration/validate-integration.mjs +17 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_adapter.mjs +124 -3
- package/api/search/_candidate-score.mjs +63 -9
- package/api/search/_entries.d.mts +10 -0
- package/api/search/_entries.mjs +68 -1
- package/api/search/_gather-templates.d.mts +11 -0
- package/api/search/_gather-templates.mjs +22 -2
- package/api/search/_words.mjs +26 -6
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/theme/_adapter.d.mts +37 -5
- package/api/theme/_adapter.mjs +381 -57
- package/api/theme/_fork.d.mts +90 -0
- package/api/theme/_fork.mjs +246 -0
- package/api/theme/build/build.d.mts +40 -2
- package/api/theme/build/build.mjs +477 -66
- package/api/theme/eject/eject.mjs +36 -15
- package/api/theme/list/list.mjs +3 -6
- package/api/theme/palette/generate/generator.d.mts +13 -0
- package/api/theme/palette/generate/generator.mjs +32 -2
- package/api/theme/targets/targets.d.mts +8 -0
- package/api/theme/targets/targets.mjs +24 -4
- package/api/theme/template/template.mjs +48 -2
- package/api/theme/theme.type.d.mts +8 -0
- package/api/theme/theme.type.mjs +5 -1
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeEject.doc.mjs +3 -3
- package/api/theme/themeRemove.doc.mjs +5 -2
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +2 -2
- package/api/theme/themeUse.doc.mjs +8 -2
- package/api/theme-edit/_adapter.d.mts +46 -3
- package/api/theme-edit/_adapter.mjs +496 -112
- package/api/theme-edit/_catalog.d.mts +1 -6
- package/api/theme-edit/_catalog.mjs +5 -268
- package/api/theme-edit/_check.d.mts +9 -4
- package/api/theme-edit/_check.mjs +1232 -229
- package/api/theme-edit/_color.d.mts +19 -0
- package/api/theme-edit/_color.mjs +280 -34
- package/api/theme-edit/_compiler.d.mts +3 -1
- package/api/theme-edit/_compiler.mjs +52 -13
- package/api/theme-edit/_context.d.mts +4 -1
- package/api/theme-edit/_context.mjs +126 -13
- package/api/theme-edit/_css.d.mts +84 -0
- package/api/theme-edit/_css.mjs +700 -0
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +806 -103
- package/api/theme-edit/_how-commands.d.mts +38 -7
- package/api/theme-edit/_how-commands.mjs +64 -45
- package/api/theme-edit/_how-question.d.mts +33 -0
- package/api/theme-edit/_how-question.mjs +2553 -381
- package/api/theme-edit/_how.mjs +402 -31
- package/api/theme-edit/_overview.mjs +2 -7
- package/api/theme-edit/_palette.d.mts +60 -13
- package/api/theme-edit/_palette.mjs +826 -295
- package/api/theme-edit/_parts.d.mts +42 -10
- package/api/theme-edit/_parts.mjs +280 -69
- package/api/theme-edit/_png.d.mts +4 -4
- package/api/theme-edit/_png.mjs +4 -2
- package/api/theme-edit/_preview-app.d.mts +14 -0
- package/api/theme-edit/_preview-app.mjs +1675 -235
- package/api/theme-edit/_preview.d.mts +7 -16
- package/api/theme-edit/_preview.mjs +79 -86
- package/api/theme-edit/_project.d.mts +32 -2
- package/api/theme-edit/_project.mjs +80 -19
- package/api/theme-edit/_settings.d.mts +199 -52
- package/api/theme-edit/_settings.mjs +1422 -217
- package/api/theme-edit/_tables.d.mts +19 -6
- package/api/theme-edit/_tables.mjs +150 -92
- package/api/theme-edit/theme-edit.type.d.mts +20 -1
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
- package/api/theme-edit/themeEditSet.doc.mjs +1 -1
- package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
- package/api/upgrade/_adapter.d.mts +1 -0
- package/assets/codemods/run-codemod.mjs +61 -0
- package/assets/codemods/runner.mjs +5 -4
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
- package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
- package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
- package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
- package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
- package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
- package/assets/docs/tree/calendars.doc.mjs +1 -3
- package/assets/docs/tree/checks.doc.mjs +22 -1
- package/assets/docs/tree/publishing.doc.mjs +1 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -1
- package/assets/preview-app/next.config.mjs +7 -1
- package/assets/self-audit.generated.json +1 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
- package/assets/templates/components.generated.json +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +8 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +19 -15
- package/clients/cli/build-id.generated.json +1 -0
- package/clients/cli/commands/ensure-core-built.mjs +12 -5
- package/clients/cli/commands/experimental/index.mjs +10 -10
- package/clients/cli/commands/experimental/theme.mjs +200 -81
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
- package/clients/cli/commands/integration.mjs +8 -0
- package/clients/cli/commands/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +439 -66
- package/clients/cli/index.mjs +27 -6
- package/clients/cli/lib/cli-error.mjs +118 -3
- package/clients/cli/lib/manifest.mjs +37 -0
- package/clients/cli/lib/resolve-theme.mjs +2 -1
- package/clients/cli/manifest.generated.json +1 -0
- package/foundation/config/project.mjs +34 -8
- package/foundation/config/theme-state.d.mts +16 -0
- package/foundation/config/theme-state.mjs +84 -13
- package/foundation/discovery/module-exports.mjs +16 -2
- package/foundation/discovery/stored-self-audit.d.mts +31 -0
- package/foundation/discovery/stored-self-audit.mjs +119 -0
- package/foundation/discovery/template-adapter.d.mts +48 -2
- package/foundation/discovery/template-adapter.mjs +51 -19
- package/foundation/discovery/template-needs.d.mts +19 -0
- package/foundation/discovery/template-needs.mjs +50 -16
- package/foundation/discovery/template-source-tree.d.mts +7 -0
- package/foundation/discovery/template-source-tree.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +2 -1
- package/foundation/discovery/theme-discovery.mjs +16 -10
- package/foundation/discovery/theme-imports.d.mts +16 -0
- package/foundation/discovery/theme-imports.mjs +30 -2
- package/foundation/discovery/theme-module-extensions.d.mts +18 -0
- package/foundation/discovery/theme-module-extensions.mjs +30 -0
- package/foundation/doc-compiler/import.mjs +22 -15
- package/foundation/doc-compiler/stored-docs.d.mts +18 -12
- package/foundation/doc-compiler/stored-docs.mjs +52 -19
- package/foundation/env/private-dir.d.mts +17 -0
- package/foundation/env/private-dir.mjs +42 -0
- package/foundation/fs/gather-cache.d.mts +108 -0
- package/foundation/fs/gather-cache.mjs +783 -0
- package/foundation/fs/jiti-cache.d.mts +21 -0
- package/foundation/fs/jiti-cache.mjs +66 -0
- package/foundation/fs/module-loader.mjs +14 -3
- package/foundation/fs/read-record.d.mts +31 -1
- package/foundation/fs/read-record.mjs +100 -7
- package/foundation/integrations/autolink.d.mts +1 -24
- package/foundation/integrations/autolink.mjs +7 -60
- package/foundation/integrations/declared-dependencies.d.mts +27 -0
- package/foundation/integrations/declared-dependencies.mjs +73 -0
- package/foundation/integrations/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/may-have-integrations.d.mts +8 -0
- package/foundation/integrations/may-have-integrations.mjs +47 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +32 -4
- package/foundation/release/cache.mjs +105 -16
- package/foundation/release/folder-lock.d.mts +28 -0
- package/foundation/release/folder-lock.mjs +205 -0
- package/foundation/release/lock-lease.d.mts +2 -1
- package/foundation/release/lock-lease.mjs +7 -2
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +8 -6
- package/api/theme-edit/_css-properties.d.mts +0 -10
- 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 {
|
|
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 =
|
|
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
|
-
|
|
219
|
-
...(st.value != null ? [
|
|
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
|
+
};
|