@astryxdesign/cli 0.7.15 → 0.7.16-canary.g3aa244b
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 +5 -3
- package/api/build/_adapter.d.mts +1 -0
- package/api/build/blocks/blocks.d.mts +1 -0
- package/api/build/blocks/blocks.mjs +18 -1
- package/api/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +35 -0
- package/api/doctor/_adapter.mjs +69 -0
- package/api/doctor/built-checks.mjs +1 -1
- package/api/doctor/doctor.d.mts +18 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +104 -4
- package/api/doctor/theme-checks.mjs +6 -10
- 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/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +43 -12
- package/api/theme/_fork.mjs +1 -1
- package/api/theme/build/build.d.mts +116 -32
- package/api/theme/build/build.mjs +449 -102
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +102 -25
- package/api/theme/theme.type.d.mts +5 -1
- package/api/theme/theme.type.mjs +2 -1
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +9 -3
- package/api/theme-edit/_adapter.d.mts +32 -2
- package/api/theme-edit/_adapter.mjs +264 -40
- package/api/theme-edit/_check.d.mts +93 -4
- package/api/theme-edit/_check.mjs +1727 -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 +1532 -149
- 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 +7 -0
- package/api/theme-edit/_how-question.mjs +1304 -176
- package/api/theme-edit/_how.mjs +144 -30
- package/api/theme-edit/_overview.mjs +2 -0
- package/api/theme-edit/_palette.d.mts +38 -0
- package/api/theme-edit/_palette.mjs +305 -71
- 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 +36 -1
- package/api/theme-edit/_preview-app.mjs +1415 -96
- package/api/theme-edit/_preview.d.mts +64 -3
- package/api/theme-edit/_preview.mjs +514 -31
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +46 -12
- package/api/theme-edit/_settings.d.mts +278 -5
- package/api/theme-edit/_settings.mjs +2741 -195
- package/api/theme-edit/_tables.d.mts +24 -0
- package/api/theme-edit/_tables.mjs +211 -149
- 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 +20 -2
- package/api/theme-edit/theme-edit.type.mjs +6 -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/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/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/dashboard/page.tsx +1 -1
- 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/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/theme.mjs +239 -45
- 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.mjs +190 -46
- package/clients/cli/formatters/index.mjs +7 -4
- 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 +3 -2
- package/foundation/config/config-writer.mjs +2 -2
- package/foundation/config/project.mjs +60 -14
- package/foundation/discovery/component-discovery.mjs +5 -17
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/module-exports.mjs +1 -15
- package/foundation/discovery/template-adapter.mjs +44 -19
- package/foundation/discovery/template-source-tree.mjs +3 -16
- package/foundation/discovery/theme-discovery.d.mts +5 -1
- package/foundation/discovery/theme-discovery.mjs +61 -43
- 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/contribution-fixes.mjs +1 -16
- package/foundation/integrations/may-have-integrations.mjs +3 -2
- 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
|
@@ -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,38 +807,80 @@ 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 => [
|
|
@@ -761,6 +892,8 @@ export function registerExperimentalTheme(group, program) {
|
|
|
761
892
|
}),
|
|
762
893
|
newDoc,
|
|
763
894
|
);
|
|
895
|
+
// new refuses an option it does not take itself, naming its help.
|
|
896
|
+
newCli.allowUnknownOption();
|
|
764
897
|
|
|
765
898
|
explained(
|
|
766
899
|
defineCommand(editor, setDoc, {
|
|
@@ -770,13 +903,30 @@ export function registerExperimentalTheme(group, program) {
|
|
|
770
903
|
/** @type {string} */ thing,
|
|
771
904
|
/** @type {string[]} */ value,
|
|
772
905
|
/** @type {any} */ o,
|
|
773
|
-
) =>
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
906
|
+
) => {
|
|
907
|
+
// A declaration pasted as one argument (`--color-accent: #e11d48`,
|
|
908
|
+
// or `--color-accent:#e11d48`) is the token and its value; with no
|
|
909
|
+
// value otherwise, the missing-argument error the parser gives.
|
|
910
|
+
if (!value.length) {
|
|
911
|
+
// Any thing, a token or a dial, with `:` or `=` (`accent: red`,
|
|
912
|
+
// `--color-accent=#e11d48`).
|
|
913
|
+
const pasted = /^(\S+?)\s*[:=]\s*(.+?);?\s*$/.exec(thing);
|
|
914
|
+
if (!pasted)
|
|
915
|
+
return missingSetValue(
|
|
916
|
+
editor.commands.find(c => c.name() === 'set'),
|
|
917
|
+
);
|
|
918
|
+
thing = pasted[1];
|
|
919
|
+
value = [pasted[2]];
|
|
920
|
+
}
|
|
921
|
+
return (
|
|
922
|
+
strayOption('set', value) ??
|
|
923
|
+
run(
|
|
924
|
+
program,
|
|
925
|
+
() => themeEditSet(name, thing, value.join(' '), changeOptions(o)),
|
|
926
|
+
changeBlocks,
|
|
927
|
+
)
|
|
928
|
+
);
|
|
929
|
+
},
|
|
780
930
|
}),
|
|
781
931
|
setDoc,
|
|
782
932
|
{tokens: true},
|
|
@@ -799,7 +949,11 @@ export function registerExperimentalTheme(group, program) {
|
|
|
799
949
|
{
|
|
800
950
|
suggestions: [
|
|
801
951
|
{
|
|
802
|
-
|
|
952
|
+
// The first section given that `show` takes, else the
|
|
953
|
+
// whole sheet.
|
|
954
|
+
name: cmd(
|
|
955
|
+
`${EDITOR} show ${name}${(sec => (sec ? ` --section ${sec}` : ''))(flagValues('section').find(v => showSections().includes(v)))}`,
|
|
956
|
+
),
|
|
803
957
|
reason: 'do this instead',
|
|
804
958
|
},
|
|
805
959
|
],
|
|
@@ -870,6 +1024,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
870
1024
|
run(
|
|
871
1025
|
program,
|
|
872
1026
|
() =>
|
|
1027
|
+
previewFlagsOnce('add', ['theme', 'template', 'top', 'path']) ??
|
|
873
1028
|
themeEditPreviewAdd([words ?? []].flat().join(' ') || undefined, {
|
|
874
1029
|
cwd: process.cwd(),
|
|
875
1030
|
theme: o.theme,
|
|
@@ -916,6 +1071,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
916
1071
|
run(
|
|
917
1072
|
program,
|
|
918
1073
|
() =>
|
|
1074
|
+
previewFlagsOnce('app', ['theme']) ??
|
|
919
1075
|
themeEditPreviewApp(dir, {
|
|
920
1076
|
cwd: process.cwd(),
|
|
921
1077
|
theme: o.theme,
|
|
@@ -954,13 +1110,28 @@ export function registerExperimentalTheme(group, program) {
|
|
|
954
1110
|
action: (/** @type {any} */ o) =>
|
|
955
1111
|
run(
|
|
956
1112
|
program,
|
|
957
|
-
() =>
|
|
1113
|
+
() =>
|
|
1114
|
+
previewFlagsOnce('list', ['path']) ??
|
|
1115
|
+
themeEditPreviewList({cwd: process.cwd(), path: o.path}),
|
|
958
1116
|
r =>
|
|
959
1117
|
r.data.folder
|
|
960
|
-
? project(
|
|
1118
|
+
? project(
|
|
1119
|
+
/** @type {any} */ ({
|
|
1120
|
+
...r.data,
|
|
1121
|
+
// A page whose file is gone says so in words.
|
|
1122
|
+
pages: r.data.pages.map(({missing, ...p}) =>
|
|
1123
|
+
missing ? {...p, file: 'missing'} : p,
|
|
1124
|
+
),
|
|
1125
|
+
}),
|
|
1126
|
+
)
|
|
961
1127
|
: [
|
|
962
1128
|
...project(/** @type {any} */ (r.data)),
|
|
963
|
-
|
|
1129
|
+
// A folder add refuses has a note that says why instead.
|
|
1130
|
+
...(r.data.notes.some(n => n.includes(' refuses this folder'))
|
|
1131
|
+
? []
|
|
1132
|
+
: [
|
|
1133
|
+
`Tip: ${PREFIX} preview add${o.path == null ? '' : ` --path ${quoteCommandArgument(String(o.path))}`}`,
|
|
1134
|
+
]),
|
|
964
1135
|
],
|
|
965
1136
|
r =>
|
|
966
1137
|
resultSet({
|
|
@@ -980,6 +1151,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
980
1151
|
run(
|
|
981
1152
|
program,
|
|
982
1153
|
() =>
|
|
1154
|
+
previewFlagsOnce('remove', ['path']) ??
|
|
983
1155
|
themeEditPreviewRemove(page, {cwd: process.cwd(), path: o.path}),
|
|
984
1156
|
r => [
|
|
985
1157
|
r.data.pages.length
|
|
@@ -1025,14 +1197,16 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1025
1197
|
);
|
|
1026
1198
|
if (themeFlags.length > 1)
|
|
1027
1199
|
return cliError('--theme is given twice; give it once.', {
|
|
1028
|
-
suggestions: [
|
|
1200
|
+
suggestions: [
|
|
1201
|
+
{name: cmd(`${HOW} --help`), reason: 'give --theme once'},
|
|
1202
|
+
],
|
|
1029
1203
|
code: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
1030
1204
|
});
|
|
1031
1205
|
if (listFlags.length > 1)
|
|
1032
1206
|
return cliError('--list is given twice; give it once.', {
|
|
1033
1207
|
suggestions: [
|
|
1034
1208
|
{
|
|
1035
|
-
name: `${HOW} --list tokens accent
|
|
1209
|
+
name: cmd(`${HOW} --list tokens accent`),
|
|
1036
1210
|
reason: 'one list, then the filter',
|
|
1037
1211
|
},
|
|
1038
1212
|
],
|
|
@@ -1124,7 +1298,27 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1124
1298
|
build: 'compile',
|
|
1125
1299
|
explain: editorThemeRefusal,
|
|
1126
1300
|
preflight: editorCompileProblem,
|
|
1301
|
+
missingSource: editorMissingSource,
|
|
1302
|
+
template: editorThemeTemplate,
|
|
1127
1303
|
hold: editorThemeHold,
|
|
1128
1304
|
},
|
|
1129
1305
|
);
|
|
1130
1306
|
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* The error for `set` given a theme and a thing but no value: the parser's
|
|
1310
|
+
* missing-argument report, from the one builder it uses.
|
|
1311
|
+
* @param {any} cmd the set command
|
|
1312
|
+
* @returns {never}
|
|
1313
|
+
*/
|
|
1314
|
+
function missingSetValue(cmd) {
|
|
1315
|
+
const {message, suggestions} = editorMissingArgument(
|
|
1316
|
+
cmd,
|
|
1317
|
+
['theme', 'thing', 'value'],
|
|
1318
|
+
'value',
|
|
1319
|
+
);
|
|
1320
|
+
return cliError(message, {
|
|
1321
|
+
code: ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
1322
|
+
suggestions,
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
@@ -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 a Playwright installed in the project or a Chrome or Chromium found on the machine; 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 a Playwright installed in the project or a Chrome or Chromium found on the machine; 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: [
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
summary:
|
|
13
13
|
'Every setting, key values, problems the theme caused, and the theme-building page with every component',
|
|
14
14
|
description:
|
|
15
|
-
'Lists every setting with where it applies and its source (dial, token or property), the resolved value of key tokens in each mode, the colors (the vibrancy; each color with its seed and the shade each token uses in light and dark, marked when an exact token setting wins; any shade moved so text reads), contrast problems this theme caused versus its base, font notes, and last the generated color files. Writes two self-contained HTML files: preview.html (the sample app page) and sheet.html (the theme-building page: every component grouped, each variant side by side, overlays open, and real template pages, with an auto/light/dark switch). A theme with no build is built first, and an in-app preview (`preview add`) of the theme has its route and Colors page rewritten. --section limits the sheet to one section. Experimental: it may change or be removed in a patch release.',
|
|
15
|
+
'Lists every setting with where it applies and its source (dial, token or property), the resolved value of key tokens in each mode, the colors (the vibrancy; each color with its seed and the shade each token uses in light and dark, marked when an exact token setting wins; any shade moved so text reads), contrast problems this theme caused versus its base, font notes, and last the generated color files. Writes two self-contained HTML files: preview.html (the sample app page) and sheet.html (the theme-building page: every component grouped, each variant side by side, overlays open, and real template pages, with an auto/light/dark switch). A theme with no build is built first, and an in-app preview (`preview add`) of the theme has its route and Colors page rewritten. --section limits the sheet to one section. An own change to <theme>.theme.ts since the last build is built first, and the colors mark where it wins over a generated shade; a theme source that no longer builds, or a token in it that is not text, is refused (ERR_THEME_INVALID, exit 1) and the folder stays as it was. 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.',
|
|
16
16
|
fn: 'themeEditShow',
|
|
17
17
|
args: [
|
|
18
18
|
{
|
|
@@ -32,7 +32,7 @@ export const doc = {
|
|
|
32
32
|
flag: '--png',
|
|
33
33
|
param: 'options.png',
|
|
34
34
|
description:
|
|
35
|
-
'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.
|
|
35
|
+
'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. 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',
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
examples: [
|
|
@@ -59,7 +59,7 @@ export const doc = {
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
code: 1,
|
|
62
|
-
when: 'the theme does not exist, an unknown --section, or a page that does not render
|
|
62
|
+
when: 'the theme does not exist or its base theme package is not installed (ERR_UNKNOWN_THEME), an unknown --section (ERR_INVALID_ARGUMENT), a theme source that does not build or parse or a token in it that is not text (ERR_THEME_INVALID), a folder where a built file goes (ERR_FILE_EXISTS), a built file that cannot be read or written (ERR_WRITE_FAILED), another command changing the theme (ERR_THEME_BUSY), a page that does not render (ERR_RENDER_FAILED), or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
65
|
related: ['experimental theme editor', 'experimental theme compile'],
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
summary:
|
|
13
13
|
'Step back one change, or remove one setting; the result says what applies instead',
|
|
14
14
|
description:
|
|
15
|
-
"With only the theme, it steps back one change: the settings, the generated settings module and the build go back to how they were before the last change (your <theme>.theme.ts is not touched), and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, and the result says what applies now (`now`): the whole-theme setting for a part setting removed, or the base theme's value; the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking
|
|
15
|
+
"With only the theme, it steps back one change: the settings, the generated settings module and the build go back to how they were before the last change (your <theme>.theme.ts is not touched), and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, and the result says what applies now (`now`): the whole-theme setting for a part setting removed, or the base theme's value; the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking; with no half named it removes the weight half, or the tracking half when that is the only one set. Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. A setting the theme does not have is refused and the error lists the settings it has for that thing. `undo <theme> base` and `undo <theme> mode` go back to the base and mode the theme was made with; when they never changed, that is refused. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
fn: 'themeEditUndo',
|
|
17
17
|
args: [
|
|
18
18
|
{
|
|
@@ -66,7 +66,7 @@ export const doc = {
|
|
|
66
66
|
flag: '--png',
|
|
67
67
|
param: 'options.png',
|
|
68
68
|
description:
|
|
69
|
-
'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.
|
|
69
|
+
'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. 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',
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
examples: [
|
|
@@ -15,7 +15,7 @@ export const doc = {
|
|
|
15
15
|
summary:
|
|
16
16
|
'Make and change a theme one checked change at a time (dials, tokens, part styles), with previews',
|
|
17
17
|
description:
|
|
18
|
-
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it
|
|
18
|
+
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it; build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor's settings first. Every build also writes the theme's app copy, src/themes/<theme>/: a standard local theme (descriptor, source, built module and stylesheets), never edited by hand, so `astryx theme add <theme>` puts the theme into the app and `theme use`, `remove` and `list` take it as they take any local theme. A folder there that is not the editor's copy is left alone, and `new` and `show` then print the import lines by hand instead (`wiring`). Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. Commands on one theme run one after the other, through a lock in node_modules/.cache/astryx-theme/ of the project; when node_modules cannot be written (a read-only install), changes are refused and `show` still reads the last build. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
|
|
19
19
|
subcommands: ['new', 'set', 'undo', 'show', 'how'],
|
|
20
20
|
examples: [
|
|
21
21
|
{
|
|
@@ -14,7 +14,7 @@ export const doc = {
|
|
|
14
14
|
stability: 'experimental',
|
|
15
15
|
summary: 'Fork a theme as editable local source',
|
|
16
16
|
description:
|
|
17
|
-
"Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Eject never writes into a folder that holds another theme or a theme the theme editor made, even with --overwrite. When the fork imports packages the app lacks, the result names them with an install command. Use --package when package themes share a slug.",
|
|
17
|
+
"Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Eject never writes into a folder that holds another theme or a theme the theme editor made, even with --overwrite. A subfolder of a folder the theme editor made is written, and the CLI warns; to keep the editor folder to its own theme, fork into the default folder or a path outside it. When the fork imports packages the app lacks, the result names them with an install command. Use --package when package themes share a slug.",
|
|
18
18
|
fn: 'themeEject',
|
|
19
19
|
args: [
|
|
20
20
|
{
|
|
@@ -33,7 +33,7 @@ export const doc = {
|
|
|
33
33
|
flag: '--template <id>',
|
|
34
34
|
param: 'options.template',
|
|
35
35
|
description:
|
|
36
|
-
'Add this page template (astryx template --list --type page) instead of ranking one from a description',
|
|
36
|
+
'Add this page template (astryx template --list --type page) instead of ranking one from a description. A default page (overview, components, colors) adds just that page back when it is missing',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
flag: '--top <n>',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
summary:
|
|
13
13
|
'Make a new starter app with the theme preview inside, ready to install and run',
|
|
14
14
|
description:
|
|
15
|
-
"Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. It takes one folder; more arguments are refused. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
|
|
15
|
+
"Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release; with --theme, Core and the base theme are pinned to the versions this project has, the ones the copied build was made on, with a note), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. It takes one folder; more arguments are refused. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
fn: 'themeEditPreviewApp',
|
|
17
17
|
args: [
|
|
18
18
|
{
|
|
@@ -14,7 +14,7 @@ export const doc = {
|
|
|
14
14
|
stability: 'experimental',
|
|
15
15
|
summary: 'Write the annotated theme template into your project',
|
|
16
16
|
description:
|
|
17
|
-
'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every defineTheme field, the token families, the component override syntax, and how a theme is consumed, naming the CLI command that prints the authoritative reference for each. Read it, copy what you need into your own theme file, delete it. Use `experimental theme add <slug>` to use an installed built theme, extend that theme for ordinary customization, or use `experimental theme eject <slug>` for a complete source fork. The path is a .ts file, never a folder. Leaves an existing file untouched unless --overwrite, which replaces only an earlier copy of the template or a file named like a theme source (`*.theme.ts`, `*Theme.ts`, `*.template.ts`).',
|
|
17
|
+
'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every defineTheme field, the token families, the component override syntax, and how a theme is consumed, naming the CLI command that prints the authoritative reference for each. Read it, copy what you need into your own theme file, delete it. Use `experimental theme add <slug>` to use an installed built theme, extend that theme for ordinary customization, or use `experimental theme eject <slug>` for a complete source fork. The path is a .ts file, never a folder. Leaves an existing file untouched unless --overwrite, which replaces only an earlier copy of the template or a file named like a theme source (`*.theme.ts`, `*Theme.ts`, `*.template.ts`). A path is read from the current folder and must stay inside the project root (the nearest folder with a package.json); with no path it writes at the project root. Outside a project (no package.json in the folder or above it) it writes in the current folder and warns; run it inside a project, or run `npm init -y` in the folder first, to write it at a project root.',
|
|
18
18
|
fn: 'themeTemplate',
|
|
19
19
|
args: [
|
|
20
20
|
{
|
|
@@ -28,7 +28,7 @@ export const doc = {
|
|
|
28
28
|
flag: '-f, --overwrite',
|
|
29
29
|
param: 'options.overwrite',
|
|
30
30
|
description:
|
|
31
|
-
'Replace an existing copy of the template or theme source file. Any other file, such as
|
|
31
|
+
'Replace an existing copy of the template or theme source file. Any other .ts file, such as util.ts, or a file the theme editor owns (named after its folder, beside its settings, such as themes/t/t.theme.ts), fails with ERR_FILE_EXISTS and is left as it was; an earlier template in that folder is replaced. A path that is not .ts, such as package.json, fails with ERR_INVALID_ARGUMENT, with or without --overwrite',
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
examples: [
|
|
@@ -41,7 +41,7 @@ export const doc = {
|
|
|
41
41
|
flag: '-o, --out <path>',
|
|
42
42
|
param: 'options.out',
|
|
43
43
|
description:
|
|
44
|
-
'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. 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)',
|
|
44
|
+
'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)',
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
flag: '--icons-specifier <specifier>',
|
|
@@ -91,7 +91,7 @@ export const doc = {
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
code: 1,
|
|
94
|
-
when: 'a build or validation error, or --check finds stale or missing outputs',
|
|
94
|
+
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)',
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
97
|
related: ['theme add', 'theme list'],
|