ui-router-devtools 0.0.0-stage → 0.1.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.
- package/LICENSE +9 -0
- package/README.md +160 -2
- package/dist/console.d.ts +5 -0
- package/dist/console.d.ts.map +1 -0
- package/dist/console.js +47 -0
- package/dist/console.js.map +1 -0
- package/dist/define.d.ts +8 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +4 -0
- package/dist/define.js.map +1 -0
- package/dist/edges.d.ts +25 -0
- package/dist/edges.d.ts.map +1 -0
- package/dist/edges.js +28 -0
- package/dist/edges.js.map +1 -0
- package/dist/element/chips.d.ts +17 -0
- package/dist/element/chips.d.ts.map +1 -0
- package/dist/element/chips.js +134 -0
- package/dist/element/chips.js.map +1 -0
- package/dist/element/glyphs.d.ts +34 -0
- package/dist/element/glyphs.d.ts.map +1 -0
- package/dist/element/glyphs.js +107 -0
- package/dist/element/glyphs.js.map +1 -0
- package/dist/element/inspector.d.ts +7 -0
- package/dist/element/inspector.d.ts.map +1 -0
- package/dist/element/inspector.js +183 -0
- package/dist/element/inspector.js.map +1 -0
- package/dist/element/links.d.ts +4 -0
- package/dist/element/links.d.ts.map +1 -0
- package/dist/element/links.js +87 -0
- package/dist/element/links.js.map +1 -0
- package/dist/element/log.d.ts +12 -0
- package/dist/element/log.d.ts.map +1 -0
- package/dist/element/log.js +272 -0
- package/dist/element/log.js.map +1 -0
- package/dist/element/map.d.ts +5 -0
- package/dist/element/map.d.ts.map +1 -0
- package/dist/element/map.js +5 -0
- package/dist/element/map.js.map +1 -0
- package/dist/element/mapview.d.ts +17 -0
- package/dist/element/mapview.d.ts.map +1 -0
- package/dist/element/mapview.js +158 -0
- package/dist/element/mapview.js.map +1 -0
- package/dist/element/measure.d.ts +3 -0
- package/dist/element/measure.d.ts.map +1 -0
- package/dist/element/measure.js +9 -0
- package/dist/element/measure.js.map +1 -0
- package/dist/element/nested.d.ts +45 -0
- package/dist/element/nested.d.ts.map +1 -0
- package/dist/element/nested.js +686 -0
- package/dist/element/nested.js.map +1 -0
- package/dist/element/pack.d.ts +75 -0
- package/dist/element/pack.d.ts.map +1 -0
- package/dist/element/pack.js +281 -0
- package/dist/element/pack.js.map +1 -0
- package/dist/element/panel.d.ts +159 -0
- package/dist/element/panel.d.ts.map +1 -0
- package/dist/element/panel.js +1542 -0
- package/dist/element/panel.js.map +1 -0
- package/dist/element/popover.d.ts +12 -0
- package/dist/element/popover.d.ts.map +1 -0
- package/dist/element/popover.js +38 -0
- package/dist/element/popover.js.map +1 -0
- package/dist/element/route.d.ts +75 -0
- package/dist/element/route.d.ts.map +1 -0
- package/dist/element/route.js +883 -0
- package/dist/element/route.js.map +1 -0
- package/dist/element/scrubber.d.ts +4 -0
- package/dist/element/scrubber.d.ts.map +1 -0
- package/dist/element/scrubber.js +67 -0
- package/dist/element/scrubber.js.map +1 -0
- package/dist/element/styles.d.ts +3 -0
- package/dist/element/styles.d.ts.map +1 -0
- package/dist/element/styles.js +2084 -0
- package/dist/element/styles.js.map +1 -0
- package/dist/element/timeline-styles.d.ts +3 -0
- package/dist/element/timeline-styles.d.ts.map +1 -0
- package/dist/element/timeline-styles.js +286 -0
- package/dist/element/timeline-styles.js.map +1 -0
- package/dist/element/timeline.d.ts +9 -0
- package/dist/element/timeline.d.ts.map +1 -0
- package/dist/element/timeline.js +225 -0
- package/dist/element/timeline.js.map +1 -0
- package/dist/element/tree.d.ts +24 -0
- package/dist/element/tree.d.ts.map +1 -0
- package/dist/element/tree.js +149 -0
- package/dist/element/tree.js.map +1 -0
- package/dist/element/viewmap-styles.d.ts +3 -0
- package/dist/element/viewmap-styles.d.ts.map +1 -0
- package/dist/element/viewmap-styles.js +282 -0
- package/dist/element/viewmap-styles.js.map +1 -0
- package/dist/element/viewmap.d.ts +39 -0
- package/dist/element/viewmap.d.ts.map +1 -0
- package/dist/element/viewmap.js +406 -0
- package/dist/element/viewmap.js.map +1 -0
- package/dist/element/viewport.d.ts +31 -0
- package/dist/element/viewport.d.ts.map +1 -0
- package/dist/element/viewport.js +37 -0
- package/dist/element/viewport.js.map +1 -0
- package/dist/element/waterfall.d.ts +85 -0
- package/dist/element/waterfall.d.ts.map +1 -0
- package/dist/element/waterfall.js +284 -0
- package/dist/element/waterfall.js.map +1 -0
- package/dist/fold.d.ts +27 -0
- package/dist/fold.d.ts.map +1 -0
- package/dist/fold.js +104 -0
- package/dist/fold.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lit-ui-router.d.ts +24 -0
- package/dist/lit-ui-router.d.ts.map +1 -0
- package/dist/lit-ui-router.js +102 -0
- package/dist/lit-ui-router.js.map +1 -0
- package/dist/notation.d.ts +28 -0
- package/dist/notation.d.ts.map +1 -0
- package/dist/notation.js +105 -0
- package/dist/notation.js.map +1 -0
- package/dist/performance.d.ts +5 -0
- package/dist/performance.d.ts.map +1 -0
- package/dist/performance.js +66 -0
- package/dist/performance.js.map +1 -0
- package/dist/plugin.d.ts +32 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +21 -0
- package/dist/plugin.js.map +1 -0
- package/dist/recorder.d.ts +30 -0
- package/dist/recorder.d.ts.map +1 -0
- package/dist/recorder.js +117 -0
- package/dist/recorder.js.map +1 -0
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -0
- package/dist/session-schema.d.ts +31 -0
- package/dist/session-schema.d.ts.map +1 -0
- package/dist/session-schema.js +314 -0
- package/dist/session-schema.js.map +1 -0
- package/dist/session.schema.json +1172 -0
- package/dist/shared/event-schema.d.ts +225 -0
- package/dist/shared/event-schema.d.ts.map +1 -0
- package/dist/shared/event-schema.js +2 -0
- package/dist/shared/event-schema.js.map +1 -0
- package/dist/shared/redaction.d.ts +19 -0
- package/dist/shared/redaction.d.ts.map +1 -0
- package/dist/shared/redaction.js +56 -0
- package/dist/shared/redaction.js.map +1 -0
- package/dist/shared/resolve-timing.d.ts +6 -0
- package/dist/shared/resolve-timing.d.ts.map +1 -0
- package/dist/shared/resolve-timing.js +61 -0
- package/dist/shared/resolve-timing.js.map +1 -0
- package/dist/shared/router-events.d.ts +10 -0
- package/dist/shared/router-events.d.ts.map +1 -0
- package/dist/shared/router-events.js +296 -0
- package/dist/shared/router-events.js.map +1 -0
- package/dist/shared/thrown.d.ts +5 -0
- package/dist/shared/thrown.d.ts.map +1 -0
- package/dist/shared/thrown.js +12 -0
- package/dist/shared/thrown.js.map +1 -0
- package/dist/shared/transition-source.d.ts +4 -0
- package/dist/shared/transition-source.d.ts.map +1 -0
- package/dist/shared/transition-source.js +2 -0
- package/dist/shared/transition-source.js.map +1 -0
- package/dist/shared/views.d.ts +10 -0
- package/dist/shared/views.d.ts.map +1 -0
- package/dist/shared/views.js +67 -0
- package/dist/shared/views.js.map +1 -0
- package/dist/spans.d.ts +15 -0
- package/dist/spans.d.ts.map +1 -0
- package/dist/spans.js +24 -0
- package/dist/spans.js.map +1 -0
- package/dist/testing.d.ts +32 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/ui-router-devtools.d.ts +36 -0
- package/dist/ui-router-devtools.d.ts.map +1 -0
- package/dist/ui-router-devtools.js +3 -0
- package/dist/ui-router-devtools.js.map +1 -0
- package/dist/views.d.ts +44 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +43 -0
- package/dist/views.js.map +1 -0
- package/package.json +118 -3
- package/src/console.ts +104 -0
- package/src/define.ts +12 -0
- package/src/edges.ts +64 -0
- package/src/element/chips.ts +187 -0
- package/src/element/glyphs.ts +218 -0
- package/src/element/inspector.ts +315 -0
- package/src/element/links.ts +136 -0
- package/src/element/log.ts +410 -0
- package/src/element/map.ts +22 -0
- package/src/element/mapview.ts +224 -0
- package/src/element/measure.ts +13 -0
- package/src/element/nested.ts +1124 -0
- package/src/element/pack.ts +526 -0
- package/src/element/panel.ts +2378 -0
- package/src/element/popover.ts +64 -0
- package/src/element/route.ts +1481 -0
- package/src/element/scrubber.ts +103 -0
- package/src/element/styles.ts +2084 -0
- package/src/element/timeline-styles.ts +287 -0
- package/src/element/timeline.ts +392 -0
- package/src/element/tree.ts +271 -0
- package/src/element/viewmap-styles.ts +283 -0
- package/src/element/viewmap.ts +733 -0
- package/src/element/viewport.ts +112 -0
- package/src/element/waterfall.ts +585 -0
- package/src/fold.ts +151 -0
- package/src/index.ts +40 -0
- package/src/lit-ui-router.ts +194 -0
- package/src/notation.ts +181 -0
- package/src/performance.ts +142 -0
- package/src/plugin.ts +57 -0
- package/src/recorder.ts +228 -0
- package/src/schema.ts +32 -0
- package/src/session-schema.ts +362 -0
- package/src/spans.ts +53 -0
- package/src/testing.ts +74 -0
- package/src/types/import-meta-env.d.ts +9 -0
- package/src/ui-router-devtools.ts +39 -0
- package/src/views.ts +116 -0
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
// The Views' code, loaded on first use of the Views view so a panel that never shows it does not pay for it.
|
|
2
|
+
import { html, nothing, type TemplateResult } from 'lit';
|
|
3
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
4
|
+
import type { DevtoolsPanel } from './panel.ts';
|
|
5
|
+
import type { ViewFill, ViewInfo } from '../schema.ts';
|
|
6
|
+
import { ancestorsOf } from '../fold.ts';
|
|
7
|
+
import { truncateMiddle } from '../notation.ts';
|
|
8
|
+
import { targetText, viewPath, viewTree, type ViewNode } from '../views.ts';
|
|
9
|
+
import { textWidth } from './measure.ts';
|
|
10
|
+
import {
|
|
11
|
+
drawnIn,
|
|
12
|
+
METRICS,
|
|
13
|
+
pack,
|
|
14
|
+
type Box,
|
|
15
|
+
type Drawn,
|
|
16
|
+
type Metrics,
|
|
17
|
+
type Placed,
|
|
18
|
+
type Size,
|
|
19
|
+
} from './pack.ts';
|
|
20
|
+
import { fitView, type View } from './viewport.ts';
|
|
21
|
+
|
|
22
|
+
export { viewMapStyles } from './viewmap-styles.ts';
|
|
23
|
+
|
|
24
|
+
/** The Map's dock step, with room for a view's name and the state that fills it in one header. */
|
|
25
|
+
const VIEW_METRICS: Metrics = { ...METRICS, max: 320 };
|
|
26
|
+
|
|
27
|
+
const LONG = 28;
|
|
28
|
+
|
|
29
|
+
export interface ViewRow {
|
|
30
|
+
node: ViewNode;
|
|
31
|
+
setsize: number;
|
|
32
|
+
posinset: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Views in tree order, for the arrow keys and the item numbering. */
|
|
36
|
+
export const viewRows = (nodes: readonly ViewNode[]): ViewRow[] =>
|
|
37
|
+
nodes.flatMap((node, index) => [
|
|
38
|
+
{ node, setsize: nodes.length, posinset: index + 1 },
|
|
39
|
+
...viewRows(node.children),
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
// A name that repeats in the tree, `$default` above all, is told apart by its path.
|
|
43
|
+
const repeatedNames = (views: readonly ViewInfo[]): Set<string> => {
|
|
44
|
+
const seen = new Set<string>();
|
|
45
|
+
const repeated = new Set<string>();
|
|
46
|
+
|
|
47
|
+
for (const { name } of views) (seen.has(name) ? repeated : seen).add(name);
|
|
48
|
+
|
|
49
|
+
return repeated;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
interface Scene {
|
|
53
|
+
host: DevtoolsPanel;
|
|
54
|
+
repeated: ReadonlySet<string>;
|
|
55
|
+
/** The states on the active path, and the root. */
|
|
56
|
+
active: ReadonlySet<string>;
|
|
57
|
+
focus: number | undefined;
|
|
58
|
+
rows: ReadonlyMap<number, ViewRow>;
|
|
59
|
+
/** The view drawn as selected. */
|
|
60
|
+
selected: number | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const viewName = (view: ViewInfo, scene: Pick<Scene, 'repeated'>): string =>
|
|
64
|
+
scene.repeated.has(view.name) ? view.fqn : view.name;
|
|
65
|
+
|
|
66
|
+
const stateText = (state: string): string =>
|
|
67
|
+
state ? truncateMiddle(state, LONG) : '(root)';
|
|
68
|
+
|
|
69
|
+
// A sticky state stays filling its views after it is left; such a fill is not on the active path.
|
|
70
|
+
const inactive = (fill: ViewFill | null, scene: Pick<Scene, 'active'>) =>
|
|
71
|
+
Boolean(fill && !scene.active.has(fill.state));
|
|
72
|
+
|
|
73
|
+
/** What a view's item says: its name, what fills it, and whether that is on the active path. */
|
|
74
|
+
export const describeView = (
|
|
75
|
+
view: ViewInfo,
|
|
76
|
+
scene: Pick<Scene, 'repeated' | 'active'>,
|
|
77
|
+
): string => {
|
|
78
|
+
const name = `${viewName(view, scene)} view`;
|
|
79
|
+
|
|
80
|
+
if (!view.fill) return `${name}, empty`;
|
|
81
|
+
|
|
82
|
+
return `${name}, filled by ${view.fill.state || 'the root'}${inactive(view.fill, scene) ? ', inactive' : ''}`;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
interface Fonts {
|
|
86
|
+
/** The face names are set in. */
|
|
87
|
+
mono: string;
|
|
88
|
+
/** The face the panel's own tags are set in. */
|
|
89
|
+
sans: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// A tag is set in uppercase caption type tracked 0.08em.
|
|
93
|
+
const tagWidth = (text: string, { sans }: Fonts): number =>
|
|
94
|
+
textWidth(text.toUpperCase(), `400 11px ${sans}`) + text.length * 0.88;
|
|
95
|
+
|
|
96
|
+
const labelWidth = (
|
|
97
|
+
view: ViewInfo,
|
|
98
|
+
scene: Pick<Scene, 'repeated' | 'active'>,
|
|
99
|
+
fonts: Fonts,
|
|
100
|
+
): number => {
|
|
101
|
+
const font = `400 ${VIEW_METRICS.type}px ${fonts.mono}`;
|
|
102
|
+
|
|
103
|
+
const parts = [
|
|
104
|
+
textWidth(viewName(view, scene), font),
|
|
105
|
+
view.fill
|
|
106
|
+
? textWidth(stateText(view.fill.state), font)
|
|
107
|
+
: tagWidth('Empty', fonts),
|
|
108
|
+
...(inactive(view.fill, scene) ? [tagWidth('Inactive', fonts)] : []),
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
// Padding either side, and a gap between each part and the next.
|
|
112
|
+
return Math.ceil(
|
|
113
|
+
16 + 8 * (parts.length - 1) + parts.reduce((a, b) => a + b, 0),
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const boxOf = (
|
|
118
|
+
node: ViewNode,
|
|
119
|
+
scene: Pick<Scene, 'repeated' | 'active'>,
|
|
120
|
+
fonts: Fonts,
|
|
121
|
+
): Box => ({
|
|
122
|
+
name: String(node.view.id),
|
|
123
|
+
label: labelWidth(node.view, scene, fonts),
|
|
124
|
+
children: node.children.map((child) => boxOf(child, scene, fonts)),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const MIRRORED: ReadonlyMap<string, string> = new Map([
|
|
128
|
+
['ArrowLeft', 'ArrowRight'],
|
|
129
|
+
['ArrowRight', 'ArrowLeft'],
|
|
130
|
+
]);
|
|
131
|
+
|
|
132
|
+
// Up and down move in tree order, right into a view's first nested view and left to the view around it, as in the Outline.
|
|
133
|
+
const target = (
|
|
134
|
+
key: string,
|
|
135
|
+
rows: readonly ViewRow[],
|
|
136
|
+
index: number,
|
|
137
|
+
): ViewRow | undefined => {
|
|
138
|
+
const row = rows[index];
|
|
139
|
+
|
|
140
|
+
switch (key) {
|
|
141
|
+
case 'ArrowDown':
|
|
142
|
+
return rows[index + 1];
|
|
143
|
+
case 'ArrowUp':
|
|
144
|
+
return rows[index - 1];
|
|
145
|
+
case 'Home':
|
|
146
|
+
return rows[0];
|
|
147
|
+
case 'End':
|
|
148
|
+
return rows.at(-1);
|
|
149
|
+
case 'ArrowRight':
|
|
150
|
+
return row?.node.children.length ? rows[index + 1] : undefined;
|
|
151
|
+
default:
|
|
152
|
+
return rows.find((each) => each.node.view.id === row?.node.parent);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const MOVES = new Set([
|
|
157
|
+
'ArrowDown',
|
|
158
|
+
'ArrowUp',
|
|
159
|
+
'Home',
|
|
160
|
+
'End',
|
|
161
|
+
'ArrowRight',
|
|
162
|
+
'ArrowLeft',
|
|
163
|
+
]);
|
|
164
|
+
|
|
165
|
+
const onKey = (
|
|
166
|
+
host: DevtoolsPanel,
|
|
167
|
+
event: KeyboardEvent,
|
|
168
|
+
rows: readonly ViewRow[],
|
|
169
|
+
focus: number | undefined,
|
|
170
|
+
) => {
|
|
171
|
+
const index = rows.findIndex((row) => row.node.view.id === focus);
|
|
172
|
+
const rtl = getComputedStyle(host).direction === 'rtl';
|
|
173
|
+
const key = (rtl && MIRRORED.get(event.key)) || event.key;
|
|
174
|
+
|
|
175
|
+
if (key === 'Enter' || key === ' ') {
|
|
176
|
+
if (focus !== undefined) host._selectView(focus);
|
|
177
|
+
} else if (key === 'Escape' && host._viewSelected !== null)
|
|
178
|
+
host._selectView(null);
|
|
179
|
+
else if (MOVES.has(key)) {
|
|
180
|
+
const next = target(key, rows, index);
|
|
181
|
+
|
|
182
|
+
if (next) {
|
|
183
|
+
host._viewFocus = next.node.view.id;
|
|
184
|
+
host._moveFocus = true;
|
|
185
|
+
}
|
|
186
|
+
} else return;
|
|
187
|
+
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const renderFill = (view: ViewInfo, scene: Pick<Scene, 'host' | 'active'>) => {
|
|
192
|
+
const { fill } = view;
|
|
193
|
+
|
|
194
|
+
if (!fill) return html`<span class="tag">Empty</span>`;
|
|
195
|
+
|
|
196
|
+
return html`<span
|
|
197
|
+
class="name vm-fill ${scene.host._depthClass(fill.state)}"
|
|
198
|
+
title=${fill.state || '(root)'}
|
|
199
|
+
>${stateText(fill.state)}</span
|
|
200
|
+
>${inactive(fill, scene) ? html`<span class="tag">Inactive</span>` : nothing}`;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/* oxlint-disable lit-a11y/click-events-have-key-events -- the tree's keydown handler moves focus and selects for every treeitem */
|
|
204
|
+
const renderHead = (scene: Scene, node: ViewNode) => {
|
|
205
|
+
const { host } = scene;
|
|
206
|
+
const { view } = node;
|
|
207
|
+
const row = scene.rows.get(view.id);
|
|
208
|
+
const compound = node.children.length > 0;
|
|
209
|
+
|
|
210
|
+
return html`<div
|
|
211
|
+
class="head"
|
|
212
|
+
role="treeitem"
|
|
213
|
+
title=${view.fqn}
|
|
214
|
+
tabindex=${view.id === scene.focus ? 0 : -1}
|
|
215
|
+
aria-label=${describeView(view, scene)}
|
|
216
|
+
aria-level=${node.depth}
|
|
217
|
+
aria-setsize=${row?.setsize ?? 1}
|
|
218
|
+
aria-posinset=${row?.posinset ?? 1}
|
|
219
|
+
aria-owns=${compound ? `vm-kids-${view.id}` : nothing}
|
|
220
|
+
aria-expanded=${compound ? 'true' : nothing}
|
|
221
|
+
aria-selected=${scene.selected === view.id}
|
|
222
|
+
@click=${() => host._selectView(view.id)}
|
|
223
|
+
@focus=${() => (host._viewFocus = view.id)}
|
|
224
|
+
@pointerenter=${() => host._pointView(view.id)}
|
|
225
|
+
@pointerleave=${() => host._pointView(null)}
|
|
226
|
+
>
|
|
227
|
+
<span class="name">${viewName(view, scene)}</span>${renderFill(view, scene)}
|
|
228
|
+
</div>`;
|
|
229
|
+
};
|
|
230
|
+
/* oxlint-enable lit-a11y/click-events-have-key-events */
|
|
231
|
+
|
|
232
|
+
const boxClasses = (scene: Scene, view: ViewInfo, compound: boolean) =>
|
|
233
|
+
[
|
|
234
|
+
'box',
|
|
235
|
+
compound ? 'open' : 'leaf',
|
|
236
|
+
view.fill ? scene.host._depthClass(view.fill.state) : 'vacant',
|
|
237
|
+
inactive(view.fill, scene) && 'inactive',
|
|
238
|
+
scene.selected === view.id && 'selected',
|
|
239
|
+
]
|
|
240
|
+
.filter(Boolean)
|
|
241
|
+
.join(' ');
|
|
242
|
+
|
|
243
|
+
const renderBoxes = (
|
|
244
|
+
scene: Scene,
|
|
245
|
+
placed: Placed,
|
|
246
|
+
nodes: ReadonlyMap<string, ViewNode>,
|
|
247
|
+
) =>
|
|
248
|
+
repeat(
|
|
249
|
+
drawnIn(placed, VIEW_METRICS),
|
|
250
|
+
(item) => item.box.name,
|
|
251
|
+
(item) => renderBox(scene, item, nodes),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const renderBox = (
|
|
255
|
+
scene: Scene,
|
|
256
|
+
item: Drawn,
|
|
257
|
+
nodes: ReadonlyMap<string, ViewNode>,
|
|
258
|
+
): TemplateResult => {
|
|
259
|
+
const node = nodes.get(item.box.name)!;
|
|
260
|
+
const compound = node.children.length > 0;
|
|
261
|
+
|
|
262
|
+
return html`<div
|
|
263
|
+
role="none"
|
|
264
|
+
class=${boxClasses(scene, node.view, compound)}
|
|
265
|
+
data-view=${node.view.id}
|
|
266
|
+
style="inset-inline-start:${item.x}px;inset-block-start:${item.y}px;inline-size:${item.width}px;block-size:${item.height}px"
|
|
267
|
+
>
|
|
268
|
+
${renderHead(scene, node)}${
|
|
269
|
+
compound
|
|
270
|
+
? html`<div class="kids" role="group" id="vm-kids-${node.view.id}">
|
|
271
|
+
${renderBoxes(scene, item.placed, nodes)}
|
|
272
|
+
</div>`
|
|
273
|
+
: nothing
|
|
274
|
+
}
|
|
275
|
+
</div>`;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// A state named in the details; it selects that state on the Map from the view path, and in the Outline from the Views.
|
|
279
|
+
const stateLink = (host: DevtoolsPanel, name: string) =>
|
|
280
|
+
name
|
|
281
|
+
? html`<button
|
|
282
|
+
class="link ${host._depthClass(name)}"
|
|
283
|
+
title=${name}
|
|
284
|
+
@click=${() => host._showState(name)}
|
|
285
|
+
>
|
|
286
|
+
${name}
|
|
287
|
+
</button>`
|
|
288
|
+
: '(root)';
|
|
289
|
+
|
|
290
|
+
type Fact = readonly [term: string, value: unknown];
|
|
291
|
+
|
|
292
|
+
export const facts = (host: DevtoolsPanel, view: ViewInfo): Fact[] => {
|
|
293
|
+
const { fill } = view;
|
|
294
|
+
// An imported session's page is not the recorded one, so it has no place to report.
|
|
295
|
+
const place = host._imported ? undefined : host.viewLocator?.describe?.(view);
|
|
296
|
+
|
|
297
|
+
return [
|
|
298
|
+
['Path', view.fqn],
|
|
299
|
+
['Type', view.type],
|
|
300
|
+
['Created in', stateLink(host, view.context)],
|
|
301
|
+
['Filled by', fill ? stateLink(host, fill.state) : 'nothing; empty'],
|
|
302
|
+
...(fill
|
|
303
|
+
? ([
|
|
304
|
+
['Declared', `views.${fill.view}`],
|
|
305
|
+
['Targets', targetText(fill)],
|
|
306
|
+
...(fill.component ? [['Component', fill.component] as const] : []),
|
|
307
|
+
] as const)
|
|
308
|
+
: []),
|
|
309
|
+
...(place === undefined
|
|
310
|
+
? []
|
|
311
|
+
: ([['On page', place ?? 'not found']] as const)),
|
|
312
|
+
];
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const renderDetail = (host: DevtoolsPanel, view: ViewInfo | undefined) => {
|
|
316
|
+
if (!view) return nothing;
|
|
317
|
+
|
|
318
|
+
return html`<section
|
|
319
|
+
class="vm-detail"
|
|
320
|
+
tabindex="0"
|
|
321
|
+
aria-labelledby="h-vm-detail"
|
|
322
|
+
>
|
|
323
|
+
<h3 class="insp-title" id="h-vm-detail">
|
|
324
|
+
<span class="name">${view.name}</span>
|
|
325
|
+
</h3>
|
|
326
|
+
<dl class="facts">
|
|
327
|
+
${facts(host, view).map(
|
|
328
|
+
([term, value]) =>
|
|
329
|
+
html`<dt>${term}</dt>
|
|
330
|
+
<dd>${value}</dd>`,
|
|
331
|
+
)}
|
|
332
|
+
</dl>
|
|
333
|
+
</section>`;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// Configs no view took: their content is declared active and is nowhere on the page.
|
|
337
|
+
const renderUnmatched = (host: DevtoolsPanel, unmatched: readonly ViewFill[]) =>
|
|
338
|
+
unmatched.length
|
|
339
|
+
? html`<section class="vm-unmatched" aria-labelledby="h-vm-unmatched">
|
|
340
|
+
<h3 class="section sub" id="h-vm-unmatched">
|
|
341
|
+
<span class="title">No view took</span>
|
|
342
|
+
</h3>
|
|
343
|
+
<ul class="plain">
|
|
344
|
+
${unmatched.map(
|
|
345
|
+
(fill) =>
|
|
346
|
+
html`<li>
|
|
347
|
+
${stateLink(host, fill.state)}<span class="muted">
|
|
348
|
+
views.${fill.view} → ${targetText(fill)}</span
|
|
349
|
+
>
|
|
350
|
+
</li>`,
|
|
351
|
+
)}
|
|
352
|
+
</ul>
|
|
353
|
+
</section>`
|
|
354
|
+
: nothing;
|
|
355
|
+
|
|
356
|
+
const activeStates = (host: DevtoolsPanel): Set<string> => {
|
|
357
|
+
const { states, current } = host._model;
|
|
358
|
+
|
|
359
|
+
return new Set(['', current.name, ...ancestorsOf(states, current.name)]);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/** The details column, which stands beside the boxes once the Views are this wide; `viewmap-styles.ts` sets both. */
|
|
363
|
+
const DETAIL = 296;
|
|
364
|
+
|
|
365
|
+
const BESIDE = 720;
|
|
366
|
+
|
|
367
|
+
// Below the drawing in the same room: the configs no view took.
|
|
368
|
+
const footOf = (host: DevtoolsPanel): number => feet.get(host) ?? 0;
|
|
369
|
+
|
|
370
|
+
const feet = new WeakMap<DevtoolsPanel, number>();
|
|
371
|
+
|
|
372
|
+
/** Measures what sits under the drawing, and draws again once when it changed, so the drawing centres in the room above it. */
|
|
373
|
+
export const measureViewMap = (host: DevtoolsPanel): void => {
|
|
374
|
+
const list = host.renderRoot.querySelector<HTMLElement>('.vm-unmatched');
|
|
375
|
+
|
|
376
|
+
const foot = list ? Math.ceil(list.getBoundingClientRect().height) : 0;
|
|
377
|
+
|
|
378
|
+
if (foot === footOf(host)) return;
|
|
379
|
+
feet.set(host, foot);
|
|
380
|
+
host.requestUpdate();
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
interface Layout {
|
|
384
|
+
placed: Placed;
|
|
385
|
+
view: View;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
interface Drawing {
|
|
389
|
+
roots: ViewNode[];
|
|
390
|
+
rows: ViewRow[];
|
|
391
|
+
scene: Scene;
|
|
392
|
+
nodes: ReadonlyMap<string, ViewNode>;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const drawingOf = (
|
|
396
|
+
host: DevtoolsPanel,
|
|
397
|
+
views: readonly ViewInfo[],
|
|
398
|
+
selected: number | null,
|
|
399
|
+
): Drawing => {
|
|
400
|
+
const roots = viewTree(views);
|
|
401
|
+
const rows = viewRows(roots);
|
|
402
|
+
|
|
403
|
+
const scene: Scene = {
|
|
404
|
+
host,
|
|
405
|
+
repeated: repeatedNames(views),
|
|
406
|
+
active: activeStates(host),
|
|
407
|
+
focus:
|
|
408
|
+
rows.find((row) => row.node.view.id === host._viewFocus)?.node.view.id ??
|
|
409
|
+
rows[0]?.node.view.id,
|
|
410
|
+
rows: new Map(rows.map((row) => [row.node.view.id, row])),
|
|
411
|
+
selected,
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const nodes = new Map(
|
|
415
|
+
rows.map((row) => [String(row.node.view.id), row.node]),
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
return { roots, rows, scene, nodes };
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const fontsOf = (host: DevtoolsPanel): Fonts => {
|
|
422
|
+
const style = getComputedStyle(host);
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
mono: style.getPropertyValue('--uird-font-mono'),
|
|
426
|
+
sans: style.getPropertyValue('--uird-font'),
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const packViews = (
|
|
431
|
+
{ roots, scene }: Drawing,
|
|
432
|
+
fonts: Fonts,
|
|
433
|
+
room: Size,
|
|
434
|
+
): Placed =>
|
|
435
|
+
pack(
|
|
436
|
+
roots.map((root) => boxOf(root, scene, fonts)),
|
|
437
|
+
room,
|
|
438
|
+
VIEW_METRICS,
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
// Margins are logical, so the view is taken as left to right and mirrors with the page.
|
|
442
|
+
const centred = (placed: Placed, room: Size & { reserve: number }): View =>
|
|
443
|
+
fitView(placed, { ...room, slack: 0, foot: 0, rtl: false });
|
|
444
|
+
|
|
445
|
+
// The Views' container, whose width puts the details beside the boxes; before it is drawn, the room it will hold.
|
|
446
|
+
const containerOf = (host: DevtoolsPanel, width: number, margin: number) =>
|
|
447
|
+
host.renderRoot.querySelector('.views-scroll')?.clientWidth ??
|
|
448
|
+
width + margin * 2;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Packs the views for the room they are drawn in and places them as the Map's fitted view does: in the middle on an
|
|
452
|
+
* axis they fit, at the start of one they overflow. Where the dock puts the details beside the boxes, the drawing is
|
|
453
|
+
* packed for the room they leave and placed in the whole room as it is before a view is selected, in the middle
|
|
454
|
+
* while their column stays free, else as near it as keeps the column free, so selecting one moves nothing.
|
|
455
|
+
*/
|
|
456
|
+
const layoutOf = (host: DevtoolsPanel, drawing: Drawing): Layout => {
|
|
457
|
+
const margin = parseFloat(
|
|
458
|
+
getComputedStyle(host).getPropertyValue('--uird-margin'),
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
const { width } = host._mapSize;
|
|
462
|
+
const container = containerOf(host, width, margin);
|
|
463
|
+
const beside = container >= BESIDE;
|
|
464
|
+
// Beside the details the room is the container's, which a selection leaves as it was.
|
|
465
|
+
const whole = beside ? container - margin * 2 : width;
|
|
466
|
+
const height = Math.max(0, host._mapSize.height - footOf(host));
|
|
467
|
+
|
|
468
|
+
const placed = packViews(drawing, fontsOf(host), {
|
|
469
|
+
width: beside ? whole - DETAIL : width,
|
|
470
|
+
height,
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// As the Map keeps the popover's column: centred while it is free either side, past that the end margin goes first.
|
|
474
|
+
const reserve = beside
|
|
475
|
+
? Math.max(0, Math.min(DETAIL, DETAIL * 2 - (whole - placed.width)))
|
|
476
|
+
: 0;
|
|
477
|
+
|
|
478
|
+
return { placed, view: centred(placed, { width: whole, height, reserve }) };
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const renderTree = (
|
|
482
|
+
host: DevtoolsPanel,
|
|
483
|
+
{ rows, scene, nodes }: Drawing,
|
|
484
|
+
{ placed, view }: Layout,
|
|
485
|
+
label: string,
|
|
486
|
+
) =>
|
|
487
|
+
html`<div
|
|
488
|
+
class="nested vm-boxes"
|
|
489
|
+
role="tree"
|
|
490
|
+
aria-labelledby=${label}
|
|
491
|
+
style="inline-size:${placed.width}px;block-size:${placed.height}px;margin-inline-start:${view.x}px;margin-block-start:${view.y}px"
|
|
492
|
+
@keydown=${(event: KeyboardEvent) => onKey(host, event, rows, scene.focus)}
|
|
493
|
+
>
|
|
494
|
+
${
|
|
495
|
+
placed.box
|
|
496
|
+
? renderBox(
|
|
497
|
+
scene,
|
|
498
|
+
{
|
|
499
|
+
box: placed.box,
|
|
500
|
+
placed,
|
|
501
|
+
x: 0,
|
|
502
|
+
y: 0,
|
|
503
|
+
width: placed.width,
|
|
504
|
+
height: placed.height,
|
|
505
|
+
},
|
|
506
|
+
nodes,
|
|
507
|
+
)
|
|
508
|
+
: renderBoxes(scene, placed, nodes)
|
|
509
|
+
}
|
|
510
|
+
</div>`;
|
|
511
|
+
|
|
512
|
+
/** The router's `ui-view`s as nested boxes, each named with what fills it, and the selected view's details. */
|
|
513
|
+
export const renderViewMap = (host: DevtoolsPanel): TemplateResult => {
|
|
514
|
+
const snapshot = host._model.views;
|
|
515
|
+
|
|
516
|
+
if (!snapshot) return html`<p class="empty">This session holds no views.</p>`;
|
|
517
|
+
|
|
518
|
+
const drawing = drawingOf(host, snapshot.views, host._viewSelected);
|
|
519
|
+
|
|
520
|
+
const selected = snapshot.views.find(
|
|
521
|
+
(view) => view.id === host._viewSelected,
|
|
522
|
+
);
|
|
523
|
+
|
|
524
|
+
return html`<div class="viewmap" ?data-detail=${Boolean(selected)}>
|
|
525
|
+
<div class="vm-main">
|
|
526
|
+
${
|
|
527
|
+
drawing.rows.length
|
|
528
|
+
? renderTree(host, drawing, layoutOf(host, drawing), 'h-states')
|
|
529
|
+
: html`<p class="empty">No ui-view is registered with the router.</p>`
|
|
530
|
+
}
|
|
531
|
+
${renderUnmatched(host, snapshot.unmatched)}
|
|
532
|
+
</div>
|
|
533
|
+
${renderDetail(host, selected)}
|
|
534
|
+
</div>`;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
// The view path under the Map
|
|
538
|
+
|
|
539
|
+
/** The width past which the path is one row; below it the panel is a sheet or tabs, and the path stacks. */
|
|
540
|
+
const WIDE = '(width > 880px)';
|
|
541
|
+
|
|
542
|
+
const OTHERS = 'others';
|
|
543
|
+
|
|
544
|
+
const keyOf = (id: number): string => `view-${id}`;
|
|
545
|
+
|
|
546
|
+
const STEPS: ReadonlyMap<string, number> = new Map([
|
|
547
|
+
['ArrowLeft', -1],
|
|
548
|
+
['ArrowUp', -1],
|
|
549
|
+
['ArrowRight', 1],
|
|
550
|
+
['ArrowDown', 1],
|
|
551
|
+
]);
|
|
552
|
+
|
|
553
|
+
const flat = (nodes: readonly ViewNode[]): ViewNode[] =>
|
|
554
|
+
nodes.flatMap((node) => [node, ...flat(node.children)]);
|
|
555
|
+
|
|
556
|
+
interface PathScene extends Pick<Scene, 'host' | 'repeated' | 'active'> {
|
|
557
|
+
/** The item that takes Tab. */
|
|
558
|
+
focus: string | undefined;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// The path is one tab stop; the arrow keys step through its items in order, Home and End to either end.
|
|
562
|
+
const onPathKey = (host: DevtoolsPanel, event: KeyboardEvent) => {
|
|
563
|
+
const items = [
|
|
564
|
+
...host.renderRoot.querySelectorAll<HTMLElement>('.vp button'),
|
|
565
|
+
];
|
|
566
|
+
|
|
567
|
+
const at = items.findIndex((item) => item === event.target);
|
|
568
|
+
const rtl = getComputedStyle(host).direction === 'rtl';
|
|
569
|
+
const key = (rtl && MIRRORED.get(event.key)) || event.key;
|
|
570
|
+
const step = STEPS.get(key);
|
|
571
|
+
|
|
572
|
+
const next =
|
|
573
|
+
key === 'Home'
|
|
574
|
+
? items[0]
|
|
575
|
+
: key === 'End'
|
|
576
|
+
? items.at(-1)
|
|
577
|
+
: step === undefined
|
|
578
|
+
? undefined
|
|
579
|
+
: items[at + step];
|
|
580
|
+
|
|
581
|
+
if (!next) return;
|
|
582
|
+
|
|
583
|
+
event.preventDefault();
|
|
584
|
+
next.focus();
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
const separator = (glyph: string) =>
|
|
588
|
+
html`<span class="vp-sep" aria-hidden="true">${glyph}</span>`;
|
|
589
|
+
|
|
590
|
+
const renderItem = (
|
|
591
|
+
scene: PathScene,
|
|
592
|
+
node: ViewNode,
|
|
593
|
+
index: number,
|
|
594
|
+
): TemplateResult => {
|
|
595
|
+
const { host } = scene;
|
|
596
|
+
const { view } = node;
|
|
597
|
+
const key = keyOf(view.id);
|
|
598
|
+
|
|
599
|
+
// In the row a nested view follows the view that holds it, and a sibling follows the one before it.
|
|
600
|
+
const sep = index
|
|
601
|
+
? separator('+')
|
|
602
|
+
: node.depth > 1
|
|
603
|
+
? separator('›')
|
|
604
|
+
: nothing;
|
|
605
|
+
|
|
606
|
+
return html`<div
|
|
607
|
+
class="vp-item ${view.fill ? host._depthClass(view.fill.state) : 'vacant'}"
|
|
608
|
+
>
|
|
609
|
+
${sep}<button
|
|
610
|
+
class="vp-chip"
|
|
611
|
+
tabindex=${key === scene.focus ? 0 : -1}
|
|
612
|
+
aria-pressed=${host._inspect === 'view' && host._viewSelected === view.id}
|
|
613
|
+
aria-label=${describeView(view, scene)}
|
|
614
|
+
title=${view.fqn}
|
|
615
|
+
@click=${() => host._selectView(view.id)}
|
|
616
|
+
@focus=${() => (host._pathFocus = key)}
|
|
617
|
+
@pointerenter=${() => host._pointView(view.id)}
|
|
618
|
+
@pointerleave=${() => host._pointView(null)}
|
|
619
|
+
>
|
|
620
|
+
<span class="name">${viewName(view, scene)}</span
|
|
621
|
+
>${renderFill(view, scene)}
|
|
622
|
+
</button>
|
|
623
|
+
${
|
|
624
|
+
node.children.length
|
|
625
|
+
? html`<div class="vp-inner">
|
|
626
|
+
${node.children.map((child, at) => renderItem(scene, child, at))}
|
|
627
|
+
</div>`
|
|
628
|
+
: nothing
|
|
629
|
+
}
|
|
630
|
+
</div>`;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
const renderOthers = (host: DevtoolsPanel, others: number, focus?: string) =>
|
|
634
|
+
others
|
|
635
|
+
? html`<button
|
|
636
|
+
class="vp-more"
|
|
637
|
+
tabindex=${focus === OTHERS ? 0 : -1}
|
|
638
|
+
title="Every view, in the Views tab"
|
|
639
|
+
@click=${() => (host._view = 'views')}
|
|
640
|
+
@focus=${() => (host._pathFocus = OTHERS)}
|
|
641
|
+
>
|
|
642
|
+
+${others} other ${others === 1 ? 'view' : 'views'}
|
|
643
|
+
</button>`
|
|
644
|
+
: nothing;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* The view path under the Map: the views the selected state fills, else the active state's, inside the views that
|
|
648
|
+
* hold them, as one row of items in the dock and as nested boxes in the sheet. A state on the active path that fills
|
|
649
|
+
* no view shows the path of the nearest ancestor that does.
|
|
650
|
+
*/
|
|
651
|
+
export const renderPath = (host: DevtoolsPanel): TemplateResult => {
|
|
652
|
+
// SAFETY: the panel draws the path only for a snapshot that holds views
|
|
653
|
+
const { views } = host._model.views!;
|
|
654
|
+
const state = host._pathState();
|
|
655
|
+
const active = activeStates(host);
|
|
656
|
+
|
|
657
|
+
const path = viewPath(
|
|
658
|
+
views,
|
|
659
|
+
state,
|
|
660
|
+
active.has(state) ? ancestorsOf(host._model.states, state) : [],
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
if (!path)
|
|
664
|
+
return html`<div
|
|
665
|
+
class="vp"
|
|
666
|
+
role="group"
|
|
667
|
+
aria-label="Views of ${state || 'the root'}"
|
|
668
|
+
>
|
|
669
|
+
<span class="vp-caption">Views</span>
|
|
670
|
+
<span class="vp-none">${stateText(state)} fills no view now</span>
|
|
671
|
+
</div>`;
|
|
672
|
+
|
|
673
|
+
const items = flat(path.nodes);
|
|
674
|
+
// SAFETY: a path is found only for a state that fills one of its views
|
|
675
|
+
const own = items.find((node) => node.view.fill?.state === path.state)!;
|
|
676
|
+
|
|
677
|
+
const keys = [
|
|
678
|
+
...items.map((node) => keyOf(node.view.id)),
|
|
679
|
+
...(path.others ? [OTHERS] : []),
|
|
680
|
+
];
|
|
681
|
+
|
|
682
|
+
const selected =
|
|
683
|
+
host._inspect === 'view' && host._viewSelected !== null
|
|
684
|
+
? keyOf(host._viewSelected)
|
|
685
|
+
: undefined;
|
|
686
|
+
|
|
687
|
+
const focus =
|
|
688
|
+
[host._pathFocus, selected].find((key): key is string =>
|
|
689
|
+
Boolean(key && keys.includes(key)),
|
|
690
|
+
) ?? keyOf(own.view.id);
|
|
691
|
+
|
|
692
|
+
const scene = { host, repeated: repeatedNames(views), active, focus };
|
|
693
|
+
|
|
694
|
+
return html`<div
|
|
695
|
+
class="vp"
|
|
696
|
+
role="toolbar"
|
|
697
|
+
aria-label="Views of ${path.state || 'the root'}"
|
|
698
|
+
aria-orientation=${matchMedia(WIDE).matches ? 'horizontal' : 'vertical'}
|
|
699
|
+
@keydown=${(event: KeyboardEvent) => onPathKey(host, event)}
|
|
700
|
+
>
|
|
701
|
+
<span class="vp-caption" aria-hidden="true"
|
|
702
|
+
>Views${
|
|
703
|
+
path.state === state
|
|
704
|
+
? nothing
|
|
705
|
+
: html` <span class="vp-of">of ${stateText(path.state)}</span>`
|
|
706
|
+
}</span
|
|
707
|
+
>
|
|
708
|
+
${path.nodes.map((node, index) => renderItem(scene, node, index))}
|
|
709
|
+
${renderOthers(host, path.others, focus)}
|
|
710
|
+
</div>`;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
/** The view selected from the Map's view path, in the panel's own inspector. */
|
|
714
|
+
export const renderViewInspector = (host: DevtoolsPanel): TemplateResult => {
|
|
715
|
+
// SAFETY: the panel drops a view selection when its view leaves the snapshot
|
|
716
|
+
const { views } = host._model.views!;
|
|
717
|
+
const view = views.find((each) => each.id === host._viewSelected)!;
|
|
718
|
+
|
|
719
|
+
return html`<div class="inspector vm-inspector">
|
|
720
|
+
<p class="insp-title">
|
|
721
|
+
<span class="name"
|
|
722
|
+
>${viewName(view, { repeated: repeatedNames(views) })}</span
|
|
723
|
+
>
|
|
724
|
+
</p>
|
|
725
|
+
<dl class="facts">
|
|
726
|
+
${facts(host, view).map(
|
|
727
|
+
([term, value]) =>
|
|
728
|
+
html`<dt>${term}</dt>
|
|
729
|
+
<dd>${value}</dd>`,
|
|
730
|
+
)}
|
|
731
|
+
</dl>
|
|
732
|
+
</div>`;
|
|
733
|
+
};
|