@astryxdesign/cli 0.7.15 → 0.7.16-canary.g07c77c0
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/build/_adapter.d.mts +1 -0
- package/api/build/blocks/blocks.d.mts +1 -0
- package/api/build/blocks/blocks.mjs +18 -1
- 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 +43 -0
- package/api/doctor/built-checks.mjs +1 -1
- package/api/doctor/doctor.mjs +18 -4
- package/api/doctor/theme-checks.mjs +1 -1
- package/api/integration/add-contribution.mjs +3 -3
- package/api/integration/pack-check.mjs +14 -8
- package/api/integration/validate-integration.mjs +1 -1
- package/api/search/_adapter.mjs +15 -16
- package/api/search/_entries.d.mts +2 -1
- package/api/search/_entries.mjs +28 -1
- package/api/swizzle/_moduleGraph.mjs +1 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +43 -12
- package/api/theme/_fork.mjs +1 -1
- package/api/theme/build/build.d.mts +116 -32
- package/api/theme/build/build.mjs +449 -102
- 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 +32 -2
- package/api/theme-edit/_adapter.mjs +213 -36
- package/api/theme-edit/_check.d.mts +69 -3
- package/api/theme-edit/_check.mjs +1517 -218
- 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 +426 -40
- 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 +1300 -135
- 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 +33 -0
- package/api/theme-edit/_parts.mjs +138 -9
- package/api/theme-edit/_png.d.mts +18 -0
- package/api/theme-edit/_png.mjs +95 -14
- package/api/theme-edit/_preview-app.d.mts +9 -0
- package/api/theme-edit/_preview-app.mjs +1191 -71
- package/api/theme-edit/_preview.d.mts +16 -3
- package/api/theme-edit/_preview.mjs +335 -30
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +46 -12
- package/api/theme-edit/_settings.d.mts +240 -5
- package/api/theme-edit/_settings.mjs +2561 -115
- 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/codemods/parse.mjs +2 -2
- 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/authoring/shadcn/source-variants.d.mts +1 -1
- package/authoring/shadcn/source-variants.mjs +32 -10
- 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 +237 -45
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
- 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 +1 -1
- package/clients/cli/commands/experimental-theme-preview-add.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 +190 -46
- 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 +72 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +49 -0
- package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
- package/foundation/agent-docs/agent-docs-target.mjs +9 -17
- package/foundation/agent-docs/agent-docs.mjs +3 -2
- package/foundation/config/config-writer.mjs +2 -2
- package/foundation/config/project.mjs +60 -14
- package/foundation/discovery/component-discovery.mjs +5 -17
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/module-exports.mjs +1 -15
- package/foundation/discovery/template-adapter.mjs +44 -19
- package/foundation/discovery/template-source-tree.mjs +3 -16
- package/foundation/discovery/theme-discovery.d.mts +5 -1
- package/foundation/discovery/theme-discovery.mjs +30 -35
- package/foundation/fs/exact-codec.d.mts +35 -0
- package/foundation/fs/exact-codec.mjs +148 -0
- package/foundation/fs/gather-cache.d.mts +15 -5
- package/foundation/fs/gather-cache.mjs +123 -30
- package/foundation/fs/paths.d.mts +39 -0
- package/foundation/fs/paths.mjs +44 -11
- package/foundation/fs/read-record.mjs +11 -1
- package/foundation/integrations/contribution-fixes.mjs +1 -16
- package/foundation/integrations/may-have-integrations.mjs +3 -2
- package/foundation/integrations/public-imports.mjs +1 -1
- package/foundation/render/embedded-imports.mjs +1 -1
- 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/foundation/runtime/lazy-dependencies.d.mts +14 -0
- package/foundation/runtime/lazy-dependencies.mjs +82 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
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
|
|
|
@@ -297,3 +302,79 @@ export function mainColors(pic, count) {
|
|
|
297
302
|
};
|
|
298
303
|
});
|
|
299
304
|
}
|
|
305
|
+
|
|
306
|
+
/** The keyword of the text chunk the theme editor stamps its pictures with. */
|
|
307
|
+
export const EDITOR_STAMP = 'astryx-theme-editor';
|
|
308
|
+
|
|
309
|
+
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The `tEXt` chunks of a PNG, keyword to text; empty for a file that is not
|
|
313
|
+
* a PNG or cannot be read whole.
|
|
314
|
+
* @param {Buffer} bytes
|
|
315
|
+
* @returns {Record<string, string>}
|
|
316
|
+
*/
|
|
317
|
+
export function pngTexts(bytes) {
|
|
318
|
+
/** @type {Record<string, string>} */
|
|
319
|
+
const out = {};
|
|
320
|
+
if (bytes.length < 8 || !bytes.subarray(0, 8).equals(PNG_SIGNATURE))
|
|
321
|
+
return out;
|
|
322
|
+
for (let at = 8; at + 8 <= bytes.length;) {
|
|
323
|
+
const len = bytes.readUInt32BE(at);
|
|
324
|
+
const type = bytes.toString('latin1', at + 4, at + 8);
|
|
325
|
+
const end = at + 12 + len;
|
|
326
|
+
if (end > bytes.length) break;
|
|
327
|
+
if (type === 'tEXt') {
|
|
328
|
+
const data = bytes.subarray(at + 8, at + 8 + len);
|
|
329
|
+
const nul = data.indexOf(0);
|
|
330
|
+
if (nul > 0)
|
|
331
|
+
out[data.toString('latin1', 0, nul)] = data.toString('latin1', nul + 1);
|
|
332
|
+
}
|
|
333
|
+
if (type === 'IEND') break;
|
|
334
|
+
at = end;
|
|
335
|
+
}
|
|
336
|
+
return out;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* A PNG with a `tEXt` chunk added right after its header (any chunk with the
|
|
341
|
+
* same keyword replaced), or the bytes as they were when they are not a PNG.
|
|
342
|
+
* @param {Buffer} bytes
|
|
343
|
+
* @param {string} keyword
|
|
344
|
+
* @param {string} text
|
|
345
|
+
* @returns {Buffer}
|
|
346
|
+
*/
|
|
347
|
+
export function withPngText(bytes, keyword, text) {
|
|
348
|
+
if (bytes.length < 33 || !bytes.subarray(0, 8).equals(PNG_SIGNATURE))
|
|
349
|
+
return bytes;
|
|
350
|
+
/** @type {Buffer[]} */
|
|
351
|
+
const chunks = [];
|
|
352
|
+
for (let at = 8; at + 8 <= bytes.length;) {
|
|
353
|
+
const len = bytes.readUInt32BE(at);
|
|
354
|
+
const type = bytes.toString('latin1', at + 4, at + 8);
|
|
355
|
+
const end = at + 12 + len;
|
|
356
|
+
if (end > bytes.length) return bytes;
|
|
357
|
+
const data = bytes.subarray(at + 8, at + 8 + len);
|
|
358
|
+
const same =
|
|
359
|
+
type === 'tEXt' &&
|
|
360
|
+
data.indexOf(0) > 0 &&
|
|
361
|
+
data.toString('latin1', 0, data.indexOf(0)) === keyword;
|
|
362
|
+
if (!same) chunks.push(bytes.subarray(at, end));
|
|
363
|
+
if (type === 'IHDR') {
|
|
364
|
+
const body = Buffer.concat([
|
|
365
|
+
Buffer.from('tEXt', 'latin1'),
|
|
366
|
+
Buffer.from(keyword, 'latin1'),
|
|
367
|
+
Buffer.from([0]),
|
|
368
|
+
Buffer.from(text, 'latin1'),
|
|
369
|
+
]);
|
|
370
|
+
const head = Buffer.alloc(4);
|
|
371
|
+
head.writeUInt32BE(body.length - 4);
|
|
372
|
+
const crc = Buffer.alloc(4);
|
|
373
|
+
crc.writeUInt32BE(zlib.crc32(body) >>> 0);
|
|
374
|
+
chunks.push(Buffer.concat([head, body, crc]));
|
|
375
|
+
}
|
|
376
|
+
if (type === 'IEND') break;
|
|
377
|
+
at = end;
|
|
378
|
+
}
|
|
379
|
+
return Buffer.concat([PNG_SIGNATURE, ...chunks]);
|
|
380
|
+
}
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* @param {((step: string) => boolean) | null} when
|
|
8
8
|
*/
|
|
9
9
|
export function stopPreviewCommitAt(when: ((step: string) => boolean) | null): void;
|
|
10
|
+
/**
|
|
11
|
+
* For tests: read at most `n` source files when checking for importers
|
|
12
|
+
* (null: the default).
|
|
13
|
+
* @param {number | null} n
|
|
14
|
+
*/
|
|
15
|
+
export function setImporterScanMax(n: number | null): void;
|
|
10
16
|
/**
|
|
11
17
|
* Rewrite the in-app preview routes of a theme when their imports changed, so
|
|
12
18
|
* a font package installed after `set` loads on the next change or `show`,
|
|
@@ -84,6 +90,8 @@ export type PreviewPage = {
|
|
|
84
90
|
file: string;
|
|
85
91
|
};
|
|
86
92
|
/**
|
|
93
|
+
* `parents`: how many folders over the preview folder its first add made,
|
|
94
|
+
* which remove takes away again when they are empty.
|
|
87
95
|
* `hashes`: a short hash of each file as the preview wrote it, so a file
|
|
88
96
|
* changed by hand is never replaced or deleted
|
|
89
97
|
*/
|
|
@@ -93,6 +101,7 @@ export type PreviewData = {
|
|
|
93
101
|
pages: PreviewPage[];
|
|
94
102
|
files: string[];
|
|
95
103
|
hashes?: Record<string, string>;
|
|
104
|
+
parents?: number;
|
|
96
105
|
};
|
|
97
106
|
/**
|
|
98
107
|
* the command again, with
|