@astryxdesign/cli 0.7.14 → 0.7.15-canary.g79b95eb
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/api/doctor/_adapter.d.mts +1 -0
- package/api/doctor/_adapter.mjs +8 -0
- 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/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.mjs +20 -9
- package/api/theme/build/build.d.mts +15 -1
- package/api/theme/build/build.mjs +132 -32
- package/api/theme/targets/targets.d.mts +8 -0
- package/api/theme/targets/targets.mjs +14 -1
- package/api/theme/themeBuild.doc.mjs +6 -3
- package/api/theme/themeEject.doc.mjs +3 -3
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme-edit/_adapter.d.mts +46 -3
- package/api/theme-edit/_adapter.mjs +372 -109
- package/api/theme-edit/_check.d.mts +6 -3
- package/api/theme-edit/_check.mjs +665 -87
- package/api/theme-edit/_color.mjs +4 -2
- package/api/theme-edit/_compiler.d.mts +2 -1
- package/api/theme-edit/_compiler.mjs +27 -13
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +47 -8
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +484 -66
- package/api/theme-edit/_how-commands.d.mts +33 -7
- package/api/theme-edit/_how-commands.mjs +57 -45
- package/api/theme-edit/_how-question.d.mts +4 -0
- package/api/theme-edit/_how-question.mjs +1004 -223
- package/api/theme-edit/_how.mjs +96 -9
- package/api/theme-edit/_palette.d.mts +38 -13
- package/api/theme-edit/_palette.mjs +620 -223
- package/api/theme-edit/_parts.mjs +63 -7
- 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 +6 -0
- package/api/theme-edit/_preview-app.mjs +1194 -207
- package/api/theme-edit/_preview.mjs +2 -2
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +37 -6
- package/api/theme-edit/_settings.d.mts +104 -33
- package/api/theme-edit/_settings.mjs +818 -118
- package/api/theme-edit/_tables.d.mts +7 -0
- package/api/theme-edit/_tables.mjs +61 -0
- package/api/theme-edit/theme-edit.type.d.mts +11 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- 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 +1 -1
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -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.generated.json +2 -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/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/theme.mjs +178 -78
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- 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/manifest.mjs +5 -2
- package/clients/cli/commands/theme.mjs +118 -22
- package/clients/cli/index.mjs +9 -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/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 +6 -0
- package/foundation/discovery/template-needs.mjs +20 -1
- 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 +2 -8
- 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 +12 -11
- 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 +716 -0
- package/foundation/fs/module-loader.mjs +7 -1
- package/foundation/fs/read-record.d.mts +31 -1
- package/foundation/fs/read-record.mjs +93 -6
- package/foundation/integrations/validate-contributions.mjs +24 -11
- package/foundation/release/cache.d.mts +11 -2
- package/foundation/release/cache.mjs +59 -10
- package/foundation/release/folder-lock.d.mts +21 -0
- package/foundation/release/folder-lock.mjs +171 -0
- package/package.json +8 -6
|
@@ -687,13 +687,15 @@ export const isNumber = (v, name = '') => {
|
|
|
687
687
|
export function isSafeValue(v) {
|
|
688
688
|
// A shell comment ("# direct"), as a command run without a shell passes
|
|
689
689
|
// it, is a comment too.
|
|
690
|
+
// `</` (a closing tag), control characters, comments and !important are
|
|
691
|
+
// refused anywhere; < and > only outside a quoted string.
|
|
690
692
|
// eslint-disable-next-line no-control-regex
|
|
691
|
-
if (
|
|
693
|
+
if (/<\/|[\u0000-\u001f\u007f]|\/\*|!important|(^|\s)#(\s|$)/i.test(v))
|
|
692
694
|
return false;
|
|
693
695
|
const outside = v
|
|
694
696
|
.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""')
|
|
695
697
|
.replace(/url\(data:[^\s"'()\\]*\)/gi, 'url()');
|
|
696
|
-
if (/[;{}
|
|
698
|
+
if (/[;{}\\<>]/.test(outside)) return false;
|
|
697
699
|
let depth = 0;
|
|
698
700
|
for (const c of outside.replace(/""/g, '')) {
|
|
699
701
|
if (c === '"' || c === "'") return false;
|
|
@@ -39,7 +39,7 @@ export function makeCompiler(project: import("./_project.mjs").ThemeProject, par
|
|
|
39
39
|
alphaOf: (v: unknown) => number;
|
|
40
40
|
compositeOver: (over: [number, number, number], alpha: number, under: [number, number, number]) => [number, number, number];
|
|
41
41
|
page: (mode: string) => string | null | undefined;
|
|
42
|
-
}) => {
|
|
42
|
+
}, extra?: TextPair[]) => {
|
|
43
43
|
problems: {
|
|
44
44
|
part: string;
|
|
45
45
|
mode: string;
|
|
@@ -55,6 +55,7 @@ export function makeCompiler(project: import("./_project.mjs").ThemeProject, par
|
|
|
55
55
|
};
|
|
56
56
|
/** Only these token types may differ between light and dark. */
|
|
57
57
|
export const MODAL: Set<string>;
|
|
58
|
+
export function isColorToken(name: string): boolean;
|
|
58
59
|
export type Read = {
|
|
59
60
|
token: string;
|
|
60
61
|
props: string[];
|
|
@@ -10,10 +10,20 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {DIRECT, GROUPS, HOW} from './_tables.mjs';
|
|
13
|
+
import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
|
|
13
14
|
|
|
14
15
|
/** Only these token types may differ between light and dark. */
|
|
15
16
|
export const MODAL = new Set(['color', 'shadow']);
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Whether a token is a color by its name, as Core's color groups and the
|
|
20
|
+
* token table type it: `--color-*`, `--syntax-*` and `--focus-outline-color`.
|
|
21
|
+
* Settings are checked by it where no installed Core is read.
|
|
22
|
+
* @param {string} name
|
|
23
|
+
*/
|
|
24
|
+
export const isColorToken = name =>
|
|
25
|
+
/^--color-|^--syntax-|^--focus-outline-color$/.test(name);
|
|
26
|
+
|
|
17
27
|
/** Tokens a component may read only in some states: never refused globally. */
|
|
18
28
|
/**
|
|
19
29
|
* Tokens no catalog part is recorded reading, though Core reads them: code
|
|
@@ -60,11 +70,10 @@ export function makeCompiler(project, parts) {
|
|
|
60
70
|
put(groupVars(core.easeVars), 'easing');
|
|
61
71
|
for (const k of Object.keys(core.tokenDefaults ?? {})) {
|
|
62
72
|
if (TYPE[k]) continue;
|
|
63
|
-
if (
|
|
73
|
+
if (isColorToken(k)) TYPE[k] = 'color';
|
|
64
74
|
else if (/^--font-family/.test(k)) TYPE[k] = 'font';
|
|
65
75
|
else if (/^--font-weight|^--text-.*-weight$/.test(k)) TYPE[k] = 'number';
|
|
66
76
|
else if (/^--shadow/.test(k)) TYPE[k] = 'shadow';
|
|
67
|
-
else if (/^--focus-outline-color/.test(k)) TYPE[k] = 'color';
|
|
68
77
|
else if (
|
|
69
78
|
/^--(radius|spacing|size|text-.*-size|border-width|focus-outline-(width|offset))/.test(
|
|
70
79
|
k,
|
|
@@ -230,9 +239,6 @@ export function makeCompiler(project, parts) {
|
|
|
230
239
|
.slice(0, 4)
|
|
231
240
|
.join(', ');
|
|
232
241
|
|
|
233
|
-
/** @param {string} v */
|
|
234
|
-
const quote = v => (/[\s"#(]/.test(v) ? `"${v.replace(/"/g, '\\"')}"` : v);
|
|
235
|
-
|
|
236
242
|
/**
|
|
237
243
|
* Whether a token set on a part can take effect there: the part, or a part
|
|
238
244
|
* inside it, must read it. A part with no record is checked through the
|
|
@@ -271,7 +277,7 @@ export function makeCompiler(project, parts) {
|
|
|
271
277
|
return null;
|
|
272
278
|
}
|
|
273
279
|
const reads = g ? partReads(target, g) : [];
|
|
274
|
-
const v =
|
|
280
|
+
const v = quoteCommandArgument(value);
|
|
275
281
|
/** @type {string[]} */
|
|
276
282
|
const run = [];
|
|
277
283
|
if (reads.length)
|
|
@@ -346,7 +352,7 @@ export function makeCompiler(project, parts) {
|
|
|
346
352
|
: [];
|
|
347
353
|
return {
|
|
348
354
|
message: `No component reads ${token}, so setting it changes nothing.${near.length ? ` Tokens components do read for ${g}: ${near.join(', ')}.` : ''}`,
|
|
349
|
-
run: [`${HOW} ${
|
|
355
|
+
run: [`${HOW} ${quoteCommandArgument(token)}`],
|
|
350
356
|
also: [],
|
|
351
357
|
};
|
|
352
358
|
}
|
|
@@ -383,12 +389,14 @@ export function makeCompiler(project, parts) {
|
|
|
383
389
|
* @param {{parseColor: (v: unknown) => [number, number, number] | null, ratio: (a: number[], b: number[]) => number, alphaOf: (v: unknown) => number, compositeOver: (over: [number, number, number], alpha: number, under: [number, number, number]) => [number, number, number], page: (mode: string) => string | null | undefined}} helpers
|
|
384
390
|
* `page` is the page color in a mode: a see-through background is drawn
|
|
385
391
|
* over it, and see-through text over that background, before measuring.
|
|
392
|
+
* @param {TextPair[]} [extra] more pairs to measure (a part's variants)
|
|
386
393
|
*/
|
|
387
394
|
function contrast(
|
|
388
395
|
value,
|
|
389
396
|
baseValue,
|
|
390
397
|
modes,
|
|
391
398
|
{parseColor, ratio, alphaOf, compositeOver, page},
|
|
399
|
+
extra = [],
|
|
392
400
|
) {
|
|
393
401
|
/**
|
|
394
402
|
* The opaque colors the eye sees for a pair, or null with no fixed color.
|
|
@@ -401,9 +409,7 @@ export function makeCompiler(project, parts) {
|
|
|
401
409
|
const bgAlpha = alphaOf(bg);
|
|
402
410
|
const back = parseColor(bg);
|
|
403
411
|
const under =
|
|
404
|
-
bgAlpha === 0
|
|
405
|
-
? ground
|
|
406
|
-
: back && compositeOver(back, bgAlpha, ground);
|
|
412
|
+
bgAlpha === 0 ? ground : back && compositeOver(back, bgAlpha, ground);
|
|
407
413
|
const top = parseColor(fg);
|
|
408
414
|
if (!under || !top) return null;
|
|
409
415
|
return [compositeOver(top, alphaOf(fg), under), under];
|
|
@@ -413,7 +419,7 @@ export function makeCompiler(project, parts) {
|
|
|
413
419
|
const seen = new Set();
|
|
414
420
|
/** @type {Set<string>} */
|
|
415
421
|
const unchecked = new Set();
|
|
416
|
-
for (const p of parts.pairs) {
|
|
422
|
+
for (const p of [...parts.pairs, ...extra]) {
|
|
417
423
|
if (
|
|
418
424
|
p.fg.target !== p.bg.target &&
|
|
419
425
|
p.bg.target &&
|
|
@@ -451,9 +457,17 @@ export function makeCompiler(project, parts) {
|
|
|
451
457
|
mode: m,
|
|
452
458
|
ratio: Number(r.toFixed(2)),
|
|
453
459
|
sample: p.sample,
|
|
454
|
-
|
|
460
|
+
// A side the theme changed is named by the value it set, not the
|
|
461
|
+
// token the part reads without it.
|
|
462
|
+
fg:
|
|
463
|
+
fg !== baseValue(p, 'fg', m)
|
|
464
|
+
? String(fg)
|
|
465
|
+
: (p.fg.tokens[0] ?? String(fg)),
|
|
455
466
|
bgPart: p.bg.target,
|
|
456
|
-
bg:
|
|
467
|
+
bg:
|
|
468
|
+
bg !== baseValue(p, 'bg', m)
|
|
469
|
+
? String(bg)
|
|
470
|
+
: (p.bg.tokens[0] ?? String(bg)),
|
|
457
471
|
});
|
|
458
472
|
}
|
|
459
473
|
}
|
|
@@ -45,7 +45,7 @@ export function context(cwd: string): Promise<{
|
|
|
45
45
|
alphaOf: (v: unknown) => number;
|
|
46
46
|
compositeOver: (over: [number, number, number], alpha: number, under: [number, number, number]) => [number, number, number];
|
|
47
47
|
page: (mode: string) => string | null | undefined;
|
|
48
|
-
}) => {
|
|
48
|
+
}, extra?: TextPair[]) => {
|
|
49
49
|
problems: {
|
|
50
50
|
part: string;
|
|
51
51
|
mode: string;
|
|
@@ -61,6 +61,7 @@ export function context(cwd: string): Promise<{
|
|
|
61
61
|
};
|
|
62
62
|
parts: import("./_parts.mjs").PartData;
|
|
63
63
|
unchecked: string | null;
|
|
64
|
+
uncheckedCode: string | null;
|
|
64
65
|
}>;
|
|
65
66
|
/**
|
|
66
67
|
* Pictures of HTML files, on request.
|
|
@@ -13,7 +13,13 @@ import {createRequire} from 'node:module';
|
|
|
13
13
|
import * as path from 'node:path';
|
|
14
14
|
import {AstryxError} from '../error.mjs';
|
|
15
15
|
import {isOutsideProject} from '../../foundation/env/project-scope.mjs';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
CLOSEST_OPEN_FONT,
|
|
18
|
+
OPEN_FONTS,
|
|
19
|
+
P,
|
|
20
|
+
SYSTEM_FAMILIES,
|
|
21
|
+
SYSTEM_FONTS,
|
|
22
|
+
} from './_tables.mjs';
|
|
17
23
|
import {makeCompiler} from './_compiler.mjs';
|
|
18
24
|
import {openProject, installLine} from './_project.mjs';
|
|
19
25
|
import {partData} from './_parts.mjs';
|
|
@@ -72,11 +78,14 @@ export async function context(cwd) {
|
|
|
72
78
|
let parts;
|
|
73
79
|
/** @type {string | null} */
|
|
74
80
|
let unchecked = null;
|
|
81
|
+
/** @type {string | null} the render error's code */
|
|
82
|
+
let uncheckedCode = null;
|
|
75
83
|
try {
|
|
76
84
|
parts = await partData(project);
|
|
77
85
|
} catch (e) {
|
|
78
86
|
if (!isRenderFailure(e)) throw e;
|
|
79
87
|
unchecked = renderCause(project, /** @type {Error} */ (e).message);
|
|
88
|
+
uncheckedCode = /** @type {any} */ (e).code ?? null;
|
|
80
89
|
parts = {
|
|
81
90
|
version: 0,
|
|
82
91
|
coreKey: project.coreKey,
|
|
@@ -86,7 +95,13 @@ export async function context(cwd) {
|
|
|
86
95
|
items: 0,
|
|
87
96
|
};
|
|
88
97
|
}
|
|
89
|
-
return {
|
|
98
|
+
return {
|
|
99
|
+
project,
|
|
100
|
+
C: makeCompiler(project, parts),
|
|
101
|
+
parts,
|
|
102
|
+
unchecked,
|
|
103
|
+
uncheckedCode,
|
|
104
|
+
};
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
/** @param {unknown} e */
|
|
@@ -185,6 +200,9 @@ export function fontNotes(ctx, data) {
|
|
|
185
200
|
if (
|
|
186
201
|
s.thing !== 'font' ||
|
|
187
202
|
SYSTEM_FONTS.includes(s.value) ||
|
|
203
|
+
SYSTEM_FAMILIES.has(
|
|
204
|
+
fontOf(s.value).family.replace(/["']/g, '').toLowerCase(),
|
|
205
|
+
) ||
|
|
188
206
|
OPEN_FONTS[s.value] ||
|
|
189
207
|
fontOf(s.value).pkg ||
|
|
190
208
|
s.value === 'rounded' ||
|
|
@@ -194,7 +212,7 @@ export function fontNotes(ctx, data) {
|
|
|
194
212
|
const family = fontOf(s.value).family.replace(/["']/g, '').toLowerCase();
|
|
195
213
|
const near = CLOSEST_OPEN_FONT[family];
|
|
196
214
|
notes.push(
|
|
197
|
-
`"${fontOf(s.value).family.replace(
|
|
215
|
+
`"${fontOf(s.value).family.replace(/^["']|["']$/g, '')}" is not a system font and no package loads it: the app must load it, or it falls back.${near ? ` The closest open font is ${near}: ${P} set ${data.name} font ${near}${s.on ? ` --on ${s.on}` : ''}` : ''}`,
|
|
198
216
|
);
|
|
199
217
|
}
|
|
200
218
|
return notes;
|
|
@@ -218,13 +236,31 @@ export function styledChanges(before, after) {
|
|
|
218
236
|
])) {
|
|
219
237
|
const x = a[target]?.[key] ?? {};
|
|
220
238
|
const y = b[target]?.[key] ?? {};
|
|
239
|
+
/** @param {string} p */
|
|
240
|
+
const cssName = p =>
|
|
241
|
+
p.startsWith('--')
|
|
242
|
+
? p
|
|
243
|
+
: p.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`);
|
|
221
244
|
for (const prop of new Set([...Object.keys(x), ...Object.keys(y)])) {
|
|
222
245
|
if (JSON.stringify(x[prop]) === JSON.stringify(y[prop])) continue;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
246
|
+
const where = `${target}${key === 'base' ? '' : ` ${key}`}`;
|
|
247
|
+
// A state block (`:hover`) lists each property it changes.
|
|
248
|
+
if (
|
|
249
|
+
prop.startsWith(':') &&
|
|
250
|
+
((y[prop] && typeof y[prop] === 'object') ||
|
|
251
|
+
(x[prop] && typeof x[prop] === 'object'))
|
|
252
|
+
) {
|
|
253
|
+
const xs = x[prop] ?? {};
|
|
254
|
+
const ys = y[prop] ?? {};
|
|
255
|
+
for (const p of new Set([...Object.keys(xs), ...Object.keys(ys)]))
|
|
256
|
+
if (JSON.stringify(xs[p]) !== JSON.stringify(ys[p]))
|
|
257
|
+
out.push(
|
|
258
|
+
`${where} ${prop}: ${cssName(p)} ${ys[p] === undefined ? '(removed)' : String(ys[p])}`,
|
|
259
|
+
);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
226
262
|
out.push(
|
|
227
|
-
`${
|
|
263
|
+
`${where}: ${cssName(prop)} ${y[prop] === undefined ? '(removed)' : typeof y[prop] === 'string' ? y[prop] : JSON.stringify(y[prop])}`,
|
|
228
264
|
);
|
|
229
265
|
}
|
|
230
266
|
}
|
|
@@ -274,9 +310,12 @@ export async function previewAfter(ctx, slug, data, png) {
|
|
|
274
310
|
preview = await renderPreview(ctx, slug, data);
|
|
275
311
|
} catch (e) {
|
|
276
312
|
// The change is already saved: any failure here leaves it unchecked.
|
|
313
|
+
const code = /** @type {any} */ (e)?.code;
|
|
277
314
|
cause ??= isRenderFailure(e)
|
|
278
315
|
? renderCause(ctx.project, /** @type {Error} */ (e).message)
|
|
279
|
-
:
|
|
316
|
+
: ['ENOSPC', 'EACCES', 'EPERM', 'EROFS', 'EIO'].includes(code)
|
|
317
|
+
? `preview.html could not be written (${code === 'ENOSPC' ? 'the disk is full' : code}), so it still shows the theme as it was`
|
|
318
|
+
: `checking it failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
280
319
|
}
|
|
281
320
|
const f = themeFiles(ctx.project.cwd, slug);
|
|
282
321
|
const shots =
|
|
@@ -1,9 +1,6 @@
|
|
|
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
|
-
* @typedef {import('./theme-edit.type.mjs').ThemeEditChangeOptions} ChangeOptions
|
|
6
|
-
*/
|
|
7
4
|
/**
|
|
8
5
|
* Start a theme in themes/<name>/, optionally on a built-in theme, with any
|
|
9
6
|
* dial settings applied in the same build. Each setting is checked as `set`
|
|
@@ -43,4 +40,13 @@ export function themeEditShow(theme: string, options?: import("./theme-edit.type
|
|
|
43
40
|
* @returns {Promise<import('./theme-edit.type.mjs').ThemeEditUndoResponse | import('./theme-edit.type.mjs').ThemeEditChangeResponse>}
|
|
44
41
|
*/
|
|
45
42
|
export function themeEditUndo(theme: string, options?: import("./theme-edit.type.mjs").ThemeEditUndoOptions): Promise<import("./theme-edit.type.mjs").ThemeEditUndoResponse | import("./theme-edit.type.mjs").ThemeEditChangeResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Why an editor theme's build is not current, or null: the editor's own
|
|
45
|
+
* staleness check (the settings it was built from, the CLI and packages it
|
|
46
|
+
* was built with), for `compile --check`.
|
|
47
|
+
* @param {string} cwd
|
|
48
|
+
* @param {string} slug
|
|
49
|
+
* @returns {Promise<string | null>}
|
|
50
|
+
*/
|
|
51
|
+
export function editorStale(cwd: string, slug: string): Promise<string | null>;
|
|
46
52
|
export type ChangeOptions = import("./theme-edit.type.mjs").ThemeEditChangeOptions;
|