@oxog/reactscope 1.0.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 +21 -0
- package/README.md +230 -0
- package/dist/chunk-4TZAECHG.cjs +160 -0
- package/dist/chunk-4TZAECHG.cjs.map +1 -0
- package/dist/chunk-6L3WUS6V.cjs +160 -0
- package/dist/chunk-6L3WUS6V.cjs.map +1 -0
- package/dist/chunk-6LHJL6MV.js +1176 -0
- package/dist/chunk-6LHJL6MV.js.map +1 -0
- package/dist/chunk-ALGKN7FA.cjs +192 -0
- package/dist/chunk-ALGKN7FA.cjs.map +1 -0
- package/dist/chunk-DVRJ7PFB.cjs +185 -0
- package/dist/chunk-DVRJ7PFB.cjs.map +1 -0
- package/dist/chunk-E4MB5KJQ.js +98 -0
- package/dist/chunk-E4MB5KJQ.js.map +1 -0
- package/dist/chunk-H4W4UBLZ.cjs +149 -0
- package/dist/chunk-H4W4UBLZ.cjs.map +1 -0
- package/dist/chunk-I427KZYN.cjs +29 -0
- package/dist/chunk-I427KZYN.cjs.map +1 -0
- package/dist/chunk-IFCS6ABF.cjs +1180 -0
- package/dist/chunk-IFCS6ABF.cjs.map +1 -0
- package/dist/chunk-JESQX3XO.js +157 -0
- package/dist/chunk-JESQX3XO.js.map +1 -0
- package/dist/chunk-KCUWALXE.cjs +252 -0
- package/dist/chunk-KCUWALXE.cjs.map +1 -0
- package/dist/chunk-LZO35OCP.js +26 -0
- package/dist/chunk-LZO35OCP.js.map +1 -0
- package/dist/chunk-M65L55OT.js +146 -0
- package/dist/chunk-M65L55OT.js.map +1 -0
- package/dist/chunk-MPOQNCGP.js +157 -0
- package/dist/chunk-MPOQNCGP.js.map +1 -0
- package/dist/chunk-MTCOZBRI.js +115 -0
- package/dist/chunk-MTCOZBRI.js.map +1 -0
- package/dist/chunk-MVK2UT4Z.js +182 -0
- package/dist/chunk-MVK2UT4Z.js.map +1 -0
- package/dist/chunk-OJGWFS55.cjs +173 -0
- package/dist/chunk-OJGWFS55.cjs.map +1 -0
- package/dist/chunk-QYMRRTSN.cjs +134 -0
- package/dist/chunk-QYMRRTSN.cjs.map +1 -0
- package/dist/chunk-QZ5T7HPO.cjs +118 -0
- package/dist/chunk-QZ5T7HPO.cjs.map +1 -0
- package/dist/chunk-RYAIO3BO.js +131 -0
- package/dist/chunk-RYAIO3BO.js.map +1 -0
- package/dist/chunk-U2OPUU5R.js +170 -0
- package/dist/chunk-U2OPUU5R.js.map +1 -0
- package/dist/chunk-WQRBHD23.cjs +105 -0
- package/dist/chunk-WQRBHD23.cjs.map +1 -0
- package/dist/chunk-XNNGOQH2.js +189 -0
- package/dist/chunk-XNNGOQH2.js.map +1 -0
- package/dist/chunk-ZTO5ZZVE.js +248 -0
- package/dist/chunk-ZTO5ZZVE.js.map +1 -0
- package/dist/index.cjs +1521 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +198 -0
- package/dist/index.d.ts +198 -0
- package/dist/index.js +1381 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/console-reporter/index.cjs +17 -0
- package/dist/plugins/console-reporter/index.cjs.map +1 -0
- package/dist/plugins/console-reporter/index.d.cts +54 -0
- package/dist/plugins/console-reporter/index.d.ts +54 -0
- package/dist/plugins/console-reporter/index.js +4 -0
- package/dist/plugins/console-reporter/index.js.map +1 -0
- package/dist/plugins/dashboard-ui/index.cjs +17 -0
- package/dist/plugins/dashboard-ui/index.cjs.map +1 -0
- package/dist/plugins/dashboard-ui/index.d.cts +68 -0
- package/dist/plugins/dashboard-ui/index.d.ts +68 -0
- package/dist/plugins/dashboard-ui/index.js +4 -0
- package/dist/plugins/dashboard-ui/index.js.map +1 -0
- package/dist/plugins/json-exporter/index.cjs +16 -0
- package/dist/plugins/json-exporter/index.cjs.map +1 -0
- package/dist/plugins/json-exporter/index.d.cts +34 -0
- package/dist/plugins/json-exporter/index.d.ts +34 -0
- package/dist/plugins/json-exporter/index.js +3 -0
- package/dist/plugins/json-exporter/index.js.map +1 -0
- package/dist/plugins/lifecycle-tracker/index.cjs +16 -0
- package/dist/plugins/lifecycle-tracker/index.cjs.map +1 -0
- package/dist/plugins/lifecycle-tracker/index.d.cts +42 -0
- package/dist/plugins/lifecycle-tracker/index.d.ts +42 -0
- package/dist/plugins/lifecycle-tracker/index.js +3 -0
- package/dist/plugins/lifecycle-tracker/index.js.map +1 -0
- package/dist/plugins/memory-tracker/index.cjs +16 -0
- package/dist/plugins/memory-tracker/index.cjs.map +1 -0
- package/dist/plugins/memory-tracker/index.d.cts +56 -0
- package/dist/plugins/memory-tracker/index.d.ts +56 -0
- package/dist/plugins/memory-tracker/index.js +3 -0
- package/dist/plugins/memory-tracker/index.js.map +1 -0
- package/dist/plugins/network-correlator/index.cjs +17 -0
- package/dist/plugins/network-correlator/index.cjs.map +1 -0
- package/dist/plugins/network-correlator/index.d.cts +48 -0
- package/dist/plugins/network-correlator/index.d.ts +48 -0
- package/dist/plugins/network-correlator/index.js +4 -0
- package/dist/plugins/network-correlator/index.js.map +1 -0
- package/dist/plugins/props-differ/index.cjs +16 -0
- package/dist/plugins/props-differ/index.cjs.map +1 -0
- package/dist/plugins/props-differ/index.d.cts +41 -0
- package/dist/plugins/props-differ/index.d.ts +41 -0
- package/dist/plugins/props-differ/index.js +3 -0
- package/dist/plugins/props-differ/index.js.map +1 -0
- package/dist/plugins/render-tracker/index.cjs +16 -0
- package/dist/plugins/render-tracker/index.cjs.map +1 -0
- package/dist/plugins/render-tracker/index.d.cts +36 -0
- package/dist/plugins/render-tracker/index.d.ts +36 -0
- package/dist/plugins/render-tracker/index.js +3 -0
- package/dist/plugins/render-tracker/index.js.map +1 -0
- package/dist/plugins/timeline-recorder/index.cjs +17 -0
- package/dist/plugins/timeline-recorder/index.cjs.map +1 -0
- package/dist/plugins/timeline-recorder/index.d.cts +52 -0
- package/dist/plugins/timeline-recorder/index.d.ts +52 -0
- package/dist/plugins/timeline-recorder/index.js +4 -0
- package/dist/plugins/timeline-recorder/index.js.map +1 -0
- package/dist/plugins/wasted-render-detector/index.cjs +16 -0
- package/dist/plugins/wasted-render-detector/index.cjs.map +1 -0
- package/dist/plugins/wasted-render-detector/index.d.cts +44 -0
- package/dist/plugins/wasted-render-detector/index.d.ts +44 -0
- package/dist/plugins/wasted-render-detector/index.js +3 -0
- package/dist/plugins/wasted-render-detector/index.js.map +1 -0
- package/dist/types-DKPG_emi.d.cts +396 -0
- package/dist/types-DKPG_emi.d.ts +396 -0
- package/package.json +173 -0
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkWQRBHD23_cjs = require('./chunk-WQRBHD23.cjs');
|
|
4
|
+
|
|
5
|
+
// src/plugins/dashboard-ui/styles/dashboard.css.ts
|
|
6
|
+
var DASHBOARD_CSS = `
|
|
7
|
+
:host {
|
|
8
|
+
--bg-primary: #0a0a0a;
|
|
9
|
+
--bg-secondary: #141414;
|
|
10
|
+
--bg-tertiary: #1f1f1f;
|
|
11
|
+
--text-primary: #fafafa;
|
|
12
|
+
--text-secondary: #a1a1aa;
|
|
13
|
+
--accent: #3b82f6;
|
|
14
|
+
--success: #22c55e;
|
|
15
|
+
--warning: #eab308;
|
|
16
|
+
--error: #ef4444;
|
|
17
|
+
--border: #27272a;
|
|
18
|
+
--fast: #22c55e;
|
|
19
|
+
--medium: #eab308;
|
|
20
|
+
--slow: #ef4444;
|
|
21
|
+
--wasted: #f97316;
|
|
22
|
+
|
|
23
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
* {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.dashboard {
|
|
35
|
+
position: fixed;
|
|
36
|
+
background: var(--bg-primary);
|
|
37
|
+
border: 1px solid var(--border);
|
|
38
|
+
border-radius: 8px;
|
|
39
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
|
40
|
+
color: var(--text-primary);
|
|
41
|
+
z-index: 99999;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dashboard.collapsed {
|
|
48
|
+
width: auto !important;
|
|
49
|
+
height: auto !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dashboard.collapsed .dashboard-content {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dashboard-header {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: space-between;
|
|
60
|
+
padding: 8px 12px;
|
|
61
|
+
background: var(--bg-secondary);
|
|
62
|
+
border-bottom: 1px solid var(--border);
|
|
63
|
+
cursor: move;
|
|
64
|
+
user-select: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dashboard-title {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: 8px;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
font-size: 13px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dashboard-title-icon {
|
|
76
|
+
font-size: 14px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dashboard-controls {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 4px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.dashboard-btn {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
width: 24px;
|
|
90
|
+
height: 24px;
|
|
91
|
+
background: transparent;
|
|
92
|
+
border: none;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
color: var(--text-secondary);
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dashboard-btn:hover {
|
|
100
|
+
background: var(--bg-tertiary);
|
|
101
|
+
color: var(--text-primary);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dashboard-content {
|
|
105
|
+
flex: 1;
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dashboard-tabs {
|
|
112
|
+
display: flex;
|
|
113
|
+
border-bottom: 1px solid var(--border);
|
|
114
|
+
background: var(--bg-secondary);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.dashboard-tab {
|
|
118
|
+
padding: 8px 16px;
|
|
119
|
+
background: transparent;
|
|
120
|
+
border: none;
|
|
121
|
+
color: var(--text-secondary);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
font-size: 12px;
|
|
124
|
+
border-bottom: 2px solid transparent;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dashboard-tab:hover {
|
|
128
|
+
color: var(--text-primary);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dashboard-tab.active {
|
|
132
|
+
color: var(--accent);
|
|
133
|
+
border-bottom-color: var(--accent);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.dashboard-panel {
|
|
137
|
+
flex: 1;
|
|
138
|
+
padding: 12px;
|
|
139
|
+
overflow: auto;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.search-input {
|
|
143
|
+
width: 100%;
|
|
144
|
+
padding: 8px 12px;
|
|
145
|
+
background: var(--bg-tertiary);
|
|
146
|
+
border: 1px solid var(--border);
|
|
147
|
+
border-radius: 4px;
|
|
148
|
+
color: var(--text-primary);
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
margin-bottom: 12px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.search-input:focus {
|
|
154
|
+
outline: none;
|
|
155
|
+
border-color: var(--accent);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tree-view {
|
|
159
|
+
font-family: inherit;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.tree-node {
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.tree-node-content {
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
padding: 4px 8px;
|
|
171
|
+
border-radius: 4px;
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.tree-node-content:hover {
|
|
176
|
+
background: var(--bg-tertiary);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.tree-node-content.selected {
|
|
180
|
+
background: var(--accent);
|
|
181
|
+
background-opacity: 0.2;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.tree-node-toggle {
|
|
185
|
+
width: 16px;
|
|
186
|
+
height: 16px;
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
margin-right: 4px;
|
|
191
|
+
color: var(--text-secondary);
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.tree-node-toggle:hover {
|
|
196
|
+
color: var(--text-primary);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.tree-node-name {
|
|
200
|
+
flex: 1;
|
|
201
|
+
margin-right: 8px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.tree-node-metrics {
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
gap: 8px;
|
|
208
|
+
font-size: 11px;
|
|
209
|
+
color: var(--text-secondary);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.tree-node-children {
|
|
213
|
+
padding-left: 20px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.metric-badge {
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 4px;
|
|
220
|
+
padding: 2px 6px;
|
|
221
|
+
border-radius: 4px;
|
|
222
|
+
font-size: 10px;
|
|
223
|
+
font-weight: 500;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.metric-badge.renders {
|
|
227
|
+
background: rgba(59, 130, 246, 0.2);
|
|
228
|
+
color: var(--accent);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.metric-badge.time {
|
|
232
|
+
background: rgba(34, 197, 94, 0.2);
|
|
233
|
+
color: var(--success);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.metric-badge.time.slow {
|
|
237
|
+
background: rgba(239, 68, 68, 0.2);
|
|
238
|
+
color: var(--error);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.metric-badge.wasted {
|
|
242
|
+
background: rgba(249, 115, 22, 0.2);
|
|
243
|
+
color: var(--wasted);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.alert-item {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: flex-start;
|
|
249
|
+
gap: 8px;
|
|
250
|
+
padding: 8px;
|
|
251
|
+
background: var(--bg-tertiary);
|
|
252
|
+
border-radius: 4px;
|
|
253
|
+
margin-bottom: 8px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.alert-icon {
|
|
257
|
+
font-size: 14px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.alert-icon.warning {
|
|
261
|
+
color: var(--warning);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.alert-icon.error {
|
|
265
|
+
color: var(--error);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.alert-content {
|
|
269
|
+
flex: 1;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.alert-title {
|
|
273
|
+
font-weight: 500;
|
|
274
|
+
margin-bottom: 2px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.alert-description {
|
|
278
|
+
font-size: 11px;
|
|
279
|
+
color: var(--text-secondary);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.details-panel {
|
|
283
|
+
display: flex;
|
|
284
|
+
flex-direction: column;
|
|
285
|
+
gap: 16px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.details-section {
|
|
289
|
+
background: var(--bg-tertiary);
|
|
290
|
+
border-radius: 4px;
|
|
291
|
+
padding: 12px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.details-section-title {
|
|
295
|
+
font-weight: 600;
|
|
296
|
+
margin-bottom: 8px;
|
|
297
|
+
color: var(--text-secondary);
|
|
298
|
+
font-size: 11px;
|
|
299
|
+
text-transform: uppercase;
|
|
300
|
+
letter-spacing: 0.5px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.details-row {
|
|
304
|
+
display: flex;
|
|
305
|
+
justify-content: space-between;
|
|
306
|
+
padding: 4px 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.details-label {
|
|
310
|
+
color: var(--text-secondary);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.details-value {
|
|
314
|
+
font-weight: 500;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.timeline-chart {
|
|
318
|
+
height: 100px;
|
|
319
|
+
background: var(--bg-tertiary);
|
|
320
|
+
border-radius: 4px;
|
|
321
|
+
position: relative;
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.timeline-bar {
|
|
326
|
+
position: absolute;
|
|
327
|
+
bottom: 0;
|
|
328
|
+
width: 2px;
|
|
329
|
+
background: var(--accent);
|
|
330
|
+
border-radius: 1px 1px 0 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.memory-chart {
|
|
334
|
+
height: 100px;
|
|
335
|
+
background: var(--bg-tertiary);
|
|
336
|
+
border-radius: 4px;
|
|
337
|
+
position: relative;
|
|
338
|
+
padding: 8px;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.memory-chart-line {
|
|
342
|
+
stroke: var(--accent);
|
|
343
|
+
stroke-width: 2;
|
|
344
|
+
fill: none;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.memory-chart-area {
|
|
348
|
+
fill: rgba(59, 130, 246, 0.1);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.network-item {
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
gap: 8px;
|
|
355
|
+
padding: 8px;
|
|
356
|
+
background: var(--bg-tertiary);
|
|
357
|
+
border-radius: 4px;
|
|
358
|
+
margin-bottom: 8px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.network-method {
|
|
362
|
+
font-weight: 600;
|
|
363
|
+
font-size: 10px;
|
|
364
|
+
padding: 2px 6px;
|
|
365
|
+
border-radius: 4px;
|
|
366
|
+
background: var(--accent);
|
|
367
|
+
color: white;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.network-url {
|
|
371
|
+
flex: 1;
|
|
372
|
+
overflow: hidden;
|
|
373
|
+
text-overflow: ellipsis;
|
|
374
|
+
white-space: nowrap;
|
|
375
|
+
color: var(--text-secondary);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.network-time {
|
|
379
|
+
font-size: 11px;
|
|
380
|
+
color: var(--text-secondary);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.empty-state {
|
|
384
|
+
display: flex;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
align-items: center;
|
|
387
|
+
justify-content: center;
|
|
388
|
+
padding: 32px;
|
|
389
|
+
color: var(--text-secondary);
|
|
390
|
+
text-align: center;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.empty-state-icon {
|
|
394
|
+
font-size: 32px;
|
|
395
|
+
margin-bottom: 8px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.resize-handle {
|
|
399
|
+
position: absolute;
|
|
400
|
+
background: transparent;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.resize-handle-se {
|
|
404
|
+
right: 0;
|
|
405
|
+
bottom: 0;
|
|
406
|
+
width: 16px;
|
|
407
|
+
height: 16px;
|
|
408
|
+
cursor: nwse-resize;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.resize-handle-e {
|
|
412
|
+
right: 0;
|
|
413
|
+
top: 16px;
|
|
414
|
+
bottom: 16px;
|
|
415
|
+
width: 4px;
|
|
416
|
+
cursor: ew-resize;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.resize-handle-s {
|
|
420
|
+
left: 16px;
|
|
421
|
+
right: 16px;
|
|
422
|
+
bottom: 0;
|
|
423
|
+
height: 4px;
|
|
424
|
+
cursor: ns-resize;
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
|
|
428
|
+
// src/plugins/dashboard-ui/utils/shadow-dom.ts
|
|
429
|
+
function createShadowContainer() {
|
|
430
|
+
const host = document.createElement("div");
|
|
431
|
+
host.id = "reactscope-dashboard-host";
|
|
432
|
+
host.style.cssText = "position: fixed; z-index: 99999; pointer-events: none;";
|
|
433
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
434
|
+
const style = document.createElement("style");
|
|
435
|
+
style.textContent = DASHBOARD_CSS;
|
|
436
|
+
shadow.appendChild(style);
|
|
437
|
+
const root = document.createElement("div");
|
|
438
|
+
root.id = "reactscope-dashboard-root";
|
|
439
|
+
root.style.cssText = "pointer-events: auto;";
|
|
440
|
+
shadow.appendChild(root);
|
|
441
|
+
document.body.appendChild(host);
|
|
442
|
+
return { host, shadow, root };
|
|
443
|
+
}
|
|
444
|
+
function removeShadowContainer(host) {
|
|
445
|
+
if (host.parentNode) {
|
|
446
|
+
host.parentNode.removeChild(host);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function createElement(tag, className, textContent) {
|
|
450
|
+
const el = document.createElement(tag);
|
|
451
|
+
if (className) {
|
|
452
|
+
el.className = className;
|
|
453
|
+
}
|
|
454
|
+
return el;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/plugins/dashboard-ui/utils/draggable.ts
|
|
458
|
+
function makeDraggable(element, handle, options = {}) {
|
|
459
|
+
let isDragging = false;
|
|
460
|
+
let startX = 0;
|
|
461
|
+
let startY = 0;
|
|
462
|
+
let offsetX = 0;
|
|
463
|
+
let offsetY = 0;
|
|
464
|
+
const handleMouseDown = (e) => {
|
|
465
|
+
if (e.button !== 0) return;
|
|
466
|
+
isDragging = true;
|
|
467
|
+
startX = e.clientX;
|
|
468
|
+
startY = e.clientY;
|
|
469
|
+
const rect = element.getBoundingClientRect();
|
|
470
|
+
offsetX = rect.left;
|
|
471
|
+
offsetY = rect.top;
|
|
472
|
+
handle.style.cursor = "grabbing";
|
|
473
|
+
options.onDragStart?.(offsetX, offsetY);
|
|
474
|
+
e.preventDefault();
|
|
475
|
+
};
|
|
476
|
+
const handleMouseMove = (e) => {
|
|
477
|
+
if (!isDragging) return;
|
|
478
|
+
const deltaX = e.clientX - startX;
|
|
479
|
+
const deltaY = e.clientY - startY;
|
|
480
|
+
let newX = offsetX + deltaX;
|
|
481
|
+
let newY = offsetY + deltaY;
|
|
482
|
+
if (options.bounds) {
|
|
483
|
+
newX = Math.max(options.bounds.minX, Math.min(newX, options.bounds.maxX));
|
|
484
|
+
newY = Math.max(options.bounds.minY, Math.min(newY, options.bounds.maxY));
|
|
485
|
+
}
|
|
486
|
+
element.style.left = `${newX}px`;
|
|
487
|
+
element.style.top = `${newY}px`;
|
|
488
|
+
element.style.right = "auto";
|
|
489
|
+
element.style.bottom = "auto";
|
|
490
|
+
options.onDrag?.(newX, newY);
|
|
491
|
+
};
|
|
492
|
+
const handleMouseUp = () => {
|
|
493
|
+
if (!isDragging) return;
|
|
494
|
+
isDragging = false;
|
|
495
|
+
handle.style.cursor = "move";
|
|
496
|
+
const rect = element.getBoundingClientRect();
|
|
497
|
+
options.onDragEnd?.(rect.left, rect.top);
|
|
498
|
+
};
|
|
499
|
+
handle.style.cursor = "move";
|
|
500
|
+
handle.addEventListener("mousedown", handleMouseDown);
|
|
501
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
502
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
503
|
+
return () => {
|
|
504
|
+
handle.removeEventListener("mousedown", handleMouseDown);
|
|
505
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
506
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function getInitialPosition(position, width, height) {
|
|
510
|
+
const margin = 16;
|
|
511
|
+
switch (position) {
|
|
512
|
+
case "top-left":
|
|
513
|
+
return { x: margin, y: margin };
|
|
514
|
+
case "top-right":
|
|
515
|
+
return { x: window.innerWidth - width - margin, y: margin };
|
|
516
|
+
case "bottom-left":
|
|
517
|
+
return { x: margin, y: window.innerHeight - height - margin };
|
|
518
|
+
case "bottom-right":
|
|
519
|
+
return { x: window.innerWidth - width - margin, y: window.innerHeight - height - margin };
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/plugins/dashboard-ui/utils/resizable.ts
|
|
524
|
+
function makeResizable(element, options = {}) {
|
|
525
|
+
const {
|
|
526
|
+
minWidth = 200,
|
|
527
|
+
minHeight = 150,
|
|
528
|
+
maxWidth = window.innerWidth - 32,
|
|
529
|
+
maxHeight = window.innerHeight - 32,
|
|
530
|
+
onResize,
|
|
531
|
+
onResizeEnd
|
|
532
|
+
} = options;
|
|
533
|
+
const cleanups = [];
|
|
534
|
+
const handleSE = document.createElement("div");
|
|
535
|
+
handleSE.className = "resize-handle resize-handle-se";
|
|
536
|
+
element.appendChild(handleSE);
|
|
537
|
+
const handleE = document.createElement("div");
|
|
538
|
+
handleE.className = "resize-handle resize-handle-e";
|
|
539
|
+
element.appendChild(handleE);
|
|
540
|
+
const handleS = document.createElement("div");
|
|
541
|
+
handleS.className = "resize-handle resize-handle-s";
|
|
542
|
+
element.appendChild(handleS);
|
|
543
|
+
const createResizeHandler = (handle, resizeWidth, resizeHeight) => {
|
|
544
|
+
let isResizing = false;
|
|
545
|
+
let startX = 0;
|
|
546
|
+
let startY = 0;
|
|
547
|
+
let startWidth = 0;
|
|
548
|
+
let startHeight = 0;
|
|
549
|
+
const onMouseDown = (e) => {
|
|
550
|
+
if (e.button !== 0) return;
|
|
551
|
+
isResizing = true;
|
|
552
|
+
startX = e.clientX;
|
|
553
|
+
startY = e.clientY;
|
|
554
|
+
startWidth = element.offsetWidth;
|
|
555
|
+
startHeight = element.offsetHeight;
|
|
556
|
+
e.preventDefault();
|
|
557
|
+
e.stopPropagation();
|
|
558
|
+
};
|
|
559
|
+
const onMouseMove = (e) => {
|
|
560
|
+
if (!isResizing) return;
|
|
561
|
+
let newWidth = startWidth;
|
|
562
|
+
let newHeight = startHeight;
|
|
563
|
+
if (resizeWidth) {
|
|
564
|
+
newWidth = startWidth + (e.clientX - startX);
|
|
565
|
+
newWidth = Math.max(minWidth, Math.min(newWidth, maxWidth));
|
|
566
|
+
}
|
|
567
|
+
if (resizeHeight) {
|
|
568
|
+
newHeight = startHeight + (e.clientY - startY);
|
|
569
|
+
newHeight = Math.max(minHeight, Math.min(newHeight, maxHeight));
|
|
570
|
+
}
|
|
571
|
+
element.style.width = `${newWidth}px`;
|
|
572
|
+
element.style.height = `${newHeight}px`;
|
|
573
|
+
onResize?.(newWidth, newHeight);
|
|
574
|
+
};
|
|
575
|
+
const onMouseUp = () => {
|
|
576
|
+
if (!isResizing) return;
|
|
577
|
+
isResizing = false;
|
|
578
|
+
onResizeEnd?.(element.offsetWidth, element.offsetHeight);
|
|
579
|
+
};
|
|
580
|
+
handle.addEventListener("mousedown", onMouseDown);
|
|
581
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
582
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
583
|
+
cleanups.push(() => {
|
|
584
|
+
handle.removeEventListener("mousedown", onMouseDown);
|
|
585
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
586
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
587
|
+
});
|
|
588
|
+
};
|
|
589
|
+
createResizeHandler(handleSE, true, true);
|
|
590
|
+
createResizeHandler(handleE, true, false);
|
|
591
|
+
createResizeHandler(handleS, false, true);
|
|
592
|
+
return () => {
|
|
593
|
+
for (const cleanup of cleanups) {
|
|
594
|
+
cleanup();
|
|
595
|
+
}
|
|
596
|
+
handleSE.remove();
|
|
597
|
+
handleE.remove();
|
|
598
|
+
handleS.remove();
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/utils/throttle.ts
|
|
603
|
+
function throttle(fn, wait, options = {}) {
|
|
604
|
+
const { leading = true, trailing = true } = options;
|
|
605
|
+
let lastCallTime;
|
|
606
|
+
let lastInvokeTime = 0;
|
|
607
|
+
let timerId;
|
|
608
|
+
let lastArgs;
|
|
609
|
+
let lastThis;
|
|
610
|
+
let result;
|
|
611
|
+
function invokeFunc(time) {
|
|
612
|
+
const args = lastArgs;
|
|
613
|
+
const thisArg = lastThis;
|
|
614
|
+
lastArgs = void 0;
|
|
615
|
+
lastThis = void 0;
|
|
616
|
+
lastInvokeTime = time;
|
|
617
|
+
result = fn.apply(thisArg, args);
|
|
618
|
+
return result;
|
|
619
|
+
}
|
|
620
|
+
function shouldInvoke(time) {
|
|
621
|
+
const timeSinceLastCall = lastCallTime === void 0 ? wait : time - lastCallTime;
|
|
622
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
623
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || timeSinceLastInvoke >= wait;
|
|
624
|
+
}
|
|
625
|
+
function remainingWait(time) {
|
|
626
|
+
const timeSinceLastCall = lastCallTime === void 0 ? 0 : time - lastCallTime;
|
|
627
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
628
|
+
const timeWaiting = wait - timeSinceLastCall;
|
|
629
|
+
return Math.max(0, Math.min(timeWaiting, wait - timeSinceLastInvoke));
|
|
630
|
+
}
|
|
631
|
+
function trailingEdge(time) {
|
|
632
|
+
timerId = void 0;
|
|
633
|
+
if (trailing && lastArgs) {
|
|
634
|
+
return invokeFunc(time);
|
|
635
|
+
}
|
|
636
|
+
lastArgs = void 0;
|
|
637
|
+
lastThis = void 0;
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
function timerExpired() {
|
|
641
|
+
const time = Date.now();
|
|
642
|
+
if (shouldInvoke(time)) {
|
|
643
|
+
trailingEdge(time);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
647
|
+
}
|
|
648
|
+
function leadingEdge(time) {
|
|
649
|
+
lastInvokeTime = time;
|
|
650
|
+
timerId = setTimeout(timerExpired, wait);
|
|
651
|
+
if (leading) {
|
|
652
|
+
return invokeFunc(time);
|
|
653
|
+
}
|
|
654
|
+
return result;
|
|
655
|
+
}
|
|
656
|
+
function throttled(...args) {
|
|
657
|
+
const time = Date.now();
|
|
658
|
+
const isInvoking = shouldInvoke(time);
|
|
659
|
+
lastArgs = args;
|
|
660
|
+
lastThis = this;
|
|
661
|
+
lastCallTime = time;
|
|
662
|
+
if (isInvoking) {
|
|
663
|
+
if (timerId === void 0) {
|
|
664
|
+
return leadingEdge(time);
|
|
665
|
+
}
|
|
666
|
+
if (trailing) {
|
|
667
|
+
timerId = setTimeout(timerExpired, wait);
|
|
668
|
+
return invokeFunc(time);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (timerId === void 0 && trailing) {
|
|
672
|
+
timerId = setTimeout(timerExpired, wait);
|
|
673
|
+
}
|
|
674
|
+
return result;
|
|
675
|
+
}
|
|
676
|
+
function cancel() {
|
|
677
|
+
if (timerId !== void 0) {
|
|
678
|
+
clearTimeout(timerId);
|
|
679
|
+
}
|
|
680
|
+
lastInvokeTime = 0;
|
|
681
|
+
lastArgs = void 0;
|
|
682
|
+
lastCallTime = void 0;
|
|
683
|
+
lastThis = void 0;
|
|
684
|
+
timerId = void 0;
|
|
685
|
+
}
|
|
686
|
+
function flush() {
|
|
687
|
+
if (timerId === void 0) {
|
|
688
|
+
return result;
|
|
689
|
+
}
|
|
690
|
+
return trailingEdge(Date.now());
|
|
691
|
+
}
|
|
692
|
+
throttled.cancel = cancel;
|
|
693
|
+
throttled.flush = flush;
|
|
694
|
+
return throttled;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/plugins/dashboard-ui/dashboard-ui.ts
|
|
698
|
+
var DEFAULT_OPTIONS = {
|
|
699
|
+
position: "bottom-right",
|
|
700
|
+
shortcut: "ctrl+shift+r",
|
|
701
|
+
draggable: true,
|
|
702
|
+
resizable: true,
|
|
703
|
+
defaultWidth: 400,
|
|
704
|
+
defaultHeight: 500,
|
|
705
|
+
defaultCollapsed: false,
|
|
706
|
+
theme: "dark"
|
|
707
|
+
};
|
|
708
|
+
var DashboardUIPlugin = class {
|
|
709
|
+
constructor(options = {}) {
|
|
710
|
+
this.name = "dashboard-ui";
|
|
711
|
+
this.version = "1.0.0";
|
|
712
|
+
this.kernel = null;
|
|
713
|
+
this.host = null;
|
|
714
|
+
this.root = null;
|
|
715
|
+
this.dashboard = null;
|
|
716
|
+
this.cleanups = [];
|
|
717
|
+
this.updateThrottled = null;
|
|
718
|
+
this.api = {
|
|
719
|
+
show: () => this.show(),
|
|
720
|
+
hide: () => this.hide(),
|
|
721
|
+
toggle: () => this.toggle(),
|
|
722
|
+
isVisible: () => this.state.isVisible,
|
|
723
|
+
setPosition: (position) => this.setPosition(position),
|
|
724
|
+
setTheme: (theme) => this.setTheme(theme),
|
|
725
|
+
expand: () => this.expand(),
|
|
726
|
+
collapse: () => this.collapse(),
|
|
727
|
+
isCollapsed: () => this.state.isCollapsed,
|
|
728
|
+
focusSearch: () => this.focusSearch(),
|
|
729
|
+
selectComponent: (id) => this.selectComponent(id),
|
|
730
|
+
refresh: () => this.render()
|
|
731
|
+
};
|
|
732
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
733
|
+
this.state = {
|
|
734
|
+
isVisible: false,
|
|
735
|
+
isCollapsed: this.options.defaultCollapsed,
|
|
736
|
+
position: this.options.position,
|
|
737
|
+
width: this.options.defaultWidth,
|
|
738
|
+
height: this.options.defaultHeight,
|
|
739
|
+
x: 0,
|
|
740
|
+
y: 0,
|
|
741
|
+
theme: this.options.theme,
|
|
742
|
+
selectedComponentId: null,
|
|
743
|
+
searchQuery: "",
|
|
744
|
+
activeTab: "tree"
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
install(kernel) {
|
|
748
|
+
this.kernel = kernel;
|
|
749
|
+
this.setupKeyboardShortcut();
|
|
750
|
+
this.setupEventListeners();
|
|
751
|
+
this.updateThrottled = throttle(() => this.render(), 100);
|
|
752
|
+
}
|
|
753
|
+
uninstall() {
|
|
754
|
+
this.hide();
|
|
755
|
+
this.cleanup();
|
|
756
|
+
this.kernel = null;
|
|
757
|
+
}
|
|
758
|
+
cleanup() {
|
|
759
|
+
for (const cleanup of this.cleanups) {
|
|
760
|
+
cleanup();
|
|
761
|
+
}
|
|
762
|
+
this.cleanups = [];
|
|
763
|
+
if (this.host) {
|
|
764
|
+
removeShadowContainer(this.host);
|
|
765
|
+
this.host = null;
|
|
766
|
+
this.root = null;
|
|
767
|
+
this.dashboard = null;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
setupKeyboardShortcut() {
|
|
771
|
+
const handleKeyDown = (e) => {
|
|
772
|
+
const shortcut = this.options.shortcut.toLowerCase();
|
|
773
|
+
const parts = shortcut.split("+");
|
|
774
|
+
const ctrlRequired = parts.includes("ctrl");
|
|
775
|
+
const shiftRequired = parts.includes("shift");
|
|
776
|
+
const altRequired = parts.includes("alt");
|
|
777
|
+
const key = parts.find((p) => !["ctrl", "shift", "alt"].includes(p)) ?? "";
|
|
778
|
+
if (e.ctrlKey === ctrlRequired && e.shiftKey === shiftRequired && e.altKey === altRequired && e.key.toLowerCase() === key) {
|
|
779
|
+
e.preventDefault();
|
|
780
|
+
this.toggle();
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
784
|
+
this.cleanups.push(() => document.removeEventListener("keydown", handleKeyDown));
|
|
785
|
+
}
|
|
786
|
+
setupEventListeners() {
|
|
787
|
+
if (!this.kernel) return;
|
|
788
|
+
const unsubscribe = this.kernel.on("metrics-update", () => {
|
|
789
|
+
if (this.state.isVisible && this.updateThrottled) {
|
|
790
|
+
this.updateThrottled();
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
this.cleanups.push(unsubscribe);
|
|
794
|
+
}
|
|
795
|
+
show() {
|
|
796
|
+
if (this.state.isVisible) return;
|
|
797
|
+
this.state.isVisible = true;
|
|
798
|
+
this.createDashboard();
|
|
799
|
+
this.render();
|
|
800
|
+
}
|
|
801
|
+
hide() {
|
|
802
|
+
if (!this.state.isVisible) return;
|
|
803
|
+
this.state.isVisible = false;
|
|
804
|
+
if (this.host) {
|
|
805
|
+
removeShadowContainer(this.host);
|
|
806
|
+
this.host = null;
|
|
807
|
+
this.root = null;
|
|
808
|
+
this.dashboard = null;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
toggle() {
|
|
812
|
+
if (this.state.isVisible) {
|
|
813
|
+
this.hide();
|
|
814
|
+
} else {
|
|
815
|
+
this.show();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
setPosition(position) {
|
|
819
|
+
this.state.position = position;
|
|
820
|
+
const pos = getInitialPosition(position, this.state.width, this.state.height);
|
|
821
|
+
this.state.x = pos.x;
|
|
822
|
+
this.state.y = pos.y;
|
|
823
|
+
if (this.dashboard) {
|
|
824
|
+
this.dashboard.style.left = `${pos.x}px`;
|
|
825
|
+
this.dashboard.style.top = `${pos.y}px`;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
setTheme(theme) {
|
|
829
|
+
this.state.theme = theme;
|
|
830
|
+
}
|
|
831
|
+
expand() {
|
|
832
|
+
this.state.isCollapsed = false;
|
|
833
|
+
if (this.dashboard) {
|
|
834
|
+
this.dashboard.classList.remove("collapsed");
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
collapse() {
|
|
838
|
+
this.state.isCollapsed = true;
|
|
839
|
+
if (this.dashboard) {
|
|
840
|
+
this.dashboard.classList.add("collapsed");
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
focusSearch() {
|
|
844
|
+
if (this.root) {
|
|
845
|
+
const searchInput = this.root.querySelector(".search-input");
|
|
846
|
+
searchInput?.focus();
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
selectComponent(componentId) {
|
|
850
|
+
this.state.selectedComponentId = componentId;
|
|
851
|
+
this.render();
|
|
852
|
+
}
|
|
853
|
+
createDashboard() {
|
|
854
|
+
const { host, root } = createShadowContainer();
|
|
855
|
+
this.host = host;
|
|
856
|
+
this.root = root;
|
|
857
|
+
const pos = getInitialPosition(this.state.position, this.state.width, this.state.height);
|
|
858
|
+
this.state.x = pos.x;
|
|
859
|
+
this.state.y = pos.y;
|
|
860
|
+
this.dashboard = createElement("div", "dashboard");
|
|
861
|
+
this.dashboard.style.width = `${this.state.width}px`;
|
|
862
|
+
this.dashboard.style.height = `${this.state.height}px`;
|
|
863
|
+
this.dashboard.style.left = `${pos.x}px`;
|
|
864
|
+
this.dashboard.style.top = `${pos.y}px`;
|
|
865
|
+
if (this.state.isCollapsed) {
|
|
866
|
+
this.dashboard.classList.add("collapsed");
|
|
867
|
+
}
|
|
868
|
+
root.appendChild(this.dashboard);
|
|
869
|
+
if (this.options.resizable) {
|
|
870
|
+
const cleanupResize = makeResizable(this.dashboard, {
|
|
871
|
+
minWidth: 300,
|
|
872
|
+
minHeight: 200,
|
|
873
|
+
onResizeEnd: (width, height) => {
|
|
874
|
+
this.state.width = width;
|
|
875
|
+
this.state.height = height;
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
this.cleanups.push(cleanupResize);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
render() {
|
|
882
|
+
if (!this.dashboard || !this.kernel) return;
|
|
883
|
+
while (this.dashboard.firstChild) {
|
|
884
|
+
this.dashboard.removeChild(this.dashboard.firstChild);
|
|
885
|
+
}
|
|
886
|
+
const header = this.renderHeader();
|
|
887
|
+
this.dashboard.appendChild(header);
|
|
888
|
+
if (this.options.draggable) {
|
|
889
|
+
const cleanupDrag = makeDraggable(this.dashboard, header, {
|
|
890
|
+
onDragEnd: (x, y) => {
|
|
891
|
+
this.state.x = x;
|
|
892
|
+
this.state.y = y;
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
this.cleanups.push(cleanupDrag);
|
|
896
|
+
}
|
|
897
|
+
if (!this.state.isCollapsed) {
|
|
898
|
+
const content = this.renderContent();
|
|
899
|
+
this.dashboard.appendChild(content);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
renderHeader() {
|
|
903
|
+
const header = createElement("div", "dashboard-header");
|
|
904
|
+
const title = createElement("div", "dashboard-title");
|
|
905
|
+
const icon = createElement("span", "dashboard-title-icon");
|
|
906
|
+
icon.textContent = "\u26A1";
|
|
907
|
+
const text = createElement("span");
|
|
908
|
+
text.textContent = "ReactScope";
|
|
909
|
+
title.appendChild(icon);
|
|
910
|
+
title.appendChild(text);
|
|
911
|
+
header.appendChild(title);
|
|
912
|
+
const controls = createElement("div", "dashboard-controls");
|
|
913
|
+
const collapseBtn = createElement("button", "dashboard-btn");
|
|
914
|
+
collapseBtn.textContent = this.state.isCollapsed ? "\u25A2" : "\u2581";
|
|
915
|
+
collapseBtn.title = this.state.isCollapsed ? "Expand" : "Collapse";
|
|
916
|
+
collapseBtn.onclick = () => {
|
|
917
|
+
if (this.state.isCollapsed) {
|
|
918
|
+
this.expand();
|
|
919
|
+
} else {
|
|
920
|
+
this.collapse();
|
|
921
|
+
}
|
|
922
|
+
this.render();
|
|
923
|
+
};
|
|
924
|
+
controls.appendChild(collapseBtn);
|
|
925
|
+
const closeBtn = createElement("button", "dashboard-btn");
|
|
926
|
+
closeBtn.textContent = "\u2715";
|
|
927
|
+
closeBtn.title = "Close";
|
|
928
|
+
closeBtn.onclick = () => this.hide();
|
|
929
|
+
controls.appendChild(closeBtn);
|
|
930
|
+
header.appendChild(controls);
|
|
931
|
+
return header;
|
|
932
|
+
}
|
|
933
|
+
renderContent() {
|
|
934
|
+
const content = createElement("div", "dashboard-content");
|
|
935
|
+
const tabs = this.renderTabs();
|
|
936
|
+
content.appendChild(tabs);
|
|
937
|
+
const panel = this.renderPanel();
|
|
938
|
+
content.appendChild(panel);
|
|
939
|
+
return content;
|
|
940
|
+
}
|
|
941
|
+
renderTabs() {
|
|
942
|
+
const tabs = createElement("div", "dashboard-tabs");
|
|
943
|
+
const tabItems = [
|
|
944
|
+
{ id: "tree", label: "Tree" },
|
|
945
|
+
{ id: "alerts", label: "Alerts" },
|
|
946
|
+
{ id: "details", label: "Details" }
|
|
947
|
+
];
|
|
948
|
+
for (const item of tabItems) {
|
|
949
|
+
const tab = createElement("button", "dashboard-tab");
|
|
950
|
+
tab.textContent = item.label;
|
|
951
|
+
if (this.state.activeTab === item.id) {
|
|
952
|
+
tab.classList.add("active");
|
|
953
|
+
}
|
|
954
|
+
tab.onclick = () => {
|
|
955
|
+
this.state.activeTab = item.id;
|
|
956
|
+
this.render();
|
|
957
|
+
};
|
|
958
|
+
tabs.appendChild(tab);
|
|
959
|
+
}
|
|
960
|
+
return tabs;
|
|
961
|
+
}
|
|
962
|
+
renderPanel() {
|
|
963
|
+
const panel = createElement("div", "dashboard-panel");
|
|
964
|
+
switch (this.state.activeTab) {
|
|
965
|
+
case "tree":
|
|
966
|
+
this.renderTreePanel(panel);
|
|
967
|
+
break;
|
|
968
|
+
case "alerts":
|
|
969
|
+
this.renderAlertsPanel(panel);
|
|
970
|
+
break;
|
|
971
|
+
case "details":
|
|
972
|
+
this.renderDetailsPanel(panel);
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
return panel;
|
|
976
|
+
}
|
|
977
|
+
renderTreePanel(panel) {
|
|
978
|
+
const searchInput = createElement("input", "search-input");
|
|
979
|
+
searchInput.type = "text";
|
|
980
|
+
searchInput.placeholder = "Search components...";
|
|
981
|
+
searchInput.value = this.state.searchQuery;
|
|
982
|
+
searchInput.oninput = (e) => {
|
|
983
|
+
this.state.searchQuery = e.target.value;
|
|
984
|
+
this.render();
|
|
985
|
+
};
|
|
986
|
+
panel.appendChild(searchInput);
|
|
987
|
+
const treeView = createElement("div", "tree-view");
|
|
988
|
+
const tree = this.kernel?.getMetrics().getTree();
|
|
989
|
+
if (tree?.root) {
|
|
990
|
+
this.renderTreeNode(treeView, tree.root);
|
|
991
|
+
} else {
|
|
992
|
+
const empty = this.createEmptyState("\u{1F4CA}", "No components tracked yet");
|
|
993
|
+
treeView.appendChild(empty);
|
|
994
|
+
}
|
|
995
|
+
panel.appendChild(treeView);
|
|
996
|
+
}
|
|
997
|
+
renderTreeNode(container, node) {
|
|
998
|
+
const query = this.state.searchQuery.toLowerCase();
|
|
999
|
+
const matchesSearch = !query || node.name.toLowerCase().includes(query);
|
|
1000
|
+
const hasMatchingChildren = node.children.some(
|
|
1001
|
+
(child) => this.nodeMatchesSearch(child, query)
|
|
1002
|
+
);
|
|
1003
|
+
if (!matchesSearch && !hasMatchingChildren) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
const nodeEl = createElement("div", "tree-node");
|
|
1007
|
+
const contentEl = createElement("div", "tree-node-content");
|
|
1008
|
+
if (this.state.selectedComponentId === node.id) {
|
|
1009
|
+
contentEl.classList.add("selected");
|
|
1010
|
+
}
|
|
1011
|
+
contentEl.onclick = () => {
|
|
1012
|
+
this.state.selectedComponentId = node.id;
|
|
1013
|
+
this.state.activeTab = "details";
|
|
1014
|
+
this.render();
|
|
1015
|
+
};
|
|
1016
|
+
if (node.children.length > 0) {
|
|
1017
|
+
const toggle = createElement("span", "tree-node-toggle");
|
|
1018
|
+
toggle.textContent = node.isExpanded ? "\u25BC" : "\u25B6";
|
|
1019
|
+
toggle.onclick = (e) => {
|
|
1020
|
+
e.stopPropagation();
|
|
1021
|
+
node.isExpanded = !node.isExpanded;
|
|
1022
|
+
this.render();
|
|
1023
|
+
};
|
|
1024
|
+
contentEl.appendChild(toggle);
|
|
1025
|
+
} else {
|
|
1026
|
+
const spacer = createElement("span", "tree-node-toggle");
|
|
1027
|
+
contentEl.appendChild(spacer);
|
|
1028
|
+
}
|
|
1029
|
+
const name = createElement("span", "tree-node-name");
|
|
1030
|
+
name.textContent = node.name;
|
|
1031
|
+
contentEl.appendChild(name);
|
|
1032
|
+
if (node.metrics) {
|
|
1033
|
+
const metrics = createElement("span", "tree-node-metrics");
|
|
1034
|
+
const rendersBadge = createElement("span", "metric-badge renders");
|
|
1035
|
+
rendersBadge.textContent = String(node.metrics.renderCount);
|
|
1036
|
+
metrics.appendChild(rendersBadge);
|
|
1037
|
+
const timeBadge = createElement("span", `metric-badge time${node.metrics.averageRenderTime > 16 ? " slow" : ""}`);
|
|
1038
|
+
timeBadge.textContent = chunkWQRBHD23_cjs.formatDuration(node.metrics.averageRenderTime);
|
|
1039
|
+
metrics.appendChild(timeBadge);
|
|
1040
|
+
if (node.metrics.wastedRenderCount > 0) {
|
|
1041
|
+
const wastedBadge = createElement("span", "metric-badge wasted");
|
|
1042
|
+
wastedBadge.textContent = `\u26A0\uFE0F ${node.metrics.wastedRenderCount}`;
|
|
1043
|
+
metrics.appendChild(wastedBadge);
|
|
1044
|
+
}
|
|
1045
|
+
contentEl.appendChild(metrics);
|
|
1046
|
+
}
|
|
1047
|
+
nodeEl.appendChild(contentEl);
|
|
1048
|
+
if (node.isExpanded && node.children.length > 0) {
|
|
1049
|
+
const childrenEl = createElement("div", "tree-node-children");
|
|
1050
|
+
for (const child of node.children) {
|
|
1051
|
+
this.renderTreeNode(childrenEl, child);
|
|
1052
|
+
}
|
|
1053
|
+
nodeEl.appendChild(childrenEl);
|
|
1054
|
+
}
|
|
1055
|
+
container.appendChild(nodeEl);
|
|
1056
|
+
}
|
|
1057
|
+
nodeMatchesSearch(node, query) {
|
|
1058
|
+
if (!query) return true;
|
|
1059
|
+
if (node.name.toLowerCase().includes(query)) return true;
|
|
1060
|
+
return node.children.some((child) => this.nodeMatchesSearch(child, query));
|
|
1061
|
+
}
|
|
1062
|
+
renderAlertsPanel(panel) {
|
|
1063
|
+
const allMetrics = this.kernel?.getMetrics().getAll();
|
|
1064
|
+
if (!allMetrics || allMetrics.size === 0) {
|
|
1065
|
+
const empty = this.createEmptyState("\u2713", "No alerts");
|
|
1066
|
+
panel.appendChild(empty);
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const alerts = [];
|
|
1070
|
+
for (const metrics of allMetrics.values()) {
|
|
1071
|
+
if (metrics.averageRenderTime > 16) {
|
|
1072
|
+
alerts.push({
|
|
1073
|
+
type: "error",
|
|
1074
|
+
title: `${metrics.componentName} is slow`,
|
|
1075
|
+
description: `Average render time: ${chunkWQRBHD23_cjs.formatDuration(metrics.averageRenderTime)}`
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
if (metrics.wastedRenderCount > 0 && metrics.renderCount > 0) {
|
|
1079
|
+
const percentage = (metrics.wastedRenderCount / metrics.renderCount * 100).toFixed(0);
|
|
1080
|
+
if (parseInt(percentage) > 30) {
|
|
1081
|
+
alerts.push({
|
|
1082
|
+
type: "warning",
|
|
1083
|
+
title: `${metrics.componentName} has wasted renders`,
|
|
1084
|
+
description: `${metrics.wastedRenderCount} wasted renders (${percentage}%)`
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
if (alerts.length === 0) {
|
|
1090
|
+
const empty = this.createEmptyState("\u2713", "No alerts - everything looks good!");
|
|
1091
|
+
panel.appendChild(empty);
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
for (const alert of alerts) {
|
|
1095
|
+
const alertEl = createElement("div", "alert-item");
|
|
1096
|
+
const icon = createElement("span", `alert-icon ${alert.type}`);
|
|
1097
|
+
icon.textContent = alert.type === "warning" ? "\u26A0\uFE0F" : "\u{1F534}";
|
|
1098
|
+
alertEl.appendChild(icon);
|
|
1099
|
+
const content = createElement("div", "alert-content");
|
|
1100
|
+
const title = createElement("div", "alert-title");
|
|
1101
|
+
title.textContent = alert.title;
|
|
1102
|
+
const description = createElement("div", "alert-description");
|
|
1103
|
+
description.textContent = alert.description;
|
|
1104
|
+
content.appendChild(title);
|
|
1105
|
+
content.appendChild(description);
|
|
1106
|
+
alertEl.appendChild(content);
|
|
1107
|
+
panel.appendChild(alertEl);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
renderDetailsPanel(panel) {
|
|
1111
|
+
const componentId = this.state.selectedComponentId;
|
|
1112
|
+
if (!componentId) {
|
|
1113
|
+
const empty = this.createEmptyState("\u{1F446}", "Select a component to view details");
|
|
1114
|
+
panel.appendChild(empty);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
const metrics = this.kernel?.getMetrics().get(componentId);
|
|
1118
|
+
if (!metrics) {
|
|
1119
|
+
const empty = this.createEmptyState("\u2753", "Component not found");
|
|
1120
|
+
panel.appendChild(empty);
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
const details = createElement("div", "details-panel");
|
|
1124
|
+
const infoSection = createElement("div", "details-section");
|
|
1125
|
+
const infoTitle = createElement("div", "details-section-title");
|
|
1126
|
+
infoTitle.textContent = "Component";
|
|
1127
|
+
infoSection.appendChild(infoTitle);
|
|
1128
|
+
infoSection.appendChild(this.createRow("Name", metrics.componentName));
|
|
1129
|
+
infoSection.appendChild(this.createRow("ID", metrics.componentId));
|
|
1130
|
+
infoSection.appendChild(this.createRow("Status", metrics.isCurrentlyMounted ? "\u{1F7E2} Mounted" : "\u{1F534} Unmounted"));
|
|
1131
|
+
details.appendChild(infoSection);
|
|
1132
|
+
const renderSection = createElement("div", "details-section");
|
|
1133
|
+
const renderTitle = createElement("div", "details-section-title");
|
|
1134
|
+
renderTitle.textContent = "Renders";
|
|
1135
|
+
renderSection.appendChild(renderTitle);
|
|
1136
|
+
renderSection.appendChild(this.createRow("Count", metrics.renderCount.toString()));
|
|
1137
|
+
renderSection.appendChild(this.createRow("Average Time", chunkWQRBHD23_cjs.formatDuration(metrics.averageRenderTime)));
|
|
1138
|
+
renderSection.appendChild(this.createRow("Total Time", chunkWQRBHD23_cjs.formatDuration(metrics.totalRenderTime)));
|
|
1139
|
+
renderSection.appendChild(this.createRow("Last Render", chunkWQRBHD23_cjs.formatDuration(metrics.lastRenderTime)));
|
|
1140
|
+
renderSection.appendChild(this.createRow("Wasted Renders", metrics.wastedRenderCount.toString()));
|
|
1141
|
+
details.appendChild(renderSection);
|
|
1142
|
+
const lifecycleSection = createElement("div", "details-section");
|
|
1143
|
+
const lifecycleTitle = createElement("div", "details-section-title");
|
|
1144
|
+
lifecycleTitle.textContent = "Lifecycle";
|
|
1145
|
+
lifecycleSection.appendChild(lifecycleTitle);
|
|
1146
|
+
lifecycleSection.appendChild(this.createRow("Mount Count", metrics.mountCount.toString()));
|
|
1147
|
+
lifecycleSection.appendChild(this.createRow("Props Changes", metrics.propsChangeCount.toString()));
|
|
1148
|
+
details.appendChild(lifecycleSection);
|
|
1149
|
+
panel.appendChild(details);
|
|
1150
|
+
}
|
|
1151
|
+
createEmptyState(iconText, message) {
|
|
1152
|
+
const empty = createElement("div", "empty-state");
|
|
1153
|
+
const icon = createElement("div", "empty-state-icon");
|
|
1154
|
+
icon.textContent = iconText;
|
|
1155
|
+
const text = createElement("div");
|
|
1156
|
+
text.textContent = message;
|
|
1157
|
+
empty.appendChild(icon);
|
|
1158
|
+
empty.appendChild(text);
|
|
1159
|
+
return empty;
|
|
1160
|
+
}
|
|
1161
|
+
createRow(label, value) {
|
|
1162
|
+
const row = createElement("div", "details-row");
|
|
1163
|
+
const labelEl = createElement("span", "details-label");
|
|
1164
|
+
labelEl.textContent = label;
|
|
1165
|
+
const valueEl = createElement("span", "details-value");
|
|
1166
|
+
valueEl.textContent = value;
|
|
1167
|
+
row.appendChild(labelEl);
|
|
1168
|
+
row.appendChild(valueEl);
|
|
1169
|
+
return row;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
function createDashboardUIPlugin(options) {
|
|
1173
|
+
return new DashboardUIPlugin(options);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
exports.DashboardUIPlugin = DashboardUIPlugin;
|
|
1177
|
+
exports.createDashboardUIPlugin = createDashboardUIPlugin;
|
|
1178
|
+
exports.throttle = throttle;
|
|
1179
|
+
//# sourceMappingURL=chunk-IFCS6ABF.cjs.map
|
|
1180
|
+
//# sourceMappingURL=chunk-IFCS6ABF.cjs.map
|