@astryxdesign/cli 0.7.15 → 0.7.16-canary.g8514aae
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/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 +1 -21
- package/api/theme/build/build.mjs +149 -37
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +91 -19
- 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 +21 -0
- package/api/theme-edit/_adapter.mjs +176 -22
- package/api/theme-edit/_check.d.mts +7 -0
- package/api/theme-edit/_check.mjs +1050 -173
- 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 +21 -0
- package/api/theme-edit/_context.mjs +235 -12
- package/api/theme-edit/_css.d.mts +50 -1
- package/api/theme-edit/_css.mjs +310 -28
- package/api/theme-edit/_edit.d.mts +9 -0
- package/api/theme-edit/_edit.mjs +907 -123
- 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/_palette.d.mts +6 -0
- package/api/theme-edit/_palette.mjs +164 -62
- package/api/theme-edit/_parts.d.mts +16 -0
- package/api/theme-edit/_parts.mjs +49 -1
- package/api/theme-edit/_png.mjs +19 -14
- package/api/theme-edit/_preview-app.mjs +514 -27
- package/api/theme-edit/_preview.d.mts +11 -0
- package/api/theme-edit/_preview.mjs +245 -24
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +35 -9
- package/api/theme-edit/_settings.d.mts +122 -5
- package/api/theme-edit/_settings.mjs +1363 -71
- package/api/theme-edit/_tables.d.mts +19 -0
- package/api/theme-edit/_tables.mjs +205 -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/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/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/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 +188 -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 +89 -6
- 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/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 +36 -10
- package/foundation/fs/paths.d.mts +16 -0
- package/foundation/fs/paths.mjs +25 -0
- 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
|
@@ -118,7 +118,7 @@ export function demoProps(project, name) {
|
|
|
118
118
|
// A doc that declares no props of its own name is a family page,
|
|
119
119
|
// not a component the Core exports.
|
|
120
120
|
!Object.keys(info.props ?? {}).length ||
|
|
121
|
-
(
|
|
121
|
+
needsParent(project, name))
|
|
122
122
|
)
|
|
123
123
|
return null;
|
|
124
124
|
const props = given ?? {};
|
|
@@ -144,6 +144,22 @@ export function demoProps(project, name) {
|
|
|
144
144
|
return props;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Whether a part works only inside its parent: its parent lists it as an
|
|
149
|
+
* item, or it is a piece of its parent by name (TableBody of Table) and
|
|
150
|
+
* its doc gives no playground of its own.
|
|
151
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
152
|
+
* @param {string} name
|
|
153
|
+
*/
|
|
154
|
+
export function needsParent(project, name) {
|
|
155
|
+
const info = project.components[name];
|
|
156
|
+
const parent = info?.subComponentOf;
|
|
157
|
+
if (!parent) return false;
|
|
158
|
+
if (isItemOf(project, name)) return true;
|
|
159
|
+
const own = info.defaults && typeof info.defaults === 'object';
|
|
160
|
+
return !own && name.startsWith(parent) && name !== parent;
|
|
161
|
+
}
|
|
162
|
+
|
|
147
163
|
/**
|
|
148
164
|
* Whether a part's parent lists it as an item of its children.
|
|
149
165
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
@@ -479,6 +495,38 @@ async function buildPartData(project) {
|
|
|
479
495
|
};
|
|
480
496
|
}
|
|
481
497
|
|
|
498
|
+
/** @type {Map<string, Set<string>>} */
|
|
499
|
+
const multipliedCache = new Map();
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* The tokens Core's stylesheet multiplies by another value inside calc()
|
|
503
|
+
* (`var(--text-body-size) * var(--text-body-leading)`): a unit there makes
|
|
504
|
+
* the declaration invalid. Empty with no stylesheet.
|
|
505
|
+
* @param {any} project
|
|
506
|
+
* @returns {Set<string>}
|
|
507
|
+
*/
|
|
508
|
+
export function multipliedTokens(project) {
|
|
509
|
+
/** @type {string} */
|
|
510
|
+
let file;
|
|
511
|
+
try {
|
|
512
|
+
file = project.req.resolve('@astryxdesign/core/astryx.css');
|
|
513
|
+
} catch {
|
|
514
|
+
return new Set();
|
|
515
|
+
}
|
|
516
|
+
const cached = multipliedCache.get(file);
|
|
517
|
+
if (cached) return cached;
|
|
518
|
+
const css = fs.readFileSync(file, 'utf8');
|
|
519
|
+
/** @type {Set<string>} */
|
|
520
|
+
const out = new Set();
|
|
521
|
+
// Each side of a `*` on its own, so `a * b * c` names all three.
|
|
522
|
+
for (const m of css.matchAll(/var\((--[a-z0-9-]+)\)(?=\s*\*)/gi))
|
|
523
|
+
out.add(m[1].toLowerCase());
|
|
524
|
+
for (const m of css.matchAll(/\*\s*var\((--[a-z0-9-]+)\)/gi))
|
|
525
|
+
out.add(m[1].toLowerCase());
|
|
526
|
+
multipliedCache.set(file, out);
|
|
527
|
+
return out;
|
|
528
|
+
}
|
|
529
|
+
|
|
482
530
|
/**
|
|
483
531
|
* Atomic class -> its declarations, with the condition (pseudo-class,
|
|
484
532
|
* attribute) each one applies under.
|
package/api/theme-edit/_png.mjs
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import * as zlib from 'node:zlib';
|
|
12
|
+
import {wordTable} from './_tables.mjs';
|
|
12
13
|
|
|
13
14
|
const SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
14
15
|
|
|
@@ -25,20 +26,24 @@ export const MAX_PIXELS_16 = 20_000_000;
|
|
|
25
26
|
const SAMPLE_BUDGET = 4_000_000;
|
|
26
27
|
|
|
27
28
|
/** The bit depths each PNG color type allows. */
|
|
28
|
-
const DEPTHS =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
const DEPTHS = wordTable(
|
|
30
|
+
/** @type {Record<number, number[]>} */ ({
|
|
31
|
+
0: [1, 2, 4, 8, 16],
|
|
32
|
+
2: [8, 16],
|
|
33
|
+
3: [1, 2, 4, 8],
|
|
34
|
+
4: [8, 16],
|
|
35
|
+
6: [8, 16],
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
const CHANNELS = wordTable(
|
|
39
|
+
/** @type {Record<number, number>} */ ({
|
|
40
|
+
0: 1,
|
|
41
|
+
2: 3,
|
|
42
|
+
3: 1,
|
|
43
|
+
4: 2,
|
|
44
|
+
6: 4,
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
42
47
|
|
|
43
48
|
/** @typedef {{width: number, height: number, rgba: Uint8Array}} Picture */
|
|
44
49
|
|