@astryxdesign/cli 0.7.16-canary.ge95b87c → 0.7.16
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 +369 -0
- package/README.md +1 -1
- package/api/build/_adapter.d.mts +9 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/kit/shell.weights.json +1 -0
- package/api/build/kit/shellcall.d.mts +26 -0
- package/api/build/kit/shellcall.mjs +87 -0
- package/api/build/kit/start.mjs +67 -4
- package/api/build/kit/weights.d.mts +15 -0
- package/api/build/kit/weights.mjs +27 -0
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/doctor/_adapter.d.mts +3 -2
- package/api/doctor/_adapter.mjs +7 -1
- package/api/doctor/doctor.d.mts +8 -0
- package/api/doctor/doctor.mjs +53 -8
- package/api/doctor/theme-checks.mjs +157 -8
- package/api/icon/_adapter.d.mts +7 -3
- package/api/icon/_adapter.mjs +12 -3
- package/api/icon/icon.type.d.mts +15 -0
- package/api/icon/icon.type.mjs +10 -3
- package/api/icon/iconUse.doc.mjs +19 -5
- package/api/icon/list/list.mjs +7 -1
- package/api/icon/use/use.d.mts +8 -5
- package/api/icon/use/use.mjs +95 -13
- package/api/init/run/run.mjs +1 -0
- package/api/template/template.type.d.mts +6 -2
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.mjs +16 -2
- package/api/theme/build/build.d.mts +10 -6
- package/api/theme/build/build.mjs +42 -29
- package/api/theme/generateTonalPalette.doc.mjs +2 -2
- package/api/theme/palette/generate/generator.mjs +141 -2
- package/api/theme/theme.type.d.mts +39 -0
- package/api/theme/theme.type.mjs +21 -0
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme-edit/_adapter.d.mts +1 -0
- package/api/theme-edit/_adapter.mjs +79 -21
- package/api/theme-edit/_check.d.mts +25 -2
- package/api/theme-edit/_check.mjs +251 -61
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +19 -1
- package/api/theme-edit/_edit.d.mts +16 -0
- package/api/theme-edit/_edit.mjs +360 -59
- package/api/theme-edit/_how-question.d.mts +8 -0
- package/api/theme-edit/_how-question.mjs +169 -22
- package/api/theme-edit/_marks.d.mts +13 -0
- package/api/theme-edit/_marks.mjs +15 -0
- package/api/theme-edit/_palette.d.mts +27 -0
- package/api/theme-edit/_palette.mjs +112 -8
- package/api/theme-edit/_preview-app.d.mts +46 -1
- package/api/theme-edit/_preview-app.mjs +367 -36
- package/api/theme-edit/_preview.d.mts +55 -0
- package/api/theme-edit/_preview.mjs +231 -6
- package/api/theme-edit/_project.d.mts +4 -0
- package/api/theme-edit/_project.mjs +27 -6
- package/api/theme-edit/_settings.d.mts +61 -2
- package/api/theme-edit/_settings.mjs +317 -115
- package/api/theme-edit/_tables.mjs +1 -1
- package/api/theme-edit/theme-edit.type.d.mts +30 -2
- package/api/theme-edit/theme-edit.type.mjs +10 -2
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.zh.mjs +4 -3
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +63 -8
- package/assets/docs.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +20 -2
- package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
- package/authoring/config/config.doc.mjs +8 -0
- package/authoring/config/parse.d.mts +1 -0
- package/authoring/config/parse.mjs +12 -0
- package/authoring/config/type.ts +8 -0
- package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/experimental/icon.mjs +61 -6
- package/clients/cli/commands/experimental/theme.mjs +9 -2
- package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +41 -18
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/index.mjs +25 -5
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/config-writer.d.mts +23 -0
- package/foundation/config/config-writer.mjs +150 -56
- package/foundation/config/project.mjs +43 -2
- package/foundation/discovery/component-discovery.mjs +6 -5
- package/foundation/discovery/icon-set-checks.mjs +164 -48
- package/foundation/discovery/icon-set-discovery.d.mts +38 -5
- package/foundation/discovery/icon-set-discovery.mjs +50 -6
- package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
- package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -3
- package/foundation/discovery/icon-set-writer.mjs +57 -16
- package/foundation/discovery/template-icons.d.mts +27 -10
- package/foundation/discovery/template-icons.mjs +142 -26
- package/foundation/discovery/theme-discovery.d.mts +25 -0
- package/foundation/discovery/theme-discovery.mjs +48 -7
- package/foundation/fs/gather-cache.mjs +6 -2
- package/foundation/integrations/autolink.d.mts +4 -2
- package/foundation/integrations/autolink.mjs +4 -2
- package/foundation/integrations/cli-requirement.d.mts +16 -5
- package/foundation/integrations/cli-requirement.mjs +27 -6
- package/foundation/integrations/may-have-integrations.mjs +5 -2
- package/foundation/integrations/missing-dependency.d.mts +9 -0
- package/foundation/integrations/missing-dependency.mjs +100 -0
- package/package.json +6 -6
|
@@ -291,6 +291,34 @@ export type TonalPaletteFamilyInput = {
|
|
|
291
291
|
*/
|
|
292
292
|
anchors?: TonalPaletteAnchor[] | undefined;
|
|
293
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* Mutes the dark edge of every chromatic family. Their dark ramps keep
|
|
296
|
+
* `edgeMultiplier` of their in-gamut chroma through `throughStop`, then
|
|
297
|
+
* recover along a smoothstep to the standard recipe at `recoverAtStop`. Light
|
|
298
|
+
* ramps, neutral families, and the black and white endpoints do not change.
|
|
299
|
+
*/
|
|
300
|
+
export type TonalPaletteDarkChromaTaper = {
|
|
301
|
+
/**
|
|
302
|
+
* Share of chroma, from 0 to 1, that the
|
|
303
|
+
* dark edge keeps.
|
|
304
|
+
*/
|
|
305
|
+
edgeMultiplier: number;
|
|
306
|
+
/**
|
|
307
|
+
* Last stop that takes the full edge
|
|
308
|
+
* multiplier; must be a requested stop.
|
|
309
|
+
*/
|
|
310
|
+
throughStop: number;
|
|
311
|
+
/**
|
|
312
|
+
* First stop back on the standard recipe;
|
|
313
|
+
* must be a requested stop after `throughStop`.
|
|
314
|
+
*/
|
|
315
|
+
recoverAtStop: number;
|
|
316
|
+
/**
|
|
317
|
+
* Edge multipliers,
|
|
318
|
+
* from 0 to 1, by chromatic family id, in place of `edgeMultiplier`.
|
|
319
|
+
*/
|
|
320
|
+
familyMultipliers?: Record<string, number> | undefined;
|
|
321
|
+
};
|
|
294
322
|
export type TonalPaletteGenerationInput = {
|
|
295
323
|
families: TonalPaletteFamilyInput[];
|
|
296
324
|
/**
|
|
@@ -305,6 +333,11 @@ export type TonalPaletteGenerationInput = {
|
|
|
305
333
|
*/
|
|
306
334
|
neutralProfile?: "custom" | "neutral-v1" | "warm-v1" | "cool-v1" | undefined;
|
|
307
335
|
modeStrategy?: "light-only" | "dark-only" | "light-and-dark" | undefined;
|
|
336
|
+
/**
|
|
337
|
+
* Mutes the dark
|
|
338
|
+
* edge of the chromatic families.
|
|
339
|
+
*/
|
|
340
|
+
darkChromaTaper?: TonalPaletteDarkChromaTaper | undefined;
|
|
308
341
|
/**
|
|
309
342
|
* Ordered stops shared by every requested family;
|
|
310
343
|
* defaults to 0 through 100 in increments of 5. Decimal stops are supported,
|
|
@@ -422,6 +455,12 @@ export type TonalPaletteNormalizedRequest = {
|
|
|
422
455
|
vibrancy: number;
|
|
423
456
|
neutralProfile: "neutral-v1" | "warm-v1" | "cool-v1" | "custom";
|
|
424
457
|
modeStrategy: "light-only" | "dark-only" | "light-and-dark";
|
|
458
|
+
/**
|
|
459
|
+
* The
|
|
460
|
+
* requested taper, with `familyMultipliers` filled in; present only when the
|
|
461
|
+
* request has a taper.
|
|
462
|
+
*/
|
|
463
|
+
darkChromaTaper?: Required<TonalPaletteDarkChromaTaper> | undefined;
|
|
425
464
|
stops: number[];
|
|
426
465
|
families: Array<{
|
|
427
466
|
id: string;
|
package/api/theme/theme.type.mjs
CHANGED
|
@@ -178,6 +178,22 @@
|
|
|
178
178
|
* @property {TonalPaletteAnchor[]} [anchors] Colors pinned at specific stops.
|
|
179
179
|
*/
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Mutes the dark edge of every chromatic family. Their dark ramps keep
|
|
183
|
+
* `edgeMultiplier` of their in-gamut chroma through `throughStop`, then
|
|
184
|
+
* recover along a smoothstep to the standard recipe at `recoverAtStop`. Light
|
|
185
|
+
* ramps, neutral families, and the black and white endpoints do not change.
|
|
186
|
+
* @typedef {object} TonalPaletteDarkChromaTaper
|
|
187
|
+
* @property {number} edgeMultiplier Share of chroma, from 0 to 1, that the
|
|
188
|
+
* dark edge keeps.
|
|
189
|
+
* @property {number} throughStop Last stop that takes the full edge
|
|
190
|
+
* multiplier; must be a requested stop.
|
|
191
|
+
* @property {number} recoverAtStop First stop back on the standard recipe;
|
|
192
|
+
* must be a requested stop after `throughStop`.
|
|
193
|
+
* @property {Record<string, number>} [familyMultipliers] Edge multipliers,
|
|
194
|
+
* from 0 to 1, by chromatic family id, in place of `edgeMultiplier`.
|
|
195
|
+
*/
|
|
196
|
+
|
|
181
197
|
/**
|
|
182
198
|
* @typedef {object} TonalPaletteGenerationInput
|
|
183
199
|
* @property {TonalPaletteFamilyInput[]} families
|
|
@@ -188,6 +204,8 @@
|
|
|
188
204
|
* `warm-v1` and `cool-v1` add a slight tint, and `custom` derives the hue from
|
|
189
205
|
* the family's own seed. Defaults to `neutral-v1`.
|
|
190
206
|
* @property {'light-only' | 'dark-only' | 'light-and-dark'} [modeStrategy]
|
|
207
|
+
* @property {TonalPaletteDarkChromaTaper} [darkChromaTaper] Mutes the dark
|
|
208
|
+
* edge of the chromatic families.
|
|
191
209
|
* @property {number[]} [stops] Ordered stops shared by every requested family;
|
|
192
210
|
* defaults to 0 through 100 in increments of 5. Decimal stops are supported,
|
|
193
211
|
* and authors may omit the repeated black and white endpoints.
|
|
@@ -245,6 +263,9 @@
|
|
|
245
263
|
* @property {number} vibrancy
|
|
246
264
|
* @property {'neutral-v1' | 'warm-v1' | 'cool-v1' | 'custom'} neutralProfile
|
|
247
265
|
* @property {'light-only' | 'dark-only' | 'light-and-dark'} modeStrategy
|
|
266
|
+
* @property {Required<TonalPaletteDarkChromaTaper>} [darkChromaTaper] The
|
|
267
|
+
* requested taper, with `familyMultipliers` filled in; present only when the
|
|
268
|
+
* request has a taper.
|
|
248
269
|
* @property {number[]} stops
|
|
249
270
|
* @property {Array<{id: string, name: string, seed: string, kind: 'chromatic' | 'neutral', anchors: TonalPaletteAnchor[]}>} families
|
|
250
271
|
*/
|
|
@@ -104,7 +104,7 @@ export const doc = {
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
code: 'ERR_THEME_INVALID',
|
|
107
|
-
when: 'the resolved theme is invalid, for example it has no name, a custom Heading type has no standalone rule with a declaration the compiler can emit, or its icon registry cannot be preserved through an import (also rejected in check mode); or an output would replace the theme source, two outputs share one path, or the file is itself an output of a build, whatever its extension (refused before loading, naming the source it was built from); in a batch, two themes that build the same outputs are refused before either writes',
|
|
107
|
+
when: 'the resolved theme is invalid, for example it has no name, it sets a private `--_*` variable (refused before anything is written, also in check mode; each one is named), a custom Heading type has no standalone rule with a declaration the compiler can emit, or its icon registry cannot be preserved through an import (also rejected in check mode); or an output would replace the theme source, two outputs share one path, or the file is itself an output of a build, whatever its extension (refused before loading, naming the source it was built from); in a batch, two themes that build the same outputs are refused before either writes',
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
code: 'ERR_FILE_EXISTS',
|
|
@@ -68,7 +68,7 @@ export const doc = {
|
|
|
68
68
|
{code: 'ERR_FILE_NOT_FOUND', when: 'the config file does not exist'},
|
|
69
69
|
{
|
|
70
70
|
code: 'ERR_PALETTE_GENERATION',
|
|
71
|
-
when: 'the config is not valid JSON; the request, seed, stop layout, mode or
|
|
71
|
+
when: 'the config is not valid JSON; the request, seed, stop layout, mode, anchor or dark chroma taper is invalid; out does not end in .ts or .json; or preview does not end in .html',
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
code: 'ERR_PATH_TRAVERSAL',
|
|
@@ -85,6 +85,7 @@ export function editorThemeTemplate(options: {
|
|
|
85
85
|
export { parsePoints } from "./_how.mjs";
|
|
86
86
|
export { newFlagList } from "./_edit.mjs";
|
|
87
87
|
export function builtInThemes(): string[];
|
|
88
|
+
export function editorBaseIn(slug: string | null | undefined, cwd: string): string;
|
|
88
89
|
export function showSections(): string[];
|
|
89
90
|
export { dialValueFits } from "./_settings.mjs";
|
|
90
91
|
/** @type {typeof edit.themeEditNew} */
|
|
@@ -37,7 +37,7 @@ import {createHash} from 'node:crypto';
|
|
|
37
37
|
import * as fs from 'node:fs';
|
|
38
38
|
import * as path from 'node:path';
|
|
39
39
|
import * as edit from './_edit.mjs';
|
|
40
|
-
import {themeCacheRoot} from './_project.mjs';
|
|
40
|
+
import {baseInstalled, themeCacheRoot} from './_project.mjs';
|
|
41
41
|
import * as preview from './_preview-app.mjs';
|
|
42
42
|
import {AstryxError} from '../error.mjs';
|
|
43
43
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
@@ -51,8 +51,17 @@ import {
|
|
|
51
51
|
} from '../../foundation/env/package-manager.mjs';
|
|
52
52
|
import {LIKE, P} from './_tables.mjs';
|
|
53
53
|
import {setLine} from './_check.mjs';
|
|
54
|
-
import {
|
|
55
|
-
|
|
54
|
+
import {
|
|
55
|
+
SHOWCASE_GROUPS,
|
|
56
|
+
takeFirstAppCopy,
|
|
57
|
+
writeAppCopy,
|
|
58
|
+
writeAppCopyAt,
|
|
59
|
+
} from './_preview.mjs';
|
|
60
|
+
import {humanWarn} from '../../foundation/response/json.mjs';
|
|
61
|
+
import {folderIsEmpty, setAfterBuild, typedThemeName} from './_settings.mjs';
|
|
62
|
+
|
|
63
|
+
// Every build of a theme writes its app copy (src/themes/<theme>/).
|
|
64
|
+
setAfterBuild(writeAppCopy);
|
|
56
65
|
import {LOCAL_THEME_ROOT} from '../../foundation/config/theme-state.mjs';
|
|
57
66
|
|
|
58
67
|
export {parsePoints} from './_how.mjs';
|
|
@@ -93,6 +102,17 @@ export async function themeEditHow(subject, options = {}) {
|
|
|
93
102
|
/** The built-in themes a theme can build on (`--like`). */
|
|
94
103
|
export const builtInThemes = () => [...LIKE];
|
|
95
104
|
|
|
105
|
+
/**
|
|
106
|
+
* The base the editor can start a theme from in a project: `slug` when it
|
|
107
|
+
* is a built-in base installed there (the check `new --like` makes), else
|
|
108
|
+
* neutral.
|
|
109
|
+
* @param {string | null | undefined} slug
|
|
110
|
+
* @param {string} cwd
|
|
111
|
+
* @returns {string}
|
|
112
|
+
*/
|
|
113
|
+
export const editorBaseIn = (slug, cwd) =>
|
|
114
|
+
slug && LIKE.includes(slug) && baseInstalled(cwd, slug) ? slug : 'neutral';
|
|
115
|
+
|
|
96
116
|
/** The sections `show --section` takes. */
|
|
97
117
|
export const showSections = () => [...SHOWCASE_GROUPS];
|
|
98
118
|
|
|
@@ -665,28 +685,37 @@ export function editorThemeRefusal(err, cwd) {
|
|
|
665
685
|
if (!slug) return null;
|
|
666
686
|
// A local theme of that name (a fork in the app's own themes folder) is
|
|
667
687
|
// one the stable commands take: their own message stands.
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
//
|
|
672
|
-
//
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
let
|
|
676
|
-
|
|
677
|
-
.
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
688
|
+
// A folder of only system files (or empty) holds no theme: as absent.
|
|
689
|
+
if (!folderIsEmpty(path.join(root, LOCAL_THEME_ROOT, slug))) return null;
|
|
690
|
+
// No app copy yet (a theme made before the editor wrote one, or the
|
|
691
|
+
// copy removed): the next build writes it, then the same steps every
|
|
692
|
+
// place gives (`wiring` of new and show).
|
|
693
|
+
// A one-mode theme's mode is a step too, as in `wiring`.
|
|
694
|
+
/** @type {'light' | 'dark' | 'system'} */
|
|
695
|
+
let mode = 'system';
|
|
696
|
+
try {
|
|
697
|
+
const m = JSON.parse(
|
|
698
|
+
fs.readFileSync(
|
|
699
|
+
path.join(root, 'themes', slug, `${slug}.settings.json`),
|
|
700
|
+
'utf8',
|
|
701
|
+
),
|
|
702
|
+
).mode;
|
|
703
|
+
if (m === 'light-only') mode = 'light';
|
|
704
|
+
else if (m === 'dark-only') mode = 'dark';
|
|
705
|
+
} catch {
|
|
706
|
+
// Settings that do not read: both modes.
|
|
707
|
+
}
|
|
708
|
+
const steps = preview.addWiring(root, slug, mode);
|
|
684
709
|
return new AstryxError(
|
|
685
|
-
`${slug} is a theme the editor made (themes/${slug}/),
|
|
710
|
+
`${slug} is a theme the editor made (themes/${slug}/), and it has no app copy yet: list, add, use, remove and eject take the copy every build of it writes in src/themes/${slug}/, a standard local theme. Build it once, then: ${steps.join('; ')}.`,
|
|
686
711
|
[
|
|
687
712
|
{
|
|
688
713
|
name: runLine(cwd, `experimental theme editor show ${slug}`),
|
|
689
|
-
reason:
|
|
714
|
+
reason: `builds it and writes its app copy, src/themes/${slug}/`,
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
name: runLine(cwd, `theme add ${slug}`),
|
|
718
|
+
reason: 'then adds it to the app',
|
|
690
719
|
},
|
|
691
720
|
],
|
|
692
721
|
ERROR_CODES.ERR_UNKNOWN_THEME,
|
|
@@ -811,6 +840,12 @@ export async function editorCompileProblem(
|
|
|
811
840
|
/^[^/]+\.(css|js|d\.ts|css\.d\.ts) was missing$/.test(why)
|
|
812
841
|
)
|
|
813
842
|
why = null;
|
|
843
|
+
// Saved settings the editor no longer accepts: show refuses them too,
|
|
844
|
+
// so the refusal names the undo that removes each.
|
|
845
|
+
if (why) {
|
|
846
|
+
const stored = await edit.editorStoredRefusal(root, slug);
|
|
847
|
+
if (stored) return stored;
|
|
848
|
+
}
|
|
814
849
|
if (why && !check)
|
|
815
850
|
return new AstryxError(
|
|
816
851
|
`${slug}'s generated settings do not match its settings (${why}), so compile would build the old ones. The editor builds it from its settings.`,
|
|
@@ -833,6 +868,13 @@ export async function editorCompileProblem(
|
|
|
833
868
|
],
|
|
834
869
|
ERROR_CODES.ERR_THEME_INVALID,
|
|
835
870
|
);
|
|
871
|
+
// A [light, dark] pair on a token that is not a color, however the
|
|
872
|
+
// file writes it: what the theme builds now is read (never written
|
|
873
|
+
// beside it), as the editor's own build reads it.
|
|
874
|
+
if (path.basename(file) === `${slug}.theme.ts`) {
|
|
875
|
+
const pairs = await edit.editorPairRefusal(root, slug);
|
|
876
|
+
if (pairs) return pairs;
|
|
877
|
+
}
|
|
836
878
|
}
|
|
837
879
|
}
|
|
838
880
|
return null;
|
|
@@ -900,6 +942,22 @@ export async function editorThemeHold(files, {cwd}) {
|
|
|
900
942
|
throw err;
|
|
901
943
|
}
|
|
902
944
|
releases.push(async () => {
|
|
945
|
+
// A compile that wrote the build refreshes the app's copy too
|
|
946
|
+
// (src/themes/<theme>/), under the same lock; a check writes nothing.
|
|
947
|
+
if (!process.argv.includes('--check')) {
|
|
948
|
+
try {
|
|
949
|
+
writeAppCopyAt(root, slug, null);
|
|
950
|
+
// The first write of the app copy is named once (the compile's
|
|
951
|
+
// own JSON envelope is the stable command's).
|
|
952
|
+
const wrote = takeFirstAppCopy(root, slug);
|
|
953
|
+
if (wrote)
|
|
954
|
+
humanWarn(
|
|
955
|
+
`wrote ${slug}'s app copy, a local theme \`theme add ${slug}\` takes, written again after every build: ${wrote.join(', ')}`,
|
|
956
|
+
);
|
|
957
|
+
} catch {
|
|
958
|
+
// A theme that does not load keeps its copy as it was.
|
|
959
|
+
}
|
|
960
|
+
}
|
|
903
961
|
release();
|
|
904
962
|
await done;
|
|
905
963
|
});
|
|
@@ -38,7 +38,7 @@ export function pastedFont(v: string): string | null;
|
|
|
38
38
|
* @param {string} slug
|
|
39
39
|
* @param {import('./_settings.mjs').ThemeData} data
|
|
40
40
|
* @param {string | {thing: string, on?: string, when?: string, state?: string, mode?: string}} [skip]
|
|
41
|
-
* @returns {Array<{setting: import('./_settings.mjs').Setting, why: string, scope?: boolean}>} every saved setting the editor no longer accepts
|
|
41
|
+
* @returns {Array<{setting: import('./_settings.mjs').Setting, why: string, scope?: boolean, fix?: string}>} every saved setting the editor no longer accepts (`fix`: the clean value to set, when one reads)
|
|
42
42
|
*/
|
|
43
43
|
export function storedProblems(ctx: import("./_settings.mjs").Ctx, slug: string, data: import("./_settings.mjs").ThemeData, skip?: string | {
|
|
44
44
|
thing: string;
|
|
@@ -50,6 +50,7 @@ export function storedProblems(ctx: import("./_settings.mjs").Ctx, slug: string,
|
|
|
50
50
|
setting: import("./_settings.mjs").Setting;
|
|
51
51
|
why: string;
|
|
52
52
|
scope?: boolean;
|
|
53
|
+
fix?: string;
|
|
53
54
|
}>;
|
|
54
55
|
/**
|
|
55
56
|
* A value of a type to put in a suggestion, so a suggested command runs.
|
|
@@ -86,12 +87,13 @@ export function normalValue(thing: string, value: string): string;
|
|
|
86
87
|
* @param {string} v
|
|
87
88
|
* @param {Record<string, unknown>} TOKENS
|
|
88
89
|
* @param {string} thing
|
|
89
|
-
* @returns {{message: string, near: string[], close: boolean} | null}
|
|
90
|
+
* @returns {{message: string, near: string[], close: boolean, fixed?: string} | null}
|
|
90
91
|
*/
|
|
91
92
|
export function unknownVarRef(v: string, TOKENS: Record<string, unknown>, thing: string): {
|
|
92
93
|
message: string;
|
|
93
94
|
near: string[];
|
|
94
95
|
close: boolean;
|
|
96
|
+
fixed?: string;
|
|
95
97
|
} | null;
|
|
96
98
|
/**
|
|
97
99
|
* Why a font value names a font file or a link rather than a family
|
|
@@ -102,6 +104,27 @@ export function unknownVarRef(v: string, TOKENS: Record<string, unknown>, thing:
|
|
|
102
104
|
* @returns {string | null}
|
|
103
105
|
*/
|
|
104
106
|
export function fontFileReason(value: string): string | null;
|
|
107
|
+
/**
|
|
108
|
+
* A value with every Unicode space (no-break, thin, ideographic…) as a plain
|
|
109
|
+
* space and zero-width and format characters dropped, for every value type:
|
|
110
|
+
* the browser reads only a plain space as one.
|
|
111
|
+
* @param {string} v
|
|
112
|
+
*/
|
|
113
|
+
export function normalValueText(v: string): string;
|
|
114
|
+
/**
|
|
115
|
+
* The thing and value a setting was typed as, put right before any check: a
|
|
116
|
+
* declaration pasted whole or split (`accent: #e11d48`, `--color-accent=red`,
|
|
117
|
+
* `font:inter`, `accent:` with the value next), a token typed with an em or
|
|
118
|
+
* en dash (`—color-accent`) or as `var(--color-accent)`, and the value's
|
|
119
|
+
* Unicode spaces. A thing it cannot read is left as typed.
|
|
120
|
+
* @param {string} thing
|
|
121
|
+
* @param {string | undefined} value
|
|
122
|
+
* @returns {{thing: string, value: string | undefined}}
|
|
123
|
+
*/
|
|
124
|
+
export function normalizeEntry(thing: string, value: string | undefined): {
|
|
125
|
+
thing: string;
|
|
126
|
+
value: string | undefined;
|
|
127
|
+
};
|
|
105
128
|
export function setLine(slug: string, thing: string, value: string, s: {
|
|
106
129
|
on?: string;
|
|
107
130
|
when?: string;
|