@astryxdesign/cli 0.7.14-canary.gfdb9213 → 0.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +197 -0
- package/api/theme/_adapter.d.mts +33 -0
- package/api/theme/_adapter.mjs +352 -16
- package/api/theme/build/build.mjs +261 -10
- package/api/theme/eject/eject.mjs +13 -1
- package/api/theme/list/list.mjs +11 -2
- package/api/theme/template/template.mjs +139 -6
- package/api/theme/theme.type.d.mts +15 -1
- package/api/theme/theme.type.mjs +9 -3
- package/api/theme/themeAdd.doc.mjs +1 -1
- package/api/theme/themeBuild.doc.mjs +10 -2
- package/api/theme/themeEject.doc.mjs +2 -2
- package/api/theme/themeListAvailable.doc.mjs +1 -1
- package/api/theme/themeRemove.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +8 -0
- package/api/theme/themeUse.doc.mjs +1 -1
- package/api/theme-edit/_adapter.d.mts +10 -2
- package/api/theme-edit/_adapter.mjs +52 -31
- package/api/theme-edit/_check.d.mts +28 -25
- package/api/theme-edit/_check.mjs +586 -548
- package/api/theme-edit/_color.d.mts +28 -2
- package/api/theme-edit/_color.mjs +306 -68
- package/api/theme-edit/_compiler.d.mts +8 -4
- package/api/theme-edit/_compiler.mjs +30 -27
- package/api/theme-edit/_context.d.mts +10 -4
- package/api/theme-edit/_context.mjs +21 -4
- package/api/theme-edit/_edit.mjs +300 -43
- package/api/theme-edit/_how-commands.d.mts +91 -0
- package/api/theme-edit/_how-commands.mjs +269 -0
- package/api/theme-edit/_how-question.d.mts +57 -0
- package/api/theme-edit/_how-question.mjs +2574 -0
- package/api/theme-edit/_how.d.mts +25 -17
- package/api/theme-edit/_how.mjs +727 -305
- package/api/theme-edit/_palette.d.mts +127 -19
- package/api/theme-edit/_palette.mjs +1313 -399
- package/api/theme-edit/_parts.mjs +36 -3
- package/api/theme-edit/_png.d.mts +18 -6
- package/api/theme-edit/_png.mjs +135 -25
- package/api/theme-edit/_preview-app.d.mts +26 -7
- package/api/theme-edit/_preview-app.mjs +1611 -280
- package/api/theme-edit/_preview.d.mts +4 -2
- package/api/theme-edit/_preview.mjs +18 -7
- package/api/theme-edit/_settings.d.mts +56 -5
- package/api/theme-edit/_settings.mjs +197 -49
- package/api/theme-edit/_tables.d.mts +0 -12
- package/api/theme-edit/_tables.mjs +24 -97
- package/api/theme-edit/theme-edit.type.d.mts +22 -5
- package/api/theme-edit/theme-edit.type.mjs +17 -6
- package/api/theme-edit/themeEditHow.doc.mjs +13 -3
- package/api/theme-edit/themeEditNew.doc.mjs +2 -1
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +16 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -4
- package/api/theme-edit/themeEditPreviewList.doc.mjs +9 -1
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +27 -2
- package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
- package/assets/docs.generated.json +1 -0
- package/assets/preview-app/gitignore +3 -0
- package/assets/templates/components.generated.json +1 -0
- package/clients/cli/bin/astryx.mjs +37 -5
- package/clients/cli/commands/experimental/theme.mjs +231 -31
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +14 -5
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-eject.doc.mjs +3 -3
- package/clients/cli/commands/theme-remove.doc.mjs +2 -2
- package/clients/cli/commands/theme-template.doc.mjs +11 -4
- package/clients/cli/commands/theme.mjs +104 -40
- package/clients/cli/commands.generated.json +1 -0
- package/clients/cli/index.mjs +96 -4
- package/clients/cli/lib/json-shim.mjs +29 -1
- package/foundation/config/project.d.mts +16 -2
- package/foundation/config/project.mjs +40 -6
- package/foundation/config/theme-state.d.mts +9 -0
- package/foundation/config/theme-state.mjs +20 -1
- package/foundation/discovery/template-adapter.d.mts +12 -1
- package/foundation/discovery/template-adapter.mjs +24 -1
- package/foundation/discovery/template-needs.d.mts +7 -0
- package/foundation/discovery/template-needs.mjs +117 -8
- package/foundation/discovery/template-source-tree.d.mts +5 -1
- package/foundation/discovery/template-source-tree.mjs +6 -4
- package/foundation/discovery/theme-discovery.d.mts +14 -3
- package/foundation/discovery/theme-discovery.mjs +45 -12
- package/foundation/doc-compiler/import.mjs +68 -3
- package/foundation/doc-compiler/stored-docs.d.mts +27 -0
- package/foundation/doc-compiler/stored-docs.mjs +65 -0
- package/foundation/fs/fs-error.d.mts +17 -0
- package/foundation/fs/fs-error.mjs +34 -0
- package/package.json +6 -6
|
@@ -88,18 +88,6 @@ export const COMMON_PROPERTIES: string[];
|
|
|
88
88
|
* @type {Record<string, (value: string, on: string | undefined) => string[]>}
|
|
89
89
|
*/
|
|
90
90
|
export const THING_HINTS: Record<string, (value: string, on: string | undefined) => string[]>;
|
|
91
|
-
/**
|
|
92
|
-
* Words for parts, and the parts (or groups, or `part:prop:value`) they
|
|
93
|
-
* mean. The first match order is the answer order.
|
|
94
|
-
* @type {Array<[RegExp, string[]]>}
|
|
95
|
-
*/
|
|
96
|
-
export const PART_WORDS: Array<[RegExp, string[]]>;
|
|
97
|
-
/**
|
|
98
|
-
* Words for aspects of a part. `background` comes last: color words mean it
|
|
99
|
-
* only when no other aspect matched them.
|
|
100
|
-
* @type {Array<[string, RegExp]>}
|
|
101
|
-
*/
|
|
102
|
-
export const INTENTS: Array<[string, RegExp]>;
|
|
103
91
|
/** Sample values for design words in a `how` question. */
|
|
104
92
|
export const DESIGN: Record<string, string>;
|
|
105
93
|
/** States every part takes, beyond the ones its doc lists. */
|
|
@@ -347,14 +347,14 @@ export const DIALS = {
|
|
|
347
347
|
'spacing space room roomy airy dense density compact tight padding gap gaps margin breathing cramped spread spacious',
|
|
348
348
|
},
|
|
349
349
|
accent: {
|
|
350
|
-
help: 'The main brand color: primary buttons, links, selection and the focus ring. From the one color the editor generates its shades, light and dark, and points the accent tokens at them: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. The fill keeps the exact color you gave, in dark
|
|
350
|
+
help: 'The main brand color: primary buttons, links, selection and the focus ring. From the one color the editor generates its shades, light and dark, and points the accent tokens at them: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. The fill keeps the exact color you gave in light, and in dark too when text on it reads at 4.5:1 and it stands out from the dark page at 3:1; otherwise dark mode uses shade 70, where the official themes put a dark fill, or the shade nearest it that passes both, and the result says so. Text on the fill is the neutral color\'s white or near-black (pure white or black without a neutral color), whichever reads on it. The fill never moves: when no text reads on it, or a pale fill does not stand out from the light page, the result says so. Other tokens move to a nearby shade when they must read: text at 4.5:1, the focus ring at 3:1. `how colors` explains it; the Colors preview page (`preview add`) shows every shade. For an exact color, set the token itself (set my --color-accent "#7c3aed"): an exact token always wins over the generated colors.',
|
|
351
351
|
values: '<color>',
|
|
352
352
|
examples: ['set my accent "#7c3aed"', 'set my accent rebeccapurple'],
|
|
353
353
|
words:
|
|
354
354
|
'accent brand primary main color colour key highlight link selection seed',
|
|
355
355
|
},
|
|
356
356
|
neutral: {
|
|
357
|
-
help: 'The gray of the theme: surfaces (cards, panels, popovers, muted fills), text, icons, borders, skeletons and hover tints. The page background stays the base theme\'s (often a light gray), so a tinted gray never tints the page; the result names it, and for a white or off-white page set --color-background-body "#ffffff" (with --mode light in a theme with both modes). From the one color the editor generates light and dark shades
|
|
357
|
+
help: 'The gray of the theme: surfaces (cards, panels, popovers, muted fills), text, icons, borders, skeletons and hover tints. The page background stays the base theme\'s (often a light gray), so a tinted gray never tints the page; the result names it, and for a white or off-white page set --color-background-body "#ffffff" (with --mode light in a theme with both modes). From the one color the editor generates light and dark shades; your exact color sits at its own shade in both modes, and the shades around it follow it. The surface, text, icon, border, skeleton and overlay tokens point at those shades. Secondary text and icons move to a shade that reads on the surfaces. Give a gray with a little color ("#64748b") for a cool or warm neutral; a strong color makes colored surfaces. `how colors` explains it.',
|
|
358
358
|
values: '<color>',
|
|
359
359
|
examples: ['set my neutral "#64748b"', 'set my neutral "#78716c"'],
|
|
360
360
|
words:
|
|
@@ -385,7 +385,7 @@ export const DIALS = {
|
|
|
385
385
|
words: 'info information notice help blue status',
|
|
386
386
|
},
|
|
387
387
|
vibrancy: {
|
|
388
|
-
help: 'How saturated the generated colors are: 0 is gray, 100 the most vivid, 50 the default; more and less step by 10. Every color the theme sets (accent, neutral, success, warning, danger, info) is generated again;
|
|
388
|
+
help: 'How saturated the generated colors are: 0 is gray, 100 the most vivid, 50 the default; more and less step by 10. Every color the theme sets (accent, neutral, success, warning, danger, info) is generated again; each exact color you gave stays as given at its own shade, and the shades around it get more or less color. more at 100 and less at 0 change nothing, so they are refused. The whole theme only, and only once the theme sets a color; undoing the last color removes vibrancy too.',
|
|
389
389
|
values: '<0-100>|more|less',
|
|
390
390
|
examples: ['set my vibrancy 70', 'set my vibrancy less'],
|
|
391
391
|
words:
|
|
@@ -440,7 +440,7 @@ export const DIALS = {
|
|
|
440
440
|
words: 'cta solid outline outlined soft tint caps uppercase filled',
|
|
441
441
|
},
|
|
442
442
|
type: {
|
|
443
|
-
help: 'The type personality: how far headings step up from body text and how they are set. compact: small steps (x1.15), semibold. standard: the default (x1.2). editorial: bigger steps (x1.3), tight tracking, semibold. display: big steps (x1.4), heavy weight, tighter tracking (a marketing feel). Text below the base size keeps its standard sizes, so small text stays readable. Works with text-size; a headings setting keeps its weight or tracking whatever the order.',
|
|
443
|
+
help: 'The type personality: how far headings step up from body text and how they are set. compact: small steps (x1.15), semibold. standard: the default (x1.2). editorial: bigger steps (x1.3), tight tracking, semibold. display: big steps (x1.4), heavy weight, tighter tracking (a marketing feel). Text below the base size keeps its standard sizes, so small text stays readable. Works with text-size; a headings setting keeps its weight or tracking whatever the order. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
|
|
444
444
|
values: Object.keys(TYPE_STYLES).join('|'),
|
|
445
445
|
examples: ['set my type display', 'set my type editorial'],
|
|
446
446
|
words:
|
|
@@ -450,7 +450,7 @@ export const DIALS = {
|
|
|
450
450
|
help:
|
|
451
451
|
'Base text size; every heading size scales from it. Rungs: ' +
|
|
452
452
|
TEXT_SIZE.map(([n, v]) => `${n} (${v}px)`).join(', ') +
|
|
453
|
-
', or a number of pixels from 10 to 32.',
|
|
453
|
+
', or a number of pixels from 10 to 32. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
|
|
454
454
|
values: 'small|medium|large|larger|more|less|<number>',
|
|
455
455
|
examples: ['set my text-size small', 'set my text-size more'],
|
|
456
456
|
words: 'text size font size small big large scale',
|
|
@@ -618,98 +618,6 @@ export const THING_HINTS = {
|
|
|
618
618
|
'text-color': (_v, on) => [`${HOW} "text color on ${on ?? '<part>'}"`],
|
|
619
619
|
};
|
|
620
620
|
|
|
621
|
-
/**
|
|
622
|
-
* Words for parts, and the parts (or groups, or `part:prop:value`) they
|
|
623
|
-
* mean. The first match order is the answer order.
|
|
624
|
-
* @type {Array<[RegExp, string[]]>}
|
|
625
|
-
*/
|
|
626
|
-
export const PART_WORDS = [
|
|
627
|
-
[
|
|
628
|
-
/\b(header|top ?bar|title ?bar|nav ?bar|app ?bar|masthead)\b/,
|
|
629
|
-
['app-shell-header'],
|
|
630
|
-
],
|
|
631
|
-
[
|
|
632
|
-
/\b(nav(igation)? (links?|items?)|menu items?|top ?nav items?)\b/,
|
|
633
|
-
['top-nav-item', 'side-nav-item'],
|
|
634
|
-
],
|
|
635
|
-
[
|
|
636
|
-
/\b(app (name|title)|logo|brand name|site title|product name)\b/,
|
|
637
|
-
['top-nav-heading'],
|
|
638
|
-
],
|
|
639
|
-
[
|
|
640
|
-
/\b(side ?nav|sidebar|side ?panel|left (panel|column))\b/,
|
|
641
|
-
['side-nav', 'side-nav-item'],
|
|
642
|
-
],
|
|
643
|
-
[
|
|
644
|
-
/\b(content area|main area|behind the cards|main content)\b/,
|
|
645
|
-
['layout-content'],
|
|
646
|
-
],
|
|
647
|
-
[
|
|
648
|
-
/\b(page|desktop|backdrop|whole background|app background)\b/,
|
|
649
|
-
['app-shell'],
|
|
650
|
-
],
|
|
651
|
-
[/\b(windows?|panels?|cards?|boxes|tiles?)\b/, ['containers']],
|
|
652
|
-
[/\b(primary|main|blue) buttons?\b/, ['button:variant:primary']],
|
|
653
|
-
[/\b(secondary|other) buttons?\b/, ['button:variant:secondary']],
|
|
654
|
-
[/\b(ghost|text|link|cancel) buttons?\b/, ['button:variant:ghost']],
|
|
655
|
-
[
|
|
656
|
-
/\b(destructive|danger|delete|red) buttons?\b/,
|
|
657
|
-
['button:variant:destructive'],
|
|
658
|
-
],
|
|
659
|
-
[/\bbuttons?\b/, ['button']],
|
|
660
|
-
[/\b(banner|alert|notice|announcement|info box)\b/, ['banner']],
|
|
661
|
-
[
|
|
662
|
-
/\b(inputs?|text ?box(es)?|text ?fields?|fields?|forms?|dropdowns?|selects?)\b/,
|
|
663
|
-
['inputs'],
|
|
664
|
-
],
|
|
665
|
-
[/\b(checkbox(es)?|check ?marks?)\b/, ['checks']],
|
|
666
|
-
[/\b(toggles?|switch(es)?)\b/, ['switch']],
|
|
667
|
-
[/\b(progress|loading bar)\b/, ['progress-bar-fill', 'progress-bar-track']],
|
|
668
|
-
[/\b(table header|column headers?)\b/, ['table-header-cell']],
|
|
669
|
-
[/\b(table|rows?)\b/, ['table-row', 'table-cell']],
|
|
670
|
-
[/\b(tabs?)\b/, ['tab', 'tab-indicator']],
|
|
671
|
-
[/\b(badges?|pills?|chips?|tags?)\b/, ['badge']],
|
|
672
|
-
[/\b(status dots?|dots?)\b/, ['status-dot']],
|
|
673
|
-
[/\b(headings?|titles?)\b/, ['heading']],
|
|
674
|
-
[/\b(dialogs?|modals?|popups?)\b/, ['dialog']],
|
|
675
|
-
[/\b(tooltips?)\b/, ['tooltip']],
|
|
676
|
-
[/\b(toasts?)\b/, ['toast']],
|
|
677
|
-
];
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Words for aspects of a part. `background` comes last: color words mean it
|
|
681
|
-
* only when no other aspect matched them.
|
|
682
|
-
* @type {Array<[string, RegExp]>}
|
|
683
|
-
*/
|
|
684
|
-
export const INTENTS = [
|
|
685
|
-
[
|
|
686
|
-
'text',
|
|
687
|
-
/\b(text|font colou?r|writing|words|white text|dark text|readable|unreadable|links?|labels?)\b/,
|
|
688
|
-
],
|
|
689
|
-
[
|
|
690
|
-
'font',
|
|
691
|
-
/\b(font|typeface|bold|weight|heavier|lighter|italic|uppercase|letter ?spacing)\b/,
|
|
692
|
-
],
|
|
693
|
-
[
|
|
694
|
-
'corners',
|
|
695
|
-
/\b(round(ed|er)?|corners?|radius|curv\w*|circular|circle|pill|sharp|square)\b/,
|
|
696
|
-
],
|
|
697
|
-
[
|
|
698
|
-
'shadow',
|
|
699
|
-
/\b(shadows?|depth|elevat\w*|bevel\w*|raised|3d|glow|sunken|inset)\b/,
|
|
700
|
-
],
|
|
701
|
-
['border', /\b(borders?|outlines?|edges?|frames?|strokes?|thick)\b/],
|
|
702
|
-
[
|
|
703
|
-
'spacing',
|
|
704
|
-
/\b(spacing|space|padding|gaps?|margins?|room|roomy|dense|compact|tight|cramped|airy)\b/,
|
|
705
|
-
],
|
|
706
|
-
['size', /\b(taller|shorter|height|bigger|smaller)\b/],
|
|
707
|
-
[
|
|
708
|
-
'background',
|
|
709
|
-
/\b(background|bg|fill|filled|gradient|glossy|tint|paint|colou?r(ed)?|blue|red|green|white|black|dark|light|cream|beige)\b/,
|
|
710
|
-
],
|
|
711
|
-
];
|
|
712
|
-
|
|
713
621
|
/** Sample values for design words in a `how` question. */
|
|
714
622
|
export const DESIGN = /** @type {Record<string, string>} */ ({
|
|
715
623
|
gradient: '"linear-gradient(#ffffff, #d1d5db)"',
|
|
@@ -729,3 +637,22 @@ export const COMMON_STATES = [
|
|
|
729
637
|
'focus-within',
|
|
730
638
|
'disabled',
|
|
731
639
|
];
|
|
640
|
+
|
|
641
|
+
// These tables are looked up by words people type: with no prototype,
|
|
642
|
+
// `constructor` or `__proto__` is never found in them.
|
|
643
|
+
for (const table of [
|
|
644
|
+
FAMILIES,
|
|
645
|
+
FONTS,
|
|
646
|
+
OPEN_FONTS,
|
|
647
|
+
CLOSEST_OPEN_FONT,
|
|
648
|
+
HEADING_WEIGHTS,
|
|
649
|
+
HEADING_TRACKING,
|
|
650
|
+
SURFACES,
|
|
651
|
+
TYPE_STYLES,
|
|
652
|
+
DIALS,
|
|
653
|
+
GROUPS,
|
|
654
|
+
DIRECT,
|
|
655
|
+
THING_HINTS,
|
|
656
|
+
DESIGN,
|
|
657
|
+
])
|
|
658
|
+
Object.setPrototypeOf(table, null);
|
|
@@ -114,6 +114,10 @@ export type ThemeEditPreviewFields = {
|
|
|
114
114
|
code: string;
|
|
115
115
|
cause: string;
|
|
116
116
|
} | null;
|
|
117
|
+
/**
|
|
118
|
+
* - Files of the in-app theme preview that were changed by hand, so they were not written again and still show the theme as it was.
|
|
119
|
+
*/
|
|
120
|
+
previewStale?: string[] | undefined;
|
|
117
121
|
};
|
|
118
122
|
/**
|
|
119
123
|
* `astryx --json experimental theme editor new <theme>`.
|
|
@@ -165,7 +169,7 @@ export type ThemeEditChangeData = {
|
|
|
165
169
|
*/
|
|
166
170
|
replaced: ThemeEditSetting | null;
|
|
167
171
|
/**
|
|
168
|
-
* - For `base` and
|
|
172
|
+
* - For `base`, `mode` and a whole-theme dial: the value before.
|
|
169
173
|
*/
|
|
170
174
|
was: string | null;
|
|
171
175
|
/**
|
|
@@ -218,6 +222,10 @@ export type ThemeEditChangeData = {
|
|
|
218
222
|
code: string;
|
|
219
223
|
cause: string;
|
|
220
224
|
} | null;
|
|
225
|
+
/**
|
|
226
|
+
* - In-app preview files changed by hand: see ThemeEditPreviewFields.
|
|
227
|
+
*/
|
|
228
|
+
previewStale?: string[] | undefined;
|
|
221
229
|
};
|
|
222
230
|
export type ThemeEditShowOptions = {
|
|
223
231
|
/**
|
|
@@ -254,6 +262,7 @@ export type ThemeEditShowResponse = {
|
|
|
254
262
|
problems: string[];
|
|
255
263
|
notes: string[];
|
|
256
264
|
preview: string;
|
|
265
|
+
previewStale?: string[] | undefined;
|
|
257
266
|
sheet: string;
|
|
258
267
|
sheetComponents: number;
|
|
259
268
|
skipped: string[];
|
|
@@ -349,9 +358,9 @@ export type ThemeEditPreviewAddOptions = {
|
|
|
349
358
|
*/
|
|
350
359
|
template?: string | undefined;
|
|
351
360
|
/**
|
|
352
|
-
* - With a description: how many of the best-fitting page templates to add, 1 to 3 (default 1).
|
|
361
|
+
* - With a description: how many of the best-fitting page templates to add, 1 to 3 (default 1). A string is taken as typed: only "1", "2" or "3".
|
|
353
362
|
*/
|
|
354
|
-
top?: number | undefined;
|
|
363
|
+
top?: string | number | undefined;
|
|
355
364
|
/**
|
|
356
365
|
* - The folder of the preview route, inside the project (default: theme-preview/ in the app's routes folder, app/ or src/app/).
|
|
357
366
|
*/
|
|
@@ -438,6 +447,10 @@ export type ThemeEditPreviewRemoveResponse = {
|
|
|
438
447
|
data: {
|
|
439
448
|
folder: string;
|
|
440
449
|
removed: string[];
|
|
450
|
+
kept: string[];
|
|
451
|
+
missing: string[];
|
|
452
|
+
rewritten: string[];
|
|
453
|
+
notes: string[];
|
|
441
454
|
pages: string[];
|
|
442
455
|
};
|
|
443
456
|
};
|
|
@@ -447,11 +460,15 @@ export type ThemeEditHowOptions = {
|
|
|
447
460
|
*/
|
|
448
461
|
cwd?: string | undefined;
|
|
449
462
|
/**
|
|
450
|
-
* - List what a change can name: dials, tokens, parts, groups, or properties; the subject filters it. An empty string lists the kinds.
|
|
463
|
+
* - List what a change can name: dials, tokens, parts, groups, or properties (any case, singular or plural); the subject filters it. An empty string or `kinds` lists the kinds.
|
|
451
464
|
*/
|
|
452
465
|
list?: string | undefined;
|
|
453
466
|
/**
|
|
454
|
-
* -
|
|
467
|
+
* - The theme the suggested commands are for, checked against its settings (default: the only theme the editor made in the app; with several, the one an editor command changed last; with none, `my-theme`, which the answer makes first). An empty name is refused.
|
|
468
|
+
*/
|
|
469
|
+
theme?: string | undefined;
|
|
470
|
+
/**
|
|
471
|
+
* - With a PNG picture: pixel points x,y, whole numbers inside the picture ("40,20;300,180", "40,20 300,180", several entries, or a flat "40,20,300,180").
|
|
455
472
|
*/
|
|
456
473
|
at?: string[] | undefined;
|
|
457
474
|
/**
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
* @property {string[]} pictures - PNG pictures taken (only with `png`).
|
|
52
52
|
* @property {string | null} pictureProblem - Why no picture was taken, and how to get a browser for it.
|
|
53
53
|
* @property {{code: string, cause: string} | null} notChecked - Set when the change is saved but the components could not be rendered, so it was not checked and has no preview: the cause, such as two copies of React.
|
|
54
|
+
* @property {string[]} [previewStale] - Files of the in-app theme preview that were changed by hand, so they were not written again and still show the theme as it was.
|
|
54
55
|
*/
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
* @property {string} [now] - On `undo`: what applies instead of the setting removed: a dial that still writes the token (such as the generated accent color), a whole-theme setting of the same thing, or the base theme's value.
|
|
80
81
|
* @property {ThemeEditSetting} [removed] - On `undo`: the setting removed (the same as `setting`); the value now in effect is the base theme's, and `changedTokens` lists it.
|
|
81
82
|
* @property {ThemeEditSetting | null} replaced - The setting this one replaced.
|
|
82
|
-
* @property {string | null} was - For `base` and
|
|
83
|
+
* @property {string | null} was - For `base`, `mode` and a whole-theme dial: the value before.
|
|
83
84
|
* @property {string[]} parts - The parts it styles (a group's members when it spread).
|
|
84
85
|
* @property {{name: string, members: string[], onlyHint: boolean} | null} group - The group it spread to; `onlyHint` when `--only` would style one member.
|
|
85
86
|
* @property {string[]} changedTokens - Resolved token changes, `name (mode): before -> after`.
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
* @property {string[]} pictures
|
|
94
95
|
* @property {string | null} pictureProblem
|
|
95
96
|
* @property {{code: string, cause: string} | null} notChecked - Saved but not checked: see ThemeEditPreviewFields.
|
|
97
|
+
* @property {string[]} [previewStale] - In-app preview files changed by hand: see ThemeEditPreviewFields.
|
|
96
98
|
*/
|
|
97
99
|
|
|
98
100
|
/**
|
|
@@ -117,10 +119,11 @@
|
|
|
117
119
|
* @property {string[]} data.partValues - Each corners or spacing setting on a part or group, with what its parts get and the whole-theme value beside it.
|
|
118
120
|
* @property {number | null} data.vibrancy - How saturated the generated colors are (0 to 100); null when the theme sets no color.
|
|
119
121
|
* @property {ThemeEditColor[]} data.colors - Each color the theme sets, with the shade each token uses.
|
|
120
|
-
* @property {string[]} data.colorNotes -
|
|
122
|
+
* @property {string[]} data.colorNotes - What the color config keeps or replaced of a hand edit, tokens that use another shade than usual so they read, and any that still do not.
|
|
121
123
|
* @property {string[]} data.problems
|
|
122
124
|
* @property {string[]} data.notes
|
|
123
125
|
* @property {string} data.preview
|
|
126
|
+
* @property {string[]} [data.previewStale] - In-app preview files changed by hand, so they were not written again and still show the theme as it was.
|
|
124
127
|
* @property {string} data.sheet - The theme-building page with every component.
|
|
125
128
|
* @property {number} data.sheetComponents
|
|
126
129
|
* @property {string[]} data.skipped - Template pages left out, with the install line each needs.
|
|
@@ -167,7 +170,7 @@
|
|
|
167
170
|
* @property {string} [cwd] - The folder to start from (default: process.cwd()); commands act on the Astryx project at or above it.
|
|
168
171
|
* @property {string} [theme] - The theme the pages wear: a theme made by `experimental theme editor` (default: the only one under themes/; with none or several, the app's own theme).
|
|
169
172
|
* @property {string} [template] - Add this page template instead of ranking one from a description.
|
|
170
|
-
* @property {number} [top] - With a description: how many of the best-fitting page templates to add, 1 to 3 (default 1).
|
|
173
|
+
* @property {number | string} [top] - With a description: how many of the best-fitting page templates to add, 1 to 3 (default 1). A string is taken as typed: only "1", "2" or "3".
|
|
171
174
|
* @property {string} [path] - The folder of the preview route, inside the project (default: theme-preview/ in the app's routes folder, app/ or src/app/).
|
|
172
175
|
*/
|
|
173
176
|
|
|
@@ -230,15 +233,23 @@
|
|
|
230
233
|
* @experimental May change or be removed in a patch release.
|
|
231
234
|
* @typedef {object} ThemeEditPreviewRemoveResponse
|
|
232
235
|
* @property {'themeEdit.previewRemove'} type
|
|
233
|
-
* @property {
|
|
236
|
+
* @property {object} data
|
|
237
|
+
* @property {string} data.folder - The preview route folder.
|
|
238
|
+
* @property {string[]} data.removed - Files deleted.
|
|
239
|
+
* @property {string[]} data.kept - Files kept: changed by hand after the preview wrote them, or not written by it.
|
|
240
|
+
* @property {string[]} data.missing - Files the preview had written that were gone already.
|
|
241
|
+
* @property {string[]} data.rewritten - Files written again, so the route and the Colors page match the pages left.
|
|
242
|
+
* @property {string[]} data.notes - What else to know.
|
|
243
|
+
* @property {string[]} data.pages - The pages left, in order; empty when the whole preview was removed.
|
|
234
244
|
*/
|
|
235
245
|
|
|
236
246
|
/**
|
|
237
247
|
* @experimental May change or be removed in a patch release.
|
|
238
248
|
* @typedef {object} ThemeEditHowOptions
|
|
239
249
|
* @property {string} [cwd] - The folder to start from (default: process.cwd()); commands act on the Astryx project at or above it.
|
|
240
|
-
* @property {string} [list] - List what a change can name: dials, tokens, parts, groups, or properties; the subject filters it. An empty string lists the kinds.
|
|
241
|
-
* @property {string
|
|
250
|
+
* @property {string} [list] - List what a change can name: dials, tokens, parts, groups, or properties (any case, singular or plural); the subject filters it. An empty string or `kinds` lists the kinds.
|
|
251
|
+
* @property {string} [theme] - The theme the suggested commands are for, checked against its settings (default: the only theme the editor made in the app; with several, the one an editor command changed last; with none, `my-theme`, which the answer makes first). An empty name is refused.
|
|
252
|
+
* @property {string[]} [at] - With a PNG picture: pixel points x,y, whole numbers inside the picture ("40,20;300,180", "40,20 300,180", several entries, or a flat "40,20,300,180").
|
|
242
253
|
* @property {number} [count] - With a PNG picture: how many main colors (default 14).
|
|
243
254
|
*/
|
|
244
255
|
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
summary:
|
|
14
14
|
"Look up a part, group, setting or aspect; answer a question in plain words; read a picture's colors; or list what you can set.",
|
|
15
15
|
description:
|
|
16
|
-
'One command for every question. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size) and
|
|
16
|
+
'One command for every question. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
|
|
17
17
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
18
18
|
signature:
|
|
19
19
|
'themeEditHow(subject?: string, options?: object): Promise<object>',
|
|
@@ -37,6 +37,12 @@ export const doc = {
|
|
|
37
37
|
description:
|
|
38
38
|
'dials, tokens, parts, groups, or properties; an empty string lists the kinds.',
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
name: 'options.theme',
|
|
42
|
+
type: 'string',
|
|
43
|
+
description:
|
|
44
|
+
'The theme the suggested commands are for (default: the only theme, the one an editor command changed last, or my-theme when there is none); an empty name is refused.',
|
|
45
|
+
},
|
|
40
46
|
{
|
|
41
47
|
name: 'options.at',
|
|
42
48
|
type: 'string[]',
|
|
@@ -57,7 +63,7 @@ export const doc = {
|
|
|
57
63
|
{
|
|
58
64
|
type: 'themeEdit.how',
|
|
59
65
|
description:
|
|
60
|
-
'`kind` says which answer it is: part (variants, states, reads per aspect, parts inside, group), group (members), setting, aspect or question (answers with commands), picture (main colors or the color at points), or list (the items).',
|
|
66
|
+
'`kind` says which answer it is: part (variants, states, reads per aspect with the flags for each condition, parts inside, group), group (members), setting, aspect or question (answers with checked commands for `theme`), picture (main colors, or the color and alpha at points), or list (the items).',
|
|
61
67
|
},
|
|
62
68
|
],
|
|
63
69
|
throws: [
|
|
@@ -67,12 +73,16 @@ export const doc = {
|
|
|
67
73
|
},
|
|
68
74
|
{
|
|
69
75
|
code: 'ERR_INVALID_ARGUMENT',
|
|
70
|
-
when: 'an unknown --list kind, --at without a picture, a picture that is not a PNG, an
|
|
76
|
+
when: 'an empty `theme`, an unknown --list kind, --at without a picture, a picture that is not a PNG or is damaged or too big, an --at point that is not whole pixel numbers or falls outside the picture, a count beside --at, or a count that is not a positive whole number',
|
|
71
77
|
},
|
|
72
78
|
{
|
|
73
79
|
code: 'ERR_FILE_NOT_FOUND',
|
|
74
80
|
when: 'the picture does not exist',
|
|
75
81
|
},
|
|
82
|
+
{
|
|
83
|
+
code: 'ERR_UNKNOWN_THEME',
|
|
84
|
+
when: '`theme` names a theme the editor did not make',
|
|
85
|
+
},
|
|
76
86
|
{
|
|
77
87
|
code: 'ERR_PROJECT_REQUIRED',
|
|
78
88
|
when: '@astryxdesign/core is not installed in the folder',
|
|
@@ -26,7 +26,8 @@ export const doc = {
|
|
|
26
26
|
{
|
|
27
27
|
name: 'theme',
|
|
28
28
|
type: 'string',
|
|
29
|
-
description:
|
|
29
|
+
description:
|
|
30
|
+
'The theme name: lowercase letters, digits and dashes, starting with a letter, 64 characters at most.',
|
|
30
31
|
required: true,
|
|
31
32
|
},
|
|
32
33
|
{
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
summary:
|
|
14
14
|
'Add pages to the theme preview in the app: the default pages, the best template pages for a description, or one template.',
|
|
15
15
|
description:
|
|
16
|
-
"Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). Experimental: it may change or be removed in a patch release.",
|
|
16
|
+
"Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/ or node_modules/, in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no `path` and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.",
|
|
17
17
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
18
18
|
signature:
|
|
19
19
|
'themeEditPreviewAdd(description?: string, options?: object): Promise<object>',
|
|
@@ -67,7 +67,7 @@ export const doc = {
|
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
code: 'ERR_FILE_EXISTS',
|
|
70
|
-
when: 'a file there that the preview did not write',
|
|
70
|
+
when: 'a file there that the preview did not write, or one it wrote and someone changed since',
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
code: 'ERR_PATH_TRAVERSAL',
|
|
@@ -75,7 +75,7 @@ export const doc = {
|
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
code: 'ERR_INVALID_ARGUMENT',
|
|
78
|
-
when: 'a description with `template`,
|
|
78
|
+
when: 'a description with `template`, an empty `template`, `top` other than 1, 2 or 3 as typed or with no description, or a folder that is no place for the preview',
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
code: 'ERR_DEP_MISSING',
|
|
@@ -83,7 +83,7 @@ export const doc = {
|
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
code: 'ERR_UNKNOWN_TEMPLATE',
|
|
86
|
-
when: '`template` names no page template',
|
|
86
|
+
when: '`template` names no page template (a block is named as one), with the closest page templates as commands',
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
code: 'ERR_THEME_LOAD',
|
|
@@ -93,6 +93,18 @@ export const doc = {
|
|
|
93
93
|
code: 'ERR_UNKNOWN_THEME',
|
|
94
94
|
when: '`theme` names a theme this command did not make',
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
code: 'ERR_THEME_INVALID',
|
|
98
|
+
when: 'theme-preview.json is damaged, or the theme does not load; nothing is written',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
code: 'ERR_WRITE_FAILED',
|
|
102
|
+
when: 'a write failed; every file is put back as it was',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
code: 'ERR_THEME_BUSY',
|
|
106
|
+
when: 'another preview command in the project did not finish within 30 seconds; nothing is changed',
|
|
107
|
+
},
|
|
96
108
|
{
|
|
97
109
|
code: 'ERR_PROJECT_REQUIRED',
|
|
98
110
|
when: 'no package.json in the folder or above it',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewApp()',
|
|
13
13
|
summary: 'Make a new starter app with the theme preview inside.',
|
|
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: the result says how to install, run and open it. `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. 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 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: the result says how to install, run and open it. `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. 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/ or node_modules/, 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. 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. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature:
|
|
18
18
|
'themeEditPreviewApp(dir: string, options?: object): Promise<object>',
|
|
@@ -53,7 +53,7 @@ export const doc = {
|
|
|
53
53
|
throws: [
|
|
54
54
|
{
|
|
55
55
|
code: 'ERR_FILE_EXISTS',
|
|
56
|
-
when: '`dir` is not empty',
|
|
56
|
+
when: '`dir` is not empty, is a file or a dangling link, or was filled while the app was written',
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
code: 'ERR_PATH_TRAVERSAL',
|
|
@@ -61,11 +61,19 @@ export const doc = {
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
code: 'ERR_UNKNOWN_THEME',
|
|
64
|
-
when: '`theme` names a theme
|
|
64
|
+
when: '`theme` names a theme `experimental theme editor` did not make; the closest editor theme is named, and for a package theme what to do instead',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
code: 'ERR_THEME_BUSY',
|
|
68
|
+
when: 'another command changing the theme did not finish within 30 seconds; nothing is written',
|
|
65
69
|
},
|
|
66
70
|
{
|
|
67
71
|
code: 'ERR_INVALID_ARGUMENT',
|
|
68
|
-
when: 'no `dir
|
|
72
|
+
when: 'no `dir`, or a folder that is no place for an app',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
code: 'ERR_WRITE_FAILED',
|
|
76
|
+
when: 'a write failed; nothing is left behind',
|
|
69
77
|
},
|
|
70
78
|
],
|
|
71
79
|
examples: [
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewList()',
|
|
13
13
|
summary: 'The pages of the theme preview in the app.',
|
|
14
14
|
description:
|
|
15
|
-
'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. Experimental: it may change or be removed in a patch release.',
|
|
15
|
+
'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. Experimental: it may change or be removed in a patch release.',
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature: 'themeEditPreviewList(options?: object): Promise<object>',
|
|
18
18
|
keywords: ['theme', 'experimental theme', 'preview', 'theme preview'],
|
|
@@ -38,6 +38,14 @@ export const doc = {
|
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
40
|
throws: [
|
|
41
|
+
{
|
|
42
|
+
code: 'ERR_THEME_INVALID',
|
|
43
|
+
when: 'theme-preview.json is damaged',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
47
|
+
when: 'several recorded previews and none in the default place',
|
|
48
|
+
},
|
|
41
49
|
{
|
|
42
50
|
code: 'ERR_PROJECT_REQUIRED',
|
|
43
51
|
when: 'no package.json in the folder or above it',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewRemove()',
|
|
13
13
|
summary: 'Remove one page from the theme preview, or the whole preview.',
|
|
14
14
|
description:
|
|
15
|
-
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Experimental: it may change or be removed in a patch release.',
|
|
15
|
+
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.',
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature:
|
|
18
18
|
'themeEditPreviewRemove(page?: string, options?: object): Promise<object>',
|
|
@@ -39,7 +39,8 @@ export const doc = {
|
|
|
39
39
|
returns: [
|
|
40
40
|
{
|
|
41
41
|
type: 'themeEdit.previewRemove',
|
|
42
|
-
description:
|
|
42
|
+
description:
|
|
43
|
+
'The files deleted, kept, missing and written again, notes, and the pages left.',
|
|
43
44
|
},
|
|
44
45
|
],
|
|
45
46
|
throws: [
|
|
@@ -51,6 +52,30 @@ export const doc = {
|
|
|
51
52
|
code: 'ERR_NOT_FOUND',
|
|
52
53
|
when: 'there is no preview, or it has no such page',
|
|
53
54
|
},
|
|
55
|
+
{
|
|
56
|
+
code: 'ERR_THEME_INVALID',
|
|
57
|
+
when: 'theme-preview.json is damaged, or the theme the route wears does not load; nothing is deleted',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
code: 'ERR_UNKNOWN_THEME',
|
|
61
|
+
when: 'the theme the route wears is not a theme; nothing is deleted',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
code: 'ERR_FILE_EXISTS',
|
|
65
|
+
when: 'the route file was changed by hand, so it is not written again (a page remove) or its pages are not deleted (a whole remove); nothing is deleted',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
code: 'ERR_WRITE_FAILED',
|
|
69
|
+
when: 'a write or delete failed; the files are put back',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
code: 'ERR_THEME_BUSY',
|
|
73
|
+
when: 'another preview command in the project did not finish within 30 seconds; nothing is changed',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
code: 'ERR_THEME_LOAD',
|
|
77
|
+
when: 'the theme the route wears has no build and does not build; nothing is deleted',
|
|
78
|
+
},
|
|
54
79
|
{
|
|
55
80
|
code: 'ERR_PROJECT_REQUIRED',
|
|
56
81
|
when: 'no package.json in the folder or above it',
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
summary:
|
|
14
14
|
'Put the theme back as it was before its last change, or remove one setting.',
|
|
15
15
|
description:
|
|
16
|
-
'With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, 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 `thing`, it removes that one setting instead, wherever it is in the settings, and the `now` field of the result says what applies instead (a dial that still writes it, a whole-theme setting of the same thing, or the value of the base theme); name it the way it was set, with the same `on`, `when`, `state`, `mode` and `only`. 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 are deleted. Removing vibrancy makes the colors again at the default, 50. Experimental: it may change or be removed in a patch release.',
|
|
16
|
+
'With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, 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 `thing`, it removes that one setting instead, wherever it is in the settings, and the `now` field of the result says what applies instead (a dial that still writes it, a whole-theme setting of the same thing, or the value of the base theme); name it the way it was set, with the same `on`, `when`, `state`, `mode` and `only`. 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. 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.',
|
|
17
17
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
18
18
|
signature: 'themeEditUndo(theme: string, options?: object): Promise<object>',
|
|
19
19
|
keywords: [
|