@astryxdesign/cli 0.7.15 → 0.7.16-canary.g22213fd
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/README.md +6 -4
- package/api/build/_adapter.d.mts +10 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/blocks/blocks.d.mts +1 -0
- package/api/build/blocks/blocks.mjs +18 -1
- 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/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +38 -2
- package/api/doctor/_adapter.mjs +76 -1
- package/api/doctor/built-checks.mjs +1 -1
- package/api/doctor/doctor.d.mts +26 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +156 -11
- package/api/doctor/theme-checks.mjs +163 -18
- 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/integration/add-contribution.mjs +3 -3
- package/api/integration/pack-check.mjs +14 -8
- package/api/integration/validate-integration.mjs +1 -1
- package/api/search/_adapter.mjs +15 -16
- package/api/search/_entries.d.mts +2 -1
- package/api/search/_entries.mjs +28 -1
- package/api/swizzle/_moduleGraph.mjs +1 -1
- package/api/template/template.type.d.mts +6 -2
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +59 -14
- package/api/theme/_fork.mjs +1 -1
- package/api/theme/build/build.d.mts +120 -32
- package/api/theme/build/build.mjs +471 -111
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/generateTonalPalette.doc.mjs +2 -2
- package/api/theme/palette/generate/generator.mjs +141 -2
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +102 -25
- package/api/theme/theme.type.d.mts +44 -1
- package/api/theme/theme.type.mjs +23 -1
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +9 -3
- package/api/theme-edit/_adapter.d.mts +33 -2
- package/api/theme-edit/_adapter.mjs +276 -41
- package/api/theme-edit/_check.d.mts +93 -4
- package/api/theme-edit/_check.mjs +1712 -223
- package/api/theme-edit/_color.d.mts +2 -8
- package/api/theme-edit/_color.mjs +292 -219
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +20 -1
- package/api/theme-edit/_context.d.mts +31 -1
- package/api/theme-edit/_context.mjs +445 -41
- package/api/theme-edit/_css.d.mts +60 -1
- package/api/theme-edit/_css.mjs +404 -28
- package/api/theme-edit/_edit.d.mts +25 -0
- package/api/theme-edit/_edit.mjs +1620 -154
- package/api/theme-edit/_how-commands.d.mts +11 -26
- package/api/theme-edit/_how-commands.mjs +30 -2
- package/api/theme-edit/_how-question.d.mts +15 -0
- package/api/theme-edit/_how-question.mjs +1469 -194
- package/api/theme-edit/_how.mjs +144 -30
- package/api/theme-edit/_marks.d.mts +13 -0
- package/api/theme-edit/_marks.mjs +15 -0
- package/api/theme-edit/_overview.mjs +2 -0
- package/api/theme-edit/_palette.d.mts +38 -0
- package/api/theme-edit/_palette.mjs +306 -73
- package/api/theme-edit/_parts.d.mts +33 -0
- package/api/theme-edit/_parts.mjs +138 -9
- package/api/theme-edit/_png.d.mts +18 -0
- package/api/theme-edit/_png.mjs +95 -14
- package/api/theme-edit/_preview-app.d.mts +55 -1
- package/api/theme-edit/_preview-app.mjs +1552 -101
- package/api/theme-edit/_preview.d.mts +71 -3
- package/api/theme-edit/_preview.mjs +565 -35
- package/api/theme-edit/_project.d.mts +15 -0
- package/api/theme-edit/_project.mjs +68 -13
- package/api/theme-edit/_settings.d.mts +299 -5
- package/api/theme-edit/_settings.mjs +2806 -158
- package/api/theme-edit/_tables.d.mts +24 -0
- package/api/theme-edit/_tables.mjs +212 -150
- package/api/theme-edit/_vet.d.mts +42 -0
- package/api/theme-edit/_vet.mjs +144 -0
- package/api/theme-edit/theme-edit.type.d.mts +31 -2
- package/api/theme-edit/theme-edit.type.mjs +10 -2
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditShow.doc.mjs +11 -3
- package/api/upgrade/registry/registry.mjs +6 -1
- package/assets/codemods/parse.mjs +2 -2
- 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/tree/single-component.doc.mjs +11 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -2
- package/assets/preview-app/next.config.mjs +7 -1
- package/assets/preview-app/package.json +1 -0
- package/assets/preview-app/src/app/globals.css +1 -0
- 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/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +20 -2
- package/assets/templates/pages/dashboard/page.tsx +1 -1
- 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/_schema.d.mts +52 -5
- package/authoring/doctypes/_schema.mjs +62 -7
- package/authoring/doctypes/base/type.ts +10 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/function/function.doc.mjs +6 -0
- package/authoring/doctypes/function/type.ts +3 -0
- package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
- package/authoring/doctypes/legacy.mjs +5 -1
- package/authoring/index.d.ts +1 -0
- package/authoring/shadcn/source-variants.d.mts +1 -1
- package/authoring/shadcn/source-variants.mjs +32 -10
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/experimental/icon.mjs +61 -6
- package/clients/cli/commands/experimental/theme.mjs +244 -45
- package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
- 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 +1 -1
- 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-template.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +3 -1
- package/clients/cli/commands/theme.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +222 -55
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +7 -4
- package/clients/cli/index.mjs +25 -5
- package/clients/cli/lib/cli-error.mjs +9 -3
- package/clients/cli/lib/component-format.mjs +27 -9
- package/clients/cli/lib/json-shim.mjs +72 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +49 -0
- package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
- package/foundation/agent-docs/agent-docs-target.mjs +9 -17
- package/foundation/agent-docs/agent-docs.mjs +4 -3
- package/foundation/config/config-writer.d.mts +23 -0
- package/foundation/config/config-writer.mjs +152 -58
- package/foundation/config/project.mjs +103 -16
- package/foundation/discovery/component-discovery.mjs +11 -22
- 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 +58 -17
- package/foundation/discovery/module-exports.mjs +1 -15
- package/foundation/discovery/template-adapter.mjs +44 -19
- package/foundation/discovery/template-icons.d.mts +27 -10
- package/foundation/discovery/template-icons.mjs +142 -26
- package/foundation/discovery/template-source-tree.mjs +3 -16
- package/foundation/discovery/theme-discovery.d.mts +30 -1
- package/foundation/discovery/theme-discovery.mjs +109 -50
- package/foundation/fs/exact-codec.d.mts +35 -0
- package/foundation/fs/exact-codec.mjs +148 -0
- package/foundation/fs/gather-cache.d.mts +15 -5
- package/foundation/fs/gather-cache.mjs +129 -31
- package/foundation/fs/paths.d.mts +39 -0
- package/foundation/fs/paths.mjs +44 -11
- package/foundation/fs/read-record.mjs +11 -1
- 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/contribution-fixes.mjs +1 -16
- package/foundation/integrations/may-have-integrations.mjs +7 -3
- package/foundation/integrations/missing-dependency.d.mts +9 -0
- package/foundation/integrations/missing-dependency.mjs +100 -0
- package/foundation/integrations/public-imports.mjs +1 -1
- package/foundation/render/embedded-imports.mjs +1 -1
- package/foundation/render/host-exit.d.mts +8 -0
- package/foundation/render/host-exit.mjs +11 -0
- package/foundation/render/page-host.mjs +56 -10
- package/foundation/render/page-worker.mjs +14 -0
- package/foundation/render/render-page.mjs +37 -2
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +5 -0
- package/foundation/response/error-codes.mjs +3 -0
- package/foundation/response/json.d.mts +15 -0
- package/foundation/response/json.mjs +52 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/runtime/lazy-dependencies.d.mts +14 -0
- package/foundation/runtime/lazy-dependencies.mjs +82 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -296,14 +296,23 @@ export function registerExperimentalIcon(group, program) {
|
|
|
296
296
|
return answered;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
const {
|
|
300
|
-
|
|
299
|
+
const {
|
|
300
|
+
status,
|
|
301
|
+
projectSet,
|
|
302
|
+
reason,
|
|
303
|
+
sets,
|
|
304
|
+
withdrawn,
|
|
305
|
+
order,
|
|
306
|
+
next,
|
|
307
|
+
variant,
|
|
308
|
+
} = result.data;
|
|
301
309
|
emit(
|
|
302
310
|
section('Icon sets'),
|
|
303
311
|
record({
|
|
304
312
|
status,
|
|
305
313
|
projectSet,
|
|
306
314
|
...(order.length > 1 ? {order: order.join(' > ')} : {}),
|
|
315
|
+
...(variant ? {variant} : {}),
|
|
307
316
|
reason,
|
|
308
317
|
}),
|
|
309
318
|
...(next ? [text(`[warn] ${next}`)] : []),
|
|
@@ -326,6 +335,7 @@ export function registerExperimentalIcon(group, program) {
|
|
|
326
335
|
'iconCount',
|
|
327
336
|
'default',
|
|
328
337
|
'variants',
|
|
338
|
+
...(variant ? ['look'] : []),
|
|
329
339
|
'builtIn',
|
|
330
340
|
'definitions',
|
|
331
341
|
'own',
|
|
@@ -396,10 +406,15 @@ export function registerExperimentalIcon(group, program) {
|
|
|
396
406
|
fn: iconUseFn,
|
|
397
407
|
action: (
|
|
398
408
|
/** @type {string} */ set,
|
|
399
|
-
/** @type {{backup?: string[]}} */ options,
|
|
409
|
+
/** @type {{backup?: string[], variant?: string}} */ options,
|
|
400
410
|
) =>
|
|
401
411
|
run(
|
|
402
|
-
() =>
|
|
412
|
+
() =>
|
|
413
|
+
iconUse(set, {
|
|
414
|
+
cwd: process.cwd(),
|
|
415
|
+
backups: options.backup ?? [],
|
|
416
|
+
variant: options.variant,
|
|
417
|
+
}),
|
|
403
418
|
({data}) => {
|
|
404
419
|
/** @type {Array<{iconSet: string, set: string}>} */
|
|
405
420
|
const backups = data.backups;
|
|
@@ -410,9 +425,18 @@ export function registerExperimentalIcon(group, program) {
|
|
|
410
425
|
backups.length > 0
|
|
411
426
|
? `main set ${main}, then ${backups.map(each => `"${each.iconSet}" (${each.set})`).join(', then ')}`
|
|
412
427
|
: main;
|
|
428
|
+
const written =
|
|
429
|
+
backups.length > 0
|
|
430
|
+
? [data.iconSet, ...backups.map(each => each.iconSet)]
|
|
431
|
+
: data.iconSet;
|
|
432
|
+
const setChanged =
|
|
433
|
+
JSON.stringify(data.previous) !== JSON.stringify(written);
|
|
434
|
+
const variantChanged = data.previousVariant !== data.variant;
|
|
435
|
+
/** @type {Array<{set: string, variant: string | null}>} */
|
|
436
|
+
const looks = data.looks ?? [];
|
|
413
437
|
emit(
|
|
414
438
|
text(
|
|
415
|
-
|
|
439
|
+
setChanged
|
|
416
440
|
? `[ok] experimental.iconSet is now ${order} in ${data.config}${data.created ? ', created' : ''}.`
|
|
417
441
|
: `[ok] experimental.iconSet already names ${order} in ${data.config}.`,
|
|
418
442
|
),
|
|
@@ -423,9 +447,40 @@ export function registerExperimentalIcon(group, program) {
|
|
|
423
447
|
),
|
|
424
448
|
]
|
|
425
449
|
: []),
|
|
426
|
-
...(data.previous &&
|
|
450
|
+
...(data.previous && setChanged
|
|
427
451
|
? [text(`It was ${shown(data.previous)}.`)]
|
|
428
452
|
: []),
|
|
453
|
+
...(data.variant
|
|
454
|
+
? [
|
|
455
|
+
text(
|
|
456
|
+
variantChanged
|
|
457
|
+
? `[ok] experimental.iconVariant is now "${data.variant}"${data.previousVariant ? ` (it was "${data.previousVariant}")` : ''}: every icon draws its ${data.variant} look where its set has one.`
|
|
458
|
+
: `[ok] experimental.iconVariant already names "${data.variant}".`,
|
|
459
|
+
),
|
|
460
|
+
]
|
|
461
|
+
: data.previousVariant
|
|
462
|
+
? [
|
|
463
|
+
text(
|
|
464
|
+
`[ok] Removed experimental.iconVariant (it was "${data.previousVariant}"): each set draws its default look.`,
|
|
465
|
+
),
|
|
466
|
+
]
|
|
467
|
+
: []),
|
|
468
|
+
...looks
|
|
469
|
+
.filter(look => look.variant !== data.variant)
|
|
470
|
+
.map(look =>
|
|
471
|
+
text(
|
|
472
|
+
look.variant
|
|
473
|
+
? `[note] ${look.set} declares no "${data.variant}" variant: its icons draw its default look, ${look.variant}.`
|
|
474
|
+
: `[note] ${look.set} declares no variants: its icons draw its one look.`,
|
|
475
|
+
),
|
|
476
|
+
),
|
|
477
|
+
...(data.themeMap
|
|
478
|
+
? [
|
|
479
|
+
text(
|
|
480
|
+
`A theme draws the built-in icons in this look with \`icons: ${data.themeMap.export}\` (import {${data.themeMap.export}} from '${data.themeMap.module}').`,
|
|
481
|
+
),
|
|
482
|
+
]
|
|
483
|
+
: []),
|
|
429
484
|
...(data.next ? [text(`[warn] ${data.next}`)] : []),
|
|
430
485
|
...(data.warning ? [text(`[warn] ${data.warning}`)] : []),
|
|
431
486
|
);
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
text,
|
|
31
31
|
} from '../../formatters/index.mjs';
|
|
32
32
|
import {cliError} from '../../lib/cli-error.mjs';
|
|
33
|
+
import {editorMissingArgument} from '../../lib/json-shim.mjs';
|
|
33
34
|
import {AstryxError} from '../../../../api/error.mjs';
|
|
34
35
|
import {defineCommand} from '../../lib/define-command.mjs';
|
|
35
36
|
import {
|
|
@@ -45,9 +46,14 @@ import {
|
|
|
45
46
|
} from '../../../../api/theme-edit/theme-edit.mjs';
|
|
46
47
|
import {
|
|
47
48
|
builtInThemes,
|
|
49
|
+
dialValueFits,
|
|
50
|
+
newFlagList,
|
|
48
51
|
editorCompileProblem,
|
|
49
52
|
editorThemeHold,
|
|
50
53
|
editorThemeRefusal,
|
|
54
|
+
editorMissingSource,
|
|
55
|
+
editorThemeTemplate,
|
|
56
|
+
showSections,
|
|
51
57
|
} from '../../../../api/theme-edit/_adapter.mjs';
|
|
52
58
|
import {registerThemeSubcommands} from '../theme.mjs';
|
|
53
59
|
import {doc as groupDoc} from '../experimental-theme.doc.mjs';
|
|
@@ -99,6 +105,8 @@ const cmd = line => {
|
|
|
99
105
|
.map(part => part.split(PREFIX).join(stem))
|
|
100
106
|
.join(stem);
|
|
101
107
|
};
|
|
108
|
+
/** The project's invocation of a command line (cmd, under a name an action's own `cmd` parameter does not hide). */
|
|
109
|
+
const cliLine = (/** @type {string} */ line) => cmd(line);
|
|
102
110
|
|
|
103
111
|
/**
|
|
104
112
|
* Print blocks, a blank line between them, with this project's run prefix
|
|
@@ -348,29 +356,110 @@ const changeOptions = o => ({
|
|
|
348
356
|
* @param {any} o
|
|
349
357
|
* @returns {Record<string, string | string[]>}
|
|
350
358
|
*/
|
|
351
|
-
function newSettings(o) {
|
|
359
|
+
function newSettings(o, themeName = '<theme>') {
|
|
352
360
|
/** @type {Record<string, string | string[]>} */
|
|
353
361
|
const out = {};
|
|
362
|
+
// --like given two values is refused like a dial given two.
|
|
363
|
+
const likes = flagValues('like');
|
|
364
|
+
if (new Set(likes).size > 1) {
|
|
365
|
+
// The suggestion keeps the first built-in theme given, or drops --like.
|
|
366
|
+
const like = likes
|
|
367
|
+
.map(l => l.toLowerCase())
|
|
368
|
+
.find(l => builtInThemes().includes(l));
|
|
369
|
+
throw new AstryxError(
|
|
370
|
+
`--like was given twice (${likes.join(', ')}); give it once. Nothing was changed.`,
|
|
371
|
+
[
|
|
372
|
+
{
|
|
373
|
+
name: cmd(`${EDITOR} new ${themeName}${newFlagLine({...o, like})}`),
|
|
374
|
+
reason: like
|
|
375
|
+
? 'do this instead: the first built-in theme given'
|
|
376
|
+
: 'do this instead: none of them is a built-in theme',
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
380
|
+
);
|
|
381
|
+
}
|
|
354
382
|
for (const opt of newDoc.options ?? []) {
|
|
355
383
|
if (opt.param !== 'options.settings') continue;
|
|
356
|
-
const
|
|
357
|
-
const
|
|
384
|
+
const flag = opt.flag.split(' ')[0].slice(2);
|
|
385
|
+
const key = flag.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
386
|
+
const value = o[key];
|
|
358
387
|
if (value == null) continue;
|
|
359
388
|
// A flag given twice: headings takes one value per axis (a weight and a
|
|
360
389
|
// tracking); any other flag given two different values is refused.
|
|
361
|
-
const all = flagValues(
|
|
362
|
-
if (
|
|
363
|
-
else if (new Set(all).size > 1)
|
|
390
|
+
const all = flagValues(flag);
|
|
391
|
+
if (flag === 'headings' && all.length > 1) out[flag] = all;
|
|
392
|
+
else if (new Set(all).size > 1) {
|
|
393
|
+
// The suggestion keeps the first value the dial takes, or drops it.
|
|
394
|
+
const fits = all.find(v => dialValueFits(flag, v));
|
|
364
395
|
throw new AstryxError(
|
|
365
|
-
`--${
|
|
366
|
-
[
|
|
396
|
+
`--${flag} was given twice (${all.join(', ')}); give it once. Nothing was changed.`,
|
|
397
|
+
[
|
|
398
|
+
{
|
|
399
|
+
name: cmd(
|
|
400
|
+
`${EDITOR} new ${themeName}${newFlagLine({...o, [key]: fits})}`,
|
|
401
|
+
),
|
|
402
|
+
reason: fits
|
|
403
|
+
? 'do this instead: the first value it takes'
|
|
404
|
+
: `do this instead: none of them is a value --${flag} takes`,
|
|
405
|
+
},
|
|
406
|
+
],
|
|
367
407
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
368
408
|
);
|
|
369
|
-
else out[
|
|
409
|
+
} else out[flag] = String(value);
|
|
370
410
|
}
|
|
371
411
|
return out;
|
|
372
412
|
}
|
|
373
413
|
|
|
414
|
+
/**
|
|
415
|
+
* The options a `new` was given, as flags for a suggested command, so a
|
|
416
|
+
* corrected command makes the theme that was asked for.
|
|
417
|
+
* @param {any} o
|
|
418
|
+
* @returns {string}
|
|
419
|
+
*/
|
|
420
|
+
function newFlagLine(o) {
|
|
421
|
+
/** @type {Record<string, string | string[]>} */
|
|
422
|
+
const settings = {};
|
|
423
|
+
for (const opt of newDoc.options ?? []) {
|
|
424
|
+
if (opt.param !== 'options.settings') continue;
|
|
425
|
+
const flag = opt.flag.split(' ')[0].slice(2);
|
|
426
|
+
const value = o[flag.replace(/-([a-z])/g, (_, c) => c.toUpperCase())];
|
|
427
|
+
if (value != null) settings[flag] = value;
|
|
428
|
+
}
|
|
429
|
+
const parts = newFlagList(
|
|
430
|
+
o.like == null ? undefined : String(o.like),
|
|
431
|
+
settings,
|
|
432
|
+
Boolean(o.png),
|
|
433
|
+
);
|
|
434
|
+
return parts.length ? ` ${parts.join(' ')}` : '';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Refuse a preview flag given twice with different values: the command
|
|
439
|
+
* would keep only the last one without a word. Undefined when each is
|
|
440
|
+
* given once.
|
|
441
|
+
* @param {string} command the preview subcommand, for the suggestion
|
|
442
|
+
* @param {string[]} flags
|
|
443
|
+
* @returns {undefined}
|
|
444
|
+
*/
|
|
445
|
+
function previewFlagsOnce(command, flags) {
|
|
446
|
+
for (const flag of flags) {
|
|
447
|
+
const all = flagValues(flag);
|
|
448
|
+
if (new Set(all).size > 1)
|
|
449
|
+
throw new AstryxError(
|
|
450
|
+
`--${flag} was given twice (${all.join(', ')}); give it once. Nothing was changed.`,
|
|
451
|
+
[
|
|
452
|
+
{
|
|
453
|
+
name: cmd(`${PREFIX} preview ${command} --help`),
|
|
454
|
+
reason: 'every option it takes',
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
return undefined;
|
|
461
|
+
}
|
|
462
|
+
|
|
374
463
|
/**
|
|
375
464
|
* Every value one flag was given on the command line, in order.
|
|
376
465
|
* @param {string} name
|
|
@@ -707,7 +796,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
707
796
|
const editor = defineGroup(theme, editorDoc);
|
|
708
797
|
explained(editor, editorDoc);
|
|
709
798
|
|
|
710
|
-
explained(
|
|
799
|
+
const newCli = explained(
|
|
711
800
|
defineCommand(editor, newDoc, {
|
|
712
801
|
fn: newFn,
|
|
713
802
|
action: (
|
|
@@ -718,49 +807,94 @@ export function registerExperimentalTheme(group, program) {
|
|
|
718
807
|
run(
|
|
719
808
|
program,
|
|
720
809
|
() => {
|
|
810
|
+
// An option new does not take (--force, --dry-run, -t) is refused
|
|
811
|
+
// with new's help, as every editor command's unknown option is.
|
|
812
|
+
const takes = new Set(
|
|
813
|
+
(newDoc.options ?? []).flatMap(opt =>
|
|
814
|
+
String(opt.flag)
|
|
815
|
+
.split(/[\s,]+/)
|
|
816
|
+
.filter(w => w.startsWith('-'))
|
|
817
|
+
.map(w => w.replace(/[<[].*$/, '')),
|
|
818
|
+
),
|
|
819
|
+
);
|
|
820
|
+
const stray = (cmd?.args ?? [])
|
|
821
|
+
.slice(1)
|
|
822
|
+
.map(String)
|
|
823
|
+
.find(
|
|
824
|
+
(/** @type {string} */ w) =>
|
|
825
|
+
/^-/.test(w) && !takes.has(w.split('=')[0]),
|
|
826
|
+
);
|
|
827
|
+
if (stray)
|
|
828
|
+
return cliError(`unknown option '${stray}'.`, {
|
|
829
|
+
suggestions: [
|
|
830
|
+
{
|
|
831
|
+
name: cliLine(`${EDITOR} new --help`),
|
|
832
|
+
reason: 'every option it takes',
|
|
833
|
+
},
|
|
834
|
+
],
|
|
835
|
+
code: ERROR_CODES.ERR_INVALID_OPTION,
|
|
836
|
+
});
|
|
721
837
|
// A word after the name is never dropped without a word.
|
|
722
838
|
const extra = (cmd?.args ?? []).slice(1);
|
|
723
|
-
if (extra.length)
|
|
839
|
+
if (extra.length) {
|
|
840
|
+
// Words after `--` that are `--<option> <value>` pairs new
|
|
841
|
+
// takes become options; the other words were most likely
|
|
842
|
+
// part of the name. The options given stay in the suggestion.
|
|
843
|
+
/** @type {Record<string, unknown>} */
|
|
844
|
+
const given = {...o};
|
|
845
|
+
/** @type {string[]} */
|
|
846
|
+
const words = [];
|
|
847
|
+
for (let i = 0; i < extra.length; i++) {
|
|
848
|
+
const w = String(extra[i]);
|
|
849
|
+
if (w.startsWith('--')) {
|
|
850
|
+
const key = w
|
|
851
|
+
.slice(2)
|
|
852
|
+
.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
853
|
+
if (extra[i + 1] != null && given[key] == null)
|
|
854
|
+
given[key] = extra[++i];
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
words.push(w);
|
|
858
|
+
}
|
|
859
|
+
const builtIn =
|
|
860
|
+
words.length && builtInThemes().includes(words[0]);
|
|
861
|
+
if (builtIn && given.like == null) given.like = words[0];
|
|
862
|
+
const fixed = builtIn
|
|
863
|
+
? name
|
|
864
|
+
: [name, ...words]
|
|
865
|
+
.join('-')
|
|
866
|
+
.toLowerCase()
|
|
867
|
+
.replace(/[^a-z0-9-]+/g, '-');
|
|
724
868
|
throw new AstryxError(
|
|
725
869
|
`new takes one theme name; "${extra.join(' ')}" is extra. For a base theme, use --like. Nothing was changed.`,
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
reason: 'do this instead',
|
|
733
|
-
},
|
|
734
|
-
]
|
|
735
|
-
: [
|
|
736
|
-
{
|
|
737
|
-
name: `${EDITOR} new ${quoteCommandArgument(
|
|
738
|
-
[name, ...extra]
|
|
739
|
-
.join('-')
|
|
740
|
-
.toLowerCase()
|
|
741
|
-
.replace(/[^a-z0-9-]+/g, '-'),
|
|
742
|
-
)}`,
|
|
743
|
-
reason: 'do this instead',
|
|
744
|
-
},
|
|
745
|
-
],
|
|
870
|
+
[
|
|
871
|
+
{
|
|
872
|
+
name: `${EDITOR} new ${quoteCommandArgument(fixed)}${newFlagLine(given)}`,
|
|
873
|
+
reason: 'do this instead',
|
|
874
|
+
},
|
|
875
|
+
],
|
|
746
876
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
747
877
|
);
|
|
878
|
+
}
|
|
748
879
|
return themeEditNew(name, {
|
|
749
880
|
cwd: process.cwd(),
|
|
750
881
|
like: o.like,
|
|
751
882
|
png: o.png ?? false,
|
|
752
|
-
settings: newSettings(o),
|
|
883
|
+
settings: newSettings(o, name),
|
|
753
884
|
});
|
|
754
885
|
},
|
|
755
886
|
r => [
|
|
756
887
|
`[ok] made theme "${r.data.theme}"${r.data.like ? ` on top of ${r.data.like}` : ''}`,
|
|
757
888
|
...project(/** @type {any} */ (r.data)),
|
|
758
889
|
`Tip: ${EDITOR} set ${r.data.theme} <thing> <value>, or ${HOW} "<what you want>"`,
|
|
890
|
+
`Look at it after each change (this changes nothing in your app): ${EDITOR} show ${r.data.theme} --png writes themes/${r.data.theme}/preview.png and sheet.png from real components; open the PNGs and check them against the request`,
|
|
759
891
|
],
|
|
760
892
|
),
|
|
761
893
|
}),
|
|
762
894
|
newDoc,
|
|
763
895
|
);
|
|
896
|
+
// new refuses an option it does not take itself, naming its help.
|
|
897
|
+
newCli.allowUnknownOption();
|
|
764
898
|
|
|
765
899
|
explained(
|
|
766
900
|
defineCommand(editor, setDoc, {
|
|
@@ -770,13 +904,30 @@ export function registerExperimentalTheme(group, program) {
|
|
|
770
904
|
/** @type {string} */ thing,
|
|
771
905
|
/** @type {string[]} */ value,
|
|
772
906
|
/** @type {any} */ o,
|
|
773
|
-
) =>
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
907
|
+
) => {
|
|
908
|
+
// A declaration pasted as one argument (`--color-accent: #e11d48`,
|
|
909
|
+
// or `--color-accent:#e11d48`) is the token and its value; with no
|
|
910
|
+
// value otherwise, the missing-argument error the parser gives.
|
|
911
|
+
if (!value.length) {
|
|
912
|
+
// Any thing, a token or a dial, with `:` or `=` (`accent: red`,
|
|
913
|
+
// `--color-accent=#e11d48`).
|
|
914
|
+
const pasted = /^(\S+?)\s*[:=]\s*(.+?);?\s*$/.exec(thing);
|
|
915
|
+
if (!pasted)
|
|
916
|
+
return missingSetValue(
|
|
917
|
+
editor.commands.find(c => c.name() === 'set'),
|
|
918
|
+
);
|
|
919
|
+
thing = pasted[1];
|
|
920
|
+
value = [pasted[2]];
|
|
921
|
+
}
|
|
922
|
+
return (
|
|
923
|
+
strayOption('set', value) ??
|
|
924
|
+
run(
|
|
925
|
+
program,
|
|
926
|
+
() => themeEditSet(name, thing, value.join(' '), changeOptions(o)),
|
|
927
|
+
changeBlocks,
|
|
928
|
+
)
|
|
929
|
+
);
|
|
930
|
+
},
|
|
780
931
|
}),
|
|
781
932
|
setDoc,
|
|
782
933
|
{tokens: true},
|
|
@@ -799,7 +950,11 @@ export function registerExperimentalTheme(group, program) {
|
|
|
799
950
|
{
|
|
800
951
|
suggestions: [
|
|
801
952
|
{
|
|
802
|
-
|
|
953
|
+
// The first section given that `show` takes, else the
|
|
954
|
+
// whole sheet.
|
|
955
|
+
name: cmd(
|
|
956
|
+
`${EDITOR} show ${name}${(sec => (sec ? ` --section ${sec}` : ''))(flagValues('section').find(v => showSections().includes(v)))}`,
|
|
957
|
+
),
|
|
803
958
|
reason: 'do this instead',
|
|
804
959
|
},
|
|
805
960
|
],
|
|
@@ -870,6 +1025,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
870
1025
|
run(
|
|
871
1026
|
program,
|
|
872
1027
|
() =>
|
|
1028
|
+
previewFlagsOnce('add', ['theme', 'template', 'top', 'path']) ??
|
|
873
1029
|
themeEditPreviewAdd([words ?? []].flat().join(' ') || undefined, {
|
|
874
1030
|
cwd: process.cwd(),
|
|
875
1031
|
theme: o.theme,
|
|
@@ -916,6 +1072,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
916
1072
|
run(
|
|
917
1073
|
program,
|
|
918
1074
|
() =>
|
|
1075
|
+
previewFlagsOnce('app', ['theme']) ??
|
|
919
1076
|
themeEditPreviewApp(dir, {
|
|
920
1077
|
cwd: process.cwd(),
|
|
921
1078
|
theme: o.theme,
|
|
@@ -954,13 +1111,32 @@ export function registerExperimentalTheme(group, program) {
|
|
|
954
1111
|
action: (/** @type {any} */ o) =>
|
|
955
1112
|
run(
|
|
956
1113
|
program,
|
|
957
|
-
() =>
|
|
1114
|
+
() =>
|
|
1115
|
+
previewFlagsOnce('list', ['path']) ??
|
|
1116
|
+
themeEditPreviewList({cwd: process.cwd(), path: o.path}),
|
|
958
1117
|
r =>
|
|
959
1118
|
r.data.folder
|
|
960
|
-
? project(
|
|
1119
|
+
? project(
|
|
1120
|
+
/** @type {any} */ ({
|
|
1121
|
+
...r.data,
|
|
1122
|
+
// A page whose file is gone says so in words.
|
|
1123
|
+
pages: r.data.pages.map(({missing, ...p}) =>
|
|
1124
|
+
missing ? {...p, file: 'missing'} : p,
|
|
1125
|
+
),
|
|
1126
|
+
}),
|
|
1127
|
+
)
|
|
961
1128
|
: [
|
|
962
1129
|
...project(/** @type {any} */ (r.data)),
|
|
963
|
-
|
|
1130
|
+
// A folder add refuses has a note that says why instead.
|
|
1131
|
+
...(r.data.notes.some(
|
|
1132
|
+
n =>
|
|
1133
|
+
n.includes(' refuses this folder') ||
|
|
1134
|
+
n.startsWith('no preview here; '),
|
|
1135
|
+
)
|
|
1136
|
+
? []
|
|
1137
|
+
: [
|
|
1138
|
+
`Tip: ${PREFIX} preview add${o.path == null ? '' : ` --path ${quoteCommandArgument(String(o.path))}`}`,
|
|
1139
|
+
]),
|
|
964
1140
|
],
|
|
965
1141
|
r =>
|
|
966
1142
|
resultSet({
|
|
@@ -980,6 +1156,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
980
1156
|
run(
|
|
981
1157
|
program,
|
|
982
1158
|
() =>
|
|
1159
|
+
previewFlagsOnce('remove', ['path']) ??
|
|
983
1160
|
themeEditPreviewRemove(page, {cwd: process.cwd(), path: o.path}),
|
|
984
1161
|
r => [
|
|
985
1162
|
r.data.pages.length
|
|
@@ -1025,14 +1202,16 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1025
1202
|
);
|
|
1026
1203
|
if (themeFlags.length > 1)
|
|
1027
1204
|
return cliError('--theme is given twice; give it once.', {
|
|
1028
|
-
suggestions: [
|
|
1205
|
+
suggestions: [
|
|
1206
|
+
{name: cmd(`${HOW} --help`), reason: 'give --theme once'},
|
|
1207
|
+
],
|
|
1029
1208
|
code: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
1030
1209
|
});
|
|
1031
1210
|
if (listFlags.length > 1)
|
|
1032
1211
|
return cliError('--list is given twice; give it once.', {
|
|
1033
1212
|
suggestions: [
|
|
1034
1213
|
{
|
|
1035
|
-
name: `${HOW} --list tokens accent
|
|
1214
|
+
name: cmd(`${HOW} --list tokens accent`),
|
|
1036
1215
|
reason: 'one list, then the filter',
|
|
1037
1216
|
},
|
|
1038
1217
|
],
|
|
@@ -1124,7 +1303,27 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1124
1303
|
build: 'compile',
|
|
1125
1304
|
explain: editorThemeRefusal,
|
|
1126
1305
|
preflight: editorCompileProblem,
|
|
1306
|
+
missingSource: editorMissingSource,
|
|
1307
|
+
template: editorThemeTemplate,
|
|
1127
1308
|
hold: editorThemeHold,
|
|
1128
1309
|
},
|
|
1129
1310
|
);
|
|
1130
1311
|
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* The error for `set` given a theme and a thing but no value: the parser's
|
|
1315
|
+
* missing-argument report, from the one builder it uses.
|
|
1316
|
+
* @param {any} cmd the set command
|
|
1317
|
+
* @returns {never}
|
|
1318
|
+
*/
|
|
1319
|
+
function missingSetValue(cmd) {
|
|
1320
|
+
const {message, suggestions} = editorMissingArgument(
|
|
1321
|
+
cmd,
|
|
1322
|
+
['theme', 'thing', 'value'],
|
|
1323
|
+
'value',
|
|
1324
|
+
);
|
|
1325
|
+
return cliError(message, {
|
|
1326
|
+
code: ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
1327
|
+
suggestions,
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
@@ -9,18 +9,25 @@ export const doc = {
|
|
|
9
9
|
displayName: 'astryx experimental icon use',
|
|
10
10
|
namespace: 'cli/commands',
|
|
11
11
|
stability: 'experimental',
|
|
12
|
-
summary: "Choose the project's main icon set and
|
|
12
|
+
summary: "Choose the project's main icon set, backups, and look",
|
|
13
13
|
description:
|
|
14
|
-
"Writes `experimental.iconSet` in astryx.config, so copied templates and blocks use that set's icons. With `--backup`, it writes a list: the main set first, then each backup in the order given. A copied template takes each icon from the first set in the list that has its meaning. Every set must be installed. Experimental: it may change or be removed in a patch release.",
|
|
14
|
+
"Writes `experimental.iconSet` in astryx.config, so copied templates and blocks use that set's icons. With `--backup`, it writes a list: the main set first, then each backup in the order given. A copied template takes each icon from the first set in the list that has its meaning. With `--variant`, it also writes `experimental.iconVariant`, the look every icon draws (`outline`, `filled`): one of the main set's variants. Each set in the list draws its variant of that name, or its default look when it declares none, and the receipt names the theme map that draws the built-in icons in that look. Without `--variant`, it removes `experimental.iconVariant`, so each set draws its default look: run it with every set and the look you want. Every set must be installed. Experimental: it may change or be removed in a patch release.",
|
|
15
15
|
fn: 'iconUse',
|
|
16
16
|
args: [{name: 'set', param: 'set', required: true}],
|
|
17
|
-
options: [
|
|
17
|
+
options: [
|
|
18
|
+
{flag: '--backup <set...>', param: 'options.backups'},
|
|
19
|
+
{flag: '--variant <variant>', param: 'options.variant'},
|
|
20
|
+
],
|
|
18
21
|
examples: [
|
|
19
22
|
{label: 'Use a set', cli: 'astryx experimental icon use outline'},
|
|
20
23
|
{
|
|
21
24
|
label: 'Use a main set with a backup',
|
|
22
25
|
cli: 'astryx experimental icon use outline --backup @acme/brand-icons/brand',
|
|
23
26
|
},
|
|
27
|
+
{
|
|
28
|
+
label: 'Draw every icon in one look',
|
|
29
|
+
cli: 'astryx experimental icon use brand --variant filled',
|
|
30
|
+
},
|
|
24
31
|
{
|
|
25
32
|
label: 'Name its package',
|
|
26
33
|
cli: 'astryx experimental icon use @acme/icons/outline',
|
|
@@ -30,11 +37,11 @@ export const doc = {
|
|
|
30
37
|
exitCodes: [
|
|
31
38
|
{
|
|
32
39
|
code: 0,
|
|
33
|
-
when: 'experimental.iconSet is written, or already names the sets',
|
|
40
|
+
when: 'experimental.iconSet (and experimental.iconVariant) is written, or already names the sets and the look',
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
43
|
code: 1,
|
|
37
|
-
when: 'a set is not installed, two packages ship it, a set is named twice, the config cannot be updated (not a static object literal, or it spreads another object, which you then edit by hand), or the config is protected (a symbolic link, or marked generated, vendored, or ignored: `ERR_CODEMOD_PROTECTED`, naming the declaration)',
|
|
44
|
+
when: 'a set is not installed, two packages ship it, a set is named twice, the main set declares no variant `--variant` names, the config cannot be updated (not a static object literal, or it spreads another object, which you then edit by hand), or the config is protected (a symbolic link, or marked generated, vendored, or ignored: `ERR_CODEMOD_PROTECTED`, naming the declaration)',
|
|
38
45
|
},
|
|
39
46
|
],
|
|
40
47
|
related: ['experimental icon', 'template'],
|
|
@@ -39,7 +39,7 @@ export const doc = {
|
|
|
39
39
|
flag: '-o, --out <path>',
|
|
40
40
|
param: 'options.out',
|
|
41
41
|
description:
|
|
42
|
-
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces
|
|
42
|
+
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. The path should end in .css; another name still builds, with a warning. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces its own earlier outputs, and the output of another theme source with a warning that names both sources; any other existing file fails with ERR_FILE_EXISTS and nothing is written. Into a folder the theme editor made (folder <slug>/ holds <slug>.settings.json), a source outside that folder builds there too, with a warning; to keep the editor folder to its own theme, build beside the source, or pass an --out outside it. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
flag: '--icons-specifier <specifier>',
|
|
@@ -89,7 +89,7 @@ export const doc = {
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
code: 1,
|
|
92
|
-
when: 'a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false
|
|
92
|
+
when: 'a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false, the stale files and code ERR_THEME_STALE, is still printed: it is a result, not an error). One exception: an editor theme whose settings changed after its build is refused (ERR_THEME_INVALID, an error envelope) before any file is checked, with `editor show <theme>` to build it again. An editor theme run from a folder other than its app root is refused (ERR_INVALID_ARGUMENT) with the `cd` to the root and the same command; `--family` does not take an editor theme (ERR_INVALID_ARGUMENT); its damaged or unbuildable settings are refused (ERR_THEME_INVALID)',
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
related: ['experimental theme add', 'experimental theme list'],
|
|
@@ -11,7 +11,7 @@ export const doc = {
|
|
|
11
11
|
stability: 'experimental',
|
|
12
12
|
summary: 'Start a theme in themes/<theme>/, optionally on a built-in theme',
|
|
13
13
|
description:
|
|
14
|
-
'Makes themes/<theme>/ with <theme>.settings.json (the settings this command owns), the generated <theme>.settings.ts, <theme>.theme.ts (which extends it and is yours), and the built <theme>.css and <theme>.js (
|
|
14
|
+
'Makes themes/<theme>/ with <theme>.settings.json (the settings this command owns), the generated <theme>.settings.ts, <theme>.theme.ts (which extends it and is yours), and the built <theme>.css and <theme>.js (build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor settings first), then writes preview.html, the sample app page with the theme. --like builds on a built-in theme (neutral, stone, matcha, y2k, gothic, chocolate, butter; its package must be installed); without it, or with --like none, the theme starts from Astryx defaults. Any `set` dial can be a flag too (--accent "#7c3aed" --font inter --corners round --vibrancy 60 ...): the same names, values and checks as `set`, all applied in the one build, with one result that lists them. Change the base later with `astryx experimental theme editor set <theme> base <theme|none>`. Afterwards, <theme>.theme.ts is yours: it extends the generated <theme>.settings.ts, and every later change rewrites only the settings files, so your own edits in <theme>.theme.ts survive. A theme name is lowercase letters, digits and dashes, starts with a letter, has 64 characters at most, and is not the name of a built-in theme or a name Windows reserves for a device (con, prn, aux, nul, com1-com9, lpt1-lpt9). Experimental: it may change or be removed in a patch release. The result ends with `wiring`: `astryx theme add <theme>` for the app copy of the theme (src/themes/<theme>/, a standard local theme every build writes), the `mode` of a one-mode theme for the `<Theme>`, and what builds it; only when a folder of yours holds src/themes/<theme>/ does it give the imports in the root file and the `<Theme>` by hand.',
|
|
15
15
|
fn: 'themeEditNew',
|
|
16
16
|
args: [
|
|
17
17
|
{
|
|
@@ -31,7 +31,7 @@ export const doc = {
|
|
|
31
31
|
flag: '--png',
|
|
32
32
|
param: 'options.png',
|
|
33
33
|
description:
|
|
34
|
-
'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it.
|
|
34
|
+
'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
flag: '--corners <rung>',
|
|
@@ -28,7 +28,7 @@ export const doc = {
|
|
|
28
28
|
{
|
|
29
29
|
name: 'value',
|
|
30
30
|
param: 'value',
|
|
31
|
-
required:
|
|
31
|
+
required: false,
|
|
32
32
|
variadic: true,
|
|
33
33
|
},
|
|
34
34
|
],
|
|
@@ -67,7 +67,7 @@ export const doc = {
|
|
|
67
67
|
flag: '--png',
|
|
68
68
|
param: 'options.png',
|
|
69
69
|
description:
|
|
70
|
-
'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it.
|
|
70
|
+
'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
|
|
71
71
|
},
|
|
72
72
|
],
|
|
73
73
|
examples: [
|