@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
|
@@ -1,6 +1,15 @@
|
|
|
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
|
+
* A lookup table that only answers for its own keys: a word typed by a
|
|
6
|
+
* person (`constructor`, `__proto__`, `toString`) never reaches
|
|
7
|
+
* `Object.prototype`. Plain objects inside it, in arrays too, get the same.
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {T} table
|
|
10
|
+
* @returns {T}
|
|
11
|
+
*/
|
|
12
|
+
export function wordTable<T>(table: T): T;
|
|
4
13
|
/** The command prefix every suggested command starts with. */
|
|
5
14
|
export const P: "astryx experimental theme editor";
|
|
6
15
|
/**
|
|
@@ -103,6 +112,21 @@ export const COMMON_PROPERTIES: string[];
|
|
|
103
112
|
export const THING_HINTS: Record<string, (value: string, on: string | undefined) => string[]>;
|
|
104
113
|
/** Sample values for design words in a `how` question. */
|
|
105
114
|
export const DESIGN: Record<string, string>;
|
|
115
|
+
/**
|
|
116
|
+
* Parts drawn by a Card (their class sits on the Card's own element), so
|
|
117
|
+
* their padding is the card's padding variables.
|
|
118
|
+
*/
|
|
119
|
+
export const CARD_LIKE: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Parts whose theme class sits on a transparent wrapper while Core draws the
|
|
122
|
+
* visible box on an inner element with no class of its own (see
|
|
123
|
+
* /core-gaps: the composer body). Padding reaches the box only through the
|
|
124
|
+
* part's padding variable; a surface (background, border, shadow) paints
|
|
125
|
+
* the wrapper's square corners; a density re-sets the variable on the box.
|
|
126
|
+
*/
|
|
127
|
+
export const WRAPPED_PARTS: Record<string, {
|
|
128
|
+
box: string;
|
|
129
|
+
}>;
|
|
106
130
|
/** States every part takes, beyond the ones its doc lists. */
|
|
107
131
|
export const COMMON_STATES: string[];
|
|
108
132
|
export type Dial = {
|
|
@@ -12,6 +12,31 @@
|
|
|
12
12
|
import {discoverBundledThemes} from '../../foundation/discovery/theme-discovery.mjs';
|
|
13
13
|
import {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A lookup table that only answers for its own keys: a word typed by a
|
|
17
|
+
* person (`constructor`, `__proto__`, `toString`) never reaches
|
|
18
|
+
* `Object.prototype`. Plain objects inside it, in arrays too, get the same.
|
|
19
|
+
* @template T
|
|
20
|
+
* @param {T} table
|
|
21
|
+
* @returns {T}
|
|
22
|
+
*/
|
|
23
|
+
export function wordTable(table) {
|
|
24
|
+
/** @param {any} v @returns {any} */
|
|
25
|
+
const own = v => {
|
|
26
|
+
if (Array.isArray(v)) return v.map(own);
|
|
27
|
+
if (
|
|
28
|
+
!v ||
|
|
29
|
+
typeof v !== 'object' ||
|
|
30
|
+
Object.getPrototypeOf(v) !== Object.prototype
|
|
31
|
+
)
|
|
32
|
+
return v;
|
|
33
|
+
const out = Object.create(null);
|
|
34
|
+
for (const [k, x] of Object.entries(v)) out[k] = own(x);
|
|
35
|
+
return out;
|
|
36
|
+
};
|
|
37
|
+
return own(table);
|
|
38
|
+
}
|
|
39
|
+
|
|
15
40
|
/** The command prefix every suggested command starts with. */
|
|
16
41
|
export const P = 'astryx experimental theme editor';
|
|
17
42
|
|
|
@@ -33,7 +58,7 @@ export const LIKE = discoverBundledThemes()
|
|
|
33
58
|
* Groups of parts that should look alike. `--on <group>` styles every member.
|
|
34
59
|
* @type {Record<string, string[]>}
|
|
35
60
|
*/
|
|
36
|
-
export const FAMILIES = {
|
|
61
|
+
export const FAMILIES = wordTable({
|
|
37
62
|
inputs: [
|
|
38
63
|
'text-input',
|
|
39
64
|
'text-area',
|
|
@@ -66,7 +91,7 @@ export const FAMILIES = {
|
|
|
66
91
|
'typeahead-dropdown',
|
|
67
92
|
'context-menu',
|
|
68
93
|
],
|
|
69
|
-
};
|
|
94
|
+
});
|
|
70
95
|
|
|
71
96
|
/**
|
|
72
97
|
* Groups whose members always look alike: styling one member styles them
|
|
@@ -113,7 +138,7 @@ export const FONT_ROLES = ['body', 'heading', 'code'];
|
|
|
113
138
|
* Font presets: the family, then its fallbacks.
|
|
114
139
|
* @type {Record<string, [string, string]>}
|
|
115
140
|
*/
|
|
116
|
-
export const FONTS = {
|
|
141
|
+
export const FONTS = wordTable({
|
|
117
142
|
system: ['system-ui', '-apple-system, "Segoe UI", Roboto, sans-serif'],
|
|
118
143
|
tahoma: ['Tahoma', 'Verdana, "Segoe UI", sans-serif'],
|
|
119
144
|
verdana: ['Verdana', 'Tahoma, sans-serif'],
|
|
@@ -125,7 +150,7 @@ export const FONTS = {
|
|
|
125
150
|
courier: ['Courier New', 'Courier, monospace'],
|
|
126
151
|
rounded: ['Nunito', '"Varela Round", system-ui, sans-serif'],
|
|
127
152
|
comic: ['Comic Sans MS', '"Comic Neue", cursive'],
|
|
128
|
-
};
|
|
153
|
+
});
|
|
129
154
|
/** The CSS-wide keywords: valid in any declaration, never a value of their own. */
|
|
130
155
|
export const CSS_WIDE = [
|
|
131
156
|
'inherit',
|
|
@@ -233,7 +258,7 @@ export const SYSTEM_FONTS = Object.keys(FONTS).filter(k =>
|
|
|
233
258
|
* When the package is installed, previews show the font; the app loads it
|
|
234
259
|
* by importing the package once.
|
|
235
260
|
*/
|
|
236
|
-
const OPEN_FONT_FAMILIES = {
|
|
261
|
+
const OPEN_FONT_FAMILIES = wordTable({
|
|
237
262
|
inter: 'Inter',
|
|
238
263
|
roboto: 'Roboto',
|
|
239
264
|
poppins: 'Poppins',
|
|
@@ -249,26 +274,30 @@ const OPEN_FONT_FAMILIES = {
|
|
|
249
274
|
'mona-sans': 'Mona Sans',
|
|
250
275
|
geist: 'Geist Sans',
|
|
251
276
|
'geist-mono': 'Geist Mono',
|
|
252
|
-
};
|
|
253
|
-
/** Presets whose package is not named after them. */
|
|
254
|
-
const OPEN_FONT_PACKAGES = /** @type {Record<string, string>} */ ({
|
|
255
|
-
'source-serif': 'source-serif-4',
|
|
256
|
-
geist: 'geist-sans',
|
|
257
277
|
});
|
|
278
|
+
/** Presets whose package is not named after them. */
|
|
279
|
+
const OPEN_FONT_PACKAGES = wordTable(
|
|
280
|
+
/** @type {Record<string, string>} */ ({
|
|
281
|
+
'source-serif': 'source-serif-4',
|
|
282
|
+
geist: 'geist-sans',
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
258
285
|
/** @type {Record<string, {family: string, fallbacks: string, pkg: string}>} */
|
|
259
|
-
export const OPEN_FONTS =
|
|
260
|
-
Object.
|
|
261
|
-
key,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
286
|
+
export const OPEN_FONTS = wordTable(
|
|
287
|
+
Object.fromEntries(
|
|
288
|
+
Object.entries(OPEN_FONT_FAMILIES).map(([key, family]) => [
|
|
289
|
+
key,
|
|
290
|
+
{
|
|
291
|
+
family,
|
|
292
|
+
fallbacks: key.endsWith('-mono')
|
|
293
|
+
? 'ui-monospace, monospace'
|
|
294
|
+
: /serif/i.test(family)
|
|
295
|
+
? 'Georgia, serif'
|
|
296
|
+
: 'system-ui, sans-serif',
|
|
297
|
+
pkg: `@fontsource/${OPEN_FONT_PACKAGES[key] ?? key}`,
|
|
298
|
+
},
|
|
299
|
+
]),
|
|
300
|
+
),
|
|
272
301
|
);
|
|
273
302
|
|
|
274
303
|
/**
|
|
@@ -276,7 +305,7 @@ export const OPEN_FONTS = Object.fromEntries(
|
|
|
276
305
|
* a theme that names one gets.
|
|
277
306
|
* @type {Record<string, string>}
|
|
278
307
|
*/
|
|
279
|
-
export const CLOSEST_OPEN_FONT = {
|
|
308
|
+
export const CLOSEST_OPEN_FONT = wordTable({
|
|
280
309
|
'sf pro': 'inter',
|
|
281
310
|
'sf pro text': 'inter',
|
|
282
311
|
'sf pro display': 'inter',
|
|
@@ -299,49 +328,55 @@ export const CLOSEST_OPEN_FONT = {
|
|
|
299
328
|
futura: 'poppins',
|
|
300
329
|
menlo: 'jetbrains-mono',
|
|
301
330
|
'sf mono': 'jetbrains-mono',
|
|
302
|
-
};
|
|
331
|
+
});
|
|
303
332
|
|
|
304
333
|
/** Heading weights (`headings` dial): rung -> font-weight. */
|
|
305
|
-
export const HEADING_WEIGHTS =
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
334
|
+
export const HEADING_WEIGHTS = wordTable(
|
|
335
|
+
/** @type {Record<string, string>} */ ({
|
|
336
|
+
light: '300',
|
|
337
|
+
regular: '400',
|
|
338
|
+
medium: '500',
|
|
339
|
+
semibold: '600',
|
|
340
|
+
bold: '700',
|
|
341
|
+
heavy: '800',
|
|
342
|
+
}),
|
|
343
|
+
);
|
|
313
344
|
/** Heading letter spacing (`headings` dial): rung -> letter-spacing. */
|
|
314
|
-
export const HEADING_TRACKING =
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
345
|
+
export const HEADING_TRACKING = wordTable(
|
|
346
|
+
/** @type {Record<string, string>} */ ({
|
|
347
|
+
tight: '-0.02em',
|
|
348
|
+
tighter: '-0.04em',
|
|
349
|
+
normal: '0',
|
|
350
|
+
wide: '0.02em',
|
|
351
|
+
}),
|
|
352
|
+
);
|
|
320
353
|
|
|
321
354
|
/** The `surfaces` dial: how every container sits on the page. */
|
|
322
|
-
export const SURFACES =
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}
|
|
355
|
+
export const SURFACES = wordTable(
|
|
356
|
+
/** @type {Record<string, Record<string, string>>} */ ({
|
|
357
|
+
flat: {
|
|
358
|
+
borderStyle: 'none',
|
|
359
|
+
boxShadow: 'none',
|
|
360
|
+
backgroundColor: 'var(--color-background-muted)',
|
|
361
|
+
},
|
|
362
|
+
outlined: {
|
|
363
|
+
borderStyle: 'solid',
|
|
364
|
+
borderWidth: '1px',
|
|
365
|
+
borderColor: 'var(--color-border)',
|
|
366
|
+
boxShadow: 'none',
|
|
367
|
+
},
|
|
368
|
+
raised: {borderStyle: 'none', boxShadow: 'var(--shadow-med)'},
|
|
369
|
+
glass: {
|
|
370
|
+
backgroundColor:
|
|
371
|
+
'color-mix(in srgb, var(--color-background-card) 72%, transparent)',
|
|
372
|
+
backdropFilter: 'blur(14px) saturate(1.4)',
|
|
373
|
+
borderStyle: 'solid',
|
|
374
|
+
borderWidth: '1px',
|
|
375
|
+
borderColor: 'rgb(255 255 255 / 0.22)',
|
|
376
|
+
boxShadow: 'var(--shadow-low)',
|
|
377
|
+
},
|
|
378
|
+
}),
|
|
379
|
+
);
|
|
345
380
|
/** The parts the `surfaces` dial moves. */
|
|
346
381
|
export const SURFACE_PARTS = [
|
|
347
382
|
'card',
|
|
@@ -372,7 +407,7 @@ export const TYPE_STYLES =
|
|
|
372
407
|
*/
|
|
373
408
|
|
|
374
409
|
/** @type {Record<string, Dial>} */
|
|
375
|
-
export const DIALS = {
|
|
410
|
+
export const DIALS = wordTable({
|
|
376
411
|
corners: {
|
|
377
412
|
help:
|
|
378
413
|
'How round corners are. Rungs: ' +
|
|
@@ -525,82 +560,86 @@ export const DIALS = {
|
|
|
525
560
|
examples: ['set my mode dark-only'],
|
|
526
561
|
words: 'mode light dark only night day scheme',
|
|
527
562
|
},
|
|
528
|
-
};
|
|
563
|
+
});
|
|
529
564
|
|
|
530
565
|
/** CSS properties grouped by the aspect of a part they change. */
|
|
531
|
-
export const GROUPS =
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
566
|
+
export const GROUPS = wordTable(
|
|
567
|
+
/** @type {Record<string, string[]>} */ ({
|
|
568
|
+
text: ['color', 'fill', '-webkit-text-fill-color', 'caret-color'],
|
|
569
|
+
background: ['background-color', 'background-image', 'background'],
|
|
570
|
+
border: [
|
|
571
|
+
'border-color',
|
|
572
|
+
'border-top-color',
|
|
573
|
+
'border-bottom-color',
|
|
574
|
+
'border-left-color',
|
|
575
|
+
'border-right-color',
|
|
576
|
+
'border-block-color',
|
|
577
|
+
'border-inline-color',
|
|
578
|
+
'border-width',
|
|
579
|
+
'border-style',
|
|
580
|
+
'outline-color',
|
|
581
|
+
],
|
|
582
|
+
corners: [
|
|
583
|
+
'border-radius',
|
|
584
|
+
'border-start-start-radius',
|
|
585
|
+
'border-start-end-radius',
|
|
586
|
+
'border-end-start-radius',
|
|
587
|
+
'border-end-end-radius',
|
|
588
|
+
'border-top-left-radius',
|
|
589
|
+
'border-top-right-radius',
|
|
590
|
+
'border-bottom-left-radius',
|
|
591
|
+
'border-bottom-right-radius',
|
|
592
|
+
],
|
|
593
|
+
shadow: ['box-shadow'],
|
|
594
|
+
spacing: [
|
|
595
|
+
'padding',
|
|
596
|
+
'padding-block',
|
|
597
|
+
'padding-inline',
|
|
598
|
+
'padding-top',
|
|
599
|
+
'padding-bottom',
|
|
600
|
+
'padding-inline-start',
|
|
601
|
+
'padding-inline-end',
|
|
602
|
+
'padding-left',
|
|
603
|
+
'padding-right',
|
|
604
|
+
'gap',
|
|
605
|
+
'row-gap',
|
|
606
|
+
'column-gap',
|
|
607
|
+
'margin',
|
|
608
|
+
'margin-block',
|
|
609
|
+
'margin-inline',
|
|
610
|
+
],
|
|
611
|
+
font: [
|
|
612
|
+
'font-family',
|
|
613
|
+
'font-size',
|
|
614
|
+
'font-weight',
|
|
615
|
+
'line-height',
|
|
616
|
+
'letter-spacing',
|
|
617
|
+
'text-transform',
|
|
618
|
+
],
|
|
619
|
+
size: [
|
|
620
|
+
'height',
|
|
621
|
+
'min-height',
|
|
622
|
+
'width',
|
|
623
|
+
'min-width',
|
|
624
|
+
'block-size',
|
|
625
|
+
'inline-size',
|
|
626
|
+
],
|
|
627
|
+
}),
|
|
628
|
+
);
|
|
592
629
|
|
|
593
630
|
/** The CSS property that sets each aspect directly, whatever token it reads. */
|
|
594
|
-
export const DIRECT =
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
631
|
+
export const DIRECT = wordTable(
|
|
632
|
+
/** @type {Record<string, string>} */ ({
|
|
633
|
+
text: 'color',
|
|
634
|
+
background: 'background',
|
|
635
|
+
border: 'border',
|
|
636
|
+
corners: 'border-radius',
|
|
637
|
+
shadow: 'box-shadow',
|
|
638
|
+
spacing: 'padding',
|
|
639
|
+
font: 'font-weight',
|
|
640
|
+
size: 'min-height',
|
|
641
|
+
}),
|
|
642
|
+
);
|
|
604
643
|
|
|
605
644
|
/** Properties whose value is one plain color. */
|
|
606
645
|
export const COLOR_PROPS =
|
|
@@ -651,39 +690,62 @@ export const COMMON_PROPERTIES = [
|
|
|
651
690
|
* the commands that do what they mean.
|
|
652
691
|
* @type {Record<string, (value: string, on: string | undefined) => string[]>}
|
|
653
692
|
*/
|
|
654
|
-
export const THING_HINTS = {
|
|
693
|
+
export const THING_HINTS = wordTable({
|
|
655
694
|
gradient: (v, on) => [
|
|
656
695
|
`${P} set <theme> background "linear-gradient(${v || '#ffffff, #dddddd'})" --on ${on ?? '<part>'}`,
|
|
657
696
|
],
|
|
658
697
|
bevel: (_v, on) => [
|
|
659
698
|
`${P} set <theme> box-shadow "inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9ca3af" --on ${on ?? '<part>'}`,
|
|
660
699
|
],
|
|
661
|
-
|
|
662
|
-
|
|
700
|
+
// The value given is carried (none, false and off are no shadow); the
|
|
701
|
+
// sample only when none is.
|
|
702
|
+
shadow: (v, on) => [
|
|
703
|
+
`${P} set <theme> box-shadow ${/^(none|false|off|no|0)$/i.test(v.trim()) ? 'none' : v.trim() ? JSON.stringify(v.trim()) : '"0 2px 6px rgb(0 0 0 / 0.3)"'} --on ${on ?? '<part>'}`,
|
|
663
704
|
],
|
|
664
705
|
radius: (v, on) => [
|
|
665
706
|
`${P} set <theme> corners ${v || 'medium'}${on ? ` --on ${on}` : ''}`,
|
|
666
707
|
],
|
|
667
|
-
rounded: (
|
|
668
|
-
`${P} set <theme> corners round${on ? ` --on ${on}` : ''}`,
|
|
708
|
+
rounded: (v, on) => [
|
|
709
|
+
`${P} set <theme> corners ${/^(none|false|off|no|0)$/i.test(v.trim()) ? 'square' : /^(true|yes|on)?$/i.test(v.trim()) ? 'round' : v.trim()}${on ? ` --on ${on}` : ''}`,
|
|
669
710
|
],
|
|
670
711
|
padding: (_v, on) => [
|
|
671
712
|
`${P} set <theme> spacing roomy${on ? ` --on ${on}` : ''}`,
|
|
672
713
|
`${P} set <theme> padding 12px --on ${on ?? '<part>'}`,
|
|
673
714
|
],
|
|
674
715
|
density: () => [`${P} set <theme> spacing compact`],
|
|
675
|
-
bold: (
|
|
716
|
+
bold: (v, on) => [
|
|
717
|
+
`${P} set <theme> font-weight ${/^(none|false|off|no|normal)$/i.test(v.trim()) ? 'normal' : 'bold'} --on ${on ?? '<part>'}`,
|
|
718
|
+
],
|
|
676
719
|
'text-color': (_v, on) => [`${HOW} "text color on ${on ?? '<part>'}"`],
|
|
677
|
-
};
|
|
720
|
+
});
|
|
678
721
|
|
|
679
722
|
/** Sample values for design words in a `how` question. */
|
|
680
|
-
export const DESIGN =
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
723
|
+
export const DESIGN = wordTable(
|
|
724
|
+
/** @type {Record<string, string>} */ ({
|
|
725
|
+
gradient: '"linear-gradient(#ffffff, #d1d5db)"',
|
|
726
|
+
glossy: '"linear-gradient(#ffffff 0%, #c7d2fe 45%, #6366f1 100%)"',
|
|
727
|
+
bevel: '"inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9ca3af"',
|
|
728
|
+
raised: '"0 1px 2px rgb(0 0 0 / 0.3)"',
|
|
729
|
+
flat: 'none',
|
|
730
|
+
sunken: '"inset 1px 1px 2px rgb(0 0 0 / 0.3)"',
|
|
731
|
+
}),
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Parts drawn by a Card (their class sits on the Card's own element), so
|
|
736
|
+
* their padding is the card's padding variables.
|
|
737
|
+
*/
|
|
738
|
+
export const CARD_LIKE = ['clickable-card', 'selectable-card'];
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Parts whose theme class sits on a transparent wrapper while Core draws the
|
|
742
|
+
* visible box on an inner element with no class of its own (see
|
|
743
|
+
* /core-gaps: the composer body). Padding reaches the box only through the
|
|
744
|
+
* part's padding variable; a surface (background, border, shadow) paints
|
|
745
|
+
* the wrapper's square corners; a density re-sets the variable on the box.
|
|
746
|
+
*/
|
|
747
|
+
export const WRAPPED_PARTS = /** @type {Record<string, {box: string}>} */ ({
|
|
748
|
+
'chat-composer': {box: 'the rounded composer body'},
|
|
687
749
|
});
|
|
688
750
|
|
|
689
751
|
/** States every part takes, beyond the ones its doc lists. */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Split a printed command into its arguments, as a POSIX shell reads them:
|
|
6
|
+
* single quotes (with `'\''` for a quote inside), double quotes and
|
|
7
|
+
* backslashes. `null` when the quotes do not close.
|
|
8
|
+
* @param {string} line
|
|
9
|
+
* @returns {string[] | null}
|
|
10
|
+
*/
|
|
11
|
+
export function splitCommand(line: string): string[] | null;
|
|
12
|
+
/**
|
|
13
|
+
* Read a suggested `set <slug> <thing> <value> [flags]` line; `null` when it
|
|
14
|
+
* is not one this check can read (another command or theme, a placeholder,
|
|
15
|
+
* an unknown flag): such a line is kept as it is.
|
|
16
|
+
* @param {string} name
|
|
17
|
+
* @param {string} slug
|
|
18
|
+
*/
|
|
19
|
+
export function readSetLine(name: string, slug: string): {
|
|
20
|
+
thing: string;
|
|
21
|
+
value: string;
|
|
22
|
+
flags: {
|
|
23
|
+
on?: string;
|
|
24
|
+
when?: string;
|
|
25
|
+
state?: string;
|
|
26
|
+
mode?: string;
|
|
27
|
+
only?: boolean;
|
|
28
|
+
};
|
|
29
|
+
} | null;
|
|
30
|
+
/**
|
|
31
|
+
* Drop each `set` suggestion of a refusal that `set` itself would refuse,
|
|
32
|
+
* checked against the theme as it is now (a copy: nothing is changed). Any
|
|
33
|
+
* other suggestion is kept. When every suggestion goes, the refusal points
|
|
34
|
+
* at `set --help`.
|
|
35
|
+
* @template T
|
|
36
|
+
* @param {T} e the error thrown
|
|
37
|
+
* @param {import('./_settings.mjs').Ctx | null | undefined} ctx
|
|
38
|
+
* @param {string} slug
|
|
39
|
+
* @param {import('./_settings.mjs').ThemeData | null | undefined} data
|
|
40
|
+
* @returns {T}
|
|
41
|
+
*/
|
|
42
|
+
export function vetSuggestions<T>(e: T, ctx: import("./_settings.mjs").Ctx | null | undefined, slug: string, data: import("./_settings.mjs").ThemeData | null | undefined): T;
|