@astryxdesign/cli 0.7.14-canary.gfb823d9 → 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/component/_adapter.d.mts +15 -0
- package/api/component/_adapter.mjs +76 -0
- package/api/component/component.mjs +8 -1
- package/api/search/_named-keywords.d.mts +31 -0
- package/api/search/_named-keywords.mjs +177 -0
- package/api/search/search-index.mjs +8 -1
- package/api/search/search.d.mts +6 -1
- package/api/search/search.mjs +49 -8
- 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/palette/generate/color.d.mts +2 -0
- package/api/theme/palette/generate/color.mjs +1 -1
- 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 +36 -2
- package/api/theme-edit/_adapter.mjs +340 -12
- package/api/theme-edit/_check.d.mts +28 -25
- package/api/theme-edit/_check.mjs +876 -308
- package/api/theme-edit/_color.d.mts +53 -4
- package/api/theme-edit/_color.mjs +406 -79
- package/api/theme-edit/_compiler.d.mts +14 -6
- package/api/theme-edit/_compiler.mjs +89 -59
- package/api/theme-edit/_context.d.mts +28 -8
- package/api/theme-edit/_context.mjs +142 -19
- package/api/theme-edit/_edit.d.mts +3 -1
- package/api/theme-edit/_edit.mjs +746 -76
- 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 +27 -8
- package/api/theme-edit/_how.mjs +776 -175
- package/api/theme-edit/_overview.d.mts +9 -0
- package/api/theme-edit/_overview.mjs +296 -0
- package/api/theme-edit/_palette.d.mts +155 -15
- package/api/theme-edit/_palette.mjs +1446 -262
- package/api/theme-edit/_parts.mjs +61 -5
- 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 +32 -11
- package/api/theme-edit/_preview-app.mjs +1976 -285
- package/api/theme-edit/_preview.d.mts +39 -8
- package/api/theme-edit/_preview.mjs +367 -41
- package/api/theme-edit/_settings.d.mts +147 -11
- package/api/theme-edit/_settings.mjs +908 -99
- package/api/theme-edit/_tables.d.mts +4 -16
- package/api/theme-edit/_tables.mjs +51 -117
- package/api/theme-edit/theme-edit.type.d.mts +102 -66
- package/api/theme-edit/theme-edit.type.mjs +58 -40
- package/api/theme-edit/themeEditHow.doc.mjs +17 -6
- package/api/theme-edit/themeEditNew.doc.mjs +21 -5
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +18 -5
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -9
- package/api/theme-edit/themeEditPreviewList.doc.mjs +11 -2
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +29 -3
- package/api/theme-edit/themeEditSet.doc.mjs +14 -8
- package/api/theme-edit/themeEditShow.doc.mjs +10 -5
- package/api/theme-edit/themeEditUndo.doc.mjs +9 -4
- package/assets/discover/official-packages.json +4 -0
- package/assets/docs/tree/icon-sets.doc.mjs +3 -3
- package/assets/docs.generated.json +1 -0
- package/assets/icons/definitions/bookmarkAdd.doc.mjs +9 -0
- package/assets/icons/definitions/documentSearch.doc.mjs +9 -0
- package/assets/icons/definitions/keyboard.doc.mjs +9 -0
- package/assets/icons/definitions/paintBrush.doc.mjs +9 -0
- package/assets/icons/definitions/wallet.doc.mjs +9 -0
- package/assets/preview-app/gitignore +3 -0
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Lightbox/LightboxGallery.tsx +1 -1
- package/assets/templates/components.generated.json +1 -0
- package/assets/templates/pages/gallery-hero/page.tsx +8 -2
- package/assets/templates/pages/settings-dialog/template.doc.mjs +3 -3
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +2 -2
- package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -1
- package/clients/cli/bin/astryx.mjs +37 -5
- package/clients/cli/commands/experimental/theme.mjs +422 -57
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +22 -9
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +103 -4
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +13 -8
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +5 -5
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +5 -5
- package/clients/cli/commands/experimental-theme-editor.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 -8
- 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 +3 -4
- 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 +145 -46
- package/clients/cli/commands.generated.json +1 -0
- package/clients/cli/index.mjs +96 -5
- 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 +29 -4
- package/foundation/discovery/template-icons.d.mts +13 -0
- package/foundation/discovery/template-icons.mjs +76 -0
- 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/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.doc.mjs +13 -1
- package/foundation/response/error-codes.mjs +11 -1
- package/foundation/response/response-types.doc.mjs +6 -6
- package/package.json +6 -7
- package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +0 -73
- package/clients/cli/commands/experimental-theme-palette.doc.mjs +0 -37
|
@@ -45,14 +45,48 @@ export function refuse(code: string, message: string, extra?: {
|
|
|
45
45
|
* The settings of a theme, or a refusal naming the command that makes it.
|
|
46
46
|
* @param {string} cwd
|
|
47
47
|
* @param {string} slug
|
|
48
|
+
* @param {string} [skip] the thing a command changes or removes: its value
|
|
49
|
+
* is not checked, so a value made under looser rules can be fixed
|
|
48
50
|
* @returns {ThemeData}
|
|
49
51
|
*/
|
|
50
|
-
export function loadTheme(cwd: string, slug: string): ThemeData;
|
|
52
|
+
export function loadTheme(cwd: string, slug: string, skip?: string): ThemeData;
|
|
53
|
+
/**
|
|
54
|
+
* What is wrong with settings data, or null: its shape, and each value with
|
|
55
|
+
* the same rules `set` checks it by (without the installed Core), so a value
|
|
56
|
+
* edited by hand never reaches the build.
|
|
57
|
+
* @param {any} data
|
|
58
|
+
* @param {string} [skip] a thing whose value is not checked (the one a
|
|
59
|
+
* command is about to change or remove)
|
|
60
|
+
* @returns {string | null}
|
|
61
|
+
*/
|
|
62
|
+
export function settingsProblem(data: any, skip?: string): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* The words that name a setting for `undo`.
|
|
65
|
+
* @param {import('./_settings.mjs').Setting} x
|
|
66
|
+
*/
|
|
67
|
+
export function undoArgs(x: import("./_settings.mjs").Setting): string;
|
|
68
|
+
/**
|
|
69
|
+
* The first setting whose only problem is its value (made under looser
|
|
70
|
+
* rules): `undo <theme> <undoArgs>` removes it.
|
|
71
|
+
* @param {any} data
|
|
72
|
+
* @returns {Setting | null}
|
|
73
|
+
*/
|
|
74
|
+
export function badSetting(data: any): Setting | null;
|
|
75
|
+
/**
|
|
76
|
+
* The settings without those whose only problem is their value (made under
|
|
77
|
+
* looser rules), and the ones left out.
|
|
78
|
+
* @param {ThemeData} data
|
|
79
|
+
* @returns {{data: ThemeData, dropped: Setting[]}}
|
|
80
|
+
*/
|
|
81
|
+
export function withoutBadValues(data: ThemeData): {
|
|
82
|
+
data: ThemeData;
|
|
83
|
+
dropped: Setting[];
|
|
84
|
+
};
|
|
51
85
|
/** One line for a setting. @param {Setting} s */
|
|
52
86
|
export function describe(s: Setting): string;
|
|
53
87
|
/**
|
|
54
|
-
* The parts a setting styles: the
|
|
55
|
-
*
|
|
88
|
+
* The parts a setting styles: the group when `--on` names one, the whole
|
|
89
|
+
* group of an always-alike member unless `--only`, else the one part.
|
|
56
90
|
* @param {Ctx} ctx
|
|
57
91
|
* @param {Pick<Setting, 'on' | 'only' | 'thing'>} s
|
|
58
92
|
* @returns {string[]}
|
|
@@ -80,6 +114,13 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
|
|
|
80
114
|
light: Record<string, string>;
|
|
81
115
|
dark: Record<string, string>;
|
|
82
116
|
}): any;
|
|
117
|
+
/**
|
|
118
|
+
* Settings whose effect a later or stronger setting hides, with why: `type`
|
|
119
|
+
* loses heading weight and tracking to `headings`.
|
|
120
|
+
* @param {ThemeData} data
|
|
121
|
+
* @returns {Map<Setting, string>}
|
|
122
|
+
*/
|
|
123
|
+
export function maskedSettings(data: ThemeData): Map<Setting, string>;
|
|
83
124
|
/**
|
|
84
125
|
* A plain part setting can lose to a more specific rule for the same part
|
|
85
126
|
* and property, such as a base theme's `.astryx-heading[data-level="1"]
|
|
@@ -100,11 +141,12 @@ export function findOverrides(cssText: string, theme: any): Array<{
|
|
|
100
141
|
* @param {Ctx} ctx
|
|
101
142
|
* @param {string} slug
|
|
102
143
|
* @param {ThemeData} data
|
|
103
|
-
* @returns {Promise<{warnings: string[], lifted: string[]}>}
|
|
144
|
+
* @returns {Promise<{warnings: string[], lifted: string[], notes: string[]}>} `notes`: what the color config kept or replaced of a hand edit
|
|
104
145
|
*/
|
|
105
146
|
export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
|
|
106
147
|
warnings: string[];
|
|
107
148
|
lifted: string[];
|
|
149
|
+
notes: string[];
|
|
108
150
|
}>;
|
|
109
151
|
/**
|
|
110
152
|
* Resolved tokens of the built theme in both modes.
|
|
@@ -129,6 +171,56 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
|
|
|
129
171
|
light: Record<string, string>;
|
|
130
172
|
dark: Record<string, string>;
|
|
131
173
|
}): Promise<string[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
|
|
176
|
+
* theme folder, and every file and folder in it. The editor writes the
|
|
177
|
+
* theme's own files only, never through a link to somewhere else.
|
|
178
|
+
* @param {string} cwd
|
|
179
|
+
* @param {string} slug
|
|
180
|
+
*/
|
|
181
|
+
export function refuseLinks(cwd: string, slug: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* What a build was made from: the settings and the CLI that built them, so
|
|
184
|
+
* a build that no longer matches its settings file is found and made again.
|
|
185
|
+
* @param {ThemeData} data
|
|
186
|
+
*/
|
|
187
|
+
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
|
+
/**
|
|
198
|
+
* Why the theme's build does not match its settings, in words, or null when
|
|
199
|
+
* it does: a file missing, another CLI version, settings changed since the
|
|
200
|
+
* build (a hand edit), or a build left half done (a command stopped).
|
|
201
|
+
* @param {string} cwd
|
|
202
|
+
* @param {string} slug
|
|
203
|
+
* @param {ThemeData} data
|
|
204
|
+
* @returns {string | null}
|
|
205
|
+
*/
|
|
206
|
+
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
|
+
/**
|
|
214
|
+
* A theme's undo history: the settings text before each change, oldest
|
|
215
|
+
* first, and how many damaged steps were dropped. Every step after the
|
|
216
|
+
* last damaged one is kept.
|
|
217
|
+
* @param {string} file
|
|
218
|
+
* @returns {{steps: string[], dropped: number}}
|
|
219
|
+
*/
|
|
220
|
+
export function readHistory(file: string): {
|
|
221
|
+
steps: string[];
|
|
222
|
+
dropped: number;
|
|
223
|
+
};
|
|
132
224
|
/**
|
|
133
225
|
* Write the settings, build, and on a failed build put back what was there.
|
|
134
226
|
* Returns what changed in the resolved tokens and the lifted keys that are
|
|
@@ -136,19 +228,20 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
|
|
|
136
228
|
* @param {Ctx} ctx
|
|
137
229
|
* @param {string} slug
|
|
138
230
|
* @param {ThemeData} data
|
|
139
|
-
* @param {{history: boolean}} options
|
|
231
|
+
* @param {{history: boolean, historyAfter?: string[]}} options
|
|
232
|
+
* `historyAfter`: the history to write with the change (a step back pops it)
|
|
140
233
|
*/
|
|
141
|
-
export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history }: {
|
|
234
|
+
export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter }: {
|
|
142
235
|
history: boolean;
|
|
236
|
+
historyAfter?: string[];
|
|
143
237
|
}): Promise<{
|
|
144
238
|
changed: string[];
|
|
145
|
-
res:
|
|
146
|
-
light: Record<string, string>;
|
|
147
|
-
dark: Record<string, string>;
|
|
148
|
-
};
|
|
239
|
+
res: Record<"light" | "dark", Record<string, string>>;
|
|
149
240
|
problems: string[];
|
|
150
241
|
warnings: string[];
|
|
151
242
|
lifted: string[];
|
|
243
|
+
notes: string[];
|
|
244
|
+
unchanged: boolean;
|
|
152
245
|
}>;
|
|
153
246
|
/** @param {Ctx} ctx @param {ThemeData} data */
|
|
154
247
|
export function fontPackages(ctx: Ctx, data: ThemeData): {
|
|
@@ -156,6 +249,35 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
|
|
|
156
249
|
family: string;
|
|
157
250
|
installed: boolean;
|
|
158
251
|
}[];
|
|
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 */
|
|
277
|
+
/** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
|
|
278
|
+
/** @typedef {import('./_parts.mjs').TextPair} TextPair */
|
|
279
|
+
/** 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";
|
|
159
281
|
export function slugOk(s: string): boolean;
|
|
160
282
|
export function kebab(s: string): string;
|
|
161
283
|
export function camel(s: string): string;
|
|
@@ -165,6 +287,8 @@ export function keyOf(s: Setting): string;
|
|
|
165
287
|
export function modesOf(d: ThemeData): Array<"light" | "dark">;
|
|
166
288
|
export function cornerPx(v: string): number;
|
|
167
289
|
export function textPx(v: string): number;
|
|
290
|
+
/** The undo steps a theme keeps; older ones are dropped. */
|
|
291
|
+
export const HISTORY_STEPS: 80;
|
|
168
292
|
/**
|
|
169
293
|
* One setting the CLI owns.
|
|
170
294
|
*/
|
|
@@ -176,7 +300,7 @@ export type Setting = {
|
|
|
176
300
|
value: string;
|
|
177
301
|
source: "dial" | "token" | "property";
|
|
178
302
|
/**
|
|
179
|
-
* - A part, a
|
|
303
|
+
* - A part, a group, or a typography role (font).
|
|
180
304
|
*/
|
|
181
305
|
on?: string | undefined;
|
|
182
306
|
/**
|
|
@@ -207,11 +331,23 @@ export type ThemeData = {
|
|
|
207
331
|
* - Variant keys the last build repeated a part setting on.
|
|
208
332
|
*/
|
|
209
333
|
lifted?: string[] | undefined;
|
|
334
|
+
/**
|
|
335
|
+
* - The hash of the palette.config.json the editor last wrote.
|
|
336
|
+
*/
|
|
337
|
+
palette?: string | undefined;
|
|
210
338
|
};
|
|
211
339
|
export type Ctx = {
|
|
212
340
|
project: import("./_project.mjs").ThemeProject;
|
|
213
341
|
C: import("./_compiler.mjs").Compiler;
|
|
342
|
+
unchecked?: string | null;
|
|
343
|
+
wrote?: Map<string, string | null>;
|
|
344
|
+
base?: {
|
|
345
|
+
light: Record<string, string>;
|
|
346
|
+
dark: Record<string, string>;
|
|
347
|
+
};
|
|
214
348
|
};
|
|
349
|
+
export type PaintSide = import("./_parts.mjs").PaintSide;
|
|
350
|
+
export type TextPair = import("./_parts.mjs").TextPair;
|
|
215
351
|
/**
|
|
216
352
|
* What a part reads for a property when the theme does not set it, so a
|
|
217
353
|
* one-mode component setting keeps the other mode as it was.
|