@astryxdesign/cli 0.7.15 → 0.7.16-canary.g54dd64e
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/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +17 -0
- package/api/doctor/_adapter.mjs +35 -0
- package/api/doctor/doctor.mjs +18 -4
- package/api/integration/pack-check.mjs +13 -7
- package/api/integration/validate-integration.mjs +1 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +43 -12
- package/api/theme/build/build.d.mts +64 -27
- package/api/theme/build/build.mjs +341 -69
- 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 +33 -0
- package/api/theme-edit/_adapter.mjs +208 -31
- package/api/theme-edit/_check.d.mts +38 -0
- package/api/theme-edit/_check.mjs +1326 -211
- 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 +29 -0
- package/api/theme-edit/_context.mjs +329 -30
- package/api/theme-edit/_css.d.mts +60 -1
- package/api/theme-edit/_css.mjs +404 -28
- package/api/theme-edit/_edit.d.mts +9 -0
- package/api/theme-edit/_edit.mjs +1025 -126
- 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 +11 -0
- package/api/theme-edit/_palette.mjs +194 -65
- package/api/theme-edit/_parts.d.mts +16 -0
- package/api/theme-edit/_parts.mjs +59 -7
- package/api/theme-edit/_png.mjs +19 -14
- package/api/theme-edit/_preview-app.d.mts +3 -0
- package/api/theme-edit/_preview-app.mjs +843 -45
- package/api/theme-edit/_preview.d.mts +16 -3
- package/api/theme-edit/_preview.mjs +310 -29
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +46 -12
- package/api/theme-edit/_settings.d.mts +178 -5
- package/api/theme-edit/_settings.mjs +2035 -86
- 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 +2 -1
- package/api/theme-edit/theme-edit.type.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditShow.doc.mjs +11 -3
- package/api/upgrade/registry/registry.mjs +6 -1
- 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/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/experimental/theme.mjs +190 -37
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.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 +168 -45
- 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 +40 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +49 -0
- package/foundation/config/project.mjs +50 -14
- package/foundation/discovery/theme-discovery.d.mts +5 -1
- package/foundation/discovery/theme-discovery.mjs +24 -3
- package/foundation/fs/gather-cache.d.mts +9 -2
- package/foundation/fs/gather-cache.mjs +79 -15
- package/foundation/fs/paths.d.mts +31 -0
- package/foundation/fs/paths.mjs +43 -10
- 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/package.json +7 -6
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import * as path from 'node:path';
|
|
9
9
|
import {AstryxError} from '../../error.mjs';
|
|
10
|
+
import {logger} from '../../logger.mjs';
|
|
10
11
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
12
|
+
import {
|
|
13
|
+
formatCliCommand,
|
|
14
|
+
quoteCommandArgument,
|
|
15
|
+
} from '../../../foundation/env/package-manager.mjs';
|
|
11
16
|
import {
|
|
12
17
|
ejectThemeFiles,
|
|
13
18
|
findTheme,
|
|
@@ -54,12 +59,28 @@ export async function themeEject(slug, options = {}) {
|
|
|
54
59
|
);
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
const {outputDir, files} = ejectThemeFiles(match, {
|
|
62
|
+
const {outputDir, files, editorFolder} = ejectThemeFiles(match, {
|
|
58
63
|
cwd,
|
|
59
64
|
targetPath,
|
|
60
65
|
overwrite,
|
|
61
66
|
takenSlugs: await availableSlugs(cwd),
|
|
62
67
|
});
|
|
68
|
+
// A folder the theme editor made holds that theme only, but a subfolder of
|
|
69
|
+
// it was always writable, so the fork is written there with one warning.
|
|
70
|
+
if (editorFolder != null) {
|
|
71
|
+
const fork = formatCliCommand(
|
|
72
|
+
[
|
|
73
|
+
'theme eject',
|
|
74
|
+
match.slug,
|
|
75
|
+
...(packageName
|
|
76
|
+
? ['--package', quoteCommandArgument(packageName)]
|
|
77
|
+
: []),
|
|
78
|
+
].join(' '),
|
|
79
|
+
cwd,
|
|
80
|
+
);
|
|
81
|
+
const warning = `Warning: ${editorFolder} is a folder the theme editor made, and the fork in ${outputDir} is inside it; eject writes there anyway. Fork into the project's local themes folder (${fork}), or pick a path outside ${editorFolder}, to keep the editor's folder to its own theme.`;
|
|
82
|
+
logger.warn(warning);
|
|
83
|
+
}
|
|
63
84
|
const {missingPackages, installCommand} = forkNeeds(outputDir, files, cwd);
|
|
64
85
|
return {
|
|
65
86
|
type: 'theme.eject',
|
|
@@ -15,7 +15,26 @@ export function themeTemplate(options?: {
|
|
|
15
15
|
overwrite?: boolean;
|
|
16
16
|
cwd?: string;
|
|
17
17
|
}): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
18
|
+
/**
|
|
19
|
+
* The template write behind `themeTemplate`, with the experimental editor's
|
|
20
|
+
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
21
|
+
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
22
|
+
* template there is the person's. Internal: the experimental `template`
|
|
23
|
+
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
24
|
+
* is not part of the public API.
|
|
25
|
+
* @internal
|
|
26
|
+
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
27
|
+
* @param {boolean} editorFilesOnly
|
|
28
|
+
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
29
|
+
*/
|
|
30
|
+
export function writeThemeTemplate(options: {
|
|
31
|
+
targetPath?: string;
|
|
32
|
+
overwrite?: boolean;
|
|
33
|
+
cwd?: string;
|
|
34
|
+
}, editorFilesOnly: boolean): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
18
35
|
/** The annotated `defineTheme` reference that ships with the CLI. */
|
|
19
36
|
export const THEME_TEMPLATE_SRC: string;
|
|
37
|
+
/** The warning the CLI prints when it writes the template outside a project. */
|
|
38
|
+
export const OUTSIDE_PROJECT_WARNING: "Warning: no package.json is in this folder or above it, so the template is written here. Run it inside a project, or run `npm init -y` here first, to write it at a project root.";
|
|
20
39
|
/** Where it lands when the caller does not say. */
|
|
21
40
|
export const THEME_TEMPLATE_DEFAULT_PATH: "theme.template.ts";
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
import * as fs from 'node:fs';
|
|
17
17
|
import * as path from 'node:path';
|
|
18
|
-
import {CLI_ROOT} from '../../../foundation/fs/paths.mjs';
|
|
19
|
-
import {
|
|
18
|
+
import {CLI_ROOT, projectWritePath} from '../../../foundation/fs/paths.mjs';
|
|
19
|
+
import {
|
|
20
|
+
assertWithin,
|
|
21
|
+
PathSafetyError,
|
|
22
|
+
} from '../../../foundation/fs/path-safety.mjs';
|
|
20
23
|
import {stripCopyrightHeader} from '../../../foundation/text/copyright-header.mjs';
|
|
21
24
|
import {formatCliCommand} from '../../../foundation/env/package-manager.mjs';
|
|
22
25
|
import {fsErrorMessage} from '../../../foundation/fs/fs-error.mjs';
|
|
@@ -25,7 +28,15 @@ import {AstryxError} from '../../error.mjs';
|
|
|
25
28
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
26
29
|
|
|
27
30
|
/** The annotated `defineTheme` reference that ships with the CLI. */
|
|
28
|
-
export const THEME_TEMPLATE_SRC = path.join(
|
|
31
|
+
export const THEME_TEMPLATE_SRC = path.join(
|
|
32
|
+
CLI_ROOT,
|
|
33
|
+
'assets',
|
|
34
|
+
'theme.template.ts',
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/** The warning the CLI prints when it writes the template outside a project. */
|
|
38
|
+
export const OUTSIDE_PROJECT_WARNING =
|
|
39
|
+
'Warning: no package.json is in this folder or above it, so the template is written here. Run it inside a project, or run `npm init -y` here first, to write it at a project root.';
|
|
29
40
|
|
|
30
41
|
/** Where it lands when the caller does not say. */
|
|
31
42
|
export const THEME_TEMPLATE_DEFAULT_PATH = 'theme.template.ts';
|
|
@@ -72,6 +83,22 @@ function isReplaceableThemeFile(file) {
|
|
|
72
83
|
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
73
84
|
*/
|
|
74
85
|
export function themeTemplate(options = {}) {
|
|
86
|
+
return writeThemeTemplate(options, false);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The template write behind `themeTemplate`, with the experimental editor's
|
|
91
|
+
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
92
|
+
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
93
|
+
* template there is the person's. Internal: the experimental `template`
|
|
94
|
+
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
95
|
+
* is not part of the public API.
|
|
96
|
+
* @internal
|
|
97
|
+
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
98
|
+
* @param {boolean} editorFilesOnly
|
|
99
|
+
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
100
|
+
*/
|
|
101
|
+
export function writeThemeTemplate(options, editorFilesOnly) {
|
|
75
102
|
const {
|
|
76
103
|
targetPath = THEME_TEMPLATE_DEFAULT_PATH,
|
|
77
104
|
overwrite = false,
|
|
@@ -86,34 +113,52 @@ export function themeTemplate(options = {}) {
|
|
|
86
113
|
);
|
|
87
114
|
if (String(targetPath).trim() === '') {
|
|
88
115
|
throw new AstryxError(
|
|
89
|
-
'The theme template path is blank. Give a file path, or leave it out for theme.template.ts.',
|
|
116
|
+
'The theme template path is blank. Give a file path, or leave it out for theme.template.ts at the project root.',
|
|
90
117
|
[
|
|
91
118
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
),
|
|
96
|
-
reason: 'the default path',
|
|
119
|
+
// No path: the template at the project root, from any folder.
|
|
120
|
+
name: formatCliCommand('theme template', cwd),
|
|
121
|
+
reason: 'write the template at the project root',
|
|
97
122
|
},
|
|
98
123
|
],
|
|
99
124
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
100
125
|
);
|
|
101
126
|
}
|
|
102
127
|
|
|
128
|
+
// The project the folder belongs to bounds the path, as for other theme
|
|
129
|
+
// commands: a path given is read from the current folder, and no path
|
|
130
|
+
// means the project root.
|
|
131
|
+
// With no package.json at or above the folder it writes here, and the CLI
|
|
132
|
+
// prints OUTSIDE_PROJECT_WARNING.
|
|
133
|
+
// Read as every theme command reads a path it writes; a backslash
|
|
134
|
+
// separates folders on every platform.
|
|
135
|
+
const {projectDir, relative: fromRoot} = projectWritePath(
|
|
136
|
+
cwd,
|
|
137
|
+
options.targetPath == null ? undefined : String(targetPath),
|
|
138
|
+
THEME_TEMPLATE_DEFAULT_PATH,
|
|
139
|
+
);
|
|
103
140
|
let resolved;
|
|
104
141
|
try {
|
|
105
|
-
resolved = assertWithin(
|
|
142
|
+
resolved = assertWithin(fromRoot, projectDir, {
|
|
143
|
+
label: 'theme template path',
|
|
144
|
+
});
|
|
106
145
|
} catch (err) {
|
|
107
146
|
if (err instanceof PathSafetyError) {
|
|
108
147
|
throw new AstryxError(
|
|
109
|
-
|
|
148
|
+
// The path as typed, not as read from the project root.
|
|
149
|
+
// A typed path is read from the current folder, so the advice says
|
|
150
|
+
// so (the safety check reads it from the project root).
|
|
151
|
+
err.message
|
|
152
|
+
.replace(`"${fromRoot}"`, `"${targetPath}"`)
|
|
153
|
+
.replace(
|
|
154
|
+
/relative to the project root/g,
|
|
155
|
+
'relative to the current folder, inside the project',
|
|
156
|
+
),
|
|
110
157
|
[
|
|
111
158
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
),
|
|
116
|
-
reason: 'write the template in this project',
|
|
159
|
+
// No path: the template at the project root.
|
|
160
|
+
name: formatCliCommand('theme template', cwd),
|
|
161
|
+
reason: 'write the template at the project root',
|
|
117
162
|
},
|
|
118
163
|
],
|
|
119
164
|
ERROR_CODES.ERR_PATH_TRAVERSAL,
|
|
@@ -153,10 +198,39 @@ export function themeTemplate(options = {}) {
|
|
|
153
198
|
);
|
|
154
199
|
}
|
|
155
200
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
201
|
+
// The folder as it is on disk (`themes/T` is `themes/t` on a
|
|
202
|
+
// case-insensitive disk, or through a link).
|
|
203
|
+
const realDir = fs.existsSync(resolved)
|
|
204
|
+
? fs.realpathSync(path.dirname(resolved))
|
|
205
|
+
: path.dirname(resolved);
|
|
206
|
+
const record = fs.existsSync(resolved) ? editorThemeRecord(realDir) : null;
|
|
207
|
+
// The editor's own files are `<folder>.*` beside its settings; with
|
|
208
|
+
// editorFilesOnly any other file there (an earlier template) is the
|
|
209
|
+
// person's.
|
|
210
|
+
// On a case-insensitive disk `T.theme.ts` is `t.theme.ts`: names are
|
|
211
|
+
// compared in any case, and an existing file by what it is on disk.
|
|
212
|
+
const folder = path.basename(realDir).toLowerCase();
|
|
213
|
+
const sameFile = (/** @type {string} */ other) => {
|
|
214
|
+
try {
|
|
215
|
+
const a = fs.statSync(resolved);
|
|
216
|
+
const b = fs.statSync(other);
|
|
217
|
+
return a.ino === b.ino && a.dev === b.dev;
|
|
218
|
+
} catch {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const editorFile =
|
|
223
|
+
record != null &&
|
|
224
|
+
(!editorFilesOnly ||
|
|
225
|
+
path.basename(resolved).toLowerCase().startsWith(`${folder}.`) ||
|
|
226
|
+
fs
|
|
227
|
+
.readdirSync(realDir)
|
|
228
|
+
.some(
|
|
229
|
+
f =>
|
|
230
|
+
f.toLowerCase().startsWith(`${folder}.`) &&
|
|
231
|
+
sameFile(path.join(realDir, f)),
|
|
232
|
+
));
|
|
233
|
+
const editorRecord = overwrite && editorFile ? record : null;
|
|
160
234
|
if (editorRecord) {
|
|
161
235
|
throw new AstryxError(
|
|
162
236
|
`${relative} belongs to a theme the theme editor made (${editorRecord} is beside it). Replacing it would cut the theme off from its settings, so --overwrite does not replace it.`,
|
|
@@ -196,9 +270,7 @@ export function themeTemplate(options = {}) {
|
|
|
196
270
|
if (fs.existsSync(resolved) && !overwrite) {
|
|
197
271
|
// Whether --overwrite would replace this file, and if not, a path that
|
|
198
272
|
// takes the template, so the hint never names a command that refuses.
|
|
199
|
-
const overwritable =
|
|
200
|
-
!editorThemeRecord(path.dirname(resolved)) &&
|
|
201
|
-
isReplaceableThemeFile(resolved);
|
|
273
|
+
const overwritable = !editorFile && isReplaceableThemeFile(resolved);
|
|
202
274
|
return {
|
|
203
275
|
type: 'theme.template',
|
|
204
276
|
data: {
|
|
@@ -212,7 +284,9 @@ export function themeTemplate(options = {}) {
|
|
|
212
284
|
}
|
|
213
285
|
|
|
214
286
|
// Our repo header has no business in someone else's source tree.
|
|
215
|
-
const contents = stripCopyrightHeader(
|
|
287
|
+
const contents = stripCopyrightHeader(
|
|
288
|
+
fs.readFileSync(THEME_TEMPLATE_SRC, 'utf-8'),
|
|
289
|
+
);
|
|
216
290
|
try {
|
|
217
291
|
fs.mkdirSync(path.dirname(resolved), {recursive: true});
|
|
218
292
|
fs.writeFileSync(resolved, contents);
|
|
@@ -223,7 +297,10 @@ export function themeTemplate(options = {}) {
|
|
|
223
297
|
throw new AstryxError(message, undefined, ERROR_CODES.ERR_WRITE_FAILED);
|
|
224
298
|
}
|
|
225
299
|
|
|
226
|
-
return {
|
|
300
|
+
return {
|
|
301
|
+
type: 'theme.template',
|
|
302
|
+
data: {path: relative, written: true, reason: null},
|
|
303
|
+
};
|
|
227
304
|
}
|
|
228
305
|
|
|
229
306
|
/** @param {string} file */
|
|
@@ -32,6 +32,9 @@ export type ThemeBuildResponse = {
|
|
|
32
32
|
*/
|
|
33
33
|
export type ThemeBuildCheckResponse = {
|
|
34
34
|
type: "theme.build.check";
|
|
35
|
+
/**
|
|
36
|
+
* `code` is set when the outputs are stale or missing (exit 1).
|
|
37
|
+
*/
|
|
35
38
|
data: {
|
|
36
39
|
name: string;
|
|
37
40
|
upToDate: boolean;
|
|
@@ -40,6 +43,7 @@ export type ThemeBuildCheckResponse = {
|
|
|
40
43
|
reason: "missing" | "outdated";
|
|
41
44
|
}>;
|
|
42
45
|
checked: string[];
|
|
46
|
+
code?: "ERR_THEME_STALE";
|
|
43
47
|
};
|
|
44
48
|
};
|
|
45
49
|
/**
|
|
@@ -281,7 +285,7 @@ export type TonalPaletteFamilyInput = {
|
|
|
281
285
|
* `neutral` derives the ramp from
|
|
282
286
|
* `neutralProfile` instead of the seed hue; defaults to `chromatic`.
|
|
283
287
|
*/
|
|
284
|
-
kind?: "
|
|
288
|
+
kind?: "chromatic" | "neutral" | undefined;
|
|
285
289
|
/**
|
|
286
290
|
* Colors pinned at specific stops.
|
|
287
291
|
*/
|
package/api/theme/theme.type.mjs
CHANGED
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
* astryx --json theme build <file> --check
|
|
39
39
|
* @typedef {object} ThemeBuildCheckResponse
|
|
40
40
|
* @property {'theme.build.check'} type
|
|
41
|
-
* @property {{name: string, upToDate: boolean, stale: Array<{path: string, reason: 'missing' | 'outdated'}>, checked: string[]}} data
|
|
41
|
+
* @property {{name: string, upToDate: boolean, stale: Array<{path: string, reason: 'missing' | 'outdated'}>, checked: string[], code?: 'ERR_THEME_STALE'}} data
|
|
42
|
+
* `code` is set when the outputs are stale or missing (exit 1).
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -58,7 +58,7 @@ export const doc = {
|
|
|
58
58
|
name: 'options.out',
|
|
59
59
|
type: 'string',
|
|
60
60
|
description:
|
|
61
|
-
'Override the output CSS path, relative or absolute; a build refuses a path outside cwd, and check mode refuses only a relative path that escapes cwd. The .js, .d.ts and any .variants.d.ts are written in the same directory, named after the theme (<name>.js), not after the CSS file. An existing folder, or a path that ends in a separator, names the folder: the CSS is written there as <name>.css. A file path should end in .css; another name still builds, with a warning, and the import line it prints names the file as written.',
|
|
61
|
+
'Override the output CSS path, relative or absolute; a build refuses a path outside cwd, and check mode refuses only a relative path that escapes cwd. The .js, .d.ts and any .variants.d.ts are written in the same directory, named after the theme (<name>.js), not after the CSS file. An existing folder, or a path that ends in a separator, names the folder: the CSS is written there as <name>.css. A file path should end in .css; another name still builds, with a warning, and the import line it prints names the file as written. A path in a folder the theme editor made (folder <slug>/ holds <slug>.settings.json) takes the outputs of a source outside that folder too, and the CLI warns; to keep the editor folder to its own theme, build beside the source, or pick an out path outside it.',
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
name: 'options.check',
|
|
@@ -90,7 +90,7 @@ export const doc = {
|
|
|
90
90
|
{
|
|
91
91
|
type: 'theme.build.check',
|
|
92
92
|
description:
|
|
93
|
-
'The {check: true} receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: "missing" | "outdated"}),
|
|
93
|
+
'The {check: true} receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: "missing" | "outdated"}), the full list of checked paths, and, when stale, code ERR_THEME_STALE. Writes nothing. Resolves to null, like a normal build, when the theme produces no CSS.',
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
throws: [
|
|
@@ -108,7 +108,7 @@ export const doc = {
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
code: 'ERR_FILE_EXISTS',
|
|
111
|
-
when: 'a path that out names holds a non-empty file without the generated header, such as package.json, app source, or an output from a CLI before 0.6.7; nothing is written.
|
|
111
|
+
when: 'a path that out names holds a non-empty file without the generated header, such as package.json, app source, or an output from a CLI before 0.6.7; nothing is written. The suggestions name a free out path beside it and the build beside the source; the file is left as it is. At the default paths beside the source, and at family output paths, a header-less file is an output of a CLI before 0.6.7 and is replaced',
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
code: 'ERR_INVALID_ARGUMENT',
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
displayName: 'themeEject()',
|
|
14
14
|
summary: 'Eject an available theme into a project as editable source.',
|
|
15
15
|
description:
|
|
16
|
-
"Resolves a theme from the CLI bundle or an installed integration and ejects it into the consumer project: a bundled theme's source files, or an integration theme's complete directory with its descriptor. Writes are staged and existing files require explicit overwrite. Duplicate slugs fail closed until the caller selects an owner package.",
|
|
16
|
+
"Resolves a theme from the CLI bundle or an installed integration and ejects it into the consumer project: a bundled theme's source files, or an integration theme's complete directory with its descriptor. Writes are staged and existing files require explicit overwrite. A target inside a folder the theme editor made (a subfolder of <slug>/ that holds <slug>.settings.json) is written, and the CLI warns. Duplicate slugs fail closed until the caller selects an owner package.",
|
|
17
17
|
importPath: '@astryxdesign/cli/api',
|
|
18
18
|
signature:
|
|
19
19
|
'themeEject(slug: string, options?: {targetPath?: string, overwrite?: boolean, cwd?: string, package?: string}): Promise<ThemeEjectResponse>',
|
|
@@ -22,7 +22,9 @@ export const doc = {
|
|
|
22
22
|
'Read it, copy what you need into your own theme file, delete it. Use `theme add` to ' +
|
|
23
23
|
'use an installed built theme, extend that theme for ordinary customization, or use ' +
|
|
24
24
|
'`theme eject` for a complete source fork. This command starts a new blank theme. Refuses to overwrite without ' +
|
|
25
|
-
'`overwrite`, so it is safe to re-run.'
|
|
25
|
+
'`overwrite`, so it is safe to re-run. With no package.json at or above cwd, it writes in cwd ' +
|
|
26
|
+
'and the CLI warns; pass a cwd inside a project, or run `npm init -y` in that folder first, to ' +
|
|
27
|
+
'write it at a project root.',
|
|
26
28
|
importPath: '@astryxdesign/cli/api',
|
|
27
29
|
signature:
|
|
28
30
|
'themeTemplate(options?: {targetPath?: string, overwrite?: boolean, cwd?: string}): ThemeTemplateResponse',
|
|
@@ -31,7 +33,8 @@ export const doc = {
|
|
|
31
33
|
{
|
|
32
34
|
name: 'options.targetPath',
|
|
33
35
|
type: 'string',
|
|
34
|
-
description:
|
|
36
|
+
description:
|
|
37
|
+
'Destination file, read from cwd. Must resolve within the project root: the nearest folder at or above cwd with a package.json. Left out, the template is written at the project root.',
|
|
35
38
|
default: "'theme.template.ts'",
|
|
36
39
|
},
|
|
37
40
|
{
|
|
@@ -55,7 +58,10 @@ export const doc = {
|
|
|
55
58
|
},
|
|
56
59
|
],
|
|
57
60
|
throws: [
|
|
58
|
-
{
|
|
61
|
+
{
|
|
62
|
+
code: 'ERR_PATH_TRAVERSAL',
|
|
63
|
+
when: 'the target path escapes the project root (the nearest folder at or above cwd with a package.json)',
|
|
64
|
+
},
|
|
59
65
|
{
|
|
60
66
|
code: 'ERR_INVALID_ARGUMENT',
|
|
61
67
|
when: 'the target path is blank, names a folder, or is not a .ts file (with or without overwrite)',
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
* @returns {Promise<import('./theme-edit.type.mjs').ThemeEditHowResponse>}
|
|
11
11
|
*/
|
|
12
12
|
export function themeEditHow(subject: string, options?: import("./theme-edit.type.mjs").ThemeEditHowOptions): Promise<import("./theme-edit.type.mjs").ThemeEditHowResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Whether a value fits what a dial takes, read from the dial's own list of
|
|
15
|
+
* values: a named rung in any case, or a value of the kind it names (a size,
|
|
16
|
+
* a color, a number). `set` still checks the value in full.
|
|
17
|
+
* @param {string} dial
|
|
18
|
+
* @param {string} value
|
|
19
|
+
*/
|
|
20
|
+
export function dialValueFits(dial: string, value: string): boolean;
|
|
13
21
|
/**
|
|
14
22
|
* The project a command acts on: the Astryx project at or above `cwd`, found
|
|
15
23
|
* as `upgrade` finds it (the nearest package that declares an Astryx package
|
|
@@ -55,8 +63,33 @@ export function editorCompileProblem(files: string[], { cwd, check, family }: {
|
|
|
55
63
|
export function editorThemeHold(files: string[], { cwd }: {
|
|
56
64
|
cwd: string;
|
|
57
65
|
}): Promise<() => Promise<void>>;
|
|
66
|
+
/**
|
|
67
|
+
* For `compile` of a file that is not there: when it is an editor theme's
|
|
68
|
+
* own source (`themes/<t>/<t>.theme.ts` beside its settings), the command
|
|
69
|
+
* that writes it again; null otherwise.
|
|
70
|
+
* @param {string} file the path as given
|
|
71
|
+
* @param {string} cwd
|
|
72
|
+
* @returns {{name: string, reason: string} | null}
|
|
73
|
+
*/
|
|
74
|
+
export function editorMissingSource(file: string, cwd: string): {
|
|
75
|
+
name: string;
|
|
76
|
+
reason: string;
|
|
77
|
+
} | null;
|
|
78
|
+
/**
|
|
79
|
+
* `theme template` for the experimental command: in a folder the theme
|
|
80
|
+
* editor made, only the editor's own files are protected.
|
|
81
|
+
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
82
|
+
* @returns {import('../theme/theme.type.mjs').ThemeTemplateResponse}
|
|
83
|
+
*/
|
|
84
|
+
export function editorThemeTemplate(options: {
|
|
85
|
+
targetPath?: string;
|
|
86
|
+
overwrite?: boolean;
|
|
87
|
+
cwd?: string;
|
|
88
|
+
}): import("../theme/theme.type.mjs").ThemeTemplateResponse;
|
|
58
89
|
export { parsePoints } from "./_how.mjs";
|
|
90
|
+
export { newFlagList } from "./_edit.mjs";
|
|
59
91
|
export function builtInThemes(): string[];
|
|
92
|
+
export function showSections(): string[];
|
|
60
93
|
/** @type {typeof edit.themeEditNew} */
|
|
61
94
|
export const themeEditNew: typeof edit.themeEditNew;
|
|
62
95
|
/** @type {typeof edit.themeEditSet} */
|