astralis-devtools 0.1.0 → 0.3.0

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.
@@ -17,6 +17,13 @@ export function scanPage(root, skip = null) {
17
17
  return instances;
18
18
  }
19
19
 
20
+ /**
21
+ * Whether an element is part of the page as it stands. React keeps a page left
22
+ * by client-side navigation in the document, hidden this way, where the app
23
+ * turns that on (Next.js cacheComponents).
24
+ */
25
+ export const isOnPage = (element) => element.isConnected && !element.closest('[style*="display: none !important"]');
26
+
20
27
  /** The instances grouped by the component they are, most used first, then by name. */
21
28
  export function groupByComponent(instances) {
22
29
  const groups = new Map();
@@ -0,0 +1,154 @@
1
+ import { specEntry } from "astralis-cli/snapshot";
2
+
3
+ /* Every prop a component takes, read from the system spec: its own props
4
+ first, then its style props by group. Pure, so it runs in the overlay and
5
+ in Node tests alike. */
6
+
7
+ const GROUP_LABELS = {
8
+ box: { label: "Box", hint: "spacing, size, paint, border, layout" },
9
+ flex: { label: "Flex", hint: "direction, wrap, alignment, gap" },
10
+ flexItem: { label: "Flex item", hint: "grow, shrink, basis, order" },
11
+ grid: { label: "Grid", hint: "columns, rows, flow, gap" },
12
+ gridItem: { label: "Grid item", hint: "spans and placement" },
13
+ text: { label: "Text", hint: "size, weight, colour, alignment" },
14
+ stack: { label: "Stack", hint: "direction, gap, alignment" },
15
+ placement: { label: "Placement", hint: "size, margin, position, motion" },
16
+ };
17
+
18
+ /**
19
+ * The spec lists some components' style props by name instead of by group
20
+ * (List, Code, Separator; Stat, Select and others): when nearly all of a
21
+ * group's names are there, they are shown as that group.
22
+ */
23
+ const GROUP_COVERAGE = 0.9;
24
+
25
+ const docsOf = (entry, name) => {
26
+ const docs = entry.propDocs?.[name];
27
+ if (!docs || typeof docs !== "object") return {};
28
+ return {
29
+ ...(typeof docs.description === "string" && docs.description.trim() ? { description: docs.description.trim() } : {}),
30
+ ...(typeof docs.default === "string" && docs.default.trim() ? { default: docs.default.trim() } : {}),
31
+ };
32
+ };
33
+
34
+ /** The props of one group, long spellings folded into their short name ("padding" into "p"). */
35
+ function groupRows(definitions, names, taken) {
36
+ const rows = new Map();
37
+ for (const name of names) {
38
+ const definition = definitions[name];
39
+ if (!definition || taken.has(name)) continue;
40
+ const short = definition.short && names.includes(definition.short) && !taken.has(definition.short) ? definition.short : null;
41
+ if (short) {
42
+ if (!rows.has(short)) rows.set(short, null);
43
+ continue;
44
+ }
45
+ rows.set(name, {
46
+ name,
47
+ aliases: [],
48
+ values: Array.isArray(definition.tokens) ? definition.tokens.map(String) : [],
49
+ type: null,
50
+ arbitrary: definition.arbitrary ? definition.valueType ?? "value" : null,
51
+ });
52
+ }
53
+ for (const name of names) {
54
+ const definition = definitions[name];
55
+ if (definition?.short && rows.get(definition.short)) rows.get(definition.short).aliases.push(name);
56
+ }
57
+ for (const [name, row] of rows) {
58
+ if (!row) rows.delete(name);
59
+ }
60
+ for (const row of rows.values()) for (const name of [row.name, ...row.aliases]) taken.add(name);
61
+ return [...rows.values()];
62
+ }
63
+
64
+ /**
65
+ * The props `name` takes, as sections of rows. `used` is the props this
66
+ * instance was given; a row it uses carries `used: { as, value }`. Returns
67
+ * null when the spec has no entry for the name.
68
+ *
69
+ * { key, total, sections: [{ id, label, hint, inferred?, rows: [
70
+ * { name, aliases, values, type, arbitrary, required, note?, description?, default?, used } ] }] }
71
+ */
72
+ export function propsModel(spec, name, used = {}) {
73
+ const found = specEntry(spec, name);
74
+ if (!found) return null;
75
+ const { key, entry } = found;
76
+ const groups = spec.propGroups ?? {};
77
+ const closed = entry.props ?? {};
78
+ const scalars = entry.scalarProps ?? {};
79
+ const required = entry.required ?? {};
80
+ const overrides = entry.overrides ?? [];
81
+ const exclude = new Set(entry.exclude ?? []);
82
+ const inGroups = new Set((entry.groups ?? []).flatMap((group) => Object.keys(groups[group] ?? {})));
83
+
84
+ const ownNames = [...new Set([...Object.keys(closed), ...Object.keys(scalars), ...Object.keys(required), ...overrides])];
85
+ let stray = (entry.ownStyleProps ?? []).filter((prop) => !ownNames.includes(prop) && !inGroups.has(prop) && !exclude.has(prop));
86
+
87
+ const taken = new Set(ownNames);
88
+ const sections = [];
89
+ const groupSection = (group, names, inferred) => {
90
+ const rows = groupRows(groups[group], names, taken);
91
+ if (rows.length) sections.push({ id: `group:${group}`, label: GROUP_LABELS[group]?.label ?? group, hint: GROUP_LABELS[group]?.hint ?? "", ...(inferred ? { inferred: true } : {}), rows });
92
+ };
93
+
94
+ for (const group of entry.groups ?? []) {
95
+ if (groups[group]) groupSection(group, Object.keys(groups[group]).filter((prop) => !exclude.has(prop)), false);
96
+ }
97
+ // Largest first: placement's names include all of flexItem's, and must claim them.
98
+ const bySize = Object.entries(groups).sort(([, a], [, b]) => Object.keys(b).length - Object.keys(a).length);
99
+ for (const [group, definitions] of bySize) {
100
+ const names = Object.keys(definitions);
101
+ const covered = names.filter((prop) => stray.includes(prop));
102
+ if (names.length && covered.length / names.length >= GROUP_COVERAGE) {
103
+ groupSection(group, covered, true);
104
+ stray = stray.filter((prop) => !taken.has(prop));
105
+ }
106
+ }
107
+
108
+ const own = [
109
+ ...ownNames.map((prop) => ({
110
+ name: prop,
111
+ aliases: [],
112
+ values: Array.isArray(closed[prop]) ? closed[prop].map(String) : [],
113
+ type: scalars[prop] ?? required[prop] ?? null,
114
+ arbitrary: null,
115
+ ...(overrides.includes(prop) && !closed[prop] && !scalars[prop] && !required[prop] ? { note: "Its own attribute, not the style prop" } : {}),
116
+ })),
117
+ ...stray.map((prop) => ({ name: prop, aliases: [], values: [], type: null, arbitrary: null, note: "Values not in the spec" })),
118
+ ];
119
+ if (own.length) sections.unshift({ id: "own", label: "Its own props", hint: "", rows: own });
120
+
121
+ for (const section of sections) {
122
+ for (const row of section.rows) {
123
+ row.required = Object.hasOwn(required, row.name);
124
+ Object.assign(row, docsOf(entry, row.name));
125
+ const as = [row.name, ...row.aliases].find((prop) => used && Object.hasOwn(used, prop));
126
+ row.used = as ? { as, value: used[as] } : null;
127
+ }
128
+ // Required props lead their section; the spec's order is kept otherwise.
129
+ section.rows.sort((a, b) => Number(b.required) - Number(a.required));
130
+ }
131
+
132
+ return { key, total: sections.reduce((n, section) => n + section.rows.length, 0), sections };
133
+ }
134
+
135
+ /**
136
+ * The rows matching `query` by prop name (or long spelling) or by a value it
137
+ * takes. A row found by a value is marked `byValue`, so its whole list can be
138
+ * shown. An empty query keeps everything.
139
+ */
140
+ export function filterProps(model, query) {
141
+ const q = query.trim().toLowerCase();
142
+ if (!model) return { sections: [], count: 0 };
143
+ if (!q) return { sections: model.sections, count: model.total };
144
+ const sections = [];
145
+ for (const section of model.sections) {
146
+ const rows = [];
147
+ for (const row of section.rows) {
148
+ if ([row.name, ...row.aliases].some((name) => name.toLowerCase().includes(q))) rows.push(row);
149
+ else if (row.values.some((value) => value.toLowerCase().includes(q)) || row.type?.toLowerCase() === q) rows.push({ ...row, byValue: true });
150
+ }
151
+ if (rows.length) sections.push({ ...section, rows });
152
+ }
153
+ return { sections, count: sections.reduce((n, section) => n + section.rows.length, 0) };
154
+ }
@@ -2,8 +2,8 @@ import { LIMITS, cleanConsoleMessage, contentOf, keptText, redactedText } from "
2
2
  import { IDENTITY_ATTRIBUTE, readIdentity } from "./identity.mjs";
3
3
 
4
4
  /* The page's part of an issue snapshot: the component tree under the
5
- selected element, the browser's facts, console errors and an optional
6
- screenshot. Nothing here sends anything; the bridge assembles the rest. */
5
+ selected element, the browser's facts and console errors. Nothing here
6
+ sends anything; the bridge assembles the rest. */
7
7
 
8
8
  const SKIP = new Set(["SCRIPT", "STYLE", "TEMPLATE", "NOSCRIPT"]);
9
9
 
@@ -119,43 +119,3 @@ function safeString(value) {
119
119
  return String(value);
120
120
  }
121
121
  }
122
-
123
- const MAX_SCREENSHOT_BYTES = 180 * 1024;
124
-
125
- /**
126
- * A screenshot of this tab through the browser's own capture prompt, as a
127
- * JPEG data URL small enough for a snapshot. `hide` and `show` take the
128
- * overlay out of the picture. Rejects if the reporter declines the prompt.
129
- */
130
- export async function captureScreenshot({ hide = () => {}, show = () => {}, win = globalThis.window } = {}) {
131
- const stream = await win.navigator.mediaDevices.getDisplayMedia({
132
- video: { displaySurface: "browser" },
133
- audio: false,
134
- preferCurrentTab: true,
135
- selfBrowserSurface: "include",
136
- });
137
- const video = win.document.createElement("video");
138
- try {
139
- video.srcObject = stream;
140
- video.muted = true;
141
- await video.play();
142
- hide();
143
- // Two frames, so the capture shows the page without the overlay.
144
- await new Promise((done) => win.requestAnimationFrame(() => win.requestAnimationFrame(done)));
145
- for (const [width, quality] of [[1280, 0.72], [960, 0.6], [720, 0.5]]) {
146
- const scale = Math.min(1, width / video.videoWidth);
147
- const canvas = win.document.createElement("canvas");
148
- canvas.width = Math.round(video.videoWidth * scale);
149
- canvas.height = Math.round(video.videoHeight * scale);
150
- canvas.getContext("2d").drawImage(video, 0, 0, canvas.width, canvas.height);
151
- const url = canvas.toDataURL("image/jpeg", quality);
152
- if (url.length * 0.75 <= MAX_SCREENSHOT_BYTES) return url;
153
- }
154
- throw new Error("The screenshot is too large to include.");
155
- } finally {
156
- show();
157
- for (const track of stream.getTracks()) track.stop();
158
- video.srcObject = null;
159
- }
160
- }
161
-
@@ -1,151 +1,158 @@
1
- import { formatValue, h, icon, plural } from "../dom.mjs";
2
- import { describeComponent, IDENTITY_ATTRIBUTE, readIdentity } from "../identity.mjs";
3
- import { ICONS } from "../icons.mjs";
4
- import { findingsFor } from "../page.mjs";
5
- import { findingRow } from "./shared.mjs";
6
-
7
- /* One component on the page: what it is, the props it was given, how it
8
- reaches the browser, where it sits, and the findings and recommendations
9
- about it. */
10
-
11
- export function componentScreen(app, element) {
12
- const root = h("div", {});
13
- const chain = readIdentity(element);
14
- const name = chain[0]?.name ?? "Component";
15
-
16
- function propsCard(entry, first) {
17
- const about = describeComponent(app.state.spec, entry.name, app.framework);
18
- const props = Object.entries(entry.props);
19
- return h(
20
- "div",
21
- { class: "card pad" },
22
- h(
23
- "div",
24
- { class: "row", style: "margin-bottom:10px" },
25
- h("span", { class: "code grow", style: "font-weight:600" }, first ? "Props" : entry.name),
26
- h("a", { class: "link", href: about.docsUrl, target: "_blank", rel: "noreferrer" }, "Docs", icon(ICONS.external)),
27
- ),
28
- app.state.spec && !about.known
29
- ? h(
30
- "p",
31
- { class: "muted", style: "margin-bottom:8px" },
32
- about.partOf ? `Part of ${about.partOf}. The spec has no entry of its own for it, so no client tier is shown.` : `${entry.name} is not in the installed spec.`,
33
- )
34
- : null,
35
- props.length
36
- ? h("table", { class: "props" }, h("tbody", {}, props.map(([key, value]) => h("tr", {}, h("td", {}, key), h("td", {}, formatValue(value))))))
37
- : h("p", { class: "muted" }, "No props beyond its defaults."),
38
- );
39
- }
40
-
41
- function findingsSection(title, list, tone) {
42
- return h(
43
- "section",
44
- {},
45
- h("h3", { class: "section-title" }, title, h("span", { class: "n" }, String(list.length))),
46
- list.length
47
- ? h(
48
- "div",
49
- { class: "file-card" },
50
- list.map((finding) => findingRow(app, finding, { showFile: true, showComponent: false, exactLabel: finding.exact ? "This one" : null })),
51
- )
52
- : h("p", { class: "muted", style: "margin-bottom:4px" }, tone === "error" ? "Nothing broken here." : "Nothing to suggest."),
53
- );
54
- }
55
-
56
- function update() {
57
- const { state } = app;
58
- if (!element.isConnected) {
59
- root.replaceChildren(
60
- h("div", { class: "gone" }, icon(ICONS.findings), "This component has left the page."),
61
- h("button", { class: "btn", type: "button", onclick: () => app.navigate("components") }, icon(ICONS.back), "All components"),
62
- );
63
- return;
64
- }
65
- const about = describeComponent(state.spec, name, app.framework);
66
- const sameKind = state.instances.filter((i) => i.name === name);
67
- const instance = state.instances.find((i) => i.element === element) ?? { element, chain, name };
68
- const found = findingsFor(instance, state.findings, { routeFiles: state.routeFiles, alone: sameKind.length === 1 });
69
- const errors = found.filter((f) => f.kind === "error" && (f.exact || f.onPage));
70
- const warnings = found.filter((f) => f.kind === "warning" && (f.exact || f.onPage));
71
-
72
- const ancestors = [];
73
- for (let node = element.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`); node; node = node.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`)) {
74
- ancestors.unshift(node);
75
- }
76
- const inside = state.instances.filter((i) => i.element !== element && element.contains(i.element) && i.element.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`) === element);
77
-
78
- const head = h(
79
- "div",
80
- { class: "detail-head" },
81
- h("span", { class: "detail-icon" }, icon(ICONS.components)),
82
- h(
83
- "div",
84
- { class: "grow" },
85
- h("h2", {}, name),
86
- chain.length > 1 ? h("p", { class: "chain" }, `renders through ${chain.slice(1).map((c) => c.name).join(" → ")}`) : null,
87
- h(
88
- "div",
89
- { class: "row" },
90
- about.client ? h("span", { class: `pill ${about.client}`, title: about.clientDetail }, h("i"), about.clientLabel) : null,
91
- about.category ? h("span", { class: "pill" }, about.category) : null,
92
- sameKind.length > 1 ? h("span", { class: "pill" }, `${sameKind.indexOf(instance) + 1} of ${sameKind.length} on this page`) : null,
93
- errors.length ? h("span", { class: "pill error" }, plural(errors.length, "finding")) : null,
94
- warnings.length ? h("span", { class: "pill advice" }, plural(warnings.length, "recommendation")) : null,
95
- ),
96
- about.client ? h("p", { class: "muted", style: "margin-top:8px;font-size:12.5px" }, about.clientDetail) : null,
97
- ),
98
- );
99
-
100
- const actions = h(
101
- "div",
102
- { class: "actions" },
103
- h("button", { class: "btn", type: "button", onclick: () => app.locate(element) }, icon(ICONS.locate), "Locate on page"),
104
- h("button", { class: "btn", type: "button", onclick: () => app.navigate("report") }, icon(ICONS.report), "Report a problem"),
105
- h("a", { class: "btn ghost", href: about.docsUrl, target: "_blank", rel: "noreferrer" }, "Docs", icon(ICONS.external)),
106
- );
107
-
108
- const crumbs = (title, nodes) =>
109
- nodes.length
110
- ? h(
111
- "section",
112
- {},
113
- h("h3", { class: "section-title" }, title),
114
- h(
115
- "div",
116
- { class: "tags" },
117
- nodes.map((node) =>
118
- h(
119
- "button",
120
- {
121
- class: "chip",
122
- type: "button",
123
- onclick: () => app.openComponent(node),
124
- onpointerenter: () => app.preview(node),
125
- onpointerleave: () => app.preview(element),
126
- },
127
- readIdentity(node)[0]?.name ?? "?",
128
- ),
129
- ),
130
- ),
131
- )
132
- : null;
133
-
134
- root.replaceChildren(
135
- head,
136
- actions,
137
- h(
138
- "div",
139
- { class: "stack" },
140
- findingsSection("Findings", errors, "error"),
141
- findingsSection("Recommendations", warnings, "advice"),
142
- h("section", {}, h("h3", { class: "section-title" }, "Props"), h("div", { class: "stack" }, chain.map((entry, index) => propsCard(entry, index === 0)))),
143
- crumbs("Inside", ancestors),
144
- crumbs("Contains", inside.map((i) => i.element)),
145
- ),
146
- );
147
- }
148
-
149
- update();
150
- return { title: [{ label: "Components", screen: "components" }, { label: name, code: true }], root, update, element };
151
- }
1
+ import { formatValue, h, icon, plural } from "../dom.mjs";
2
+ import { describeComponent, IDENTITY_ATTRIBUTE, readIdentity } from "../identity.mjs";
3
+ import { ICONS } from "../icons.mjs";
4
+ import { findingsFor } from "../page.mjs";
5
+ import { allProps } from "./props.mjs";
6
+ import { findingRow } from "./shared.mjs";
7
+
8
+ /* One component on the page: what it is, the props it was given and every
9
+ prop it takes, how it reaches the browser, where it sits, and the findings
10
+ and recommendations about it. */
11
+
12
+ export function componentScreen(app, element) {
13
+ const root = h("div", {});
14
+ const chain = readIdentity(element);
15
+ const name = chain[0]?.name ?? "Component";
16
+ // Built once: findings and page changes redraw the screen, and must not reset the search.
17
+ const takes = allProps(app, chain);
18
+
19
+ function propsCard(entry) {
20
+ const about = describeComponent(app.state.spec, entry.name, app.framework);
21
+ const props = Object.entries(entry.props);
22
+ return h(
23
+ "div",
24
+ { class: "card pad" },
25
+ h(
26
+ "div",
27
+ { class: "row", style: "margin-bottom:10px" },
28
+ h("span", { class: "code grow", style: "font-weight:600" }, entry.name),
29
+ h("a", { class: "link", href: about.docsUrl, target: "_blank", rel: "noreferrer" }, "Docs", icon(ICONS.external)),
30
+ ),
31
+ app.state.spec && !about.known
32
+ ? h(
33
+ "p",
34
+ { class: "muted", style: "margin-bottom:8px" },
35
+ about.partOf ? `Part of ${about.partOf}. The spec has no entry of its own for it, so no client tier is shown.` : `${entry.name} is not in the installed spec.`,
36
+ )
37
+ : null,
38
+ props.length
39
+ ? h("table", { class: "props" }, h("tbody", {}, props.map(([key, value]) => h("tr", {}, h("td", {}, key), h("td", {}, formatValue(value))))))
40
+ : h("p", { class: "muted" }, "No props beyond its defaults."),
41
+ );
42
+ }
43
+
44
+ function findingsSection(title, list, tone) {
45
+ return h(
46
+ "section",
47
+ {},
48
+ h("h3", { class: "section-title" }, title, h("span", { class: "n" }, String(list.length))),
49
+ list.length
50
+ ? h(
51
+ "div",
52
+ { class: "file-card" },
53
+ list.map((finding) => findingRow(app, finding, { showFile: true, showComponent: false, exactLabel: finding.exact ? "This one" : null })),
54
+ )
55
+ : h("p", { class: "muted", style: "margin-bottom:4px" }, tone === "error" ? "Nothing broken here." : "Nothing to suggest."),
56
+ );
57
+ }
58
+
59
+ function update() {
60
+ const { state } = app;
61
+ if (!element.isConnected) {
62
+ root.replaceChildren(
63
+ h("div", { class: "gone" }, icon(ICONS.findings), "This component has left the page."),
64
+ h("button", { class: "btn", type: "button", onclick: () => app.navigate("components") }, icon(ICONS.back), "All components"),
65
+ );
66
+ return;
67
+ }
68
+ const about = describeComponent(state.spec, name, app.framework);
69
+ const sameKind = state.instances.filter((i) => i.name === name);
70
+ const instance = state.instances.find((i) => i.element === element) ?? { element, chain, name };
71
+ const found = findingsFor(instance, state.findings, { routeFiles: state.routeFiles, alone: sameKind.length === 1 });
72
+ const errors = found.filter((f) => f.kind === "error" && (f.exact || f.onPage));
73
+ const warnings = found.filter((f) => f.kind === "warning" && (f.exact || f.onPage));
74
+
75
+ const ancestors = [];
76
+ for (let node = element.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`); node; node = node.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`)) {
77
+ ancestors.unshift(node);
78
+ }
79
+ const inside = state.instances.filter((i) => i.element !== element && element.contains(i.element) && i.element.parentElement?.closest(`[${IDENTITY_ATTRIBUTE}]`) === element);
80
+
81
+ const head = h(
82
+ "div",
83
+ { class: "detail-head" },
84
+ h("span", { class: "detail-icon" }, icon(ICONS.components)),
85
+ h(
86
+ "div",
87
+ { class: "grow" },
88
+ h("h2", {}, name),
89
+ chain.length > 1 ? h("p", { class: "chain" }, `renders through ${chain.slice(1).map((c) => c.name).join(" → ")}`) : null,
90
+ h(
91
+ "div",
92
+ { class: "row" },
93
+ about.client ? h("span", { class: `pill ${about.client}`, title: about.clientDetail }, h("i"), about.clientLabel) : null,
94
+ about.category ? h("span", { class: "pill" }, about.category) : null,
95
+ sameKind.length > 1 ? h("span", { class: "pill" }, `${sameKind.indexOf(instance) + 1} of ${sameKind.length} on this page`) : null,
96
+ errors.length ? h("span", { class: "pill error" }, plural(errors.length, "finding")) : null,
97
+ warnings.length ? h("span", { class: "pill advice" }, plural(warnings.length, "recommendation")) : null,
98
+ ),
99
+ about.client ? h("p", { class: "muted", style: "margin-top:8px;font-size:12.5px" }, about.clientDetail) : null,
100
+ ),
101
+ );
102
+
103
+ const actions = h(
104
+ "div",
105
+ { class: "actions" },
106
+ h("button", { class: "btn", type: "button", onclick: () => app.locate(element) }, icon(ICONS.locate), "Locate on page"),
107
+ h("button", { class: "btn", type: "button", onclick: () => app.navigate("report") }, icon(ICONS.report), "Report a problem"),
108
+ h("a", { class: "btn ghost", href: about.docsUrl, target: "_blank", rel: "noreferrer" }, "Docs", icon(ICONS.external)),
109
+ );
110
+
111
+ const crumbs = (title, nodes) =>
112
+ nodes.length
113
+ ? h(
114
+ "section",
115
+ {},
116
+ h("h3", { class: "section-title" }, title),
117
+ h(
118
+ "div",
119
+ { class: "tags" },
120
+ nodes.map((node) =>
121
+ h(
122
+ "button",
123
+ {
124
+ class: "chip",
125
+ type: "button",
126
+ onclick: () => app.openComponent(node),
127
+ onpointerenter: () => app.preview(node),
128
+ onpointerleave: () => app.preview(element),
129
+ },
130
+ readIdentity(node)[0]?.name ?? "?",
131
+ ),
132
+ ),
133
+ ),
134
+ )
135
+ : null;
136
+
137
+ takes.update();
138
+ const searching = takes.input.getRootNode().activeElement === takes.input;
139
+ root.replaceChildren(
140
+ head,
141
+ actions,
142
+ h(
143
+ "div",
144
+ { class: "stack" },
145
+ findingsSection("Findings", errors, "error"),
146
+ findingsSection("Recommendations", warnings, "advice"),
147
+ h("section", {}, h("h3", { class: "section-title" }, "Props given"), h("div", { class: "stack" }, chain.map((entry) => propsCard(entry)))),
148
+ takes.root,
149
+ crumbs("Inside", ancestors),
150
+ crumbs("Contains", inside.map((i) => i.element)),
151
+ ),
152
+ );
153
+ if (searching) takes.input.focus({ preventScroll: true });
154
+ }
155
+
156
+ update();
157
+ return { title: [{ label: "Components", screen: "components" }, { label: name, code: true }], root, update, element };
158
+ }