@astryxdesign/cli 0.7.14 → 0.7.15-canary.g06b7e61
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 +3 -3
- 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/add-helpers.mjs +5 -0
- package/api/integration/add-theme.mjs +15 -110
- 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 +37 -5
- package/api/theme/_adapter.mjs +381 -57
- package/api/theme/_fork.d.mts +90 -0
- package/api/theme/_fork.mjs +246 -0
- package/api/theme/build/build.d.mts +40 -2
- package/api/theme/build/build.mjs +477 -66
- package/api/theme/eject/eject.mjs +36 -15
- package/api/theme/list/list.mjs +3 -6
- package/api/theme/palette/generate/generator.d.mts +13 -0
- package/api/theme/palette/generate/generator.mjs +32 -2
- 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 +496 -112
- package/api/theme-edit/_catalog.d.mts +1 -6
- package/api/theme-edit/_catalog.mjs +5 -268
- package/api/theme-edit/_check.d.mts +9 -4
- package/api/theme-edit/_check.mjs +1232 -229
- package/api/theme-edit/_color.d.mts +19 -0
- package/api/theme-edit/_color.mjs +280 -34
- package/api/theme-edit/_compiler.d.mts +3 -1
- package/api/theme-edit/_compiler.mjs +52 -13
- package/api/theme-edit/_context.d.mts +4 -1
- package/api/theme-edit/_context.mjs +126 -13
- package/api/theme-edit/_css.d.mts +84 -0
- package/api/theme-edit/_css.mjs +700 -0
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +806 -103
- package/api/theme-edit/_how-commands.d.mts +38 -7
- package/api/theme-edit/_how-commands.mjs +64 -45
- package/api/theme-edit/_how-question.d.mts +33 -0
- package/api/theme-edit/_how-question.mjs +2553 -381
- package/api/theme-edit/_how.mjs +402 -31
- package/api/theme-edit/_overview.mjs +2 -7
- package/api/theme-edit/_palette.d.mts +60 -13
- package/api/theme-edit/_palette.mjs +826 -295
- package/api/theme-edit/_parts.d.mts +42 -10
- package/api/theme-edit/_parts.mjs +280 -69
- 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 +14 -0
- package/api/theme-edit/_preview-app.mjs +1675 -235
- package/api/theme-edit/_preview.d.mts +7 -16
- package/api/theme-edit/_preview.mjs +79 -86
- package/api/theme-edit/_project.d.mts +32 -2
- package/api/theme-edit/_project.mjs +80 -19
- package/api/theme-edit/_settings.d.mts +199 -52
- package/api/theme-edit/_settings.mjs +1422 -217
- package/api/theme-edit/_tables.d.mts +19 -6
- package/api/theme-edit/_tables.mjs +150 -92
- package/api/theme-edit/theme-edit.type.d.mts +20 -1
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- 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 +2 -2
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
- package/api/theme-edit/themeEditSet.doc.mjs +1 -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/tree/publishing.doc.mjs +1 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -1
- package/assets/preview-app/next.config.mjs +7 -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/index.mjs +10 -10
- package/clients/cli/commands/experimental/theme.mjs +200 -81
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
- 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/integration.mjs +8 -0
- package/clients/cli/commands/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- 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 +439 -66
- package/clients/cli/index.mjs +27 -6
- package/clients/cli/lib/cli-error.mjs +118 -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/project.mjs +34 -8
- 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 +16 -10
- package/foundation/discovery/theme-imports.d.mts +16 -0
- package/foundation/discovery/theme-imports.mjs +30 -2
- 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 +783 -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/autolink.d.mts +1 -24
- package/foundation/integrations/autolink.mjs +7 -60
- package/foundation/integrations/declared-dependencies.d.mts +27 -0
- package/foundation/integrations/declared-dependencies.mjs +73 -0
- package/foundation/integrations/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/may-have-integrations.d.mts +8 -0
- package/foundation/integrations/may-have-integrations.mjs +47 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +32 -4
- package/foundation/release/cache.mjs +105 -16
- package/foundation/release/folder-lock.d.mts +28 -0
- package/foundation/release/folder-lock.mjs +205 -0
- package/foundation/release/lock-lease.d.mts +2 -1
- package/foundation/release/lock-lease.mjs +7 -2
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +8 -6
- package/api/theme-edit/_css-properties.d.mts +0 -10
- package/api/theme-edit/_css-properties.mjs +0 -556
|
@@ -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
|
|
@@ -82,6 +100,12 @@ export function withoutBadValues(data: ThemeData): {
|
|
|
82
100
|
data: ThemeData;
|
|
83
101
|
dropped: Setting[];
|
|
84
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* What is wrong with a setting's value, or null.
|
|
105
|
+
* @param {any} s
|
|
106
|
+
* @returns {string | null}
|
|
107
|
+
*/
|
|
108
|
+
export function valueProblem(s: any): string | null;
|
|
85
109
|
/** One line for a setting. @param {Setting} s */
|
|
86
110
|
export function describe(s: Setting): string;
|
|
87
111
|
/**
|
|
@@ -92,6 +116,13 @@ export function describe(s: Setting): string;
|
|
|
92
116
|
* @returns {string[]}
|
|
93
117
|
*/
|
|
94
118
|
export function partsOf(ctx: Ctx, s: Pick<Setting, "on" | "only" | "thing">): string[];
|
|
119
|
+
/**
|
|
120
|
+
* A length in pixels: px as given, rem and em at 16px; null for anything
|
|
121
|
+
* else (a percentage, calc(), a word).
|
|
122
|
+
* @param {string} v
|
|
123
|
+
* @returns {number | null}
|
|
124
|
+
*/
|
|
125
|
+
export function lengthPx(v: string): number | null;
|
|
95
126
|
/**
|
|
96
127
|
* The family and fallbacks a font value means: a preset, an open font, a
|
|
97
128
|
* whole stack with commas, or one family name.
|
|
@@ -103,6 +134,35 @@ export function fontOf(value: string): {
|
|
|
103
134
|
fallbacks: string;
|
|
104
135
|
pkg: string | null;
|
|
105
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* A font family name as CSS reads it. A name that is a sequence of CSS
|
|
139
|
+
* identifiers stays bare; any other is quoted, or the browser drops the
|
|
140
|
+
* whole font (`3Dumb`, `My/Font`, `a.b`). Core quotes a family that has
|
|
141
|
+
* a space itself, so such a name is quoted here only as a fallback
|
|
142
|
+
* (`spaced`), where Core writes the list as given.
|
|
143
|
+
* @param {string} name without quotes
|
|
144
|
+
* @param {boolean} [spaced]
|
|
145
|
+
*/
|
|
146
|
+
export function cssFamily(name: string, spaced?: boolean): string;
|
|
147
|
+
/**
|
|
148
|
+
* Whether a generated module is as the editor wrote it: true, false for a
|
|
149
|
+
* hand edit, null for a module with no hash (an earlier editor's).
|
|
150
|
+
* @param {string} text
|
|
151
|
+
* @returns {boolean | null}
|
|
152
|
+
*/
|
|
153
|
+
export function moduleUnedited(text: string): boolean | null;
|
|
154
|
+
/**
|
|
155
|
+
* The palette stops each token reads in a generated settings module, as
|
|
156
|
+
* written there (`palette.accent.light[85]`, with ` + 'aa'` for a
|
|
157
|
+
* see-through one): `[light, dark]` per token.
|
|
158
|
+
* @param {string} source
|
|
159
|
+
* @returns {Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>>}
|
|
160
|
+
*/
|
|
161
|
+
export function stopsIn(source: string): Record<string, Record<"light" | "dark", {
|
|
162
|
+
family: string;
|
|
163
|
+
stop: number;
|
|
164
|
+
alpha?: string;
|
|
165
|
+
}>>;
|
|
106
166
|
/**
|
|
107
167
|
* The settings, as a `defineTheme` object.
|
|
108
168
|
* @param {Ctx} ctx
|
|
@@ -135,6 +195,22 @@ export function findOverrides(cssText: string, theme: any): Array<{
|
|
|
135
195
|
prop: string;
|
|
136
196
|
value: string;
|
|
137
197
|
}>;
|
|
198
|
+
/**
|
|
199
|
+
* Why `<slug>.theme.ts` cannot carry the settings, or null: it must import
|
|
200
|
+
* `./<slug>.settings`, extend `<camel>Settings` and keep the name, or no
|
|
201
|
+
* setting takes effect.
|
|
202
|
+
* @param {string} cwd
|
|
203
|
+
* @param {string} slug
|
|
204
|
+
* @returns {string | null}
|
|
205
|
+
*/
|
|
206
|
+
export function themeSourceProblem(cwd: string, slug: string): string | null;
|
|
207
|
+
/**
|
|
208
|
+
* Refuse a build whose theme source cannot carry the settings, naming the
|
|
209
|
+
* lines that put it back.
|
|
210
|
+
* @param {string} cwd
|
|
211
|
+
* @param {string} slug
|
|
212
|
+
*/
|
|
213
|
+
export function refuseThemeSource(cwd: string, slug: string): void;
|
|
138
214
|
/**
|
|
139
215
|
* Generate the theme source, build it with the theme build, then repeat any
|
|
140
216
|
* part setting a more specific rule would beat and build again.
|
|
@@ -171,6 +247,93 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
|
|
|
171
247
|
light: Record<string, string>;
|
|
172
248
|
dark: Record<string, string>;
|
|
173
249
|
}): Promise<string[]>;
|
|
250
|
+
/**
|
|
251
|
+
* Whether parsed settings have the shape the editor reads: an object with a
|
|
252
|
+
* list of settings.
|
|
253
|
+
* @param {any} data
|
|
254
|
+
*/
|
|
255
|
+
export function settingsShapeOk(data: any): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The value the base theme itself gives a part's property where a setting
|
|
258
|
+
* applies (its variant and state), as the build keys part styles; null
|
|
259
|
+
* when the base theme leaves it to Core.
|
|
260
|
+
* @param {{light: Record<string, string>, components?: Record<string, any>}} base
|
|
261
|
+
* @param {Ctx} ctx
|
|
262
|
+
* @param {string} target
|
|
263
|
+
* @param {string} prop camelCase
|
|
264
|
+
* @param {{when?: string, state?: string}} s
|
|
265
|
+
* @returns {string | null}
|
|
266
|
+
*/
|
|
267
|
+
export function baseComponent(base: {
|
|
268
|
+
light: Record<string, string>;
|
|
269
|
+
components?: Record<string, any>;
|
|
270
|
+
}, ctx: Ctx, target: string, prop: string, s: {
|
|
271
|
+
when?: string;
|
|
272
|
+
state?: string;
|
|
273
|
+
}): string | null;
|
|
274
|
+
/**
|
|
275
|
+
* The focus state a part's own styles key on: a part whose styled element
|
|
276
|
+
* is a wrapper (a text input's box) shows focus only through
|
|
277
|
+
* `focus-within`; null when it keys on none.
|
|
278
|
+
* @param {Ctx} ctx
|
|
279
|
+
* @param {string} part
|
|
280
|
+
* @returns {string | null}
|
|
281
|
+
*/
|
|
282
|
+
export function focusStateOf(ctx: Ctx, part: string): string | null;
|
|
283
|
+
/**
|
|
284
|
+
* The radius token a part's resting corners read. A part the census saw
|
|
285
|
+
* closed (a menu, a popover) has none recorded: a container or menu reads
|
|
286
|
+
* the container radius, like every Core surface; any other part reads the
|
|
287
|
+
* element radius.
|
|
288
|
+
* @param {Ctx} ctx
|
|
289
|
+
* @param {string} part
|
|
290
|
+
* @param {string} [when]
|
|
291
|
+
* @returns {string}
|
|
292
|
+
*/
|
|
293
|
+
export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
|
|
294
|
+
/**
|
|
295
|
+
* Remove a `new` marker from a theme folder whose settings are whole: the
|
|
296
|
+
* `new` that left it made the theme, and nothing is left to finish.
|
|
297
|
+
* @param {string} dir
|
|
298
|
+
*/
|
|
299
|
+
export function clearNewMarker(dir: string): void;
|
|
300
|
+
/**
|
|
301
|
+
* The pseudo key a state writes in a part's styles. Core marks a disabled
|
|
302
|
+
* button, link, tab or menu item with aria-disabled (it stays focusable),
|
|
303
|
+
* and its own styles match both forms: so does the theme.
|
|
304
|
+
* @param {string} state
|
|
305
|
+
* @returns {string}
|
|
306
|
+
*/
|
|
307
|
+
export function stateKey(state: string): string;
|
|
308
|
+
/**
|
|
309
|
+
* The whole-theme radius tokens a generated settings module writes, or null
|
|
310
|
+
* when it writes none.
|
|
311
|
+
* @param {string} source
|
|
312
|
+
* @returns {Record<string, string> | null}
|
|
313
|
+
*/
|
|
314
|
+
export function radiiIn(source: string): Record<string, string> | null;
|
|
315
|
+
/**
|
|
316
|
+
* The radius, in px, the build writes for a radius token at a corners value
|
|
317
|
+
* (a rung, or a size). The derived radii keep the base theme's own
|
|
318
|
+
* proportions to the element radius (matcha's page is 3.5 times it), so a
|
|
319
|
+
* bigger element radius never makes them smaller; a checkbox stays a
|
|
320
|
+
* rounded square at pill, and a container or page at pill is half again as
|
|
321
|
+
* round as at `round` (a fully round card is a capsule). Past 1000px a
|
|
322
|
+
* radius is fully round.
|
|
323
|
+
* @param {{light: Record<string, string>}} base the base theme's tokens
|
|
324
|
+
* @param {string} value
|
|
325
|
+
* @param {string} token
|
|
326
|
+
* @returns {number}
|
|
327
|
+
*/
|
|
328
|
+
export function radiusAt(base: {
|
|
329
|
+
light: Record<string, string>;
|
|
330
|
+
}, value: string, token: string): number;
|
|
331
|
+
/**
|
|
332
|
+
* Whether a file is a module the editor generated (its first line is the
|
|
333
|
+
* editor's header).
|
|
334
|
+
* @param {string} file
|
|
335
|
+
*/
|
|
336
|
+
export function madeByEditor(file: string): boolean;
|
|
174
337
|
/**
|
|
175
338
|
* Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
|
|
176
339
|
* theme folder, and every file and folder in it. The editor writes the
|
|
@@ -185,15 +348,6 @@ export function refuseLinks(cwd: string, slug: string): void;
|
|
|
185
348
|
* @param {ThemeData} data
|
|
186
349
|
*/
|
|
187
350
|
export function settingsStamp(data: ThemeData): string;
|
|
188
|
-
/**
|
|
189
|
-
* Whether the theme's build was made, whole, from these settings by this
|
|
190
|
-
* CLI (a command stopped mid-build, or settings edited by hand, leave it
|
|
191
|
-
* behind).
|
|
192
|
-
* @param {string} cwd
|
|
193
|
-
* @param {string} slug
|
|
194
|
-
* @param {ThemeData} data
|
|
195
|
-
*/
|
|
196
|
-
export function buildCurrent(cwd: string, slug: string, data: ThemeData): boolean;
|
|
197
351
|
/**
|
|
198
352
|
* Why the theme's build does not match its settings, in words, or null when
|
|
199
353
|
* it does: a file missing, another CLI version, settings changed since the
|
|
@@ -204,12 +358,6 @@ export function buildCurrent(cwd: string, slug: string, data: ThemeData): boolea
|
|
|
204
358
|
* @returns {string | null}
|
|
205
359
|
*/
|
|
206
360
|
export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
|
|
207
|
-
/**
|
|
208
|
-
* Write a file whole: a new file beside it, renamed into place.
|
|
209
|
-
* @param {string} file
|
|
210
|
-
* @param {string} text
|
|
211
|
-
*/
|
|
212
|
-
export function writeAtomic(file: string, text: string): void;
|
|
213
361
|
/**
|
|
214
362
|
* A theme's undo history: the settings text before each change, oldest
|
|
215
363
|
* first, and how many damaged steps were dropped. Every step after the
|
|
@@ -228,12 +376,14 @@ export function readHistory(file: string): {
|
|
|
228
376
|
* @param {Ctx} ctx
|
|
229
377
|
* @param {string} slug
|
|
230
378
|
* @param {ThemeData} data
|
|
231
|
-
* @param {{history: boolean, historyAfter?: string[]}} options
|
|
232
|
-
* `historyAfter`: the history to write with the change (a step back pops it)
|
|
379
|
+
* @param {{history: boolean, historyAfter?: string[], radii?: Record<string, string> | null}} options
|
|
380
|
+
* `historyAfter`: the history to write with the change (a step back pops it);
|
|
381
|
+
* `radii`: the whole-theme radii the step being restored was built with
|
|
233
382
|
*/
|
|
234
|
-
export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter }: {
|
|
383
|
+
export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter, radii }: {
|
|
235
384
|
history: boolean;
|
|
236
385
|
historyAfter?: string[];
|
|
386
|
+
radii?: Record<string, string> | null;
|
|
237
387
|
}): Promise<{
|
|
238
388
|
changed: string[];
|
|
239
389
|
res: Record<"light" | "dark", Record<string, string>>;
|
|
@@ -248,45 +398,31 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
|
|
|
248
398
|
pkg: string;
|
|
249
399
|
family: string;
|
|
250
400
|
installed: boolean;
|
|
401
|
+
of: Setting;
|
|
251
402
|
}[];
|
|
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 */
|
|
403
|
+
/** @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>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null}} Ctx */
|
|
277
404
|
/** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
|
|
278
405
|
/** @typedef {import('./_parts.mjs').TextPair} TextPair */
|
|
279
406
|
/** What a theme name may be, in words. */
|
|
280
|
-
export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, 64 characters at most";
|
|
407
|
+
export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, 64 characters at most, and not a name Windows reserves (con, prn, aux, nul, com1-com9, lpt1-lpt9)";
|
|
281
408
|
export function slugOk(s: string): boolean;
|
|
409
|
+
export function windowsReserved(s: string): boolean;
|
|
410
|
+
export function slugFor(name: unknown): string;
|
|
282
411
|
export function kebab(s: string): string;
|
|
283
412
|
export function camel(s: string): string;
|
|
284
|
-
export function q(v: unknown): string;
|
|
285
413
|
export function shown(cwd: string, f: string): string;
|
|
286
414
|
export function keyOf(s: Setting): string;
|
|
287
|
-
export function modesOf(d: ThemeData): Array<"light" | "dark">;
|
|
288
415
|
export function cornerPx(v: string): number;
|
|
289
416
|
export function textPx(v: string): number;
|
|
417
|
+
export function themeSource(slug: string): string;
|
|
418
|
+
/** The file a `new` keeps beside the files it writes until it is done. */
|
|
419
|
+
export const NEW_MARKER: ".astryx-new.json";
|
|
420
|
+
/**
|
|
421
|
+
* The files the editor writes for a theme, after `<slug>.`: the only ones a
|
|
422
|
+
* change reads, hashes or puts back, and the only ones a stopped `new`
|
|
423
|
+
* leaves (a designer's `<slug>.design.psd` beside them is never touched).
|
|
424
|
+
*/
|
|
425
|
+
export const EDITOR_SUFFIXES: string[];
|
|
290
426
|
/** The undo steps a theme keeps; older ones are dropped. */
|
|
291
427
|
export const HISTORY_STEPS: 80;
|
|
292
428
|
/**
|
|
@@ -340,14 +476,23 @@ export type Ctx = {
|
|
|
340
476
|
project: import("./_project.mjs").ThemeProject;
|
|
341
477
|
C: import("./_compiler.mjs").Compiler;
|
|
342
478
|
unchecked?: string | null;
|
|
479
|
+
uncheckedCode?: string | null;
|
|
343
480
|
wrote?: Map<string, string | null>;
|
|
344
481
|
base?: {
|
|
345
482
|
light: Record<string, string>;
|
|
346
483
|
dark: Record<string, string>;
|
|
484
|
+
components?: Record<string, any>;
|
|
347
485
|
};
|
|
486
|
+
keepStops?: Record<string, Record<"light" | "dark", {
|
|
487
|
+
family: string;
|
|
488
|
+
stop: number;
|
|
489
|
+
alpha?: string;
|
|
490
|
+
}>> | null;
|
|
491
|
+
keepRadii?: Record<string, string> | null;
|
|
348
492
|
};
|
|
349
493
|
export type PaintSide = import("./_parts.mjs").PaintSide;
|
|
350
494
|
export type TextPair = import("./_parts.mjs").TextPair;
|
|
495
|
+
import { modesOf } from './_palette.mjs';
|
|
351
496
|
/**
|
|
352
497
|
* What a part reads for a property when the theme does not set it, so a
|
|
353
498
|
* one-mode component setting keeps the other mode as it was.
|
|
@@ -355,5 +500,7 @@ export type TextPair = import("./_parts.mjs").TextPair;
|
|
|
355
500
|
* @param {string} target
|
|
356
501
|
* @param {string} prop camelCase or kebab-case
|
|
357
502
|
* @param {string | undefined} when
|
|
503
|
+
* @param {string} [state] a state (hover): that state's own value
|
|
358
504
|
*/
|
|
359
|
-
export function partDefault(ctx: Ctx, target: string, prop: string, when: string | undefined): string | null;
|
|
505
|
+
export function partDefault(ctx: Ctx, target: string, prop: string, when: string | undefined, state?: string): string | null;
|
|
506
|
+
export { modesOf };
|