@astryxdesign/cli 0.7.14 → 0.7.15-canary.g061b2fa
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 +63 -63
- package/api/build/_adapter.d.mts +4 -0
- package/api/build/_adapter.mjs +28 -2
- package/api/build/blocks/blocks.d.mts +10 -1
- package/api/build/blocks/blocks.mjs +84 -7
- package/api/build/build.mjs +6 -1
- package/api/build/tree.d.mts +4 -0
- package/api/build/tree.mjs +9 -2
- package/api/doctor/_adapter.d.mts +3 -1
- package/api/doctor/_adapter.mjs +14 -1
- package/api/doctor/_authoring-audit.d.mts +42 -0
- package/api/doctor/_authoring-audit.mjs +106 -0
- package/api/doctor/doctor.d.mts +7 -0
- package/api/doctor/doctor.mjs +24 -39
- package/api/doctor/theme-checks.mjs +56 -21
- package/api/integration/validate-integration.mjs +17 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_adapter.mjs +124 -3
- package/api/search/_candidate-score.mjs +63 -9
- package/api/search/_entries.d.mts +10 -0
- package/api/search/_entries.mjs +68 -1
- package/api/search/_gather-templates.d.mts +11 -0
- package/api/search/_gather-templates.mjs +22 -2
- package/api/search/_words.mjs +26 -6
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/theme/_adapter.d.mts +17 -1
- package/api/theme/_adapter.mjs +185 -40
- package/api/theme/build/build.d.mts +29 -1
- package/api/theme/build/build.mjs +426 -65
- package/api/theme/eject/eject.mjs +10 -6
- package/api/theme/targets/targets.d.mts +8 -0
- package/api/theme/targets/targets.mjs +24 -4
- package/api/theme/template/template.mjs +48 -2
- package/api/theme/theme.type.d.mts +8 -0
- package/api/theme/theme.type.mjs +5 -1
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeEject.doc.mjs +3 -3
- package/api/theme/themeRemove.doc.mjs +5 -2
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +2 -2
- package/api/theme/themeUse.doc.mjs +8 -2
- package/api/theme-edit/_adapter.d.mts +46 -3
- package/api/theme-edit/_adapter.mjs +372 -109
- package/api/theme-edit/_check.d.mts +6 -3
- package/api/theme-edit/_check.mjs +665 -87
- package/api/theme-edit/_color.mjs +4 -2
- package/api/theme-edit/_compiler.d.mts +2 -1
- package/api/theme-edit/_compiler.mjs +27 -13
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +47 -8
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +484 -66
- package/api/theme-edit/_how-commands.d.mts +33 -7
- package/api/theme-edit/_how-commands.mjs +57 -45
- package/api/theme-edit/_how-question.d.mts +4 -0
- package/api/theme-edit/_how-question.mjs +1004 -223
- package/api/theme-edit/_how.mjs +96 -9
- package/api/theme-edit/_palette.d.mts +38 -13
- package/api/theme-edit/_palette.mjs +620 -223
- package/api/theme-edit/_parts.mjs +63 -7
- package/api/theme-edit/_png.d.mts +4 -4
- package/api/theme-edit/_png.mjs +4 -2
- package/api/theme-edit/_preview-app.d.mts +6 -0
- package/api/theme-edit/_preview-app.mjs +1194 -207
- package/api/theme-edit/_preview.mjs +2 -2
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +37 -6
- package/api/theme-edit/_settings.d.mts +104 -33
- package/api/theme-edit/_settings.mjs +818 -118
- package/api/theme-edit/_tables.d.mts +7 -0
- package/api/theme-edit/_tables.mjs +61 -0
- package/api/theme-edit/theme-edit.type.d.mts +11 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewList.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
- package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
- package/api/upgrade/_adapter.d.mts +1 -0
- package/assets/codemods/run-codemod.mjs +61 -0
- package/assets/codemods/runner.mjs +5 -4
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
- package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
- package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
- package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
- package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
- package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
- package/assets/docs/tree/calendars.doc.mjs +1 -3
- package/assets/docs/tree/checks.doc.mjs +22 -1
- package/assets/docs.generated.json +2 -1
- package/assets/self-audit.generated.json +1 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
- package/assets/templates/components.generated.json +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +8 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +19 -15
- package/clients/cli/build-id.generated.json +1 -0
- package/clients/cli/commands/ensure-core-built.mjs +12 -5
- package/clients/cli/commands/experimental/theme.mjs +178 -78
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- 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 +3 -3
- 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-preview-list.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
- package/clients/cli/commands/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +374 -42
- package/clients/cli/index.mjs +9 -3
- package/clients/cli/lib/manifest.mjs +37 -0
- package/clients/cli/lib/resolve-theme.mjs +2 -1
- package/clients/cli/manifest.generated.json +1 -0
- package/foundation/config/theme-state.d.mts +16 -0
- package/foundation/config/theme-state.mjs +84 -13
- package/foundation/discovery/module-exports.mjs +16 -2
- package/foundation/discovery/stored-self-audit.d.mts +31 -0
- package/foundation/discovery/stored-self-audit.mjs +119 -0
- package/foundation/discovery/template-adapter.d.mts +48 -2
- package/foundation/discovery/template-adapter.mjs +51 -19
- package/foundation/discovery/template-needs.d.mts +19 -0
- package/foundation/discovery/template-needs.mjs +50 -16
- package/foundation/discovery/template-source-tree.d.mts +7 -0
- package/foundation/discovery/template-source-tree.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +2 -1
- package/foundation/discovery/theme-discovery.mjs +2 -8
- package/foundation/discovery/theme-module-extensions.d.mts +18 -0
- package/foundation/discovery/theme-module-extensions.mjs +30 -0
- package/foundation/doc-compiler/import.mjs +22 -15
- package/foundation/doc-compiler/stored-docs.d.mts +18 -12
- package/foundation/doc-compiler/stored-docs.mjs +52 -19
- package/foundation/env/private-dir.d.mts +17 -0
- package/foundation/env/private-dir.mjs +42 -0
- package/foundation/fs/gather-cache.d.mts +108 -0
- package/foundation/fs/gather-cache.mjs +741 -0
- package/foundation/fs/jiti-cache.d.mts +21 -0
- package/foundation/fs/jiti-cache.mjs +66 -0
- package/foundation/fs/module-loader.mjs +14 -3
- package/foundation/fs/read-record.d.mts +31 -1
- package/foundation/fs/read-record.mjs +100 -7
- package/foundation/integrations/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +11 -2
- package/foundation/release/cache.mjs +59 -10
- package/foundation/release/folder-lock.d.mts +21 -0
- package/foundation/release/folder-lock.mjs +171 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +8 -6
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from './_catalog.mjs';
|
|
27
27
|
import {renderDir, renderGenerated} from './_parts.mjs';
|
|
28
28
|
import {OVERVIEW_SECTIONS} from './_overview.mjs';
|
|
29
|
-
import {fontPackages, modesOf, themeFiles, shown} from './_settings.mjs';
|
|
29
|
+
import {camel, fontPackages, modesOf, themeFiles, shown} from './_settings.mjs';
|
|
30
30
|
import {writeWhole} from './_palette.mjs';
|
|
31
31
|
import {importPathOf, installLine} from './_project.mjs';
|
|
32
32
|
import {DIRECT} from './_tables.mjs';
|
|
@@ -1081,7 +1081,7 @@ export function previewRouteSource({
|
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
1083
|
/** @param {string} slug */
|
|
1084
|
-
const camelName =
|
|
1084
|
+
const camelName = camel;
|
|
1085
1085
|
|
|
1086
1086
|
/**
|
|
1087
1087
|
* A PNG of an HTML file, with a Playwright the project has installed, else
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The theme editor's cache folder for a project: the `.cache/astryx-theme`
|
|
6
|
+
* of the node_modules that holds the Core the command reads (the
|
|
7
|
+
* project's own, or a workspace root's). The locks and the part-data cache
|
|
8
|
+
* both live here, so one command never finds two answers. Null without
|
|
9
|
+
* Core.
|
|
10
|
+
* @param {string} dir
|
|
11
|
+
* @returns {string | null}
|
|
12
|
+
*/
|
|
13
|
+
export function themeCacheRoot(dir: string): string | null;
|
|
4
14
|
/**
|
|
5
15
|
* The install line for packages, in the project's package manager.
|
|
6
16
|
* @param {string} cwd
|
|
@@ -33,11 +43,12 @@ export function baseThemeFile(project: ThemeProject, like: string): string;
|
|
|
33
43
|
* Resolved tokens of the base theme in both modes.
|
|
34
44
|
* @param {ThemeProject} project
|
|
35
45
|
* @param {string | undefined} like
|
|
36
|
-
* @returns {Promise<{light: Record<string, string>, dark: Record<string, string>}>}
|
|
46
|
+
* @returns {Promise<{light: Record<string, string>, dark: Record<string, string>, components: Record<string, any>}>}
|
|
37
47
|
*/
|
|
38
48
|
export function baseResolved(project: ThemeProject, like: string | undefined): Promise<{
|
|
39
49
|
light: Record<string, string>;
|
|
40
50
|
dark: Record<string, string>;
|
|
51
|
+
components: Record<string, any>;
|
|
41
52
|
}>;
|
|
42
53
|
export type ThemeProject = {
|
|
43
54
|
cwd: string;
|
|
@@ -21,6 +21,7 @@ import {loadComponentDoc} from '../../foundation/discovery/component-loader.mjs'
|
|
|
21
21
|
import {collectThemingTargets} from '../../foundation/discovery/theming-targets.mjs';
|
|
22
22
|
import {resolveImportPath} from '../../foundation/discovery/component-discovery.mjs';
|
|
23
23
|
import {detectPackageManager} from '../../foundation/env/package-manager.mjs';
|
|
24
|
+
import {findProjectCoreDir} from '../../foundation/fs/paths.mjs';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* @typedef {object} ThemeProject
|
|
@@ -53,6 +54,31 @@ const projects = new Map();
|
|
|
53
54
|
/** Bump when the shape of the cached component docs changes. */
|
|
54
55
|
const DOCS_VERSION = 2;
|
|
55
56
|
|
|
57
|
+
/**
|
|
58
|
+
* The theme editor's cache folder for a project: the `.cache/astryx-theme`
|
|
59
|
+
* of the node_modules that holds the Core the command reads (the
|
|
60
|
+
* project's own, or a workspace root's). The locks and the part-data cache
|
|
61
|
+
* both live here, so one command never finds two answers. Null without
|
|
62
|
+
* Core.
|
|
63
|
+
* @param {string} dir
|
|
64
|
+
* @returns {string | null}
|
|
65
|
+
*/
|
|
66
|
+
export function themeCacheRoot(dir) {
|
|
67
|
+
const core = findProjectCoreDir(dir);
|
|
68
|
+
if (!core) return null;
|
|
69
|
+
// Core read from source (a fork of the design system, packages/core) is
|
|
70
|
+
// in no node_modules: the cache goes in the project's own node_modules,
|
|
71
|
+
// never in a source folder.
|
|
72
|
+
const modules = path.dirname(path.dirname(core));
|
|
73
|
+
if (
|
|
74
|
+
path.basename(path.dirname(core)) === '@astryxdesign' &&
|
|
75
|
+
path.basename(modules) === 'node_modules'
|
|
76
|
+
)
|
|
77
|
+
return path.join(modules, '.cache', 'astryx-theme');
|
|
78
|
+
const own = nodeModulesRoot(dir);
|
|
79
|
+
return own ? path.join(own, 'node_modules', '.cache', 'astryx-theme') : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
56
82
|
/**
|
|
57
83
|
* The nearest folder at or above `dir` that holds node_modules.
|
|
58
84
|
* @param {string} dir
|
|
@@ -201,13 +227,15 @@ export async function openProject(cwd) {
|
|
|
201
227
|
// No stylesheet: the part data is empty, and the version alone keys it.
|
|
202
228
|
}
|
|
203
229
|
const coreKey = `${coreVersion}-${fingerprint}`;
|
|
204
|
-
const root = nodeModulesRoot(key) ?? key;
|
|
205
230
|
const core = await import(pathToFileURL(themeFile).href);
|
|
206
231
|
const cacheDir = path.join(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
232
|
+
themeCacheRoot(key) ??
|
|
233
|
+
path.join(
|
|
234
|
+
nodeModulesRoot(key) ?? key,
|
|
235
|
+
'node_modules',
|
|
236
|
+
'.cache',
|
|
237
|
+
'astryx-theme',
|
|
238
|
+
),
|
|
211
239
|
coreKey,
|
|
212
240
|
);
|
|
213
241
|
// Reading every component doc takes a second; it is fixed per Core install.
|
|
@@ -287,7 +315,7 @@ export function baseThemeFile(project, like) {
|
|
|
287
315
|
* Resolved tokens of the base theme in both modes.
|
|
288
316
|
* @param {ThemeProject} project
|
|
289
317
|
* @param {string | undefined} like
|
|
290
|
-
* @returns {Promise<{light: Record<string, string>, dark: Record<string, string>}>}
|
|
318
|
+
* @returns {Promise<{light: Record<string, string>, dark: Record<string, string>, components: Record<string, any>}>}
|
|
291
319
|
*/
|
|
292
320
|
export async function baseResolved(project, like) {
|
|
293
321
|
const {core} = project;
|
|
@@ -303,5 +331,8 @@ export async function baseResolved(project, like) {
|
|
|
303
331
|
return {
|
|
304
332
|
light: core.resolveThemeTokens(theme, {mode: 'light'}),
|
|
305
333
|
dark: core.resolveThemeTokens(theme, {mode: 'dark'}),
|
|
334
|
+
// The base theme's own part styles (neutral's pale destructive button),
|
|
335
|
+
// which a one-mode setting keeps in the other mode.
|
|
336
|
+
components: theme.components ?? {},
|
|
306
337
|
};
|
|
307
338
|
}
|
|
@@ -20,6 +20,16 @@ export function themeFiles(cwd: string, slug: string): {
|
|
|
20
20
|
previewPng: string;
|
|
21
21
|
sheetPng: string;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The themes the editor made in the app (a settings file of its own), by
|
|
25
|
+
* name, or with `changed` the one an editor command changed last first: the
|
|
26
|
+
* undo history is written only by an editor command, so its time is the
|
|
27
|
+
* last change made there.
|
|
28
|
+
* @param {string} cwd
|
|
29
|
+
* @param {'name' | 'changed'} [order]
|
|
30
|
+
* @returns {string[]}
|
|
31
|
+
*/
|
|
32
|
+
export function editedThemes(cwd: string, order?: "name" | "changed"): string[];
|
|
23
33
|
/**
|
|
24
34
|
* Up to `n` names close to `x`.
|
|
25
35
|
* @param {string} x
|
|
@@ -45,21 +55,29 @@ export function refuse(code: string, message: string, extra?: {
|
|
|
45
55
|
* The settings of a theme, or a refusal naming the command that makes it.
|
|
46
56
|
* @param {string} cwd
|
|
47
57
|
* @param {string} slug
|
|
48
|
-
* @param {string} [skip] the thing
|
|
49
|
-
* is not checked, so a value made
|
|
58
|
+
* @param {string | Partial<Setting>} [skip] the thing (or the one setting)
|
|
59
|
+
* a command changes or removes: its value is not checked, so a value made
|
|
60
|
+
* under looser rules can be fixed
|
|
50
61
|
* @returns {ThemeData}
|
|
51
62
|
*/
|
|
52
|
-
export function loadTheme(cwd: string, slug: string, skip?: string): ThemeData;
|
|
63
|
+
export function loadTheme(cwd: string, slug: string, skip?: string | Partial<Setting>): ThemeData;
|
|
53
64
|
/**
|
|
54
65
|
* What is wrong with settings data, or null: its shape, and each value with
|
|
55
66
|
* the same rules `set` checks it by (without the installed Core), so a value
|
|
56
67
|
* edited by hand never reaches the build.
|
|
57
68
|
* @param {any} data
|
|
58
|
-
* @param {string} [skip] a thing whose value is not checked (the one a
|
|
69
|
+
* @param {string | Partial<Setting>} [skip] a thing or setting whose value is not checked (the one a
|
|
59
70
|
* command is about to change or remove)
|
|
60
71
|
* @returns {string | null}
|
|
61
72
|
*/
|
|
62
|
-
export function settingsProblem(data: any, skip?: string): string | null;
|
|
73
|
+
export function settingsProblem(data: any, skip?: string | Partial<Setting>): string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Every setting whose only problem is its value or scope, each with the
|
|
76
|
+
* command that removes it.
|
|
77
|
+
* @param {any} data
|
|
78
|
+
* @returns {Setting[]}
|
|
79
|
+
*/
|
|
80
|
+
export function badSettings(data: any): Setting[];
|
|
63
81
|
/**
|
|
64
82
|
* The words that name a setting for `undo`.
|
|
65
83
|
* @param {import('./_settings.mjs').Setting} x
|
|
@@ -92,6 +110,13 @@ export function describe(s: Setting): string;
|
|
|
92
110
|
* @returns {string[]}
|
|
93
111
|
*/
|
|
94
112
|
export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing">): string[];
|
|
113
|
+
/**
|
|
114
|
+
* A length in pixels: px as given, rem and em at 16px; null for anything
|
|
115
|
+
* else (a percentage, calc(), a word).
|
|
116
|
+
* @param {string} v
|
|
117
|
+
* @returns {number | null}
|
|
118
|
+
*/
|
|
119
|
+
export function lengthPx(v: string): number | null;
|
|
95
120
|
/**
|
|
96
121
|
* The family and fallbacks a font value means: a preset, an open font, a
|
|
97
122
|
* whole stack with commas, or one family name.
|
|
@@ -103,6 +128,16 @@ export function fontOf(value: string): {
|
|
|
103
128
|
fallbacks: string;
|
|
104
129
|
pkg: string | null;
|
|
105
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* A font family name as CSS reads it. A name that is a sequence of CSS
|
|
133
|
+
* identifiers stays bare; any other is quoted, or the browser drops the
|
|
134
|
+
* whole font (`3Dumb`, `My/Font`, `a.b`). Core quotes a family that has
|
|
135
|
+
* a space itself, so such a name is quoted here only as a fallback
|
|
136
|
+
* (`spaced`), where Core writes the list as given.
|
|
137
|
+
* @param {string} name without quotes
|
|
138
|
+
* @param {boolean} [spaced]
|
|
139
|
+
*/
|
|
140
|
+
export function cssFamily(name: string, spaced?: boolean): string;
|
|
106
141
|
/**
|
|
107
142
|
* The settings, as a `defineTheme` object.
|
|
108
143
|
* @param {Ctx} ctx
|
|
@@ -135,6 +170,22 @@ export function findOverrides(cssText: string, theme: any): Array<{
|
|
|
135
170
|
prop: string;
|
|
136
171
|
value: string;
|
|
137
172
|
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Why `<slug>.theme.ts` cannot carry the settings, or null: it must import
|
|
175
|
+
* `./<slug>.settings`, extend `<camel>Settings` and keep the name, or no
|
|
176
|
+
* setting takes effect.
|
|
177
|
+
* @param {string} cwd
|
|
178
|
+
* @param {string} slug
|
|
179
|
+
* @returns {string | null}
|
|
180
|
+
*/
|
|
181
|
+
export function themeSourceProblem(cwd: string, slug: string): string | null;
|
|
182
|
+
/**
|
|
183
|
+
* Refuse a build whose theme source cannot carry the settings, naming the
|
|
184
|
+
* lines that put it back.
|
|
185
|
+
* @param {string} cwd
|
|
186
|
+
* @param {string} slug
|
|
187
|
+
*/
|
|
188
|
+
export function refuseThemeSource(cwd: string, slug: string): void;
|
|
138
189
|
/**
|
|
139
190
|
* Generate the theme source, build it with the theme build, then repeat any
|
|
140
191
|
* part setting a more specific rule would beat and build again.
|
|
@@ -171,6 +222,40 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
|
|
|
171
222
|
light: Record<string, string>;
|
|
172
223
|
dark: Record<string, string>;
|
|
173
224
|
}): Promise<string[]>;
|
|
225
|
+
/**
|
|
226
|
+
* The value the base theme itself gives a part's property where a setting
|
|
227
|
+
* applies (its variant and state), as the build keys part styles; null
|
|
228
|
+
* when the base theme leaves it to Core.
|
|
229
|
+
* @param {{light: Record<string, string>, components?: Record<string, any>}} base
|
|
230
|
+
* @param {Ctx} ctx
|
|
231
|
+
* @param {string} target
|
|
232
|
+
* @param {string} prop camelCase
|
|
233
|
+
* @param {{when?: string, state?: string}} s
|
|
234
|
+
* @returns {string | null}
|
|
235
|
+
*/
|
|
236
|
+
export function baseComponent(base: {
|
|
237
|
+
light: Record<string, string>;
|
|
238
|
+
components?: Record<string, any>;
|
|
239
|
+
}, ctx: Ctx, target: string, prop: string, s: {
|
|
240
|
+
when?: string;
|
|
241
|
+
state?: string;
|
|
242
|
+
}): string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The radius, in px, the build writes for a radius token at a corners value
|
|
245
|
+
* (a rung, or a size). The derived radii keep the base theme's own
|
|
246
|
+
* proportions to the element radius (matcha's page is 3.5 times it), so a
|
|
247
|
+
* bigger element radius never makes them smaller; a checkbox stays a
|
|
248
|
+
* rounded square at pill, and a container or page at pill is half again as
|
|
249
|
+
* round as at `round` (a fully round card is a capsule). Past 1000px a
|
|
250
|
+
* radius is fully round.
|
|
251
|
+
* @param {{light: Record<string, string>}} base the base theme's tokens
|
|
252
|
+
* @param {string} value
|
|
253
|
+
* @param {string} token
|
|
254
|
+
* @returns {number}
|
|
255
|
+
*/
|
|
256
|
+
export function radiusAt(base: {
|
|
257
|
+
light: Record<string, string>;
|
|
258
|
+
}, value: string, token: string): number;
|
|
174
259
|
/**
|
|
175
260
|
* Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
|
|
176
261
|
* theme folder, and every file and folder in it. The editor writes the
|
|
@@ -249,31 +334,7 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
|
|
|
249
334
|
family: string;
|
|
250
335
|
installed: boolean;
|
|
251
336
|
}[];
|
|
252
|
-
/**
|
|
253
|
-
* One setting the CLI owns.
|
|
254
|
-
* @typedef {object} Setting
|
|
255
|
-
* @property {string} thing - A dial, a token (`--color-accent`), or a CSS property.
|
|
256
|
-
* @property {string} value
|
|
257
|
-
* @property {'dial' | 'token' | 'property'} source
|
|
258
|
-
* @property {string} [on] - A part, a group, or a typography role (font).
|
|
259
|
-
* @property {string} [when] - `<prop>:<value>`.
|
|
260
|
-
* @property {string} [state]
|
|
261
|
-
* @property {'light' | 'dark'} [mode]
|
|
262
|
-
* @property {boolean} [only]
|
|
263
|
-
* @property {string} [axis] - For the `headings` dial: `weight` or `tracking`.
|
|
264
|
-
* @property {string} [note]
|
|
265
|
-
*/
|
|
266
|
-
/**
|
|
267
|
-
* The settings file.
|
|
268
|
-
* @typedef {object} ThemeData
|
|
269
|
-
* @property {string} name
|
|
270
|
-
* @property {string} [like] - The built-in theme it builds on.
|
|
271
|
-
* @property {'both' | 'light-only' | 'dark-only'} mode
|
|
272
|
-
* @property {Setting[]} settings
|
|
273
|
-
* @property {string[]} [lifted] - Variant keys the last build repeated a part setting on.
|
|
274
|
-
* @property {string} [palette] - The hash of the palette.config.json the editor last wrote.
|
|
275
|
-
*/
|
|
276
|
-
/** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>}}} Ctx */
|
|
337
|
+
/** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}}} Ctx */
|
|
277
338
|
/** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
|
|
278
339
|
/** @typedef {import('./_parts.mjs').TextPair} TextPair */
|
|
279
340
|
/** What a theme name may be, in words. */
|
|
@@ -281,12 +342,17 @@ export const NAME_RULE: "lowercase letters, digits and dashes, starting with a l
|
|
|
281
342
|
export function slugOk(s: string): boolean;
|
|
282
343
|
export function kebab(s: string): string;
|
|
283
344
|
export function camel(s: string): string;
|
|
284
|
-
export function q(v: unknown): string;
|
|
285
345
|
export function shown(cwd: string, f: string): string;
|
|
286
346
|
export function keyOf(s: Setting): string;
|
|
287
|
-
export function modesOf(d: ThemeData): Array<"light" | "dark">;
|
|
288
347
|
export function cornerPx(v: string): number;
|
|
289
348
|
export function textPx(v: string): number;
|
|
349
|
+
export function themeSource(slug: string): string;
|
|
350
|
+
/**
|
|
351
|
+
* The files the editor writes for a theme, after `<slug>.`: the only ones a
|
|
352
|
+
* change reads, hashes or puts back, and the only ones a stopped `new`
|
|
353
|
+
* leaves (a designer's `<slug>.design.psd` beside them is never touched).
|
|
354
|
+
*/
|
|
355
|
+
export const EDITOR_SUFFIXES: string[];
|
|
290
356
|
/** The undo steps a theme keeps; older ones are dropped. */
|
|
291
357
|
export const HISTORY_STEPS: 80;
|
|
292
358
|
/**
|
|
@@ -340,14 +406,17 @@ export type Ctx = {
|
|
|
340
406
|
project: import("./_project.mjs").ThemeProject;
|
|
341
407
|
C: import("./_compiler.mjs").Compiler;
|
|
342
408
|
unchecked?: string | null;
|
|
409
|
+
uncheckedCode?: string | null;
|
|
343
410
|
wrote?: Map<string, string | null>;
|
|
344
411
|
base?: {
|
|
345
412
|
light: Record<string, string>;
|
|
346
413
|
dark: Record<string, string>;
|
|
414
|
+
components?: Record<string, any>;
|
|
347
415
|
};
|
|
348
416
|
};
|
|
349
417
|
export type PaintSide = import("./_parts.mjs").PaintSide;
|
|
350
418
|
export type TextPair = import("./_parts.mjs").TextPair;
|
|
419
|
+
import { modesOf } from './_palette.mjs';
|
|
351
420
|
/**
|
|
352
421
|
* What a part reads for a property when the theme does not set it, so a
|
|
353
422
|
* one-mode component setting keeps the other mode as it was.
|
|
@@ -355,5 +424,7 @@ export type TextPair = import("./_parts.mjs").TextPair;
|
|
|
355
424
|
* @param {string} target
|
|
356
425
|
* @param {string} prop camelCase or kebab-case
|
|
357
426
|
* @param {string | undefined} when
|
|
427
|
+
* @param {string} [state] a state (hover): that state's own value
|
|
358
428
|
*/
|
|
359
|
-
export function partDefault(ctx: Ctx, target: string, prop: string, when: string | undefined): string | null;
|
|
429
|
+
export function partDefault(ctx: Ctx, target: string, prop: string, when: string | undefined, state?: string): string | null;
|
|
430
|
+
export { modesOf };
|