@astryxdesign/cli 0.7.17 → 0.7.18-canary.g170df15
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 +1 -1
- package/api/discover/_adapter.d.mts +7 -5
- package/api/discover/_adapter.mjs +12 -11
- package/api/docs/_adapter.d.mts +19 -2
- package/api/docs/_adapter.mjs +66 -5
- package/api/doctor/_adapter.d.mts +11 -62
- package/api/doctor/_adapter.mjs +242 -472
- package/api/doctor/doctor.d.mts +1 -1
- package/api/doctor/doctor.mjs +3 -3
- package/api/doctor/theme-checks.mjs +37 -45
- package/api/error.d.mts +21 -0
- package/api/error.mjs +89 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/icon/_adapter.d.mts +8 -0
- package/api/icon/_adapter.mjs +17 -0
- package/api/icon/_authoring.mjs +6 -6
- package/api/icon/_default-look.mjs +16 -16
- package/api/icon/add/add.mjs +3 -3
- package/api/icon/exportIconIndex.doc.mjs +2 -2
- package/api/icon/icon.doc.mjs +2 -2
- package/api/icon/icon.type.d.mts +4 -0
- package/api/icon/icon.type.mjs +2 -1
- package/api/icon/search/icon-index.mjs +16 -3
- package/api/icon/search/search.d.mts +15 -5
- package/api/icon/search/search.mjs +74 -16
- package/api/icon/use/use.mjs +4 -4
- package/api/render/_adapter.mjs +233 -40
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.mjs +4 -0
- package/api/search/_candidate-score.mjs +32 -8
- package/api/search/_cards.json +1 -1
- package/api/search/_compound.d.mts +0 -1
- package/api/search/_compound.mjs +93 -2
- package/api/search/_icons.d.mts +4 -2
- package/api/search/_icons.mjs +4 -2
- package/api/search/_lexical.mjs +177 -17
- package/api/search/_order.d.mts +3 -1
- package/api/search/_order.mjs +16 -5
- package/api/search/_result.d.mts +9 -0
- package/api/search/_result.mjs +10 -0
- package/api/search/_score.mjs +21 -3
- package/api/swizzle/_moduleGraph.d.mts +8 -0
- package/api/swizzle/_moduleGraph.mjs +61 -3
- package/api/template/copy/copy.mjs +5 -3
- package/api/template/template.type.d.mts +3 -3
- package/api/template/template.type.mjs +3 -3
- package/api/theme/_adapter.mjs +48 -12
- package/api/theme/build/build.d.mts +4 -0
- package/api/theme/build/build.mjs +69 -18
- package/api/theme/build/style-keys.mjs +4 -5
- package/api/theme/build/theme-object.mjs +5 -0
- package/api/theme/palette/generate/color.d.mts +47 -0
- package/api/theme/palette/generate/color.mjs +58 -1
- package/api/theme/palette/generate/derive-look.d.mts +293 -0
- package/api/theme/palette/generate/derive-look.mjs +1362 -0
- package/api/theme/palette/generate/editor-look.d.mts +62 -0
- package/api/theme/palette/generate/editor-look.mjs +550 -0
- package/api/theme/palette/generate/mapping.d.mts +94 -9
- package/api/theme/palette/generate/mapping.mjs +94 -22
- package/api/theme-edit/_adapter.mjs +13 -2
- package/api/theme-edit/_catalog.d.mts +13 -13
- package/api/theme-edit/_catalog.mjs +66 -28
- package/api/theme-edit/_check.d.mts +82 -6
- package/api/theme-edit/_check.mjs +1270 -238
- package/api/theme-edit/_color.d.mts +74 -0
- package/api/theme-edit/_color.mjs +168 -3
- package/api/theme-edit/_compiler.d.mts +3 -5
- package/api/theme-edit/_compiler.mjs +122 -23
- package/api/theme-edit/_context.d.mts +55 -12
- package/api/theme-edit/_context.mjs +114 -60
- package/api/theme-edit/_css.d.mts +11 -0
- package/api/theme-edit/_css.mjs +40 -0
- package/api/theme-edit/_edit.d.mts +15 -2
- package/api/theme-edit/_edit.mjs +1469 -133
- package/api/theme-edit/_how-commands.d.mts +116 -0
- package/api/theme-edit/_how-commands.mjs +227 -115
- package/api/theme-edit/_how-question.d.mts +74 -29
- package/api/theme-edit/_how-question.mjs +8514 -1256
- package/api/theme-edit/_how-sides.d.mts +22 -0
- package/api/theme-edit/_how-sides.mjs +173 -0
- package/api/theme-edit/_how-steps.d.mts +42 -0
- package/api/theme-edit/_how-steps.mjs +208 -0
- package/api/theme-edit/_how-values.d.mts +29 -0
- package/api/theme-edit/_how-values.mjs +111 -0
- package/api/theme-edit/_how-words.d.mts +15 -0
- package/api/theme-edit/_how-words.mjs +239 -0
- package/api/theme-edit/_how.d.mts +1 -1
- package/api/theme-edit/_how.mjs +422 -37
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +125 -13
- package/api/theme-edit/_normal.d.mts +5 -3
- package/api/theme-edit/_normal.mjs +54 -14
- package/api/theme-edit/_palette.d.mts +204 -4
- package/api/theme-edit/_palette.mjs +901 -25
- package/api/theme-edit/_part-pieces.d.mts +54 -0
- package/api/theme-edit/_part-pieces.mjs +179 -0
- package/api/theme-edit/_part-words.mjs +33 -5
- package/api/theme-edit/_parts.d.mts +133 -0
- package/api/theme-edit/_parts.mjs +599 -10
- package/api/theme-edit/_picture-traits.d.mts +259 -0
- package/api/theme-edit/_picture-traits.mjs +1030 -0
- package/api/theme-edit/_preview.d.mts +95 -4
- package/api/theme-edit/_preview.mjs +284 -31
- package/api/theme-edit/_project.d.mts +14 -4
- package/api/theme-edit/_project.mjs +95 -26
- package/api/theme-edit/_resolved.d.mts +46 -0
- package/api/theme-edit/_resolved.mjs +800 -0
- package/api/theme-edit/_set-line.d.mts +29 -0
- package/api/theme-edit/_set-line.mjs +100 -0
- package/api/theme-edit/_settings.d.mts +625 -28
- package/api/theme-edit/_settings.mjs +4867 -888
- package/api/theme-edit/_tables.d.mts +25 -1
- package/api/theme-edit/_tables.mjs +115 -11
- package/api/theme-edit/_text-looks.d.mts +78 -0
- package/api/theme-edit/_text-looks.mjs +376 -0
- package/api/theme-edit/_vet.d.mts +3 -26
- package/api/theme-edit/_vet.mjs +5 -89
- package/api/theme-edit/how/how.d.mts +1 -1
- package/api/theme-edit/how/how.mjs +1 -1
- package/api/theme-edit/show/show.d.mts +4 -3
- package/api/theme-edit/show/show.mjs +3 -2
- package/api/theme-edit/theme-edit.type.d.mts +117 -1
- package/api/theme-edit/theme-edit.type.mjs +46 -3
- package/api/theme-edit/themeEditHow.doc.mjs +3 -3
- package/api/theme-edit/themeEditNew.doc.mjs +4 -0
- package/api/theme-edit/themeEditSet.doc.mjs +6 -2
- package/api/theme-edit/themeEditShow.doc.mjs +22 -3
- package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/author-a-theme.doc.mjs +7 -4
- package/assets/docs/icons.doc.mjs +7 -6
- package/assets/docs/theme.doc.dense.mjs +10 -0
- package/assets/docs/theme.doc.mjs +10 -0
- package/assets/docs/theme.doc.zh.mjs +10 -0
- package/assets/docs/tree/export-pages.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +89 -17
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/article.doc.mjs +9 -0
- package/assets/icons/template-icons.json +5 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ide/page.tsx +5 -10
- package/assets/templates/pages/payment-form/page.tsx +16 -60
- package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
- package/authoring/config/parse.mjs +1 -1
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +13 -13
- package/authoring/doctypes/icon-definition/parse.mjs +2 -2
- package/authoring/doctypes/icon-set/parse.mjs +1 -1
- package/authoring/doctypes/template/parse.mjs +1 -4
- package/authoring/gap-report/parse.d.mts +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/ensure-core-built.mjs +17 -10
- package/clients/cli/commands/experimental/icon.mjs +7 -7
- package/clients/cli/commands/experimental/theme.mjs +175 -13
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/hook.mjs +7 -0
- package/clients/cli/commands/template.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/index.mjs +6 -2
- package/clients/cli/lib/hook-format.mjs +41 -1
- package/clients/cli/lib/json-shim.mjs +34 -14
- package/clients/cli/lib/other-cli-words.mjs +7 -0
- package/clients/cli/lib/unknown-command.mjs +345 -46
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +11 -2
- package/foundation/agent-docs/agent-docs.mjs +51 -8
- package/foundation/config/project.d.mts +11 -1
- package/foundation/config/project.mjs +11 -2
- package/foundation/discovery/component-replacement.d.mts +5 -8
- package/foundation/discovery/component-replacement.mjs +12 -14
- package/foundation/discovery/core-augmentation-points.d.mts +35 -0
- package/foundation/discovery/core-augmentation-points.mjs +410 -9
- package/foundation/discovery/core-elements.d.mts +6 -0
- package/foundation/discovery/core-elements.mjs +10 -2
- package/foundation/discovery/core-prop-types.d.mts +5 -0
- package/foundation/discovery/core-prop-types.mjs +10 -3
- package/foundation/discovery/core-props.d.mts +8 -0
- package/foundation/discovery/core-props.mjs +29 -13
- package/foundation/discovery/icon-ranking.d.mts +5 -2
- package/foundation/discovery/icon-ranking.mjs +101 -18
- package/foundation/discovery/icon-set-checks.mjs +1 -1
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/official-list.d.mts +17 -0
- package/foundation/discovery/official-list.mjs +77 -0
- package/foundation/discovery/template-icon-notes.mjs +3 -3
- package/foundation/discovery/template-icons.mjs +2 -2
- package/foundation/discovery/template-placeholders.mjs +1 -1
- package/foundation/discovery/unknown-core-props.d.mts +130 -0
- package/foundation/discovery/unknown-core-props.mjs +601 -0
- package/foundation/discovery/written-prop-values.d.mts +35 -0
- package/foundation/discovery/written-prop-values.mjs +258 -0
- package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
- package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
- package/foundation/fs/package-name.d.mts +10 -0
- package/foundation/fs/package-name.mjs +37 -0
- package/foundation/fs/project-source-files.d.mts +27 -0
- package/foundation/fs/project-source-files.mjs +115 -0
- package/foundation/fs/project-sources.d.mts +25 -0
- package/foundation/fs/project-sources.mjs +83 -0
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +36 -2
- package/foundation/integrations/integration-warnings.d.mts +39 -7
- package/foundation/integrations/integration-warnings.mjs +141 -19
- package/foundation/integrations/missing-dependency.d.mts +11 -0
- package/foundation/integrations/missing-dependency.mjs +20 -5
- package/foundation/release/folder-lock.d.mts +5 -2
- package/foundation/release/folder-lock.mjs +9 -3
- package/foundation/release/notices.mjs +2 -8
- package/foundation/render/cut-short.d.mts +8 -2
- package/foundation/render/cut-short.mjs +50 -5
- package/foundation/render/drawn-contrast.d.mts +40 -0
- package/foundation/render/drawn-contrast.mjs +355 -0
- package/foundation/render/file-header.mjs +4 -0
- package/foundation/render/layers.d.mts +2 -1
- package/foundation/render/layers.mjs +22 -1
- package/foundation/render/package-resolve-hooks.d.mts +38 -9
- package/foundation/render/package-resolve-hooks.mjs +124 -32
- package/foundation/render/page-worker.mjs +95 -23
- package/foundation/render/part-boxes.d.mts +27 -0
- package/foundation/render/part-boxes.mjs +45 -0
- package/foundation/render/picture-chrome.mjs +36 -4
- package/foundation/render/picture-playwright.mjs +26 -2
- package/foundation/render/picture-window.d.mts +29 -2
- package/foundation/render/picture-window.mjs +99 -1
- package/foundation/render/render-page.d.mts +39 -6
- package/foundation/render/render-page.mjs +26 -10
- package/foundation/render/ts-paths.mjs +2 -1
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +9 -5
- package/foundation/suggest/other-command.mjs +25 -1
- package/foundation/text/icon-set-next.d.mts +1 -1
- package/foundation/text/icon-set-next.mjs +2 -2
- package/foundation/text/written-string.d.mts +4 -1
- package/foundation/text/written-string.mjs +4 -1
- package/package.json +8 -7
|
@@ -22,8 +22,12 @@ import * as os from 'node:os';
|
|
|
22
22
|
import * as path from 'node:path';
|
|
23
23
|
import {pathToFileURL} from 'node:url';
|
|
24
24
|
import {CUT_SHORT_PREFIX, cutShortText} from './cut-short.mjs';
|
|
25
|
+
import {LOW_CONTRAST_PREFIX, lowContrastText} from './drawn-contrast.mjs';
|
|
26
|
+
import {PART_BOXES_PREFIX, partBoxes} from './part-boxes.mjs';
|
|
25
27
|
import {NETWORK_URL_PATTERNS, QUIET_BROWSER_ARGS} from './offline.mjs';
|
|
26
28
|
import {
|
|
29
|
+
FIT_CELLS,
|
|
30
|
+
PLACE_LAYERS,
|
|
27
31
|
PICTURE_PAGES_AT_ONCE,
|
|
28
32
|
PICTURE_TAKEN,
|
|
29
33
|
PICTURE_WINDOW,
|
|
@@ -34,7 +38,7 @@ import {
|
|
|
34
38
|
import {FONT_PROBE_PREFIX, probeFonts} from './font-probe.mjs';
|
|
35
39
|
|
|
36
40
|
const [chrome, batch] = process.argv.slice(2);
|
|
37
|
-
/** @type {Array<{html: string, png: string, mode: string}>} */
|
|
41
|
+
/** @type {Array<{html: string, png: string, mode: string, boxes?: string[]}>} */
|
|
38
42
|
const jobs = JSON.parse(batch);
|
|
39
43
|
/** A line for one job of the batch. @param {number} i @param {string} line */
|
|
40
44
|
const say = (i, line) => process.stdout.write(`${i}\t${line}\n`);
|
|
@@ -155,10 +159,10 @@ function event(method, sessionId) {
|
|
|
155
159
|
/**
|
|
156
160
|
* One page of the batch in a tab of its own: drawn, pictured whole, and
|
|
157
161
|
* measured.
|
|
158
|
-
* @param {{html: string, png: string, mode: string}} job
|
|
162
|
+
* @param {{html: string, png: string, mode: string, boxes?: string[]}} job
|
|
159
163
|
* @param {number} i
|
|
160
164
|
*/
|
|
161
|
-
async function picture({html, png, mode}, i) {
|
|
165
|
+
async function picture({html, png, mode, boxes}, i) {
|
|
162
166
|
// Each page in a window of its own: a page in a background tab runs
|
|
163
167
|
// no animation frames, so a chart drawn over frames never finishes.
|
|
164
168
|
const {targetId} = await send('Target.createTarget', {url: 'about:blank', newWindow: true});
|
|
@@ -198,6 +202,10 @@ async function picture({html, png, mode}, i) {
|
|
|
198
202
|
// page loads: it is run to its end, and a looping one held at a frame a
|
|
199
203
|
// person sees (SETTLE_ANIMATIONS), before the picture.
|
|
200
204
|
await send('Runtime.evaluate', {expression: SETTLE_ANIMATIONS}, sessionId);
|
|
205
|
+
// Text a part cuts when narrow gets the room it needs (FIT_CELLS).
|
|
206
|
+
await send('Runtime.evaluate', {expression: FIT_CELLS}, sessionId);
|
|
207
|
+
// An overlay drawn after its part sits under its opener (PLACE_LAYERS).
|
|
208
|
+
await send('Runtime.evaluate', {expression: PLACE_LAYERS}, sessionId);
|
|
201
209
|
const metrics = await send('Page.getLayoutMetrics', {}, sessionId);
|
|
202
210
|
const size = metrics.cssContentSize ?? metrics.contentSize;
|
|
203
211
|
// A picture beyond the window makes the page see a resize; a part that
|
|
@@ -213,7 +221,9 @@ async function picture({html, png, mode}, i) {
|
|
|
213
221
|
clip: {
|
|
214
222
|
x: 0,
|
|
215
223
|
y: 0,
|
|
216
|
-
|
|
224
|
+
// The whole page: a part wider than the window (the page lays it out
|
|
225
|
+
// past the window's edge) is pictured whole, never cut at it.
|
|
226
|
+
width: Math.max(PICTURE_WINDOW.width, Math.ceil(size.width)),
|
|
217
227
|
height: Math.max(1, Math.ceil(size.height)),
|
|
218
228
|
scale: 1,
|
|
219
229
|
},
|
|
@@ -237,6 +247,28 @@ async function picture({html, png, mode}, i) {
|
|
|
237
247
|
).catch(() => null);
|
|
238
248
|
if (Array.isArray(measured?.result?.value) && !measured.exceptionDetails)
|
|
239
249
|
say(i, `${CUT_SHORT_PREFIX}${JSON.stringify(measured.result.value)}`);
|
|
250
|
+
// The text the picture draws too faint to read, measured the same way.
|
|
251
|
+
const faint = await send(
|
|
252
|
+
'Runtime.evaluate',
|
|
253
|
+
{expression: `(${lowContrastText})()`, returnByValue: true},
|
|
254
|
+
sessionId,
|
|
255
|
+
).catch(() => null);
|
|
256
|
+
if (Array.isArray(faint?.result?.value) && !faint.exceptionDetails)
|
|
257
|
+
say(i, `${LOW_CONTRAST_PREFIX}${JSON.stringify(faint.result.value)}`);
|
|
258
|
+
// The size of each part the job names, for a check that compares two
|
|
259
|
+
// pictures' boxes.
|
|
260
|
+
if (boxes?.length) {
|
|
261
|
+
const sized = await send(
|
|
262
|
+
'Runtime.evaluate',
|
|
263
|
+
{
|
|
264
|
+
expression: `(${partBoxes})(${JSON.stringify(boxes)})`,
|
|
265
|
+
returnByValue: true,
|
|
266
|
+
},
|
|
267
|
+
sessionId,
|
|
268
|
+
).catch(() => null);
|
|
269
|
+
if (sized?.result?.value && !sized.exceptionDetails)
|
|
270
|
+
say(i, `${PART_BOXES_PREFIX}${JSON.stringify(sized.result.value)}`);
|
|
271
|
+
}
|
|
240
272
|
await send('Target.closeTarget', {targetId}).catch(() => {});
|
|
241
273
|
say(i, PICTURE_TAKEN);
|
|
242
274
|
}
|
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
import {pathToFileURL} from 'node:url';
|
|
19
19
|
import {CUT_SHORT_PREFIX, cutShortText} from './cut-short.mjs';
|
|
20
|
+
import {LOW_CONTRAST_PREFIX, lowContrastText} from './drawn-contrast.mjs';
|
|
21
|
+
import {PART_BOXES_PREFIX, partBoxes} from './part-boxes.mjs';
|
|
20
22
|
import {LOCAL_URL, QUIET_BROWSER_ARGS} from './offline.mjs';
|
|
21
23
|
import {
|
|
24
|
+
FIT_CELLS,
|
|
25
|
+
PLACE_LAYERS,
|
|
22
26
|
PICTURE_PAGES_AT_ONCE,
|
|
23
27
|
PICTURE_TAKEN,
|
|
24
28
|
PICTURE_WINDOW,
|
|
@@ -29,7 +33,7 @@ import {
|
|
|
29
33
|
import {FONT_PROBE_PREFIX, probeFonts} from './font-probe.mjs';
|
|
30
34
|
|
|
31
35
|
const [entry, batch, executablePath] = process.argv.slice(2);
|
|
32
|
-
/** @type {Array<{html: string, png: string, mode: string}>} */
|
|
36
|
+
/** @type {Array<{html: string, png: string, mode: string, boxes?: string[]}>} */
|
|
33
37
|
const jobs = JSON.parse(batch);
|
|
34
38
|
/** A line for one job of the batch. @param {number} i @param {string} line */
|
|
35
39
|
const say = (i, line) => process.stdout.write(`${i}\t${line}\n`);
|
|
@@ -46,7 +50,7 @@ try {
|
|
|
46
50
|
await eachAtOnce(
|
|
47
51
|
jobs,
|
|
48
52
|
PICTURE_PAGES_AT_ONCE,
|
|
49
|
-
async ({html, png, mode}, i) => {
|
|
53
|
+
async ({html, png, mode, boxes}, i) => {
|
|
50
54
|
const page = await browser.newPage({
|
|
51
55
|
viewport: {...PICTURE_WINDOW},
|
|
52
56
|
colorScheme: mode === 'dark' ? 'dark' : 'light',
|
|
@@ -68,6 +72,10 @@ try {
|
|
|
68
72
|
// Playwright's own animations: 'disabled' would put a looping one
|
|
69
73
|
// back at its first frame, where a skeleton is faint.
|
|
70
74
|
await page.evaluate(SETTLE_ANIMATIONS);
|
|
75
|
+
// Text a part cuts when narrow gets the room it needs (FIT_CELLS).
|
|
76
|
+
await page.evaluate(FIT_CELLS);
|
|
77
|
+
// An overlay drawn after its part sits under its opener (PLACE_LAYERS).
|
|
78
|
+
await page.evaluate(PLACE_LAYERS);
|
|
71
79
|
// A whole-page picture makes the page see a resize; a part that
|
|
72
80
|
// redraws on it (a responsive chart) would start over and be
|
|
73
81
|
// pictured empty. The page's script is held while it is taken.
|
|
@@ -93,6 +101,22 @@ try {
|
|
|
93
101
|
} catch {
|
|
94
102
|
// Not measured.
|
|
95
103
|
}
|
|
104
|
+
// The text the picture draws too faint to read, the same way.
|
|
105
|
+
try {
|
|
106
|
+
const faint = await page.evaluate(lowContrastText);
|
|
107
|
+
say(i, `${LOW_CONTRAST_PREFIX}${JSON.stringify(faint)}`);
|
|
108
|
+
} catch {
|
|
109
|
+
// Not measured.
|
|
110
|
+
}
|
|
111
|
+
// The size of each part the job names, for a check that compares
|
|
112
|
+
// two pictures' boxes.
|
|
113
|
+
if (boxes?.length)
|
|
114
|
+
try {
|
|
115
|
+
const sized = await page.evaluate(partBoxes, boxes);
|
|
116
|
+
say(i, `${PART_BOXES_PREFIX}${JSON.stringify(sized)}`);
|
|
117
|
+
} catch {
|
|
118
|
+
// Not measured.
|
|
119
|
+
}
|
|
96
120
|
await page.close?.().catch(() => {});
|
|
97
121
|
say(i, PICTURE_TAKEN);
|
|
98
122
|
},
|
|
@@ -41,11 +41,13 @@ export function desktopMatches(query: string, { sure }?: {
|
|
|
41
41
|
/**
|
|
42
42
|
* The script run on a page before its picture: each animation that ends (an
|
|
43
43
|
* overlay's fade-in) is run to its end, so the picture shows the part as it
|
|
44
|
-
* looks once it has played
|
|
44
|
+
* looks once it has played, except a part drawn pressed, whose press
|
|
45
|
+
* animation (a flash that fades) is held at its start, the moment of the
|
|
46
|
+
* press; each that loops (a skeleton's shimmer, a pulsing
|
|
45
47
|
* dot, a spinner) is held at the middle of its first round, a frame a person
|
|
46
48
|
* sees as it plays, never its first frame, where a part can be faint or gone.
|
|
47
49
|
*/
|
|
48
|
-
export const SETTLE_ANIMATIONS: "for (const a of document.getAnimations()) {\n const t = a.effect?.getComputedTiming();\n if (!t) continue;\n if (t.iterations !== Infinity) { a.finish(); continue; }\n a.pause();\n a.currentTime = (Number(a.effect.getTiming().delay) || 0) + (typeof t.duration === 'number' ? t.duration : 0) / 2;\n}";
|
|
50
|
+
export const SETTLE_ANIMATIONS: "for (const a of document.getAnimations()) {\n const t = a.effect?.getComputedTiming();\n if (!t) continue;\n if (typeof CSSAnimation === 'function' && a instanceof CSSAnimation && t.iterations !== Infinity && a.effect.target?.closest?.('[data-astryx-state~=\"active\"]')) { a.pause(); a.currentTime = Number(a.effect.getTiming().delay) || 0; continue; }\n if (t.iterations !== Infinity) { a.finish(); continue; }\n a.pause();\n a.currentTime = (Number(a.effect.getTiming().delay) || 0) + (typeof t.duration === 'number' ? t.duration : 0) / 2;\n}";
|
|
49
51
|
/**
|
|
50
52
|
* The script run before the picture: it waits until the page stops
|
|
51
53
|
* changing, so a part drawn over animation frames (a responsive chart's
|
|
@@ -61,6 +63,31 @@ export const AWAIT_QUIET: "new Promise(resolve => {\n const QUIET_MS = 300;\n
|
|
|
61
63
|
export const PICTURE_TAKEN: "taken";
|
|
62
64
|
/** How many pages of a batch a picture script draws at once. */
|
|
63
65
|
export const PICTURE_PAGES_AT_ONCE: 3;
|
|
66
|
+
/**
|
|
67
|
+
* The script run on a sheet before its picture: text a part cuts with an
|
|
68
|
+
* ellipsis when it is narrow (a stepper's step names, a section heading)
|
|
69
|
+
* gets the room it needs, and so does a row that scrolls sideways (a
|
|
70
|
+
* carousel's slides), so its picture shows every item and cuts none at its
|
|
71
|
+
* edge. Each sheet item holding such text or row grows by what it lacks, a
|
|
72
|
+
* few rounds while the layout settles, up to the room an item has in a cell
|
|
73
|
+
* as wide as the sheet's content box (the sheet's width less its padding,
|
|
74
|
+
* the cell's padding and border, and the item's margins), so a grown cell
|
|
75
|
+
* stays inside the sheet and the picture keeps the window's width. A part
|
|
76
|
+
* whose own width is fixed keeps it, and what it still cuts is the theme's
|
|
77
|
+
* to fix. A page with no sheet items is left as it is.
|
|
78
|
+
*/
|
|
79
|
+
export const FIT_CELLS: "(() => {\n for (let round = 0; round < 4; round++) {\n let grew = false;\n for (const item of document.querySelectorAll('.cs-item')) {\n let need = 0;\n for (const el of item.querySelectorAll('*')) {\n // A text cut by less than a pixel still ends in an ellipsis. Text\n // drawn in no width at all (a label only a screen reader reads) is\n // not cut: no width given to it would show it.\n if (el.clientWidth < 2 || el.scrollWidth <= el.clientWidth) continue;\n const cs = getComputedStyle(el);\n const scrolls = /^(?:auto|scroll)$/.test(cs.overflowX);\n if (cs.textOverflow !== 'ellipsis' && !scrolls) continue;\n need = Math.max(need, el.scrollWidth - el.clientWidth + 1);\n }\n if (!need) continue;\n const width = item.getBoundingClientRect().width;\n const sheet = item.closest('.cs-sheet');\n if (!sheet) continue;\n const sides = (el, a, b) => {\n const s = getComputedStyle(el);\n return (parseFloat(s[a]) || 0) + (parseFloat(s[b]) || 0);\n };\n const cell = item.closest('.cs-cell');\n const most = Math.floor(\n sheet.clientWidth -\n sides(sheet, 'paddingLeft', 'paddingRight') -\n (cell\n ? sides(cell, 'paddingLeft', 'paddingRight') +\n sides(cell, 'borderLeftWidth', 'borderRightWidth')\n : 0) -\n sides(item, 'marginLeft', 'marginRight'),\n );\n const next = Math.min(Math.ceil(width + need), Math.max(most, width));\n if (next > width + 0.5) {\n item.style.minWidth = next + 'px';\n grew = true;\n }\n }\n if (!grew) break;\n }\n})()";
|
|
80
|
+
/**
|
|
81
|
+
* The script run on a sheet before its picture: an overlay drawn open
|
|
82
|
+
* after its part (a toolbar's menu) moves along the row to sit under the
|
|
83
|
+
* control that opens it, as a browser places it, as far as its item has
|
|
84
|
+
* room for what it draws. A flyout drawn beside its menu stays there. A
|
|
85
|
+
* panel as wide as the window is drawn as wide as its cell. A dialog drawn
|
|
86
|
+
* in its cell is not in the top layer, so the browser draws no backdrop
|
|
87
|
+
* for it: one with no background of its own (a lightbox, its controls
|
|
88
|
+
* drawn for the dark backdrop) gets its backdrop's colour as its own.
|
|
89
|
+
*/
|
|
90
|
+
export const PLACE_LAYERS: "(() => {\n for (const layer of document.querySelectorAll('.cs-item [data-astryx-layer-root]')) {\n if (layer.parentElement?.closest('[data-astryx-layer-root], [data-astryx-layer-nest]')) continue;\n const item = layer.closest('.cs-item');\n const ids = [layer, ...layer.querySelectorAll('[id]')].map(e => e.id).filter(Boolean);\n const opener = [...item.querySelectorAll('[aria-controls]')].find(c => !layer.contains(c) && !c.closest('[data-astryx-layer-root]') && ids.includes(c.getAttribute('aria-controls')));\n if (!opener) continue;\n // The layer box spans its row; what it draws is its content, so the\n // room is measured from the content's right edge.\n const at = layer.getBoundingClientRect();\n const drawn = Math.max(at.left, ...[...layer.children].map(c => c.getBoundingClientRect().right));\n const shift = Math.min(opener.getBoundingClientRect().left - at.left, item.getBoundingClientRect().right - drawn);\n if (shift > 0.5) layer.style.setProperty('margin-inline-start', shift + 'px', 'important');\n }\n // A panel as wide as the window (a navigation drawer's dialog) is drawn as\n // wide as its cell: the window's width would stretch the cell, and the\n // page, past it.\n for (const dialog of document.querySelectorAll('.cs-cell dialog')) {\n if (dialog.getBoundingClientRect().width >= window.innerWidth - 0.5)\n dialog.style.setProperty('width', '100%', 'important');\n }\n const clear = color => /^transparent$|rgba\\([^)]*,\\s*0\\)$/.test(color.trim());\n for (const dialog of document.querySelectorAll('.cs-cell dialog')) {\n const backdrop = getComputedStyle(dialog, '::backdrop').backgroundColor;\n if (clear(getComputedStyle(dialog).backgroundColor) && backdrop && !clear(backdrop))\n dialog.style.setProperty('background-color', backdrop, 'important');\n }\n})()";
|
|
64
91
|
export const PICTURE_WINDOW: Readonly<{
|
|
65
92
|
width: 1280;
|
|
66
93
|
height: 900;
|
|
@@ -15,13 +15,16 @@
|
|
|
15
15
|
/**
|
|
16
16
|
* The script run on a page before its picture: each animation that ends (an
|
|
17
17
|
* overlay's fade-in) is run to its end, so the picture shows the part as it
|
|
18
|
-
* looks once it has played
|
|
18
|
+
* looks once it has played, except a part drawn pressed, whose press
|
|
19
|
+
* animation (a flash that fades) is held at its start, the moment of the
|
|
20
|
+
* press; each that loops (a skeleton's shimmer, a pulsing
|
|
19
21
|
* dot, a spinner) is held at the middle of its first round, a frame a person
|
|
20
22
|
* sees as it plays, never its first frame, where a part can be faint or gone.
|
|
21
23
|
*/
|
|
22
24
|
export const SETTLE_ANIMATIONS = `for (const a of document.getAnimations()) {
|
|
23
25
|
const t = a.effect?.getComputedTiming();
|
|
24
26
|
if (!t) continue;
|
|
27
|
+
if (typeof CSSAnimation === 'function' && a instanceof CSSAnimation && t.iterations !== Infinity && a.effect.target?.closest?.('[data-astryx-state~="active"]')) { a.pause(); a.currentTime = Number(a.effect.getTiming().delay) || 0; continue; }
|
|
25
28
|
if (t.iterations !== Infinity) { a.finish(); continue; }
|
|
26
29
|
a.pause();
|
|
27
30
|
a.currentTime = (Number(a.effect.getTiming().delay) || 0) + (typeof t.duration === 'number' ? t.duration : 0) / 2;
|
|
@@ -90,6 +93,101 @@ export async function eachAtOnce(jobs, atOnce, run) {
|
|
|
90
93
|
if (first) throw first.error;
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The script run on a sheet before its picture: text a part cuts with an
|
|
98
|
+
* ellipsis when it is narrow (a stepper's step names, a section heading)
|
|
99
|
+
* gets the room it needs, and so does a row that scrolls sideways (a
|
|
100
|
+
* carousel's slides), so its picture shows every item and cuts none at its
|
|
101
|
+
* edge. Each sheet item holding such text or row grows by what it lacks, a
|
|
102
|
+
* few rounds while the layout settles, up to the room an item has in a cell
|
|
103
|
+
* as wide as the sheet's content box (the sheet's width less its padding,
|
|
104
|
+
* the cell's padding and border, and the item's margins), so a grown cell
|
|
105
|
+
* stays inside the sheet and the picture keeps the window's width. A part
|
|
106
|
+
* whose own width is fixed keeps it, and what it still cuts is the theme's
|
|
107
|
+
* to fix. A page with no sheet items is left as it is.
|
|
108
|
+
*/
|
|
109
|
+
export const FIT_CELLS = `(() => {
|
|
110
|
+
for (let round = 0; round < 4; round++) {
|
|
111
|
+
let grew = false;
|
|
112
|
+
for (const item of document.querySelectorAll('.cs-item')) {
|
|
113
|
+
let need = 0;
|
|
114
|
+
for (const el of item.querySelectorAll('*')) {
|
|
115
|
+
// A text cut by less than a pixel still ends in an ellipsis. Text
|
|
116
|
+
// drawn in no width at all (a label only a screen reader reads) is
|
|
117
|
+
// not cut: no width given to it would show it.
|
|
118
|
+
if (el.clientWidth < 2 || el.scrollWidth <= el.clientWidth) continue;
|
|
119
|
+
const cs = getComputedStyle(el);
|
|
120
|
+
const scrolls = /^(?:auto|scroll)$/.test(cs.overflowX);
|
|
121
|
+
if (cs.textOverflow !== 'ellipsis' && !scrolls) continue;
|
|
122
|
+
need = Math.max(need, el.scrollWidth - el.clientWidth + 1);
|
|
123
|
+
}
|
|
124
|
+
if (!need) continue;
|
|
125
|
+
const width = item.getBoundingClientRect().width;
|
|
126
|
+
const sheet = item.closest('.cs-sheet');
|
|
127
|
+
if (!sheet) continue;
|
|
128
|
+
const sides = (el, a, b) => {
|
|
129
|
+
const s = getComputedStyle(el);
|
|
130
|
+
return (parseFloat(s[a]) || 0) + (parseFloat(s[b]) || 0);
|
|
131
|
+
};
|
|
132
|
+
const cell = item.closest('.cs-cell');
|
|
133
|
+
const most = Math.floor(
|
|
134
|
+
sheet.clientWidth -
|
|
135
|
+
sides(sheet, 'paddingLeft', 'paddingRight') -
|
|
136
|
+
(cell
|
|
137
|
+
? sides(cell, 'paddingLeft', 'paddingRight') +
|
|
138
|
+
sides(cell, 'borderLeftWidth', 'borderRightWidth')
|
|
139
|
+
: 0) -
|
|
140
|
+
sides(item, 'marginLeft', 'marginRight'),
|
|
141
|
+
);
|
|
142
|
+
const next = Math.min(Math.ceil(width + need), Math.max(most, width));
|
|
143
|
+
if (next > width + 0.5) {
|
|
144
|
+
item.style.minWidth = next + 'px';
|
|
145
|
+
grew = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!grew) break;
|
|
149
|
+
}
|
|
150
|
+
})()`;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The script run on a sheet before its picture: an overlay drawn open
|
|
154
|
+
* after its part (a toolbar's menu) moves along the row to sit under the
|
|
155
|
+
* control that opens it, as a browser places it, as far as its item has
|
|
156
|
+
* room for what it draws. A flyout drawn beside its menu stays there. A
|
|
157
|
+
* panel as wide as the window is drawn as wide as its cell. A dialog drawn
|
|
158
|
+
* in its cell is not in the top layer, so the browser draws no backdrop
|
|
159
|
+
* for it: one with no background of its own (a lightbox, its controls
|
|
160
|
+
* drawn for the dark backdrop) gets its backdrop's colour as its own.
|
|
161
|
+
*/
|
|
162
|
+
export const PLACE_LAYERS = `(() => {
|
|
163
|
+
for (const layer of document.querySelectorAll('.cs-item [data-astryx-layer-root]')) {
|
|
164
|
+
if (layer.parentElement?.closest('[data-astryx-layer-root], [data-astryx-layer-nest]')) continue;
|
|
165
|
+
const item = layer.closest('.cs-item');
|
|
166
|
+
const ids = [layer, ...layer.querySelectorAll('[id]')].map(e => e.id).filter(Boolean);
|
|
167
|
+
const opener = [...item.querySelectorAll('[aria-controls]')].find(c => !layer.contains(c) && !c.closest('[data-astryx-layer-root]') && ids.includes(c.getAttribute('aria-controls')));
|
|
168
|
+
if (!opener) continue;
|
|
169
|
+
// The layer box spans its row; what it draws is its content, so the
|
|
170
|
+
// room is measured from the content's right edge.
|
|
171
|
+
const at = layer.getBoundingClientRect();
|
|
172
|
+
const drawn = Math.max(at.left, ...[...layer.children].map(c => c.getBoundingClientRect().right));
|
|
173
|
+
const shift = Math.min(opener.getBoundingClientRect().left - at.left, item.getBoundingClientRect().right - drawn);
|
|
174
|
+
if (shift > 0.5) layer.style.setProperty('margin-inline-start', shift + 'px', 'important');
|
|
175
|
+
}
|
|
176
|
+
// A panel as wide as the window (a navigation drawer's dialog) is drawn as
|
|
177
|
+
// wide as its cell: the window's width would stretch the cell, and the
|
|
178
|
+
// page, past it.
|
|
179
|
+
for (const dialog of document.querySelectorAll('.cs-cell dialog')) {
|
|
180
|
+
if (dialog.getBoundingClientRect().width >= window.innerWidth - 0.5)
|
|
181
|
+
dialog.style.setProperty('width', '100%', 'important');
|
|
182
|
+
}
|
|
183
|
+
const clear = color => /^transparent$|rgba\\([^)]*,\\s*0\\)$/.test(color.trim());
|
|
184
|
+
for (const dialog of document.querySelectorAll('.cs-cell dialog')) {
|
|
185
|
+
const backdrop = getComputedStyle(dialog, '::backdrop').backgroundColor;
|
|
186
|
+
if (clear(getComputedStyle(dialog).backgroundColor) && backdrop && !clear(backdrop))
|
|
187
|
+
dialog.style.setProperty('background-color', backdrop, 'important');
|
|
188
|
+
}
|
|
189
|
+
})()`;
|
|
190
|
+
|
|
93
191
|
export const PICTURE_WINDOW = Object.freeze({width: 1280, height: 900});
|
|
94
192
|
|
|
95
193
|
/** The pointer of the window a picture is taken in. */
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A warning for each of the first five lines the page printed while it
|
|
6
|
+
* rendered.
|
|
7
|
+
* @param {{level: string, text: string}[]} logs
|
|
8
|
+
* @returns {RenderWarning[]}
|
|
9
|
+
*/
|
|
10
|
+
export function pageOutputWarnings(logs: {
|
|
11
|
+
level: string;
|
|
12
|
+
text: string;
|
|
13
|
+
}[]): RenderWarning[];
|
|
4
14
|
/**
|
|
5
15
|
* An `@import` rule's parts: what it loads, and the layer, supports() and
|
|
6
16
|
* media conditions that scope it.
|
|
@@ -232,9 +242,14 @@ export function renderPage(entry: string, options?: {
|
|
|
232
242
|
}): Promise<RenderedPage>;
|
|
233
243
|
/** How long one page may take to render before it is stopped. */
|
|
234
244
|
export const RENDER_TIMEOUT_MS: 60000;
|
|
245
|
+
/**
|
|
246
|
+
* The console line React prints for a prop that reaches a DOM element it
|
|
247
|
+
* does not know, with the prop's name.
|
|
248
|
+
*/
|
|
249
|
+
export const REACT_UNKNOWN_PROP: RegExp;
|
|
235
250
|
/**
|
|
236
251
|
* @typedef {object} RenderWarning
|
|
237
|
-
* @property {'dropped-children' | 'unknown-prop-value' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'not-carried' | 'node-crash'} code - What kind of problem.
|
|
252
|
+
* @property {'dropped-children' | 'unknown-prop' | 'props-not-checked' | 'unknown-prop-value' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'not-carried' | 'node-crash'} code - What kind of problem.
|
|
238
253
|
* @property {string} message - What happened and what to do, in one sentence.
|
|
239
254
|
*/
|
|
240
255
|
/**
|
|
@@ -249,7 +264,9 @@ export const RENDER_TIMEOUT_MS: 60000;
|
|
|
249
264
|
* @property {number} images - Local files inlined as data: URIs.
|
|
250
265
|
* @property {RenderWarning[]} warnings
|
|
251
266
|
* @property {string[]} [notCarried] - Files the page uses that the file does not carry, so experimental import cannot give them back (each also has a warning); present only when there are some.
|
|
252
|
-
* @property {{component: string, prop: string,
|
|
267
|
+
* @property {(import('../discovery/written-prop-values.mjs').WrittenValue & {component: string, prop: string, file: string, line: number})[]} [propValues] - What the page's own files certainly give a Core component's prop (the kinds of value and the strings among them), for the caller to check against the component's docs and types.
|
|
268
|
+
* @property {{level: string, text: string}[]} [logs] - What the page printed while it rendered, of which the `page-output` warnings show the first lines.
|
|
269
|
+
* @property {(import('../discovery/core-props.mjs').CorePropUse & {file: string, element: {line: number, column: number}})[]} [propNames] - Each prop the page's own files give a Core component by name, with the file's absolute path and where its element opens, for the caller to check against the component's docs and types.
|
|
253
270
|
* @property {{name: string, dir: string}[]} fromSet - Packages that came from the package set the CLI runs from, not the page's folder.
|
|
254
271
|
* @property {number} [scriptBytes] - Bytes of the page's script; none in a markup-only render.
|
|
255
272
|
* @property {number} [scriptModules] - The modules the page's script holds; none in a markup-only render.
|
|
@@ -302,7 +319,7 @@ export type RenderWarning = {
|
|
|
302
319
|
/**
|
|
303
320
|
* - What kind of problem.
|
|
304
321
|
*/
|
|
305
|
-
code: "dropped-children" | "unknown-prop-value" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "screen-query" | "not-embedded" | "not-carried" | "node-crash";
|
|
322
|
+
code: "dropped-children" | "unknown-prop" | "props-not-checked" | "unknown-prop-value" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "screen-query" | "not-embedded" | "not-carried" | "node-crash";
|
|
306
323
|
/**
|
|
307
324
|
* - What happened and what to do, in one sentence.
|
|
308
325
|
*/
|
|
@@ -347,15 +364,31 @@ export type RenderedPage = {
|
|
|
347
364
|
*/
|
|
348
365
|
notCarried?: string[] | undefined;
|
|
349
366
|
/**
|
|
350
|
-
* -
|
|
367
|
+
* - What the page's own files certainly give a Core component's prop (the kinds of value and the strings among them), for the caller to check against the component's docs and types.
|
|
351
368
|
*/
|
|
352
|
-
propValues?: {
|
|
369
|
+
propValues?: (import("../discovery/written-prop-values.mjs").WrittenValue & {
|
|
353
370
|
component: string;
|
|
354
371
|
prop: string;
|
|
355
|
-
value: string;
|
|
356
372
|
file: string;
|
|
357
373
|
line: number;
|
|
374
|
+
})[] | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* - What the page printed while it rendered, of which the `page-output` warnings show the first lines.
|
|
377
|
+
*/
|
|
378
|
+
logs?: {
|
|
379
|
+
level: string;
|
|
380
|
+
text: string;
|
|
358
381
|
}[] | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* - Each prop the page's own files give a Core component by name, with the file's absolute path and where its element opens, for the caller to check against the component's docs and types.
|
|
384
|
+
*/
|
|
385
|
+
propNames?: (import("../discovery/core-props.mjs").CorePropUse & {
|
|
386
|
+
file: string;
|
|
387
|
+
element: {
|
|
388
|
+
line: number;
|
|
389
|
+
column: number;
|
|
390
|
+
};
|
|
391
|
+
})[] | undefined;
|
|
359
392
|
/**
|
|
360
393
|
* - Packages that came from the package set the CLI runs from, not the page's folder.
|
|
361
394
|
*/
|
|
@@ -65,9 +65,28 @@ export const RENDER_TIMEOUT_MS = 60_000;
|
|
|
65
65
|
|
|
66
66
|
export {MODULE_EXTENSIONS, PAGE_EXTENSIONS} from './embedded-files.mjs';
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The console line React prints for a prop that reaches a DOM element it
|
|
70
|
+
* does not know, with the prop's name.
|
|
71
|
+
*/
|
|
72
|
+
export const REACT_UNKNOWN_PROP = /React does not recognize the `([^`]+)` prop|Unknown event handler property `([^`]+)`/;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A warning for each of the first five lines the page printed while it
|
|
76
|
+
* rendered.
|
|
77
|
+
* @param {{level: string, text: string}[]} logs
|
|
78
|
+
* @returns {RenderWarning[]}
|
|
79
|
+
*/
|
|
80
|
+
export function pageOutputWarnings(logs) {
|
|
81
|
+
return logs.slice(0, 5).map(log => ({
|
|
82
|
+
code: 'page-output',
|
|
83
|
+
message: `The page printed while rendering (${log.level}): ${log.text.split('\n')[0].slice(0, 200)}`,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
/**
|
|
69
88
|
* @typedef {object} RenderWarning
|
|
70
|
-
* @property {'dropped-children' | 'unknown-prop-value' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'not-carried' | 'node-crash'} code - What kind of problem.
|
|
89
|
+
* @property {'dropped-children' | 'unknown-prop' | 'props-not-checked' | 'unknown-prop-value' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'not-carried' | 'node-crash'} code - What kind of problem.
|
|
71
90
|
* @property {string} message - What happened and what to do, in one sentence.
|
|
72
91
|
*/
|
|
73
92
|
|
|
@@ -83,7 +102,9 @@ export {MODULE_EXTENSIONS, PAGE_EXTENSIONS} from './embedded-files.mjs';
|
|
|
83
102
|
* @property {number} images - Local files inlined as data: URIs.
|
|
84
103
|
* @property {RenderWarning[]} warnings
|
|
85
104
|
* @property {string[]} [notCarried] - Files the page uses that the file does not carry, so experimental import cannot give them back (each also has a warning); present only when there are some.
|
|
86
|
-
* @property {{component: string, prop: string,
|
|
105
|
+
* @property {(import('../discovery/written-prop-values.mjs').WrittenValue & {component: string, prop: string, file: string, line: number})[]} [propValues] - What the page's own files certainly give a Core component's prop (the kinds of value and the strings among them), for the caller to check against the component's docs and types.
|
|
106
|
+
* @property {{level: string, text: string}[]} [logs] - What the page printed while it rendered, of which the `page-output` warnings show the first lines.
|
|
107
|
+
* @property {(import('../discovery/core-props.mjs').CorePropUse & {file: string, element: {line: number, column: number}})[]} [propNames] - Each prop the page's own files give a Core component by name, with the file's absolute path and where its element opens, for the caller to check against the component's docs and types.
|
|
87
108
|
* @property {{name: string, dir: string}[]} fromSet - Packages that came from the package set the CLI runs from, not the page's folder.
|
|
88
109
|
* @property {number} [scriptBytes] - Bytes of the page's script; none in a markup-only render.
|
|
89
110
|
* @property {number} [scriptModules] - The modules the page's script holds; none in a markup-only render.
|
|
@@ -2452,14 +2473,7 @@ export async function renderPage(entry, options = {}) {
|
|
|
2452
2473
|
message: `The page imports ${sheet}, a Sass or Less stylesheet, which a render does not compile, so its styles are missing.`,
|
|
2453
2474
|
});
|
|
2454
2475
|
}
|
|
2455
|
-
|
|
2456
|
-
message.logs ?? []
|
|
2457
|
-
).slice(0, 5)) {
|
|
2458
|
-
warnings.push({
|
|
2459
|
-
code: 'page-output',
|
|
2460
|
-
message: `The page printed while rendering (${log.level}): ${log.text.split('\n')[0].slice(0, 200)}`,
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2476
|
+
warnings.push(...pageOutputWarnings(message.logs ?? []));
|
|
2463
2477
|
|
|
2464
2478
|
const files = /** @type {string[]} */ (message.files ?? [entry]);
|
|
2465
2479
|
if (!files.includes(entry)) files.unshift(entry);
|
|
@@ -2923,6 +2937,8 @@ export async function renderPage(entry, options = {}) {
|
|
|
2923
2937
|
warnings,
|
|
2924
2938
|
...(leftOut.length > 0 ? {notCarried: leftOut} : {}),
|
|
2925
2939
|
propValues: message.propValues ?? [],
|
|
2940
|
+
propNames: message.propNames ?? [],
|
|
2941
|
+
logs: message.logs ?? [],
|
|
2926
2942
|
fromSet: message.fromSet ?? [],
|
|
2927
2943
|
...(pageScript ? {scriptBytes: Buffer.byteLength(pageScript), scriptModules: message.scriptModules ?? 0} : {}),
|
|
2928
2944
|
...(remoteSummary && remoteSummary.fetched.length + remoteSummary.failed.length > 0 ? {remoteImages: remoteSummary} : {}),
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @position foundation/render — used by page-worker.mjs, embedded-imports.mjs,
|
|
19
19
|
* the theme build's module loader (api/theme/build/build.mjs), and Doctor's
|
|
20
|
-
* icon-imports
|
|
20
|
+
* icon-imports scan (api/doctor/_adapter.mjs), and the Core prop check of
|
|
21
|
+
* doctor and export (discovery/unknown-core-props.mjs)
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import * as fs from 'node:fs';
|
|
@@ -248,7 +248,7 @@ export const doc = {
|
|
|
248
248
|
{
|
|
249
249
|
value: 'ERR_DEP_MISSING',
|
|
250
250
|
description:
|
|
251
|
-
'A required external dependency (e.g. jscodeshift) is missing.',
|
|
251
|
+
'A required external dependency (e.g. jscodeshift) is missing, or an installed package needs a package it declares that is not installed (a broken install; installing again repairs it).',
|
|
252
252
|
},
|
|
253
253
|
|
|
254
254
|
// GitHub CLI
|
|
@@ -240,7 +240,7 @@ export const ERROR_CODES = Object.freeze({
|
|
|
240
240
|
ERR_VERSION_DETECT: 'ERR_VERSION_DETECT',
|
|
241
241
|
/** A `--from`/`--to` value was not a valid semver string. */
|
|
242
242
|
ERR_INVALID_VERSION: 'ERR_INVALID_VERSION',
|
|
243
|
-
/** A required external dependency (e.g. jscodeshift) is missing. */
|
|
243
|
+
/** A required external dependency (e.g. jscodeshift) is missing, or an installed package needs a package it declares that is not installed (a broken install). */
|
|
244
244
|
ERR_DEP_MISSING: 'ERR_DEP_MISSING',
|
|
245
245
|
|
|
246
246
|
// ── GitHub CLI ───────────────────────────────────────────────────
|
|
@@ -103,13 +103,11 @@ export const doc = {
|
|
|
103
103
|
|
|
104
104
|
{
|
|
105
105
|
value: 'docs.skills',
|
|
106
|
-
description:
|
|
107
|
-
'Each skill here: {name, description, package}[].',
|
|
106
|
+
description: 'Each skill here: {name, description, package}[].',
|
|
108
107
|
},
|
|
109
108
|
{
|
|
110
109
|
value: 'docs.skill',
|
|
111
|
-
description:
|
|
112
|
-
'One skill: {name, description, text}.',
|
|
110
|
+
description: 'One skill: {name, description, text}.',
|
|
113
111
|
},
|
|
114
112
|
|
|
115
113
|
// blog (read from the published RSS feed)
|
|
@@ -134,7 +132,7 @@ export const doc = {
|
|
|
134
132
|
value: 'themeEdit.set',
|
|
135
133
|
stability: 'experimental',
|
|
136
134
|
description:
|
|
137
|
-
'One checked change written: the `setting`, the one it `replaced`, `was` (for base and mode), the `parts` and `group` it styles, resolved `changedTokens`, part styles written (`styled`), part settings a dial `kept`, newly `lifted` variant keys, `notes`, contrast `problems`, `newProblems` (every problem this change made, each with the command that fixes it, measured against every problem the theme had before; the text shows the first eight and counts the rest), build `warnings`, what a whole-theme change leaves out (`leftOut`, each `note` with the lines that `run` it), how many misses the changes to the theme leave (`missed`), on how many parts (`missedParts`; a part can miss two ways, its border and its shadow) and which (`missedOn`), all left out when none (`show` lists each), the `preview` page and any `pictures`, and `sheetStale` when sheet.html (made by `show`) still shows the theme as it was before. Experimental: may change or be removed in a patch release.',
|
|
135
|
+
'One checked change written: the `setting`, the one it `replaced`, `was` (for base and mode), the `parts` and `group` it styles, resolved `changedTokens`, part styles written (`styled`), part settings a dial `kept`, newly `lifted` variant keys, `notes`, contrast `problems`, `newProblems` (every problem this change made, each with the command that fixes it, measured against every problem the theme had before; the text shows the first eight and counts the rest), the problems it moved but left failing (`leftProblems`, each with what it was and its fix, left out when none), build `warnings`, what a whole-theme change leaves out (`leftOut`, each `note` with the lines that `run` it), the open fonts it names that do not load until installed (`fontNotLoaded`, each `family` with the line that installs it, left out when none), how many misses the changes to the theme leave (`missed`), on how many parts (`missedParts`; a part can miss two ways, its border and its shadow) and which (`missedOn`), and how many of them this change brought (`missedNew`; the text says the missed line only then), all left out when none (`show` lists each), the `preview` page and any `pictures`, and `sheetStale` when sheet.html (made by `show`) still shows the theme as it was before. Experimental: may change or be removed in a patch release.',
|
|
138
136
|
},
|
|
139
137
|
{
|
|
140
138
|
value: 'themeEdit.show',
|
|
@@ -142,6 +140,12 @@ export const doc = {
|
|
|
142
140
|
description:
|
|
143
141
|
'Every `settings` entry with the `parts` it styles, key `resolved` token values (colors and shadows per mode, other values once), `openProblems` (every contrast problem the theme has now, each with the command that fixes it; the text shows the first eight and counts the rest), `partValues` (corners or spacing set on a part or group, with what its parts get beside the whole-theme value), `missed` (the parts the changes the theme makes did not reach, most flagged first, each with why and the line that reaches it), `unreached` (the parts with a fill of their own the theme leaves on the base look, most visible first: no setting on them and their fill or text color as the base gives it), the generated colors (`vibrancy`; `colors`, each with its `seed` and the shade each token uses in light and dark; `colorNotes` on shades moved for contrast), contrast `problems`, font `notes`, the `preview` and `sheet` pages, the `sheetComponents` count, template pages `skipped`, any `pictures` with the two to open (`look`, left out when none was taken), and last the generated color files (`colorFiles`; null with no color). Experimental: may change or be removed in a patch release.',
|
|
144
142
|
},
|
|
143
|
+
{
|
|
144
|
+
value: 'themeEdit.showPart',
|
|
145
|
+
stability: 'experimental',
|
|
146
|
+
description:
|
|
147
|
+
'What one part of a theme shows (`show <theme> --on <part>`, which writes nothing): the `theme`, its `kind` (editor, local, package or bundled), the `part`, and `values`: each CSS `property` at rest and per variant (`when`, `state`, as `set` takes them; `notSettable`, with why, for a condition no flag reaches), its final `value` (per mode when the modes differ), the `expression` that gives it (per mode when a rule sets one mode), the `tokens` it reads, and who decides it (`source`: core, base or theme; which setting gives it is not shown yet). Experimental: may change or be removed in a patch release.',
|
|
148
|
+
},
|
|
145
149
|
{
|
|
146
150
|
value: 'themeEdit.undo',
|
|
147
151
|
stability: 'experimental',
|
|
@@ -397,7 +397,8 @@ export async function findOtherCommand(
|
|
|
397
397
|
async () => ({
|
|
398
398
|
components:
|
|
399
399
|
coreDir && inCore.component
|
|
400
|
-
? (
|
|
400
|
+
? coreComponentNames(
|
|
401
|
+
await componentDiscovery(),
|
|
401
402
|
coreDir,
|
|
402
403
|
isWanted,
|
|
403
404
|
inCore.componentTops,
|
|
@@ -705,6 +706,29 @@ function componentDiscovery() {
|
|
|
705
706
|
return import('../discovery/component-discovery.mjs');
|
|
706
707
|
}
|
|
707
708
|
|
|
709
|
+
/**
|
|
710
|
+
* The Core components `keep` accepts that the component lookup opens: each
|
|
711
|
+
* one discovery lists, and each top folder of `tops` that the lookup opens
|
|
712
|
+
* by the folder's own doc, without a component file of that name (a family
|
|
713
|
+
* doc, such as a chat folder's).
|
|
714
|
+
* @param {typeof import('../discovery/component-discovery.mjs')} discovery
|
|
715
|
+
* @param {string} coreDir
|
|
716
|
+
* @param {(name: string) => boolean} keep
|
|
717
|
+
* @param {Set<string> | undefined} tops
|
|
718
|
+
* @returns {string[]}
|
|
719
|
+
*/
|
|
720
|
+
function coreComponentNames(discovery, coreDir, keep, tops) {
|
|
721
|
+
const names = discovery.discoverComponentNamesWhere(coreDir, keep, tops);
|
|
722
|
+
const opened = [...(tops ?? [])].filter(
|
|
723
|
+
top =>
|
|
724
|
+
keep(top) &&
|
|
725
|
+
!names.includes(top) &&
|
|
726
|
+
discovery.findComponentReadme(coreDir, top) ===
|
|
727
|
+
path.join(coreDir, 'src', top, `${top}.doc.mjs`),
|
|
728
|
+
);
|
|
729
|
+
return [...names, ...opened];
|
|
730
|
+
}
|
|
731
|
+
|
|
708
732
|
/**
|
|
709
733
|
* The integrations the project at `cwd` loads: those of the project this run
|
|
710
734
|
* already loaded, else a fresh load. Where none can load, the project's
|
|
@@ -18,7 +18,7 @@ export function noIconSetNext(discoverListsPacks: boolean): string;
|
|
|
18
18
|
* @output The sentence, and the commands for suggestions
|
|
19
19
|
* @position packages/cli/foundation/text — read by the `icon` leaves
|
|
20
20
|
*/
|
|
21
|
-
/** The discover query that finds the icon
|
|
21
|
+
/** The discover query that finds the icon sets a project could add. */
|
|
22
22
|
export const ICON_PACK_QUERY: "icon set";
|
|
23
23
|
/** The command that makes an installed set the project's main set. */
|
|
24
24
|
export const ICON_USE_COMMAND: "astryx experimental icon use <set>";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @position packages/cli/foundation/text — read by the `icon` leaves
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/** The discover query that finds the icon
|
|
12
|
+
/** The discover query that finds the icon sets a project could add. */
|
|
13
13
|
export const ICON_PACK_QUERY = 'icon set';
|
|
14
14
|
|
|
15
15
|
/** The discover search the sentence names. */
|
|
@@ -32,6 +32,6 @@ export const ICON_SET_GUIDE_COMMAND = 'astryx docs cli/experimental/icon-sets';
|
|
|
32
32
|
export function noIconSetNext(discoverListsPacks) {
|
|
33
33
|
const use = `then run \`${ICON_USE_COMMAND}\`. To make your own set, read \`${ICON_SET_GUIDE_COMMAND}\`.`;
|
|
34
34
|
return discoverListsPacks
|
|
35
|
-
? `Find an icon
|
|
35
|
+
? `Find an icon set with \`${ICON_PACK_FIND_COMMAND}\`, install it, ${use}`
|
|
36
36
|
: `Install a package that ships an icon set, ${use}`;
|
|
37
37
|
}
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
* @output Its string, or null when it writes none as it is.
|
|
9
9
|
* @position Read by the module readers that take an import's specifier
|
|
10
10
|
* (foundation/discovery/template-needs.mjs,
|
|
11
|
-
* foundation/render/embedded-imports.mjs),
|
|
11
|
+
* foundation/render/embedded-imports.mjs), by doctor's button-action reader
|
|
12
|
+
* (foundation/discovery/button-actions.mjs) and by the export's prop-value
|
|
13
|
+
* reader (foundation/discovery/written-prop-values.mjs), so all read one
|
|
14
|
+
* rule.
|
|
12
15
|
*/
|
|
13
16
|
/**
|
|
14
17
|
* @param {any} node
|