@three-flatland/devtools 0.1.0-alpha.3 → 1.0.0-alpha.6
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/dist/buffers-modal.d.ts +16 -52
- package/dist/buffers-modal.d.ts.map +1 -0
- package/dist/buffers-modal.js +459 -464
- package/dist/buffers-modal.js.map +1 -1
- package/dist/buffers-view.d.ts +22 -34
- package/dist/buffers-view.d.ts.map +1 -0
- package/dist/buffers-view.js +252 -240
- package/dist/buffers-view.js.map +1 -1
- package/dist/create-pane.d.ts +38 -37
- package/dist/create-pane.d.ts.map +1 -0
- package/dist/create-pane.js +197 -166
- package/dist/create-pane.js.map +1 -1
- package/dist/dashboard/app.tsx +2 -0
- package/dist/dashboard/export.ts +1 -3
- package/dist/dashboard/frame-cursor.ts +81 -0
- package/dist/dashboard/hooks.ts +10 -2
- package/dist/dashboard/index.html +61 -0
- package/dist/dashboard/panels/batches.tsx +5 -18
- package/dist/dashboard/panels/buffers.tsx +52 -26
- package/dist/dashboard/panels/env.tsx +5 -6
- package/dist/dashboard/panels/protocol-log.tsx +146 -58
- package/dist/dashboard/panels/registry.tsx +55 -69
- package/dist/dashboard/panels/scrubber.tsx +100 -0
- package/dist/dashboard/panels/stats.tsx +60 -32
- package/dist/dashboard/protocol-store.ts +25 -8
- package/dist/dashboard/vendor/hooks.module.d.ts +146 -0
- package/dist/dashboard/vendor/jsx-runtime.d.ts +55 -0
- package/dist/dashboard/vendor/jsx.d.ts +3123 -0
- package/dist/dashboard/vendor/preact.module.d.ts +397 -0
- package/dist/devtools-client.d.ts +312 -300
- package/dist/devtools-client.d.ts.map +1 -0
- package/dist/devtools-client.js +866 -838
- package/dist/devtools-client.js.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.js +5 -12
- package/dist/perf-trace.d.ts +6 -4
- package/dist/perf-trace.d.ts.map +1 -0
- package/dist/perf-trace.js +80 -66
- package/dist/perf-trace.js.map +1 -1
- package/dist/plugins.d.ts +6 -6
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +5 -5
- package/dist/plugins.js.map +1 -1
- package/dist/provider-switcher.d.ts +8 -15
- package/dist/provider-switcher.d.ts.map +1 -0
- package/dist/provider-switcher.js +68 -68
- package/dist/provider-switcher.js.map +1 -1
- package/dist/react/devtools-provider.d.ts +11 -10
- package/dist/react/devtools-provider.d.ts.map +1 -0
- package/dist/react/devtools-provider.js +60 -32
- package/dist/react/devtools-provider.js.map +1 -1
- package/dist/react/use-fps-graph.d.ts +7 -7
- package/dist/react/use-fps-graph.d.ts.map +1 -0
- package/dist/react/use-fps-graph.js +27 -21
- package/dist/react/use-fps-graph.js.map +1 -1
- package/dist/react/use-pane-button.d.ts +4 -4
- package/dist/react/use-pane-button.d.ts.map +1 -0
- package/dist/react/use-pane-button.js +35 -30
- package/dist/react/use-pane-button.js.map +1 -1
- package/dist/react/use-pane-folder.d.ts +5 -4
- package/dist/react/use-pane-folder.d.ts.map +1 -0
- package/dist/react/use-pane-folder.js +33 -20
- package/dist/react/use-pane-folder.js.map +1 -1
- package/dist/react/use-pane-input.d.ts +31 -30
- package/dist/react/use-pane-input.d.ts.map +1 -0
- package/dist/react/use-pane-input.js +46 -42
- package/dist/react/use-pane-input.js.map +1 -1
- package/dist/react/use-pane-radio-grid.d.ts +20 -20
- package/dist/react/use-pane-radio-grid.d.ts.map +1 -0
- package/dist/react/use-pane-radio-grid.js +72 -50
- package/dist/react/use-pane-radio-grid.js.map +1 -1
- package/dist/react/use-pane.d.ts +4 -4
- package/dist/react/use-pane.d.ts.map +1 -0
- package/dist/react/use-pane.js +52 -17
- package/dist/react/use-pane.js.map +1 -1
- package/dist/react.d.ts +10 -12
- package/dist/react.js +2 -12
- package/dist/registry-view.d.ts +8 -21
- package/dist/registry-view.d.ts.map +1 -0
- package/dist/registry-view.js +357 -338
- package/dist/registry-view.js.map +1 -1
- package/dist/relay.d.ts +16 -0
- package/dist/relay.d.ts.map +1 -0
- package/dist/relay.js +189 -0
- package/dist/relay.js.map +1 -0
- package/dist/remote.d.ts +10 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +28 -0
- package/dist/remote.js.map +1 -0
- package/dist/stats-graph.d.ts +23 -31
- package/dist/stats-graph.d.ts.map +1 -0
- package/dist/stats-graph.js +323 -264
- package/dist/stats-graph.js.map +1 -1
- package/dist/stats-row.d.ts +8 -21
- package/dist/stats-row.d.ts.map +1 -0
- package/dist/stats-row.js +99 -101
- package/dist/stats-row.js.map +1 -1
- package/dist/theme.d.ts +3 -1
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +43 -54
- package/dist/theme.js.map +1 -1
- package/dist/vite-plugin.d.ts +7 -6
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +87 -78
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +33 -29
- package/dist/buffers-modal.cjs +0 -491
- package/dist/buffers-modal.cjs.map +0 -1
- package/dist/buffers-modal.d.cts +0 -62
- package/dist/buffers-view.cjs +0 -269
- package/dist/buffers-view.cjs.map +0 -1
- package/dist/buffers-view.d.cts +0 -39
- package/dist/create-pane.cjs +0 -203
- package/dist/create-pane.cjs.map +0 -1
- package/dist/create-pane.d.cts +0 -66
- package/dist/devtools-client.cjs +0 -870
- package/dist/devtools-client.cjs.map +0 -1
- package/dist/devtools-client.d.cts +0 -362
- package/dist/index.cjs +0 -42
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -8
- package/dist/index.js.map +0 -1
- package/dist/perf-trace.cjs +0 -103
- package/dist/perf-trace.cjs.map +0 -1
- package/dist/perf-trace.d.cts +0 -27
- package/dist/plugins.cjs +0 -44
- package/dist/plugins.cjs.map +0 -1
- package/dist/plugins.d.cts +0 -7
- package/dist/provider-switcher.cjs +0 -95
- package/dist/provider-switcher.cjs.map +0 -1
- package/dist/provider-switcher.d.cts +0 -18
- package/dist/react/devtools-provider.cjs +0 -59
- package/dist/react/devtools-provider.cjs.map +0 -1
- package/dist/react/devtools-provider.d.cts +0 -39
- package/dist/react/use-fps-graph.cjs +0 -49
- package/dist/react/use-fps-graph.cjs.map +0 -1
- package/dist/react/use-fps-graph.d.cts +0 -15
- package/dist/react/use-pane-button.cjs +0 -58
- package/dist/react/use-pane-button.cjs.map +0 -1
- package/dist/react/use-pane-button.d.cts +0 -10
- package/dist/react/use-pane-folder.cjs +0 -48
- package/dist/react/use-pane-folder.cjs.map +0 -1
- package/dist/react/use-pane-folder.d.cts +0 -15
- package/dist/react/use-pane-input.cjs +0 -70
- package/dist/react/use-pane-input.cjs.map +0 -1
- package/dist/react/use-pane-input.d.cts +0 -44
- package/dist/react/use-pane-radio-grid.cjs +0 -78
- package/dist/react/use-pane-radio-grid.cjs.map +0 -1
- package/dist/react/use-pane-radio-grid.d.cts +0 -35
- package/dist/react/use-pane.cjs +0 -45
- package/dist/react/use-pane.cjs.map +0 -1
- package/dist/react/use-pane.d.cts +0 -40
- package/dist/react.cjs +0 -50
- package/dist/react.cjs.map +0 -1
- package/dist/react.d.cts +0 -12
- package/dist/react.js.map +0 -1
- package/dist/registry-view.cjs +0 -371
- package/dist/registry-view.cjs.map +0 -1
- package/dist/registry-view.d.cts +0 -24
- package/dist/stats-graph.cjs +0 -297
- package/dist/stats-graph.cjs.map +0 -1
- package/dist/stats-graph.d.cts +0 -40
- package/dist/stats-row.cjs +0 -153
- package/dist/stats-row.cjs.map +0 -1
- package/dist/stats-row.d.cts +0 -24
- package/dist/theme.cjs +0 -260
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.d.cts +0 -10
- package/dist/vite-plugin.cjs +0 -113
- package/dist/vite-plugin.cjs.map +0 -1
- package/dist/vite-plugin.d.cts +0 -9
package/dist/registry-view.js
CHANGED
|
@@ -1,347 +1,366 @@
|
|
|
1
|
+
//#region src/registry-view.ts
|
|
1
2
|
const BAR_HEIGHT = 24;
|
|
2
3
|
const BAR_WIDTH = 240;
|
|
3
4
|
const FILL_BY_KIND = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
float: "#47cca9",
|
|
6
|
+
int: "#47cc6a",
|
|
7
|
+
uint: "#ffa347",
|
|
8
|
+
bits: "#d94c87",
|
|
9
|
+
float2: "#9d7aff",
|
|
10
|
+
float3: "#9d7aff",
|
|
11
|
+
float4: "#9d7aff"
|
|
11
12
|
};
|
|
12
13
|
function splitName(name) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const dot = name.indexOf(".");
|
|
15
|
+
if (dot === -1) return {
|
|
16
|
+
group: "ungrouped",
|
|
17
|
+
short: name
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
group: name.slice(0, dot),
|
|
21
|
+
short: name.slice(dot + 1)
|
|
22
|
+
};
|
|
16
23
|
}
|
|
17
24
|
function addRegistryView(parent, client) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
25
|
+
const blade = parent.addBlade({ view: "separator" });
|
|
26
|
+
const bladeEl = blade.element;
|
|
27
|
+
bladeEl.innerHTML = "";
|
|
28
|
+
bladeEl.className = "tp-cntv";
|
|
29
|
+
bladeEl.style.cssText = "display:none;flex-direction:column;background:rgba(0,0,0,0.3)";
|
|
30
|
+
const header = document.createElement("div");
|
|
31
|
+
header.style.cssText = [
|
|
32
|
+
"display:grid",
|
|
33
|
+
"grid-template-columns:2em 1fr 2em",
|
|
34
|
+
"align-items:center",
|
|
35
|
+
"padding:4px 6px 6px",
|
|
36
|
+
"font-size:11px",
|
|
37
|
+
"color:var(--tp-label-foreground-color)",
|
|
38
|
+
"user-select:none",
|
|
39
|
+
"-webkit-user-select:none",
|
|
40
|
+
"font-variant-numeric:tabular-nums",
|
|
41
|
+
"cursor:pointer"
|
|
42
|
+
].join(";");
|
|
43
|
+
const arrowStyle = "cursor:pointer;padding:0 4px;opacity:0.8;font-family:ui-monospace,monospace;text-align:center";
|
|
44
|
+
const prevBtn = document.createElement("span");
|
|
45
|
+
prevBtn.textContent = "◀";
|
|
46
|
+
prevBtn.style.cssText = arrowStyle;
|
|
47
|
+
prevBtn.setAttribute("role", "button");
|
|
48
|
+
prevBtn.setAttribute("aria-label", "Previous registry group");
|
|
49
|
+
const groupLabel = document.createElement("span");
|
|
50
|
+
groupLabel.style.cssText = "font-weight:500;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none";
|
|
51
|
+
const nextBtn = document.createElement("span");
|
|
52
|
+
nextBtn.textContent = "▶";
|
|
53
|
+
nextBtn.style.cssText = arrowStyle;
|
|
54
|
+
nextBtn.setAttribute("role", "button");
|
|
55
|
+
nextBtn.setAttribute("aria-label", "Next registry group");
|
|
56
|
+
header.appendChild(prevBtn);
|
|
57
|
+
header.appendChild(groupLabel);
|
|
58
|
+
header.appendChild(nextBtn);
|
|
59
|
+
const body = document.createElement("div");
|
|
60
|
+
body.style.cssText = "display:flex;flex-direction:column;gap:4px;padding:2px 6px 6px";
|
|
61
|
+
bladeEl.appendChild(header);
|
|
62
|
+
bladeEl.appendChild(body);
|
|
63
|
+
const groups = /* @__PURE__ */ new Map();
|
|
64
|
+
let activeGroup = null;
|
|
65
|
+
let collapsed = true;
|
|
66
|
+
body.style.display = "none";
|
|
67
|
+
/** Push the currently-visible entry names up to the client. */
|
|
68
|
+
function syncFilter() {
|
|
69
|
+
if (collapsed || activeGroup === null) {
|
|
70
|
+
client.setRegistry([]);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const g = groups.get(activeGroup);
|
|
74
|
+
if (!g) {
|
|
75
|
+
client.setRegistry([]);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const names = [];
|
|
79
|
+
for (const row of g.entries.values()) names.push(row.name);
|
|
80
|
+
client.setRegistry(names);
|
|
81
|
+
}
|
|
82
|
+
const toggleCollapse = (e) => {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
collapsed = !collapsed;
|
|
85
|
+
body.style.display = collapsed ? "none" : "flex";
|
|
86
|
+
if (!collapsed && activeGroup !== null) {
|
|
87
|
+
const g = groups.get(activeGroup);
|
|
88
|
+
if (g) {
|
|
89
|
+
g.container.style.display = "flex";
|
|
90
|
+
for (const row of g.entries.values()) row.lastVersion = -1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
syncFilter();
|
|
94
|
+
};
|
|
95
|
+
header.addEventListener("click", toggleCollapse);
|
|
96
|
+
prevBtn.addEventListener("click", (e) => {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
cycle(-1);
|
|
99
|
+
});
|
|
100
|
+
nextBtn.addEventListener("click", (e) => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
cycle(1);
|
|
103
|
+
});
|
|
104
|
+
function ensureGroup(name) {
|
|
105
|
+
let g = groups.get(name);
|
|
106
|
+
if (g) return g;
|
|
107
|
+
const container = document.createElement("div");
|
|
108
|
+
container.style.cssText = "display:none;flex-direction:column;gap:4px";
|
|
109
|
+
body.appendChild(container);
|
|
110
|
+
g = {
|
|
111
|
+
group: name,
|
|
112
|
+
container,
|
|
113
|
+
entries: /* @__PURE__ */ new Map()
|
|
114
|
+
};
|
|
115
|
+
groups.set(name, g);
|
|
116
|
+
return g;
|
|
117
|
+
}
|
|
118
|
+
function destroyGroup(name) {
|
|
119
|
+
const g = groups.get(name);
|
|
120
|
+
if (!g) return;
|
|
121
|
+
g.container.remove();
|
|
122
|
+
groups.delete(name);
|
|
123
|
+
if (activeGroup === name) activeGroup = null;
|
|
124
|
+
}
|
|
125
|
+
function ensureEntryRow(g, name, shortName) {
|
|
126
|
+
const existing = g.entries.get(shortName);
|
|
127
|
+
if (existing) return existing;
|
|
128
|
+
const row = document.createElement("div");
|
|
129
|
+
row.style.cssText = "display:flex;flex-direction:column;gap:2px";
|
|
130
|
+
const head = document.createElement("div");
|
|
131
|
+
head.style.cssText = [
|
|
132
|
+
"display:flex",
|
|
133
|
+
"align-items:baseline",
|
|
134
|
+
"gap:6px",
|
|
135
|
+
"font-size:10px",
|
|
136
|
+
"line-height:1.2",
|
|
137
|
+
"font-family:var(--tp-base-font-family, ui-monospace, monospace)",
|
|
138
|
+
"font-variant-numeric:tabular-nums",
|
|
139
|
+
"color:var(--tp-monitor-foreground-color)"
|
|
140
|
+
].join(";");
|
|
141
|
+
const nameLabel = document.createElement("span");
|
|
142
|
+
nameLabel.style.cssText = "flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--tp-label-foreground-color)";
|
|
143
|
+
nameLabel.textContent = shortName;
|
|
144
|
+
const valueLabel = document.createElement("span");
|
|
145
|
+
valueLabel.style.cssText = "opacity:0.75;white-space:nowrap";
|
|
146
|
+
head.appendChild(nameLabel);
|
|
147
|
+
head.appendChild(valueLabel);
|
|
148
|
+
const canvas = document.createElement("canvas");
|
|
149
|
+
canvas.width = BAR_WIDTH;
|
|
150
|
+
canvas.height = BAR_HEIGHT;
|
|
151
|
+
canvas.style.cssText = `width:100%;height:${BAR_HEIGHT}px;background:rgba(0,2,28,0.45);border-radius:2px`;
|
|
152
|
+
row.appendChild(head);
|
|
153
|
+
row.appendChild(canvas);
|
|
154
|
+
g.container.appendChild(row);
|
|
155
|
+
const entry = {
|
|
156
|
+
name,
|
|
157
|
+
shortName,
|
|
158
|
+
row,
|
|
159
|
+
nameLabel,
|
|
160
|
+
valueLabel,
|
|
161
|
+
canvas,
|
|
162
|
+
ctx: canvas.getContext("2d"),
|
|
163
|
+
lastVersion: -1
|
|
164
|
+
};
|
|
165
|
+
g.entries.set(shortName, entry);
|
|
166
|
+
return entry;
|
|
167
|
+
}
|
|
168
|
+
function destroyEntryRow(g, shortName) {
|
|
169
|
+
const row = g.entries.get(shortName);
|
|
170
|
+
if (!row) return;
|
|
171
|
+
row.row.remove();
|
|
172
|
+
g.entries.delete(shortName);
|
|
173
|
+
}
|
|
174
|
+
function setActiveGroup(name) {
|
|
175
|
+
activeGroup = name;
|
|
176
|
+
for (const [groupName, g] of groups) g.container.style.display = groupName === name && !collapsed ? "flex" : "none";
|
|
177
|
+
groupLabel.textContent = name ?? "—";
|
|
178
|
+
if (name !== null) {
|
|
179
|
+
const g = groups.get(name);
|
|
180
|
+
if (g) for (const row of g.entries.values()) row.lastVersion = -1;
|
|
181
|
+
}
|
|
182
|
+
syncFilter();
|
|
183
|
+
}
|
|
184
|
+
function cycle(delta) {
|
|
185
|
+
const names = Array.from(groups.keys());
|
|
186
|
+
if (names.length === 0) return;
|
|
187
|
+
const next = names[((activeGroup !== null ? names.indexOf(activeGroup) : -1) + delta + names.length) % names.length];
|
|
188
|
+
setActiveGroup(next);
|
|
189
|
+
}
|
|
190
|
+
function renderBars(row, kind, sample, isSigned) {
|
|
191
|
+
const ctx = row.ctx;
|
|
192
|
+
const w = row.canvas.width;
|
|
193
|
+
const h = row.canvas.height;
|
|
194
|
+
let min = Infinity;
|
|
195
|
+
let max = -Infinity;
|
|
196
|
+
let sum = 0;
|
|
197
|
+
const n = sample.length;
|
|
198
|
+
for (let i = 0; i < n; i++) {
|
|
199
|
+
const v = sample[i];
|
|
200
|
+
if (v < min) min = v;
|
|
201
|
+
if (v > max) max = v;
|
|
202
|
+
sum += v;
|
|
203
|
+
}
|
|
204
|
+
const mean = n > 0 ? sum / n : 0;
|
|
205
|
+
if (!ctx) return {
|
|
206
|
+
min,
|
|
207
|
+
max,
|
|
208
|
+
mean
|
|
209
|
+
};
|
|
210
|
+
ctx.clearRect(0, 0, w, h);
|
|
211
|
+
if (n === 0 || !Number.isFinite(min) || !Number.isFinite(max)) return {
|
|
212
|
+
min,
|
|
213
|
+
max: 0,
|
|
214
|
+
mean
|
|
215
|
+
};
|
|
216
|
+
const zeroY = isSigned ? h / 2 : h;
|
|
217
|
+
const scale = isSigned ? h / 2 / Math.max(Math.abs(min), Math.abs(max) || 1) : h / (max || 1);
|
|
218
|
+
ctx.fillStyle = FILL_BY_KIND[kind] ?? "#47cca9";
|
|
219
|
+
const bw = Math.max(1, w / n);
|
|
220
|
+
for (let i = 0; i < n; i++) {
|
|
221
|
+
const v = sample[i];
|
|
222
|
+
const x = Math.floor(i / n * w);
|
|
223
|
+
const bh = v * scale;
|
|
224
|
+
if (isSigned) if (bh >= 0) ctx.fillRect(x, zeroY - bh, Math.ceil(bw), bh);
|
|
225
|
+
else ctx.fillRect(x, zeroY, Math.ceil(bw), -bh);
|
|
226
|
+
else ctx.fillRect(x, zeroY - bh, Math.ceil(bw), bh);
|
|
227
|
+
}
|
|
228
|
+
if (isSigned) {
|
|
229
|
+
ctx.fillStyle = "rgba(240, 237, 216, 0.2)";
|
|
230
|
+
ctx.fillRect(0, zeroY, w, 1);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
min,
|
|
234
|
+
max,
|
|
235
|
+
mean
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function renderBits(row, sample, count) {
|
|
239
|
+
const ctx = row.ctx;
|
|
240
|
+
const w = row.canvas.width;
|
|
241
|
+
const h = row.canvas.height;
|
|
242
|
+
if (!ctx) return {
|
|
243
|
+
ones: 0,
|
|
244
|
+
total: 0
|
|
245
|
+
};
|
|
246
|
+
ctx.clearRect(0, 0, w, h);
|
|
247
|
+
const totalBits = count * 32;
|
|
248
|
+
if (totalBits === 0) return {
|
|
249
|
+
ones: 0,
|
|
250
|
+
total: 0
|
|
251
|
+
};
|
|
252
|
+
let ones = 0;
|
|
253
|
+
const px = w / totalBits;
|
|
254
|
+
ctx.fillStyle = FILL_BY_KIND.bits;
|
|
255
|
+
for (let i = 0; i < count; i++) {
|
|
256
|
+
const word = sample[i] >>> 0;
|
|
257
|
+
for (let b = 0; b < 32; b++) if (word >>> b & 1) {
|
|
258
|
+
ones++;
|
|
259
|
+
const bitIdx = i * 32 + b;
|
|
260
|
+
const x = Math.floor(bitIdx * px);
|
|
261
|
+
ctx.fillRect(x, 2, Math.max(1, Math.ceil(px)), h - 4);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
ones,
|
|
266
|
+
total: totalBits
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function renderEntry(row, entry) {
|
|
270
|
+
if (row.lastVersion === entry.version) return;
|
|
271
|
+
row.lastVersion = entry.version;
|
|
272
|
+
row.nameLabel.title = `${entry.name} · ${entry.kind} · ${entry.count}`;
|
|
273
|
+
const kind = entry.kind;
|
|
274
|
+
if (kind === "bits") {
|
|
275
|
+
const { ones, total } = renderBits(row, entry.sample, entry.count);
|
|
276
|
+
row.valueLabel.textContent = `${ones} / ${total}`;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (kind === "float2" || kind === "float3" || kind === "float4") {
|
|
280
|
+
const stride = kind === "float2" ? 2 : kind === "float3" ? 3 : 4;
|
|
281
|
+
const n = Math.floor(entry.sample.length / stride);
|
|
282
|
+
const mags = new Float32Array(n);
|
|
283
|
+
for (let i = 0; i < n; i++) {
|
|
284
|
+
let sq = 0;
|
|
285
|
+
for (let c = 0; c < stride; c++) {
|
|
286
|
+
const v = entry.sample[i * stride + c];
|
|
287
|
+
sq += v * v;
|
|
288
|
+
}
|
|
289
|
+
mags[i] = Math.sqrt(sq);
|
|
290
|
+
}
|
|
291
|
+
const stats = renderBars(row, kind, mags, false);
|
|
292
|
+
row.valueLabel.textContent = `${n}×${stride} μ=${stats.mean.toFixed(2)}`;
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const isSigned = kind === "int" || kind === "float";
|
|
296
|
+
const stats = renderBars(row, kind, entry.sample, isSigned);
|
|
297
|
+
const fmt = (v) => {
|
|
298
|
+
if (!Number.isFinite(v)) return "—";
|
|
299
|
+
if (kind === "uint" || kind === "int") return Math.round(v).toString();
|
|
300
|
+
return v.toFixed(2);
|
|
301
|
+
};
|
|
302
|
+
row.valueLabel.textContent = `μ=${fmt(stats.mean)} ${fmt(stats.min)}–${fmt(stats.max)}`;
|
|
303
|
+
}
|
|
304
|
+
const unsubscribe = client.addListener((state) => {
|
|
305
|
+
const registry = state.registry;
|
|
306
|
+
const seen = /* @__PURE__ */ new Map();
|
|
307
|
+
for (const [name] of registry) {
|
|
308
|
+
const { group, short } = splitName(name);
|
|
309
|
+
let bucket = seen.get(group);
|
|
310
|
+
if (!bucket) {
|
|
311
|
+
bucket = /* @__PURE__ */ new Set();
|
|
312
|
+
seen.set(group, bucket);
|
|
313
|
+
}
|
|
314
|
+
bucket.add(short);
|
|
315
|
+
}
|
|
316
|
+
for (const [groupName, g] of groups) {
|
|
317
|
+
const bucket = seen.get(groupName);
|
|
318
|
+
if (!bucket) {
|
|
319
|
+
destroyGroup(groupName);
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
for (const shortName of g.entries.keys()) if (!bucket.has(shortName)) destroyEntryRow(g, shortName);
|
|
323
|
+
}
|
|
324
|
+
for (const [name] of registry) {
|
|
325
|
+
const { group, short } = splitName(name);
|
|
326
|
+
ensureEntryRow(ensureGroup(group), name, short);
|
|
327
|
+
}
|
|
328
|
+
if (groups.size === 0) {
|
|
329
|
+
activeGroup = null;
|
|
330
|
+
groupLabel.textContent = "—";
|
|
331
|
+
} else if (activeGroup === null || !groups.has(activeGroup)) setActiveGroup(groups.keys().next().value);
|
|
332
|
+
else {
|
|
333
|
+
groupLabel.textContent = activeGroup;
|
|
334
|
+
const g = groups.get(activeGroup);
|
|
335
|
+
g.container.style.display = collapsed ? "none" : "flex";
|
|
336
|
+
}
|
|
337
|
+
if (!collapsed && activeGroup !== null) {
|
|
338
|
+
const g = groups.get(activeGroup);
|
|
339
|
+
if (g) for (const [shortName, row] of g.entries) {
|
|
340
|
+
const entry = registry.get(`${activeGroup}.${shortName}`) ?? registry.get(shortName);
|
|
341
|
+
if (entry) renderEntry(row, entry);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const multi = groups.size > 1;
|
|
345
|
+
const arrowOpacity = multi ? "0.8" : "0.25";
|
|
346
|
+
const arrowPointer = multi ? "pointer" : "default";
|
|
347
|
+
prevBtn.style.opacity = arrowOpacity;
|
|
348
|
+
nextBtn.style.opacity = arrowOpacity;
|
|
349
|
+
prevBtn.style.cursor = arrowPointer;
|
|
350
|
+
nextBtn.style.cursor = arrowPointer;
|
|
351
|
+
bladeEl.style.display = registry.size > 0 ? "flex" : "none";
|
|
352
|
+
syncFilter();
|
|
353
|
+
});
|
|
354
|
+
return {
|
|
355
|
+
element: bladeEl,
|
|
356
|
+
dispose() {
|
|
357
|
+
unsubscribe();
|
|
358
|
+
groups.clear();
|
|
359
|
+
blade.dispose();
|
|
360
|
+
}
|
|
361
|
+
};
|
|
343
362
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
363
|
+
//#endregion
|
|
364
|
+
export { addRegistryView };
|
|
365
|
+
|
|
347
366
|
//# sourceMappingURL=registry-view.js.map
|