vite-plugin-vue-devtools 0.0.1-alpha.0 → 0.0.1-alpha.2
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/dist/client/assets/VCard-07e53519.js +15 -0
- package/dist/client/assets/VIcon.vue_vue_type_script_setup_true_lang-c622c694.js +19 -0
- package/dist/client/assets/VIconTitle.vue_vue_type_script_setup_true_lang-5f26c7d7.js +30 -0
- package/dist/client/assets/VPanelGrids-2e4d7603.js +15 -0
- package/dist/client/assets/VTextInput-52804693.css +18 -0
- package/dist/client/assets/VTextInput.vue_vue_type_script_setup_true_lang-11aa9678.js +145 -0
- package/dist/client/assets/__inspecting-ca212e33.js +51 -0
- package/dist/client/assets/assets-7d94be21.js +1403 -0
- package/dist/client/assets/components-f04eb68e.js +699 -0
- package/dist/client/assets/fuse.esm-c317b696.js +1782 -0
- package/dist/client/assets/graph-b9e504aa.js +52260 -0
- package/dist/client/assets/index-ab9e9151.js +15372 -0
- package/dist/client/assets/index-f0fa9f81.css +454 -0
- package/dist/client/assets/inspect-d697adb8.js +96 -0
- package/dist/client/assets/overview-afb7d69a.js +305 -0
- package/dist/client/assets/pages-43ddf646.js +21 -0
- package/dist/client/assets/pages-4aa45253.js +320 -0
- package/dist/client/assets/pinia-178be7b6.js +139 -0
- package/dist/client/assets/routes-cd4e8e50.js +129 -0
- package/dist/client/assets/rpc-c07563d7.js +136 -0
- package/dist/client/assets/settings-c9f4467d.js +299 -0
- package/dist/client/assets/splitpanes.es-f2ab0d30.js +725 -0
- package/dist/client/assets/timeline-6da2fbae.js +209 -0
- package/dist/client/index.html +23 -0
- package/dist/index.cjs +7764 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +7748 -0
- package/package.json +92 -8
- package/src/node/Container.vue +298 -0
- package/src/node/app.js +41 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
import { a as _sfc_main$2, g, M, _ as _sfc_main$3 } from './splitpanes.es-f2ab0d30.js';
|
|
2
|
+
import { ab as getInstanceName, ac as classify, ad as kebabize, ae as isFragment, af as camelize, ag as returnError, ah as isBeingDestroyed, ai as getUniqueComponentId, aj as getRenderKey, P as ref, ak as shallowRef, Q as computed, d as defineComponent, X as resolveComponent, o as openBlock, c as createElementBlock, e as createBaseVNode, u as unref, a as createBlock, n as normalizeClass, t as toDisplayString, N as normalizeStyle, F as Fragment, r as renderList, m as createCommentVNode, f as onMounted, al as onVueInstanceUpdate, b as createVNode, w as withCtx, a3 as reactive, am as instance } from './index-ab9e9151.js';
|
|
3
|
+
import './VIcon.vue_vue_type_script_setup_true_lang-c622c694.js';
|
|
4
|
+
|
|
5
|
+
class ComponentFilter {
|
|
6
|
+
filter;
|
|
7
|
+
constructor(filter) {
|
|
8
|
+
this.filter = filter || "";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if an instance is qualified.
|
|
12
|
+
*
|
|
13
|
+
* @param {Vue|Vnode} instance
|
|
14
|
+
* @return {Boolean}
|
|
15
|
+
*/
|
|
16
|
+
isQualified(instance) {
|
|
17
|
+
const name = getInstanceName(instance);
|
|
18
|
+
return classify(name).toLowerCase().includes(this.filter) || kebabize(name).toLowerCase().includes(this.filter);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Injected with object hook! */
|
|
23
|
+
|
|
24
|
+
function getRootElementsFromComponentInstance(instance) {
|
|
25
|
+
if (isFragment(instance))
|
|
26
|
+
return getFragmentRootElements(instance.subTree);
|
|
27
|
+
if (!instance.subTree)
|
|
28
|
+
return [];
|
|
29
|
+
return [instance.subTree.el];
|
|
30
|
+
}
|
|
31
|
+
function getFragmentRootElements(vnode) {
|
|
32
|
+
if (!vnode.children)
|
|
33
|
+
return [];
|
|
34
|
+
const list = [];
|
|
35
|
+
for (let i = 0, l = vnode.children.length; i < l; i++) {
|
|
36
|
+
const childVnode = vnode.children[i];
|
|
37
|
+
if (childVnode.component)
|
|
38
|
+
list.push(...getRootElementsFromComponentInstance(childVnode.component));
|
|
39
|
+
else if (childVnode.el)
|
|
40
|
+
list.push(childVnode.el);
|
|
41
|
+
}
|
|
42
|
+
return list;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Injected with object hook! */
|
|
46
|
+
|
|
47
|
+
const vueBuiltins = [
|
|
48
|
+
"nextTick",
|
|
49
|
+
"defineComponent",
|
|
50
|
+
"defineAsyncComponent",
|
|
51
|
+
"defineCustomElement",
|
|
52
|
+
"ref",
|
|
53
|
+
"computed",
|
|
54
|
+
"reactive",
|
|
55
|
+
"readonly",
|
|
56
|
+
"watchEffect",
|
|
57
|
+
"watchPostEffect",
|
|
58
|
+
"watchSyncEffect",
|
|
59
|
+
"watch",
|
|
60
|
+
"isRef",
|
|
61
|
+
"unref",
|
|
62
|
+
"toRef",
|
|
63
|
+
"toRefs",
|
|
64
|
+
"isProxy",
|
|
65
|
+
"isReactive",
|
|
66
|
+
"isReadonly",
|
|
67
|
+
"shallowRef",
|
|
68
|
+
"triggerRef",
|
|
69
|
+
"customRef",
|
|
70
|
+
"shallowReactive",
|
|
71
|
+
"shallowReadonly",
|
|
72
|
+
"toRaw",
|
|
73
|
+
"markRaw",
|
|
74
|
+
"effectScope",
|
|
75
|
+
"getCurrentScope",
|
|
76
|
+
"onScopeDispose",
|
|
77
|
+
"onMounted",
|
|
78
|
+
"onUpdated",
|
|
79
|
+
"onUnmounted",
|
|
80
|
+
"onBeforeMount",
|
|
81
|
+
"onBeforeUpdate",
|
|
82
|
+
"onBeforeUnmount",
|
|
83
|
+
"onErrorCaptured",
|
|
84
|
+
"onRenderTracked",
|
|
85
|
+
"onRenderTriggered",
|
|
86
|
+
"onActivated",
|
|
87
|
+
"onDeactivated",
|
|
88
|
+
"onServerPrefetch",
|
|
89
|
+
"provide",
|
|
90
|
+
"inject",
|
|
91
|
+
"h",
|
|
92
|
+
"mergeProps",
|
|
93
|
+
"cloneVNode",
|
|
94
|
+
"isVNode",
|
|
95
|
+
"resolveComponent",
|
|
96
|
+
"resolveDirective",
|
|
97
|
+
"withDirectives",
|
|
98
|
+
"withModifiers"
|
|
99
|
+
];
|
|
100
|
+
function getInstanceState(instance) {
|
|
101
|
+
const mergedType = resolveMergedOptions(instance);
|
|
102
|
+
return processProps(instance).concat(
|
|
103
|
+
processState(instance),
|
|
104
|
+
processSetupState(instance),
|
|
105
|
+
processComputed(instance, mergedType),
|
|
106
|
+
processAttrs(instance),
|
|
107
|
+
processProvide(instance),
|
|
108
|
+
processInject(instance, mergedType),
|
|
109
|
+
processRefs(instance),
|
|
110
|
+
processEventListeners(instance)
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function processProps(instance) {
|
|
114
|
+
const propsData = [];
|
|
115
|
+
const propDefinitions = instance.type.props;
|
|
116
|
+
for (let key in instance.props) {
|
|
117
|
+
const propDefinition = propDefinitions ? propDefinitions[key] : null;
|
|
118
|
+
key = camelize(key);
|
|
119
|
+
propsData.push({
|
|
120
|
+
type: "props",
|
|
121
|
+
key,
|
|
122
|
+
value: returnError(() => instance.props[key]),
|
|
123
|
+
meta: propDefinition ? {
|
|
124
|
+
type: propDefinition.type ? getPropType(propDefinition.type) : "any",
|
|
125
|
+
required: !!propDefinition.required,
|
|
126
|
+
...propDefinition.default != null ? { default: propDefinition.default.toString() } : {}
|
|
127
|
+
} : {
|
|
128
|
+
type: "invalid"
|
|
129
|
+
},
|
|
130
|
+
editable: false
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return propsData;
|
|
134
|
+
}
|
|
135
|
+
const fnTypeRE = /^(?:function|class) (\w+)/;
|
|
136
|
+
function getPropType(type) {
|
|
137
|
+
if (Array.isArray(type))
|
|
138
|
+
return type.map((t) => getPropType(t)).join(" or ");
|
|
139
|
+
if (type == null)
|
|
140
|
+
return "null";
|
|
141
|
+
const match = type.toString().match(fnTypeRE);
|
|
142
|
+
return typeof type === "function" ? match && match[1] || "any" : "any";
|
|
143
|
+
}
|
|
144
|
+
function processState(instance) {
|
|
145
|
+
const type = instance.type;
|
|
146
|
+
const props = type.props;
|
|
147
|
+
const getters = type.vuex && type.vuex.getters;
|
|
148
|
+
const computedDefs = type.computed;
|
|
149
|
+
const data = {
|
|
150
|
+
...instance.data,
|
|
151
|
+
...instance.renderContext
|
|
152
|
+
};
|
|
153
|
+
return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
|
|
154
|
+
key,
|
|
155
|
+
type: "data",
|
|
156
|
+
value: returnError(() => data[key]),
|
|
157
|
+
editable: true
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
function processSetupState(instance) {
|
|
161
|
+
const raw = instance.devtoolsRawSetupState || {};
|
|
162
|
+
return Object.keys(instance.setupState).filter((key) => !vueBuiltins.includes(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
|
|
163
|
+
const value = returnError(() => toRaw(instance.setupState[key]));
|
|
164
|
+
const rawData = raw[key];
|
|
165
|
+
let result;
|
|
166
|
+
let isOther = typeof value === "function" || typeof value?.render === "function" || typeof value?.__asyncLoader === "function";
|
|
167
|
+
if (rawData) {
|
|
168
|
+
const info = getSetupStateInfo(rawData);
|
|
169
|
+
const objectType = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
|
|
170
|
+
const isState = info.ref || info.computed || info.reactive;
|
|
171
|
+
const raw2 = rawData.effect?.raw?.toString() || rawData.effect?.fn?.toString();
|
|
172
|
+
if (objectType)
|
|
173
|
+
isOther = false;
|
|
174
|
+
result = {
|
|
175
|
+
...objectType ? { objectType } : {},
|
|
176
|
+
...raw2 ? { raw: raw2 } : {},
|
|
177
|
+
editable: isState && !info.readonly
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const type = isOther ? "setup (other)" : "setup";
|
|
181
|
+
return {
|
|
182
|
+
key,
|
|
183
|
+
value,
|
|
184
|
+
type,
|
|
185
|
+
...result
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function isRef(raw) {
|
|
190
|
+
return !!raw.__v_isRef;
|
|
191
|
+
}
|
|
192
|
+
function isComputed(raw) {
|
|
193
|
+
return isRef(raw) && !!raw.effect;
|
|
194
|
+
}
|
|
195
|
+
function isReactive(raw) {
|
|
196
|
+
return !!raw.__v_isReactive;
|
|
197
|
+
}
|
|
198
|
+
function isReadOnly(raw) {
|
|
199
|
+
return !!raw.__v_isReadonly;
|
|
200
|
+
}
|
|
201
|
+
function toRaw(value) {
|
|
202
|
+
if (value?.__v_raw)
|
|
203
|
+
return value.__v_raw;
|
|
204
|
+
return value;
|
|
205
|
+
}
|
|
206
|
+
function getSetupStateInfo(raw) {
|
|
207
|
+
return {
|
|
208
|
+
ref: isRef(raw),
|
|
209
|
+
computed: isComputed(raw),
|
|
210
|
+
reactive: isReactive(raw),
|
|
211
|
+
readonly: isReadOnly(raw)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function processComputed(instance, mergedType) {
|
|
215
|
+
const type = mergedType;
|
|
216
|
+
const computed = [];
|
|
217
|
+
const defs = type.computed || {};
|
|
218
|
+
for (const key in defs) {
|
|
219
|
+
const def = defs[key];
|
|
220
|
+
const type2 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
|
|
221
|
+
computed.push({
|
|
222
|
+
type: type2,
|
|
223
|
+
key,
|
|
224
|
+
value: returnError(() => instance.proxy[key]),
|
|
225
|
+
editable: typeof def.set === "function"
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return computed;
|
|
229
|
+
}
|
|
230
|
+
function processAttrs(instance) {
|
|
231
|
+
return Object.keys(instance.attrs).map((key) => ({
|
|
232
|
+
type: "attrs",
|
|
233
|
+
key,
|
|
234
|
+
value: returnError(() => instance.attrs[key])
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
function processProvide(instance) {
|
|
238
|
+
return Reflect.ownKeys(instance.provides).map((key) => ({
|
|
239
|
+
type: "provided",
|
|
240
|
+
key: key.toString(),
|
|
241
|
+
value: returnError(() => instance.provides[key])
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
function processInject(instance, mergedType) {
|
|
245
|
+
if (!mergedType?.inject)
|
|
246
|
+
return [];
|
|
247
|
+
let keys = [];
|
|
248
|
+
let defaultValue;
|
|
249
|
+
if (Array.isArray(mergedType.inject)) {
|
|
250
|
+
keys = mergedType.inject.map((key) => ({
|
|
251
|
+
key,
|
|
252
|
+
originalKey: key
|
|
253
|
+
}));
|
|
254
|
+
} else {
|
|
255
|
+
keys = Reflect.ownKeys(mergedType.inject).map((key) => {
|
|
256
|
+
const value = mergedType.inject[key];
|
|
257
|
+
let originalKey;
|
|
258
|
+
if (typeof value === "string" || typeof value === "symbol") {
|
|
259
|
+
originalKey = value;
|
|
260
|
+
} else {
|
|
261
|
+
originalKey = value.from;
|
|
262
|
+
defaultValue = value.default;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
key,
|
|
266
|
+
originalKey
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return keys.map(({ key, originalKey }) => ({
|
|
271
|
+
type: "injected",
|
|
272
|
+
key: originalKey && key !== originalKey ? `${originalKey.toString()} ➞ ${key.toString()}` : key.toString(),
|
|
273
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
274
|
+
value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
function processRefs(instance) {
|
|
278
|
+
return Object.keys(instance.refs).map((key) => ({
|
|
279
|
+
type: "refs",
|
|
280
|
+
key,
|
|
281
|
+
value: returnError(() => instance.refs[key])
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
function processEventListeners(instance) {
|
|
285
|
+
const emitsDefinition = instance.type.emits;
|
|
286
|
+
const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition ?? {});
|
|
287
|
+
const keys = Object.keys(instance.vnode.props ?? {});
|
|
288
|
+
const result = [];
|
|
289
|
+
for (const key of keys) {
|
|
290
|
+
const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
|
|
291
|
+
if (prefix === "on") {
|
|
292
|
+
const eventName = eventNameParts.join("-").toLowerCase();
|
|
293
|
+
const isDeclared = declaredEmits.includes(eventName);
|
|
294
|
+
result.push({
|
|
295
|
+
type: "event listeners",
|
|
296
|
+
key: eventName,
|
|
297
|
+
value: {
|
|
298
|
+
_custom: {
|
|
299
|
+
display: isDeclared ? "✅ Declared" : "⚠️ Not declared",
|
|
300
|
+
tooltip: !isDeclared ? `The event <code>${eventName}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
function resolveMergedOptions(instance) {
|
|
309
|
+
const raw = instance.type;
|
|
310
|
+
const { mixins, extends: extendsOptions } = raw;
|
|
311
|
+
const globalMixins = instance.appContext.mixins;
|
|
312
|
+
if (!globalMixins.length && !mixins && !extendsOptions)
|
|
313
|
+
return raw;
|
|
314
|
+
const options = {};
|
|
315
|
+
globalMixins.forEach((m) => mergeOptions(options, m));
|
|
316
|
+
mergeOptions(options, raw);
|
|
317
|
+
return options;
|
|
318
|
+
}
|
|
319
|
+
function mergeOptions(to, from, instance) {
|
|
320
|
+
if (typeof from === "function")
|
|
321
|
+
from = from.options;
|
|
322
|
+
if (!from)
|
|
323
|
+
return to;
|
|
324
|
+
const { mixins, extends: extendsOptions } = from;
|
|
325
|
+
extendsOptions && mergeOptions(to, extendsOptions);
|
|
326
|
+
mixins && mixins.forEach(
|
|
327
|
+
(m) => mergeOptions(to, m)
|
|
328
|
+
);
|
|
329
|
+
for (const key of ["computed", "inject"]) {
|
|
330
|
+
if (Object.prototype.hasOwnProperty.call(from, key)) {
|
|
331
|
+
if (!to[key])
|
|
332
|
+
to[key] = from[key];
|
|
333
|
+
else
|
|
334
|
+
Object.assign(to[key], from[key]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return to;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* Injected with object hook! */
|
|
341
|
+
|
|
342
|
+
const InstanceMap = /* @__PURE__ */ new Map();
|
|
343
|
+
class ComponentWalker {
|
|
344
|
+
maxDepth;
|
|
345
|
+
recursively;
|
|
346
|
+
componentFilter;
|
|
347
|
+
// Dedupe instances
|
|
348
|
+
// Some instances may be both on a component and on a child abstract/functional component
|
|
349
|
+
captureIds;
|
|
350
|
+
constructor(maxDepth, filter, recursively) {
|
|
351
|
+
this.maxDepth = maxDepth;
|
|
352
|
+
this.recursively = recursively;
|
|
353
|
+
this.componentFilter = new ComponentFilter(filter);
|
|
354
|
+
this.captureIds = /* @__PURE__ */ new Map();
|
|
355
|
+
}
|
|
356
|
+
getComponentTree(instance) {
|
|
357
|
+
this.captureIds = /* @__PURE__ */ new Map();
|
|
358
|
+
return this.findQualifiedChildren(instance, 0);
|
|
359
|
+
}
|
|
360
|
+
getComponentParents(instance) {
|
|
361
|
+
this.captureIds = /* @__PURE__ */ new Map();
|
|
362
|
+
const parents = [];
|
|
363
|
+
this.captureId(instance);
|
|
364
|
+
let parent = instance;
|
|
365
|
+
while (parent = parent.parent) {
|
|
366
|
+
this.captureId(parent);
|
|
367
|
+
parents.push(parent);
|
|
368
|
+
}
|
|
369
|
+
return parents;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Find qualified children from a single instance.
|
|
373
|
+
* If the instance itself is qualified, just return itself.
|
|
374
|
+
* This is ok because [].concat works in both cases.
|
|
375
|
+
*
|
|
376
|
+
* @param {Vue|Vnode} instance
|
|
377
|
+
* @return {Vue|Array}
|
|
378
|
+
*/
|
|
379
|
+
async findQualifiedChildren(instance, depth) {
|
|
380
|
+
if (this.componentFilter.isQualified(instance) && !instance.type.devtools?.hide) {
|
|
381
|
+
return [await this.capture(instance, [], depth)];
|
|
382
|
+
} else if (instance.subTree) {
|
|
383
|
+
const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
|
|
384
|
+
return this.findQualifiedChildrenFromList(list, depth);
|
|
385
|
+
} else {
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Iterate through an array of instances and flatten it into
|
|
391
|
+
* an array of qualified instances. This is a depth-first
|
|
392
|
+
* traversal - e.g. if an instance is not matched, we will
|
|
393
|
+
* recursively go deeper until a qualified child is found.
|
|
394
|
+
*
|
|
395
|
+
* @param {Array} instances
|
|
396
|
+
* @return {Array}
|
|
397
|
+
*/
|
|
398
|
+
async findQualifiedChildrenFromList(instances, depth) {
|
|
399
|
+
instances = instances.filter((child) => !isBeingDestroyed(child));
|
|
400
|
+
if (!this.componentFilter.filter)
|
|
401
|
+
return Promise.all(instances.map((child, index, list) => this.capture(child, list, depth)));
|
|
402
|
+
else
|
|
403
|
+
return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Get children from a component instance.
|
|
407
|
+
*/
|
|
408
|
+
getInternalInstanceChildren(subTree, suspense = null) {
|
|
409
|
+
const list = [];
|
|
410
|
+
if (subTree) {
|
|
411
|
+
if (subTree.component) {
|
|
412
|
+
!suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
|
|
413
|
+
} else if (subTree.suspense) {
|
|
414
|
+
const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
|
|
415
|
+
list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
|
|
416
|
+
} else if (Array.isArray(subTree.children)) {
|
|
417
|
+
subTree.children.forEach((childSubTree) => {
|
|
418
|
+
if (childSubTree?.component)
|
|
419
|
+
!suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
|
|
420
|
+
else
|
|
421
|
+
list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return list.filter((child) => !isBeingDestroyed(child));
|
|
426
|
+
}
|
|
427
|
+
captureId(instance) {
|
|
428
|
+
if (!instance)
|
|
429
|
+
return null;
|
|
430
|
+
const id = getUniqueComponentId(instance);
|
|
431
|
+
if (this.captureIds.has(id))
|
|
432
|
+
return null;
|
|
433
|
+
else
|
|
434
|
+
this.captureIds.set(id, void 0);
|
|
435
|
+
return id;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Capture the meta information of an instance. (recursive)
|
|
439
|
+
*
|
|
440
|
+
* @param {Vue} instance
|
|
441
|
+
* @return {Object}
|
|
442
|
+
*/
|
|
443
|
+
async capture(instance, list, depth) {
|
|
444
|
+
if (!instance)
|
|
445
|
+
return null;
|
|
446
|
+
const id = this.captureId(instance);
|
|
447
|
+
const name = getInstanceName(instance);
|
|
448
|
+
const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
|
|
449
|
+
const parents = this.getComponentParents(instance) || [];
|
|
450
|
+
const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
|
|
451
|
+
const treeNode = {
|
|
452
|
+
uid: instance.uid,
|
|
453
|
+
id,
|
|
454
|
+
name,
|
|
455
|
+
renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
|
|
456
|
+
inactive,
|
|
457
|
+
hasChildren: !!children.length,
|
|
458
|
+
children: [],
|
|
459
|
+
isFragment: isFragment(instance),
|
|
460
|
+
// TODO: functional components, suspense
|
|
461
|
+
tags: [],
|
|
462
|
+
autoOpen: this.recursively,
|
|
463
|
+
instance: null
|
|
464
|
+
};
|
|
465
|
+
if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
|
|
466
|
+
treeNode.children = await Promise.all(children.map((child, index, list2) => this.capture(child, list2, depth + 1)).filter(Boolean));
|
|
467
|
+
}
|
|
468
|
+
if (this.isKeepAlive(instance)) {
|
|
469
|
+
const cachedComponents = this.getKeepAliveCachedInstances(instance);
|
|
470
|
+
for (const cachedChild of cachedComponents) {
|
|
471
|
+
const node = await this.capture({ ...cachedChild, isDeactivated: true }, [], depth + 1);
|
|
472
|
+
if (node)
|
|
473
|
+
treeNode.children.push(node);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const rootElements = getRootElementsFromComponentInstance(instance);
|
|
477
|
+
const firstElement = rootElements[0];
|
|
478
|
+
if (firstElement?.parentElement) {
|
|
479
|
+
const parentInstance = instance.parent;
|
|
480
|
+
const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
|
|
481
|
+
let el = firstElement;
|
|
482
|
+
const indexList = [];
|
|
483
|
+
do {
|
|
484
|
+
indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
|
|
485
|
+
el = el.parentElement;
|
|
486
|
+
} while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
|
|
487
|
+
treeNode.domOrder = indexList.reverse();
|
|
488
|
+
} else {
|
|
489
|
+
treeNode.domOrder = [-1];
|
|
490
|
+
}
|
|
491
|
+
InstanceMap.set(treeNode.id, getInstanceState(instance));
|
|
492
|
+
treeNode.instance = instance;
|
|
493
|
+
return treeNode;
|
|
494
|
+
}
|
|
495
|
+
isKeepAlive(instance) {
|
|
496
|
+
return instance.type.__isKeepAlive && instance.__v_cache;
|
|
497
|
+
}
|
|
498
|
+
getKeepAliveCachedInstances(instance) {
|
|
499
|
+
return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* Injected with object hook! */
|
|
504
|
+
|
|
505
|
+
const selected = ref("vue-devtools:root");
|
|
506
|
+
const expandedMap = ref({
|
|
507
|
+
"vue-devtools:root": true
|
|
508
|
+
});
|
|
509
|
+
const selectedComponent = ref();
|
|
510
|
+
const selectedComponentState = shallowRef([]);
|
|
511
|
+
function useComponent(instance) {
|
|
512
|
+
function select(id) {
|
|
513
|
+
selected.value = id;
|
|
514
|
+
selectedComponentState.value = InstanceMap.get(id);
|
|
515
|
+
}
|
|
516
|
+
function toggleExpand(id) {
|
|
517
|
+
expandedMap.value[id] = !expandedMap.value[id];
|
|
518
|
+
}
|
|
519
|
+
const isSelected = computed(() => selected.value === instance.id);
|
|
520
|
+
const isExpanded = computed(() => expandedMap.value[instance.id]);
|
|
521
|
+
return { isSelected, select, isExpanded, toggleExpand };
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/* Injected with object hook! */
|
|
525
|
+
|
|
526
|
+
const _hoisted_1$1 = {
|
|
527
|
+
key: 1,
|
|
528
|
+
"inline-block": "",
|
|
529
|
+
"h-6": "",
|
|
530
|
+
"w-6": ""
|
|
531
|
+
};
|
|
532
|
+
const _hoisted_2$1 = { key: 0 };
|
|
533
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
534
|
+
__name: "ComponentTreeNode",
|
|
535
|
+
props: {
|
|
536
|
+
data: null,
|
|
537
|
+
depth: { default: 0 }
|
|
538
|
+
},
|
|
539
|
+
setup(__props) {
|
|
540
|
+
const props = __props;
|
|
541
|
+
const { isSelected, select, isExpanded, toggleExpand } = useComponent(props.data);
|
|
542
|
+
return (_ctx, _cache) => {
|
|
543
|
+
const _component_VExpandIcon = _sfc_main$2;
|
|
544
|
+
const _component_ComponentTreeNode = resolveComponent("ComponentTreeNode", true);
|
|
545
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
546
|
+
createBaseVNode("div", {
|
|
547
|
+
style: normalizeStyle({
|
|
548
|
+
paddingLeft: `${__props.depth * 15 + 4}px`
|
|
549
|
+
}),
|
|
550
|
+
"vue-block": "",
|
|
551
|
+
class: normalizeClass([unref(isSelected) ? "vue-block-active" : "vue-block-hover"]),
|
|
552
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(select)(__props.data.id))
|
|
553
|
+
}, [
|
|
554
|
+
createBaseVNode("h3", {
|
|
555
|
+
"vue-block-title": "",
|
|
556
|
+
onClick: _cache[0] || (_cache[0] = ($event) => __props.data.hasChildren ? unref(toggleExpand)(__props.data.id) : () => {
|
|
557
|
+
})
|
|
558
|
+
}, [
|
|
559
|
+
__props.data.hasChildren ? (openBlock(), createBlock(_component_VExpandIcon, {
|
|
560
|
+
key: 0,
|
|
561
|
+
value: unref(isExpanded)
|
|
562
|
+
}, null, 8, ["value"])) : (openBlock(), createElementBlock("i", _hoisted_1$1)),
|
|
563
|
+
createBaseVNode("span", {
|
|
564
|
+
class: normalizeClass([
|
|
565
|
+
unref(isSelected) ? "vue-tag-symbol-active" : "vue-tag-symbol"
|
|
566
|
+
])
|
|
567
|
+
}, "<", 2),
|
|
568
|
+
createBaseVNode("span", {
|
|
569
|
+
class: normalizeClass([unref(isSelected) ? "text-white" : "vue-block-text"])
|
|
570
|
+
}, toDisplayString(__props.data.name), 3),
|
|
571
|
+
createBaseVNode("span", {
|
|
572
|
+
class: normalizeClass([
|
|
573
|
+
unref(isSelected) ? "vue-tag-symbol-active" : "vue-tag-symbol"
|
|
574
|
+
])
|
|
575
|
+
}, ">", 2)
|
|
576
|
+
])
|
|
577
|
+
], 6),
|
|
578
|
+
unref(isExpanded) && __props.data.hasChildren ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
579
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.children, (item) => {
|
|
580
|
+
return openBlock(), createBlock(_component_ComponentTreeNode, {
|
|
581
|
+
key: item.id,
|
|
582
|
+
data: item,
|
|
583
|
+
depth: __props.depth + 1
|
|
584
|
+
}, null, 8, ["data", "depth"]);
|
|
585
|
+
}), 128))
|
|
586
|
+
])) : createCommentVNode("", true)
|
|
587
|
+
], 64);
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
/* Injected with object hook! */
|
|
593
|
+
|
|
594
|
+
const _hoisted_1 = {
|
|
595
|
+
"h-screen": "",
|
|
596
|
+
"n-panel-grids": ""
|
|
597
|
+
};
|
|
598
|
+
const _hoisted_2 = { "p-2": "" };
|
|
599
|
+
const _hoisted_3 = {
|
|
600
|
+
"h-screen": "",
|
|
601
|
+
"select-none": "",
|
|
602
|
+
"overflow-scroll": "",
|
|
603
|
+
"p-2": "",
|
|
604
|
+
class: "no-scrollbar"
|
|
605
|
+
};
|
|
606
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
607
|
+
__name: "components",
|
|
608
|
+
setup(__props) {
|
|
609
|
+
const componentTree = ref([]);
|
|
610
|
+
function normalizeComponentState(value, type) {
|
|
611
|
+
if (type === "Reactive")
|
|
612
|
+
return reactive(value);
|
|
613
|
+
else if (type === "Computed")
|
|
614
|
+
return computed(() => value);
|
|
615
|
+
else if (type === "Ref")
|
|
616
|
+
return ref(value);
|
|
617
|
+
else
|
|
618
|
+
return value;
|
|
619
|
+
}
|
|
620
|
+
const normalizedComponentState = computed(() => {
|
|
621
|
+
const list = [];
|
|
622
|
+
selectedComponentState.value.forEach((item) => {
|
|
623
|
+
if (list.some((i) => i.key === item.type)) {
|
|
624
|
+
const index = list.findIndex((i) => i.key === item.type);
|
|
625
|
+
list[index].value = {
|
|
626
|
+
...list[index].value,
|
|
627
|
+
[item.key]: normalizeComponentState(item.value, item.objectType)
|
|
628
|
+
};
|
|
629
|
+
} else {
|
|
630
|
+
list.push({
|
|
631
|
+
key: item.type,
|
|
632
|
+
value: {
|
|
633
|
+
[item.key]: normalizeComponentState(item.value, item.objectType)
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
return list;
|
|
639
|
+
});
|
|
640
|
+
function init() {
|
|
641
|
+
const walker = new ComponentWalker(500, null, true);
|
|
642
|
+
selectedComponent.value = instance.value;
|
|
643
|
+
selectedComponentState.value = getInstanceState(instance.value);
|
|
644
|
+
walker.getComponentTree(instance.value).then((res) => {
|
|
645
|
+
componentTree.value = res;
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
onMounted(() => {
|
|
649
|
+
onVueInstanceUpdate(() => {
|
|
650
|
+
init();
|
|
651
|
+
selected.value = "vue-devtools:root";
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
return (_ctx, _cache) => {
|
|
655
|
+
const _component_ComponentTreeNode = _sfc_main$1;
|
|
656
|
+
const _component_StateFields = _sfc_main$3;
|
|
657
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
658
|
+
createVNode(unref(M), null, {
|
|
659
|
+
default: withCtx(() => [
|
|
660
|
+
createVNode(unref(g), { border: "r base" }, {
|
|
661
|
+
default: withCtx(() => [
|
|
662
|
+
createBaseVNode("div", _hoisted_2, [
|
|
663
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(componentTree), (item) => {
|
|
664
|
+
return openBlock(), createBlock(_component_ComponentTreeNode, {
|
|
665
|
+
key: item.id,
|
|
666
|
+
data: item
|
|
667
|
+
}, null, 8, ["data"]);
|
|
668
|
+
}), 128))
|
|
669
|
+
])
|
|
670
|
+
]),
|
|
671
|
+
_: 1
|
|
672
|
+
}),
|
|
673
|
+
createVNode(unref(g), null, {
|
|
674
|
+
default: withCtx(() => [
|
|
675
|
+
createBaseVNode("div", _hoisted_3, [
|
|
676
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedComponentState), (item, index) => {
|
|
677
|
+
return openBlock(), createBlock(_component_StateFields, {
|
|
678
|
+
id: index,
|
|
679
|
+
key: item.value,
|
|
680
|
+
data: item
|
|
681
|
+
}, null, 8, ["id", "data"]);
|
|
682
|
+
}), 128))
|
|
683
|
+
])
|
|
684
|
+
]),
|
|
685
|
+
_: 1
|
|
686
|
+
})
|
|
687
|
+
]),
|
|
688
|
+
_: 1
|
|
689
|
+
})
|
|
690
|
+
]);
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
/* Injected with object hook! */
|
|
696
|
+
|
|
697
|
+
/* Injected with object hook! */
|
|
698
|
+
|
|
699
|
+
export { _sfc_main as default };
|