@vue/devtools-api 8.2.1 → 9.0.0-beta.1
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 +17 -3
- package/dist/index-node.cjs +3 -9
- package/dist/index-node.d.cts +5 -9
- package/dist/index-node.d.mts +7 -0
- package/dist/index-node.mjs +10 -0
- package/dist/index.cjs +0 -18
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +38 -21
- package/dist/index-node.d.ts +0 -11
- package/dist/index-node.js +0 -13
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/vue-devtools-api.esm-browser.js +0 -1771
- package/dist/vue-devtools-api.global.js +0 -1781
|
@@ -1,1781 +0,0 @@
|
|
|
1
|
-
var VueDevToolsApi = (function(exports) {
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
//#region \0rolldown/runtime.js
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
-
key = keys[i];
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region ../shared/src/env.ts
|
|
27
|
-
const isBrowser = typeof navigator !== "undefined";
|
|
28
|
-
const target = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : {};
|
|
29
|
-
typeof target.chrome !== "undefined" && target.chrome.devtools;
|
|
30
|
-
isBrowser && (target.self, target.top);
|
|
31
|
-
typeof navigator !== "undefined" && navigator.userAgent?.toLowerCase().includes("electron");
|
|
32
|
-
typeof window !== "undefined" && window.__NUXT__;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region ../shared/src/general.ts
|
|
35
|
-
var import_rfdc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
36
|
-
module.exports = rfdc;
|
|
37
|
-
function copyBuffer(cur) {
|
|
38
|
-
if (cur instanceof Buffer) return Buffer.from(cur);
|
|
39
|
-
return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length);
|
|
40
|
-
}
|
|
41
|
-
function rfdc(opts) {
|
|
42
|
-
opts = opts || {};
|
|
43
|
-
if (opts.circles) return rfdcCircles(opts);
|
|
44
|
-
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
45
|
-
constructorHandlers.set(Date, (o) => new Date(o));
|
|
46
|
-
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
47
|
-
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
48
|
-
if (opts.constructorHandlers) for (const handler of opts.constructorHandlers) constructorHandlers.set(handler[0], handler[1]);
|
|
49
|
-
let handler = null;
|
|
50
|
-
return opts.proto ? cloneProto : clone;
|
|
51
|
-
function cloneArray(a, fn) {
|
|
52
|
-
const keys = Object.keys(a);
|
|
53
|
-
const a2 = new Array(keys.length);
|
|
54
|
-
for (let i = 0; i < keys.length; i++) {
|
|
55
|
-
const k = keys[i];
|
|
56
|
-
const cur = a[k];
|
|
57
|
-
if (typeof cur !== "object" || cur === null) a2[k] = cur;
|
|
58
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) a2[k] = handler(cur, fn);
|
|
59
|
-
else if (ArrayBuffer.isView(cur)) a2[k] = copyBuffer(cur);
|
|
60
|
-
else a2[k] = fn(cur);
|
|
61
|
-
}
|
|
62
|
-
return a2;
|
|
63
|
-
}
|
|
64
|
-
function clone(o) {
|
|
65
|
-
if (typeof o !== "object" || o === null) return o;
|
|
66
|
-
if (Array.isArray(o)) return cloneArray(o, clone);
|
|
67
|
-
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, clone);
|
|
68
|
-
const o2 = {};
|
|
69
|
-
for (const k in o) {
|
|
70
|
-
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
71
|
-
const cur = o[k];
|
|
72
|
-
if (typeof cur !== "object" || cur === null) o2[k] = cur;
|
|
73
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, clone);
|
|
74
|
-
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
|
|
75
|
-
else o2[k] = clone(cur);
|
|
76
|
-
}
|
|
77
|
-
return o2;
|
|
78
|
-
}
|
|
79
|
-
function cloneProto(o) {
|
|
80
|
-
if (typeof o !== "object" || o === null) return o;
|
|
81
|
-
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
82
|
-
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, cloneProto);
|
|
83
|
-
const o2 = {};
|
|
84
|
-
for (const k in o) {
|
|
85
|
-
const cur = o[k];
|
|
86
|
-
if (typeof cur !== "object" || cur === null) o2[k] = cur;
|
|
87
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, cloneProto);
|
|
88
|
-
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
|
|
89
|
-
else o2[k] = cloneProto(cur);
|
|
90
|
-
}
|
|
91
|
-
return o2;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function rfdcCircles(opts) {
|
|
95
|
-
const refs = [];
|
|
96
|
-
const refsNew = [];
|
|
97
|
-
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
98
|
-
constructorHandlers.set(Date, (o) => new Date(o));
|
|
99
|
-
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
100
|
-
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
101
|
-
if (opts.constructorHandlers) for (const handler of opts.constructorHandlers) constructorHandlers.set(handler[0], handler[1]);
|
|
102
|
-
let handler = null;
|
|
103
|
-
return opts.proto ? cloneProto : clone;
|
|
104
|
-
function cloneArray(a, fn) {
|
|
105
|
-
const keys = Object.keys(a);
|
|
106
|
-
const a2 = new Array(keys.length);
|
|
107
|
-
for (let i = 0; i < keys.length; i++) {
|
|
108
|
-
const k = keys[i];
|
|
109
|
-
const cur = a[k];
|
|
110
|
-
if (typeof cur !== "object" || cur === null) a2[k] = cur;
|
|
111
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) a2[k] = handler(cur, fn);
|
|
112
|
-
else if (ArrayBuffer.isView(cur)) a2[k] = copyBuffer(cur);
|
|
113
|
-
else {
|
|
114
|
-
const index = refs.indexOf(cur);
|
|
115
|
-
if (index !== -1) a2[k] = refsNew[index];
|
|
116
|
-
else a2[k] = fn(cur);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return a2;
|
|
120
|
-
}
|
|
121
|
-
function clone(o) {
|
|
122
|
-
if (typeof o !== "object" || o === null) return o;
|
|
123
|
-
if (Array.isArray(o)) return cloneArray(o, clone);
|
|
124
|
-
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, clone);
|
|
125
|
-
const o2 = {};
|
|
126
|
-
refs.push(o);
|
|
127
|
-
refsNew.push(o2);
|
|
128
|
-
for (const k in o) {
|
|
129
|
-
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
130
|
-
const cur = o[k];
|
|
131
|
-
if (typeof cur !== "object" || cur === null) o2[k] = cur;
|
|
132
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, clone);
|
|
133
|
-
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
|
|
134
|
-
else {
|
|
135
|
-
const i = refs.indexOf(cur);
|
|
136
|
-
if (i !== -1) o2[k] = refsNew[i];
|
|
137
|
-
else o2[k] = clone(cur);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
refs.pop();
|
|
141
|
-
refsNew.pop();
|
|
142
|
-
return o2;
|
|
143
|
-
}
|
|
144
|
-
function cloneProto(o) {
|
|
145
|
-
if (typeof o !== "object" || o === null) return o;
|
|
146
|
-
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
147
|
-
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, cloneProto);
|
|
148
|
-
const o2 = {};
|
|
149
|
-
refs.push(o);
|
|
150
|
-
refsNew.push(o2);
|
|
151
|
-
for (const k in o) {
|
|
152
|
-
const cur = o[k];
|
|
153
|
-
if (typeof cur !== "object" || cur === null) o2[k] = cur;
|
|
154
|
-
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, cloneProto);
|
|
155
|
-
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
|
|
156
|
-
else {
|
|
157
|
-
const i = refs.indexOf(cur);
|
|
158
|
-
if (i !== -1) o2[k] = refsNew[i];
|
|
159
|
-
else o2[k] = cloneProto(cur);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
refs.pop();
|
|
163
|
-
refsNew.pop();
|
|
164
|
-
return o2;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
})))(), 1);
|
|
168
|
-
const classifyRE = /(?:^|[-_/])(\w)/g;
|
|
169
|
-
function toUpper(_, c) {
|
|
170
|
-
return c ? c.toUpperCase() : "";
|
|
171
|
-
}
|
|
172
|
-
function classify(str) {
|
|
173
|
-
return str && `${str}`.replace(classifyRE, toUpper);
|
|
174
|
-
}
|
|
175
|
-
function basename(filename, ext) {
|
|
176
|
-
let normalizedFilename = filename.replace(/^[a-z]:/i, "").replace(/\\/g, "/");
|
|
177
|
-
if (normalizedFilename.endsWith(`index${ext}`)) normalizedFilename = normalizedFilename.replace(`/index${ext}`, ext);
|
|
178
|
-
const lastSlashIndex = normalizedFilename.lastIndexOf("/");
|
|
179
|
-
const baseNameWithExt = normalizedFilename.substring(lastSlashIndex + 1);
|
|
180
|
-
if (ext) {
|
|
181
|
-
const extIndex = baseNameWithExt.lastIndexOf(ext);
|
|
182
|
-
return baseNameWithExt.substring(0, extIndex);
|
|
183
|
-
}
|
|
184
|
-
return "";
|
|
185
|
-
}
|
|
186
|
-
const HTTP_URL_RE = /^https?:\/\//;
|
|
187
|
-
/**
|
|
188
|
-
* Check a string is start with `/` or a valid http url
|
|
189
|
-
*/
|
|
190
|
-
function isUrlString(str) {
|
|
191
|
-
return str.startsWith("/") || HTTP_URL_RE.test(str);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* @copyright [rfdc](https://github.com/davidmarkclements/rfdc)
|
|
195
|
-
* @description A really fast deep clone alternative
|
|
196
|
-
*/
|
|
197
|
-
const deepClone = (0, import_rfdc.default)({ circles: true });
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region ../devtools-kit/src/core/component/utils/index.ts
|
|
200
|
-
function getComponentTypeName(options) {
|
|
201
|
-
if (typeof options === "function") return options.displayName || options.name || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || "";
|
|
202
|
-
const name = options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
|
|
203
|
-
if (name === "index" && options.__file?.endsWith("index.vue")) return "";
|
|
204
|
-
return name;
|
|
205
|
-
}
|
|
206
|
-
function getComponentFileName(options) {
|
|
207
|
-
const file = options.__file;
|
|
208
|
-
if (file) return classify(basename(file, ".vue"));
|
|
209
|
-
}
|
|
210
|
-
function saveComponentGussedName(instance, name) {
|
|
211
|
-
instance.type.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ = name;
|
|
212
|
-
return name;
|
|
213
|
-
}
|
|
214
|
-
function getAppRecord(instance) {
|
|
215
|
-
if (instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__) return instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
|
|
216
|
-
else if (instance.root) return instance.appContext.app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
|
|
217
|
-
}
|
|
218
|
-
function isFragment(instance) {
|
|
219
|
-
const subTreeType = instance.subTree?.type;
|
|
220
|
-
const appRecord = getAppRecord(instance);
|
|
221
|
-
if (appRecord) return appRecord?.types?.Fragment === subTreeType;
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Get the appropriate display name for an instance.
|
|
226
|
-
*
|
|
227
|
-
* @param {Vue} instance
|
|
228
|
-
* @return {string}
|
|
229
|
-
*/
|
|
230
|
-
function getInstanceName(instance) {
|
|
231
|
-
const name = getComponentTypeName(instance?.type || {});
|
|
232
|
-
if (name) return name;
|
|
233
|
-
if (instance?.root === instance) return "Root";
|
|
234
|
-
for (const key in instance.parent?.type?.components) if (instance.parent.type.components[key] === instance?.type) return saveComponentGussedName(instance, key);
|
|
235
|
-
for (const key in instance.appContext?.components) if (instance.appContext.components[key] === instance?.type) return saveComponentGussedName(instance, key);
|
|
236
|
-
const fileName = getComponentFileName(instance?.type || {});
|
|
237
|
-
if (fileName) return fileName;
|
|
238
|
-
return "Anonymous Component";
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Returns a devtools unique id for instance.
|
|
242
|
-
* @param {Vue} instance
|
|
243
|
-
*/
|
|
244
|
-
function getUniqueComponentId(instance) {
|
|
245
|
-
return `${instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0}:${instance === instance?.root ? "root" : instance.uid}`;
|
|
246
|
-
}
|
|
247
|
-
function getComponentInstance(appRecord, instanceId) {
|
|
248
|
-
instanceId = instanceId || `${appRecord.id}:root`;
|
|
249
|
-
return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
|
|
250
|
-
}
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region ../devtools-kit/src/core/component/state/bounding-rect.ts
|
|
253
|
-
function createRect() {
|
|
254
|
-
const rect = {
|
|
255
|
-
top: 0,
|
|
256
|
-
bottom: 0,
|
|
257
|
-
left: 0,
|
|
258
|
-
right: 0,
|
|
259
|
-
get width() {
|
|
260
|
-
return rect.right - rect.left;
|
|
261
|
-
},
|
|
262
|
-
get height() {
|
|
263
|
-
return rect.bottom - rect.top;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
return rect;
|
|
267
|
-
}
|
|
268
|
-
let range;
|
|
269
|
-
function getTextRect(node) {
|
|
270
|
-
if (!range) range = document.createRange();
|
|
271
|
-
range.selectNode(node);
|
|
272
|
-
return range.getBoundingClientRect();
|
|
273
|
-
}
|
|
274
|
-
function getFragmentRect(vnode) {
|
|
275
|
-
const rect = createRect();
|
|
276
|
-
if (!vnode.children) return rect;
|
|
277
|
-
for (let i = 0, l = vnode.children.length; i < l; i++) {
|
|
278
|
-
const childVnode = vnode.children[i];
|
|
279
|
-
let childRect;
|
|
280
|
-
if (childVnode.component) childRect = getComponentBoundingRect(childVnode.component);
|
|
281
|
-
else if (childVnode.el) {
|
|
282
|
-
const el = childVnode.el;
|
|
283
|
-
if (el.nodeType === 1 || el.getBoundingClientRect) childRect = el.getBoundingClientRect();
|
|
284
|
-
else if (el.nodeType === 3 && el.data.trim()) childRect = getTextRect(el);
|
|
285
|
-
}
|
|
286
|
-
if (childRect) mergeRects(rect, childRect);
|
|
287
|
-
}
|
|
288
|
-
return rect;
|
|
289
|
-
}
|
|
290
|
-
function mergeRects(a, b) {
|
|
291
|
-
if (!a.top || b.top < a.top) a.top = b.top;
|
|
292
|
-
if (!a.bottom || b.bottom > a.bottom) a.bottom = b.bottom;
|
|
293
|
-
if (!a.left || b.left < a.left) a.left = b.left;
|
|
294
|
-
if (!a.right || b.right > a.right) a.right = b.right;
|
|
295
|
-
return a;
|
|
296
|
-
}
|
|
297
|
-
const DEFAULT_RECT = {
|
|
298
|
-
top: 0,
|
|
299
|
-
left: 0,
|
|
300
|
-
right: 0,
|
|
301
|
-
bottom: 0,
|
|
302
|
-
width: 0,
|
|
303
|
-
height: 0
|
|
304
|
-
};
|
|
305
|
-
function getComponentBoundingRect(instance) {
|
|
306
|
-
const el = instance.subTree.el;
|
|
307
|
-
if (typeof window === "undefined") return DEFAULT_RECT;
|
|
308
|
-
if (isFragment(instance)) return getFragmentRect(instance.subTree);
|
|
309
|
-
else if (el?.nodeType === 1) return el?.getBoundingClientRect();
|
|
310
|
-
else if (instance.subTree.component) return getComponentBoundingRect(instance.subTree.component);
|
|
311
|
-
else return DEFAULT_RECT;
|
|
312
|
-
}
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region ../devtools-kit/src/core/component/tree/el.ts
|
|
315
|
-
function getRootElementsFromComponentInstance(instance) {
|
|
316
|
-
if (isFragment(instance)) return getFragmentRootElements(instance.subTree);
|
|
317
|
-
if (!instance.subTree) return [];
|
|
318
|
-
return [instance.subTree.el];
|
|
319
|
-
}
|
|
320
|
-
function getFragmentRootElements(vnode) {
|
|
321
|
-
if (!vnode.children) return [];
|
|
322
|
-
const list = [];
|
|
323
|
-
vnode.children.forEach((childVnode) => {
|
|
324
|
-
if (childVnode.component) list.push(...getRootElementsFromComponentInstance(childVnode.component));
|
|
325
|
-
else if (childVnode?.el) list.push(childVnode.el);
|
|
326
|
-
});
|
|
327
|
-
return list;
|
|
328
|
-
}
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region ../devtools-kit/src/core/component-highlighter/index.ts
|
|
331
|
-
const CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
|
|
332
|
-
const CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
|
|
333
|
-
const COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
|
|
334
|
-
const INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
|
|
335
|
-
const containerStyles = {
|
|
336
|
-
display: "block",
|
|
337
|
-
zIndex: 2147483640,
|
|
338
|
-
position: "fixed",
|
|
339
|
-
backgroundColor: "#42b88325",
|
|
340
|
-
border: "1px solid #42b88350",
|
|
341
|
-
borderRadius: "5px",
|
|
342
|
-
transition: "all 0.1s ease-in",
|
|
343
|
-
pointerEvents: "none"
|
|
344
|
-
};
|
|
345
|
-
const cardStyles = {
|
|
346
|
-
fontFamily: "Arial, Helvetica, sans-serif",
|
|
347
|
-
padding: "5px 8px",
|
|
348
|
-
borderRadius: "4px",
|
|
349
|
-
textAlign: "left",
|
|
350
|
-
position: "absolute",
|
|
351
|
-
left: 0,
|
|
352
|
-
color: "#e9e9e9",
|
|
353
|
-
fontSize: "14px",
|
|
354
|
-
fontWeight: 600,
|
|
355
|
-
lineHeight: "24px",
|
|
356
|
-
backgroundColor: "#42b883",
|
|
357
|
-
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
|
|
358
|
-
};
|
|
359
|
-
const indicatorStyles = {
|
|
360
|
-
display: "inline-block",
|
|
361
|
-
fontWeight: 400,
|
|
362
|
-
fontStyle: "normal",
|
|
363
|
-
fontSize: "12px",
|
|
364
|
-
opacity: .7
|
|
365
|
-
};
|
|
366
|
-
function getContainerElement() {
|
|
367
|
-
return document.getElementById(CONTAINER_ELEMENT_ID);
|
|
368
|
-
}
|
|
369
|
-
function getCardElement() {
|
|
370
|
-
return document.getElementById(CARD_ELEMENT_ID);
|
|
371
|
-
}
|
|
372
|
-
function getIndicatorElement() {
|
|
373
|
-
return document.getElementById(INDICATOR_ELEMENT_ID);
|
|
374
|
-
}
|
|
375
|
-
function getNameElement() {
|
|
376
|
-
return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
|
|
377
|
-
}
|
|
378
|
-
function getStyles(bounds) {
|
|
379
|
-
return {
|
|
380
|
-
left: `${Math.round(bounds.left * 100) / 100}px`,
|
|
381
|
-
top: `${Math.round(bounds.top * 100) / 100}px`,
|
|
382
|
-
width: `${Math.round(bounds.width * 100) / 100}px`,
|
|
383
|
-
height: `${Math.round(bounds.height * 100) / 100}px`
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
function create(options) {
|
|
387
|
-
const containerEl = document.createElement("div");
|
|
388
|
-
containerEl.id = options.elementId ?? CONTAINER_ELEMENT_ID;
|
|
389
|
-
Object.assign(containerEl.style, {
|
|
390
|
-
...containerStyles,
|
|
391
|
-
...getStyles(options.bounds),
|
|
392
|
-
...options.style
|
|
393
|
-
});
|
|
394
|
-
const cardEl = document.createElement("span");
|
|
395
|
-
cardEl.id = CARD_ELEMENT_ID;
|
|
396
|
-
Object.assign(cardEl.style, {
|
|
397
|
-
...cardStyles,
|
|
398
|
-
top: options.bounds.top < 35 ? 0 : "-35px"
|
|
399
|
-
});
|
|
400
|
-
const nameEl = document.createElement("span");
|
|
401
|
-
nameEl.id = COMPONENT_NAME_ELEMENT_ID;
|
|
402
|
-
nameEl.innerHTML = `<${options.name}> `;
|
|
403
|
-
const indicatorEl = document.createElement("i");
|
|
404
|
-
indicatorEl.id = INDICATOR_ELEMENT_ID;
|
|
405
|
-
indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
|
|
406
|
-
Object.assign(indicatorEl.style, indicatorStyles);
|
|
407
|
-
cardEl.appendChild(nameEl);
|
|
408
|
-
cardEl.appendChild(indicatorEl);
|
|
409
|
-
containerEl.appendChild(cardEl);
|
|
410
|
-
document.body.appendChild(containerEl);
|
|
411
|
-
return containerEl;
|
|
412
|
-
}
|
|
413
|
-
function update(options) {
|
|
414
|
-
const containerEl = getContainerElement();
|
|
415
|
-
const cardEl = getCardElement();
|
|
416
|
-
const nameEl = getNameElement();
|
|
417
|
-
const indicatorEl = getIndicatorElement();
|
|
418
|
-
if (containerEl) {
|
|
419
|
-
Object.assign(containerEl.style, {
|
|
420
|
-
...containerStyles,
|
|
421
|
-
...getStyles(options.bounds)
|
|
422
|
-
});
|
|
423
|
-
Object.assign(cardEl.style, { top: options.bounds.top < 35 ? 0 : "-35px" });
|
|
424
|
-
nameEl.innerHTML = `<${options.name}> `;
|
|
425
|
-
indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
function highlight(instance) {
|
|
429
|
-
const bounds = getComponentBoundingRect(instance);
|
|
430
|
-
if (!bounds.width && !bounds.height) return;
|
|
431
|
-
const name = getInstanceName(instance);
|
|
432
|
-
getContainerElement() ? update({
|
|
433
|
-
bounds,
|
|
434
|
-
name
|
|
435
|
-
}) : create({
|
|
436
|
-
bounds,
|
|
437
|
-
name
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
function unhighlight() {
|
|
441
|
-
const el = getContainerElement();
|
|
442
|
-
if (el) el.style.display = "none";
|
|
443
|
-
}
|
|
444
|
-
let inspectInstance = null;
|
|
445
|
-
function inspectFn(e) {
|
|
446
|
-
const target = e.target;
|
|
447
|
-
if (target) {
|
|
448
|
-
const instance = target.__vueParentComponent;
|
|
449
|
-
if (instance) {
|
|
450
|
-
inspectInstance = instance;
|
|
451
|
-
if (instance.vnode.el) {
|
|
452
|
-
const bounds = getComponentBoundingRect(instance);
|
|
453
|
-
const name = getInstanceName(instance);
|
|
454
|
-
getContainerElement() ? update({
|
|
455
|
-
bounds,
|
|
456
|
-
name
|
|
457
|
-
}) : create({
|
|
458
|
-
bounds,
|
|
459
|
-
name
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
function selectComponentFn(e, cb) {
|
|
466
|
-
e.preventDefault();
|
|
467
|
-
e.stopPropagation();
|
|
468
|
-
if (inspectInstance) cb(getUniqueComponentId(inspectInstance));
|
|
469
|
-
}
|
|
470
|
-
let inspectComponentHighLighterSelectFn = null;
|
|
471
|
-
function cancelInspectComponentHighLighter() {
|
|
472
|
-
unhighlight();
|
|
473
|
-
window.removeEventListener("mouseover", inspectFn);
|
|
474
|
-
window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
|
|
475
|
-
inspectComponentHighLighterSelectFn = null;
|
|
476
|
-
}
|
|
477
|
-
function inspectComponentHighLighter() {
|
|
478
|
-
window.addEventListener("mouseover", inspectFn);
|
|
479
|
-
return new Promise((resolve) => {
|
|
480
|
-
function onSelect(e) {
|
|
481
|
-
e.preventDefault();
|
|
482
|
-
e.stopPropagation();
|
|
483
|
-
selectComponentFn(e, (id) => {
|
|
484
|
-
window.removeEventListener("click", onSelect, true);
|
|
485
|
-
inspectComponentHighLighterSelectFn = null;
|
|
486
|
-
window.removeEventListener("mouseover", inspectFn);
|
|
487
|
-
const el = getContainerElement();
|
|
488
|
-
if (el) el.style.display = "none";
|
|
489
|
-
resolve(JSON.stringify({ id }));
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
inspectComponentHighLighterSelectFn = onSelect;
|
|
493
|
-
window.addEventListener("click", onSelect, true);
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
function scrollToComponent(options) {
|
|
497
|
-
const instance = getComponentInstance(activeAppRecord.value, options.id);
|
|
498
|
-
if (instance) {
|
|
499
|
-
const [el] = getRootElementsFromComponentInstance(instance);
|
|
500
|
-
if (typeof el.scrollIntoView === "function") el.scrollIntoView({ behavior: "smooth" });
|
|
501
|
-
else {
|
|
502
|
-
const bounds = getComponentBoundingRect(instance);
|
|
503
|
-
const scrollTarget = document.createElement("div");
|
|
504
|
-
const styles = {
|
|
505
|
-
...getStyles(bounds),
|
|
506
|
-
position: "absolute"
|
|
507
|
-
};
|
|
508
|
-
Object.assign(scrollTarget.style, styles);
|
|
509
|
-
document.body.appendChild(scrollTarget);
|
|
510
|
-
scrollTarget.scrollIntoView({ behavior: "smooth" });
|
|
511
|
-
setTimeout(() => {
|
|
512
|
-
document.body.removeChild(scrollTarget);
|
|
513
|
-
}, 2e3);
|
|
514
|
-
}
|
|
515
|
-
setTimeout(() => {
|
|
516
|
-
const bounds = getComponentBoundingRect(instance);
|
|
517
|
-
if (bounds.width || bounds.height) {
|
|
518
|
-
const name = getInstanceName(instance);
|
|
519
|
-
const el = getContainerElement();
|
|
520
|
-
el ? update({
|
|
521
|
-
...options,
|
|
522
|
-
name,
|
|
523
|
-
bounds
|
|
524
|
-
}) : create({
|
|
525
|
-
...options,
|
|
526
|
-
name,
|
|
527
|
-
bounds
|
|
528
|
-
});
|
|
529
|
-
setTimeout(() => {
|
|
530
|
-
if (el) el.style.display = "none";
|
|
531
|
-
}, 1500);
|
|
532
|
-
}
|
|
533
|
-
}, 1200);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
//#endregion
|
|
537
|
-
//#region ../devtools-kit/src/core/component-inspector/index.ts
|
|
538
|
-
target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ ??= true;
|
|
539
|
-
function waitForInspectorInit(cb) {
|
|
540
|
-
let total = 0;
|
|
541
|
-
const timer = setInterval(() => {
|
|
542
|
-
if (target.__VUE_INSPECTOR__) {
|
|
543
|
-
clearInterval(timer);
|
|
544
|
-
total += 30;
|
|
545
|
-
cb();
|
|
546
|
-
}
|
|
547
|
-
if (total >= 5e3) clearInterval(timer);
|
|
548
|
-
}, 30);
|
|
549
|
-
}
|
|
550
|
-
function setupInspector() {
|
|
551
|
-
const inspector = target.__VUE_INSPECTOR__;
|
|
552
|
-
const _openInEditor = inspector.openInEditor;
|
|
553
|
-
inspector.openInEditor = async (...params) => {
|
|
554
|
-
inspector.disable();
|
|
555
|
-
_openInEditor(...params);
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
function getComponentInspector() {
|
|
559
|
-
return new Promise((resolve) => {
|
|
560
|
-
function setup() {
|
|
561
|
-
setupInspector();
|
|
562
|
-
resolve(target.__VUE_INSPECTOR__);
|
|
563
|
-
}
|
|
564
|
-
if (!target.__VUE_INSPECTOR__) waitForInspectorInit(() => {
|
|
565
|
-
setup();
|
|
566
|
-
});
|
|
567
|
-
else setup();
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
//#endregion
|
|
571
|
-
//#region ../devtools-kit/src/shared/stub-vue.ts
|
|
572
|
-
/**
|
|
573
|
-
* To prevent include a **HUGE** vue package in the final bundle of chrome ext / electron
|
|
574
|
-
* we stub the necessary vue module.
|
|
575
|
-
* This implementation is based on the 1c3327a0fa5983aa9078e3f7bb2330f572435425 commit
|
|
576
|
-
*/
|
|
577
|
-
/**
|
|
578
|
-
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/constants.ts#L17-L23)
|
|
579
|
-
*/
|
|
580
|
-
let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
|
|
581
|
-
ReactiveFlags["SKIP"] = "__v_skip";
|
|
582
|
-
ReactiveFlags["IS_REACTIVE"] = "__v_isReactive";
|
|
583
|
-
ReactiveFlags["IS_READONLY"] = "__v_isReadonly";
|
|
584
|
-
ReactiveFlags["IS_SHALLOW"] = "__v_isShallow";
|
|
585
|
-
ReactiveFlags["RAW"] = "__v_raw";
|
|
586
|
-
return ReactiveFlags;
|
|
587
|
-
}({});
|
|
588
|
-
/**
|
|
589
|
-
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L330-L332)
|
|
590
|
-
*/
|
|
591
|
-
function isReadonly(value) {
|
|
592
|
-
return !!(value && value[ReactiveFlags.IS_READONLY]);
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L312-L317)
|
|
596
|
-
*/
|
|
597
|
-
function isReactive(value) {
|
|
598
|
-
if (isReadonly(value)) return isReactive(value[ReactiveFlags.RAW]);
|
|
599
|
-
return !!(value && value[ReactiveFlags.IS_REACTIVE]);
|
|
600
|
-
}
|
|
601
|
-
function isRef(r) {
|
|
602
|
-
return !!(r && r.__v_isRef === true);
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L372-L375)
|
|
606
|
-
*/
|
|
607
|
-
function toRaw(observed) {
|
|
608
|
-
const raw = observed && observed[ReactiveFlags.RAW];
|
|
609
|
-
return raw ? toRaw(raw) : observed;
|
|
610
|
-
}
|
|
611
|
-
//#endregion
|
|
612
|
-
//#region ../devtools-kit/src/core/component/state/editor.ts
|
|
613
|
-
var StateEditor = class {
|
|
614
|
-
constructor() {
|
|
615
|
-
this.refEditor = new RefStateEditor();
|
|
616
|
-
}
|
|
617
|
-
set(object, path, value, cb) {
|
|
618
|
-
const sections = Array.isArray(path) ? path : path.split(".");
|
|
619
|
-
while (sections.length > 1) {
|
|
620
|
-
const section = sections.shift();
|
|
621
|
-
if (object instanceof Map) object = object.get(section);
|
|
622
|
-
else if (object instanceof Set) object = Array.from(object.values())[section];
|
|
623
|
-
else object = object[section];
|
|
624
|
-
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
|
|
625
|
-
}
|
|
626
|
-
const field = sections[0];
|
|
627
|
-
const item = this.refEditor.get(object)[field];
|
|
628
|
-
if (cb) cb(object, field, value);
|
|
629
|
-
else if (this.refEditor.isRef(item)) this.refEditor.set(item, value);
|
|
630
|
-
else object[field] = value;
|
|
631
|
-
}
|
|
632
|
-
get(object, path) {
|
|
633
|
-
const sections = Array.isArray(path) ? path : path.split(".");
|
|
634
|
-
for (let i = 0; i < sections.length; i++) {
|
|
635
|
-
if (object instanceof Map) object = object.get(sections[i]);
|
|
636
|
-
else object = object[sections[i]];
|
|
637
|
-
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
|
|
638
|
-
if (!object) return void 0;
|
|
639
|
-
}
|
|
640
|
-
return object;
|
|
641
|
-
}
|
|
642
|
-
has(object, path, parent = false) {
|
|
643
|
-
if (typeof object === "undefined") return false;
|
|
644
|
-
const sections = Array.isArray(path) ? path.slice() : path.split(".");
|
|
645
|
-
const size = !parent ? 1 : 2;
|
|
646
|
-
while (object && sections.length > size) {
|
|
647
|
-
const section = sections.shift();
|
|
648
|
-
object = object[section];
|
|
649
|
-
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
|
|
650
|
-
}
|
|
651
|
-
return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
|
|
652
|
-
}
|
|
653
|
-
createDefaultSetCallback(state) {
|
|
654
|
-
return (object, field, value) => {
|
|
655
|
-
if (state.remove || state.newKey) if (Array.isArray(object)) object.splice(field, 1);
|
|
656
|
-
else if (toRaw(object) instanceof Map) object.delete(field);
|
|
657
|
-
else if (toRaw(object) instanceof Set) object.delete(Array.from(object.values())[field]);
|
|
658
|
-
else Reflect.deleteProperty(object, field);
|
|
659
|
-
if (!state.remove) {
|
|
660
|
-
const target = object[state.newKey || field];
|
|
661
|
-
if (this.refEditor.isRef(target)) this.refEditor.set(target, value);
|
|
662
|
-
else if (toRaw(object) instanceof Map) object.set(state.newKey || field, value);
|
|
663
|
-
else if (toRaw(object) instanceof Set) object.add(value);
|
|
664
|
-
else object[state.newKey || field] = value;
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
|
-
var RefStateEditor = class {
|
|
670
|
-
set(ref, value) {
|
|
671
|
-
if (isRef(ref)) ref.value = value;
|
|
672
|
-
else {
|
|
673
|
-
if (ref instanceof Set && Array.isArray(value)) {
|
|
674
|
-
ref.clear();
|
|
675
|
-
value.forEach((v) => ref.add(v));
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
const currentKeys = Object.keys(value);
|
|
679
|
-
if (ref instanceof Map) {
|
|
680
|
-
const previousKeysSet = new Set(ref.keys());
|
|
681
|
-
currentKeys.forEach((key) => {
|
|
682
|
-
ref.set(key, Reflect.get(value, key));
|
|
683
|
-
previousKeysSet.delete(key);
|
|
684
|
-
});
|
|
685
|
-
previousKeysSet.forEach((key) => ref.delete(key));
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
const previousKeysSet = new Set(Object.keys(ref));
|
|
689
|
-
currentKeys.forEach((key) => {
|
|
690
|
-
Reflect.set(ref, key, Reflect.get(value, key));
|
|
691
|
-
previousKeysSet.delete(key);
|
|
692
|
-
});
|
|
693
|
-
previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
get(ref) {
|
|
697
|
-
return isRef(ref) ? ref.value : ref;
|
|
698
|
-
}
|
|
699
|
-
isRef(ref) {
|
|
700
|
-
return isRef(ref) || isReactive(ref);
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
new StateEditor();
|
|
704
|
-
//#endregion
|
|
705
|
-
//#region ../../node_modules/.pnpm/perfect-debounce@2.0.0/node_modules/perfect-debounce/dist/index.mjs
|
|
706
|
-
const DEBOUNCE_DEFAULTS = { trailing: true };
|
|
707
|
-
/**
|
|
708
|
-
Debounce functions
|
|
709
|
-
@param fn - Promise-returning/async function to debounce.
|
|
710
|
-
@param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
|
|
711
|
-
@returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
|
|
712
|
-
@example
|
|
713
|
-
```
|
|
714
|
-
import { debounce } from 'perfect-debounce';
|
|
715
|
-
const expensiveCall = async input => input;
|
|
716
|
-
const debouncedFn = debounce(expensiveCall, 200);
|
|
717
|
-
for (const number of [1, 2, 3]) {
|
|
718
|
-
console.log(await debouncedFn(number));
|
|
719
|
-
}
|
|
720
|
-
//=> 1
|
|
721
|
-
//=> 2
|
|
722
|
-
//=> 3
|
|
723
|
-
```
|
|
724
|
-
*/
|
|
725
|
-
function debounce(fn, wait = 25, options = {}) {
|
|
726
|
-
options = {
|
|
727
|
-
...DEBOUNCE_DEFAULTS,
|
|
728
|
-
...options
|
|
729
|
-
};
|
|
730
|
-
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
|
|
731
|
-
let leadingValue;
|
|
732
|
-
let timeout;
|
|
733
|
-
let resolveList = [];
|
|
734
|
-
let currentPromise;
|
|
735
|
-
let trailingArgs;
|
|
736
|
-
const applyFn = (_this, args) => {
|
|
737
|
-
currentPromise = _applyPromised(fn, _this, args);
|
|
738
|
-
currentPromise.finally(() => {
|
|
739
|
-
currentPromise = null;
|
|
740
|
-
if (options.trailing && trailingArgs && !timeout) {
|
|
741
|
-
const promise = applyFn(_this, trailingArgs);
|
|
742
|
-
trailingArgs = null;
|
|
743
|
-
return promise;
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
return currentPromise;
|
|
747
|
-
};
|
|
748
|
-
const debounced = function(...args) {
|
|
749
|
-
if (options.trailing) trailingArgs = args;
|
|
750
|
-
if (currentPromise) return currentPromise;
|
|
751
|
-
return new Promise((resolve) => {
|
|
752
|
-
const shouldCallNow = !timeout && options.leading;
|
|
753
|
-
clearTimeout(timeout);
|
|
754
|
-
timeout = setTimeout(() => {
|
|
755
|
-
timeout = null;
|
|
756
|
-
const promise = options.leading ? leadingValue : applyFn(this, args);
|
|
757
|
-
trailingArgs = null;
|
|
758
|
-
for (const _resolve of resolveList) _resolve(promise);
|
|
759
|
-
resolveList = [];
|
|
760
|
-
}, wait);
|
|
761
|
-
if (shouldCallNow) {
|
|
762
|
-
leadingValue = applyFn(this, args);
|
|
763
|
-
resolve(leadingValue);
|
|
764
|
-
} else resolveList.push(resolve);
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
const _clearTimeout = (timer) => {
|
|
768
|
-
if (timer) {
|
|
769
|
-
clearTimeout(timer);
|
|
770
|
-
timeout = null;
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
debounced.isPending = () => !!timeout;
|
|
774
|
-
debounced.cancel = () => {
|
|
775
|
-
_clearTimeout(timeout);
|
|
776
|
-
resolveList = [];
|
|
777
|
-
trailingArgs = null;
|
|
778
|
-
};
|
|
779
|
-
debounced.flush = () => {
|
|
780
|
-
_clearTimeout(timeout);
|
|
781
|
-
if (!trailingArgs || currentPromise) return;
|
|
782
|
-
const args = trailingArgs;
|
|
783
|
-
trailingArgs = null;
|
|
784
|
-
return applyFn(this, args);
|
|
785
|
-
};
|
|
786
|
-
return debounced;
|
|
787
|
-
}
|
|
788
|
-
async function _applyPromised(fn, _this, args) {
|
|
789
|
-
return await fn.apply(_this, args);
|
|
790
|
-
}
|
|
791
|
-
//#endregion
|
|
792
|
-
//#region ../devtools-kit/src/core/timeline/storage.ts
|
|
793
|
-
const TIMELINE_LAYERS_STATE_STORAGE_ID = "__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__";
|
|
794
|
-
function getTimelineLayersStateFromStorage() {
|
|
795
|
-
if (typeof window === "undefined" || !isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
|
|
796
|
-
recordingState: false,
|
|
797
|
-
mouseEventEnabled: false,
|
|
798
|
-
keyboardEventEnabled: false,
|
|
799
|
-
componentEventEnabled: false,
|
|
800
|
-
performanceEventEnabled: false,
|
|
801
|
-
selected: ""
|
|
802
|
-
};
|
|
803
|
-
const state = typeof localStorage.getItem !== "undefined" ? localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID) : null;
|
|
804
|
-
return state ? JSON.parse(state) : {
|
|
805
|
-
recordingState: false,
|
|
806
|
-
mouseEventEnabled: false,
|
|
807
|
-
keyboardEventEnabled: false,
|
|
808
|
-
componentEventEnabled: false,
|
|
809
|
-
performanceEventEnabled: false,
|
|
810
|
-
selected: ""
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
//#endregion
|
|
814
|
-
//#region ../../node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs
|
|
815
|
-
function flatHooks(configHooks, hooks = {}, parentName) {
|
|
816
|
-
for (const key in configHooks) {
|
|
817
|
-
const subHook = configHooks[key];
|
|
818
|
-
const name = parentName ? `${parentName}:${key}` : key;
|
|
819
|
-
if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
|
|
820
|
-
else if (typeof subHook === "function") hooks[name] = subHook;
|
|
821
|
-
}
|
|
822
|
-
return hooks;
|
|
823
|
-
}
|
|
824
|
-
const defaultTask = { run: (function_) => function_() };
|
|
825
|
-
const _createTask = () => defaultTask;
|
|
826
|
-
const createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask;
|
|
827
|
-
function serialTaskCaller(hooks, args) {
|
|
828
|
-
const task = createTask(args.shift());
|
|
829
|
-
return hooks.reduce((promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))), Promise.resolve());
|
|
830
|
-
}
|
|
831
|
-
function parallelTaskCaller(hooks, args) {
|
|
832
|
-
const task = createTask(args.shift());
|
|
833
|
-
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
|
834
|
-
}
|
|
835
|
-
function callEachWith(callbacks, arg0) {
|
|
836
|
-
for (const callback of [...callbacks]) callback(arg0);
|
|
837
|
-
}
|
|
838
|
-
var Hookable = class {
|
|
839
|
-
constructor() {
|
|
840
|
-
this._hooks = {};
|
|
841
|
-
this._before = void 0;
|
|
842
|
-
this._after = void 0;
|
|
843
|
-
this._deprecatedMessages = void 0;
|
|
844
|
-
this._deprecatedHooks = {};
|
|
845
|
-
this.hook = this.hook.bind(this);
|
|
846
|
-
this.callHook = this.callHook.bind(this);
|
|
847
|
-
this.callHookWith = this.callHookWith.bind(this);
|
|
848
|
-
}
|
|
849
|
-
hook(name, function_, options = {}) {
|
|
850
|
-
if (!name || typeof function_ !== "function") return () => {};
|
|
851
|
-
const originalName = name;
|
|
852
|
-
let dep;
|
|
853
|
-
while (this._deprecatedHooks[name]) {
|
|
854
|
-
dep = this._deprecatedHooks[name];
|
|
855
|
-
name = dep.to;
|
|
856
|
-
}
|
|
857
|
-
if (dep && !options.allowDeprecated) {
|
|
858
|
-
let message = dep.message;
|
|
859
|
-
if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
|
860
|
-
if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
|
|
861
|
-
if (!this._deprecatedMessages.has(message)) {
|
|
862
|
-
console.warn(message);
|
|
863
|
-
this._deprecatedMessages.add(message);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
if (!function_.name) try {
|
|
867
|
-
Object.defineProperty(function_, "name", {
|
|
868
|
-
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
|
869
|
-
configurable: true
|
|
870
|
-
});
|
|
871
|
-
} catch {}
|
|
872
|
-
this._hooks[name] = this._hooks[name] || [];
|
|
873
|
-
this._hooks[name].push(function_);
|
|
874
|
-
return () => {
|
|
875
|
-
if (function_) {
|
|
876
|
-
this.removeHook(name, function_);
|
|
877
|
-
function_ = void 0;
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
hookOnce(name, function_) {
|
|
882
|
-
let _unreg;
|
|
883
|
-
let _function = (...arguments_) => {
|
|
884
|
-
if (typeof _unreg === "function") _unreg();
|
|
885
|
-
_unreg = void 0;
|
|
886
|
-
_function = void 0;
|
|
887
|
-
return function_(...arguments_);
|
|
888
|
-
};
|
|
889
|
-
_unreg = this.hook(name, _function);
|
|
890
|
-
return _unreg;
|
|
891
|
-
}
|
|
892
|
-
removeHook(name, function_) {
|
|
893
|
-
if (this._hooks[name]) {
|
|
894
|
-
const index = this._hooks[name].indexOf(function_);
|
|
895
|
-
if (index !== -1) this._hooks[name].splice(index, 1);
|
|
896
|
-
if (this._hooks[name].length === 0) delete this._hooks[name];
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
deprecateHook(name, deprecated) {
|
|
900
|
-
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
|
901
|
-
const _hooks = this._hooks[name] || [];
|
|
902
|
-
delete this._hooks[name];
|
|
903
|
-
for (const hook of _hooks) this.hook(name, hook);
|
|
904
|
-
}
|
|
905
|
-
deprecateHooks(deprecatedHooks) {
|
|
906
|
-
Object.assign(this._deprecatedHooks, deprecatedHooks);
|
|
907
|
-
for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
|
|
908
|
-
}
|
|
909
|
-
addHooks(configHooks) {
|
|
910
|
-
const hooks = flatHooks(configHooks);
|
|
911
|
-
const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
|
|
912
|
-
return () => {
|
|
913
|
-
for (const unreg of removeFns.splice(0, removeFns.length)) unreg();
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
removeHooks(configHooks) {
|
|
917
|
-
const hooks = flatHooks(configHooks);
|
|
918
|
-
for (const key in hooks) this.removeHook(key, hooks[key]);
|
|
919
|
-
}
|
|
920
|
-
removeAllHooks() {
|
|
921
|
-
for (const key in this._hooks) delete this._hooks[key];
|
|
922
|
-
}
|
|
923
|
-
callHook(name, ...arguments_) {
|
|
924
|
-
arguments_.unshift(name);
|
|
925
|
-
return this.callHookWith(serialTaskCaller, name, ...arguments_);
|
|
926
|
-
}
|
|
927
|
-
callHookParallel(name, ...arguments_) {
|
|
928
|
-
arguments_.unshift(name);
|
|
929
|
-
return this.callHookWith(parallelTaskCaller, name, ...arguments_);
|
|
930
|
-
}
|
|
931
|
-
callHookWith(caller, name, ...arguments_) {
|
|
932
|
-
const event = this._before || this._after ? {
|
|
933
|
-
name,
|
|
934
|
-
args: arguments_,
|
|
935
|
-
context: {}
|
|
936
|
-
} : void 0;
|
|
937
|
-
if (this._before) callEachWith(this._before, event);
|
|
938
|
-
const result = caller(name in this._hooks ? [...this._hooks[name]] : [], arguments_);
|
|
939
|
-
if (result instanceof Promise) return result.finally(() => {
|
|
940
|
-
if (this._after && event) callEachWith(this._after, event);
|
|
941
|
-
});
|
|
942
|
-
if (this._after && event) callEachWith(this._after, event);
|
|
943
|
-
return result;
|
|
944
|
-
}
|
|
945
|
-
beforeEach(function_) {
|
|
946
|
-
this._before = this._before || [];
|
|
947
|
-
this._before.push(function_);
|
|
948
|
-
return () => {
|
|
949
|
-
if (this._before !== void 0) {
|
|
950
|
-
const index = this._before.indexOf(function_);
|
|
951
|
-
if (index !== -1) this._before.splice(index, 1);
|
|
952
|
-
}
|
|
953
|
-
};
|
|
954
|
-
}
|
|
955
|
-
afterEach(function_) {
|
|
956
|
-
this._after = this._after || [];
|
|
957
|
-
this._after.push(function_);
|
|
958
|
-
return () => {
|
|
959
|
-
if (this._after !== void 0) {
|
|
960
|
-
const index = this._after.indexOf(function_);
|
|
961
|
-
if (index !== -1) this._after.splice(index, 1);
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
function createHooks() {
|
|
967
|
-
return new Hookable();
|
|
968
|
-
}
|
|
969
|
-
//#endregion
|
|
970
|
-
//#region ../devtools-kit/src/ctx/timeline.ts
|
|
971
|
-
target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS ??= [];
|
|
972
|
-
const devtoolsTimelineLayers = new Proxy(target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS, { get(target, prop, receiver) {
|
|
973
|
-
return Reflect.get(target, prop, receiver);
|
|
974
|
-
} });
|
|
975
|
-
function addTimelineLayer(options, descriptor) {
|
|
976
|
-
devtoolsState.timelineLayersState[descriptor.id] = false;
|
|
977
|
-
devtoolsTimelineLayers.push({
|
|
978
|
-
...options,
|
|
979
|
-
descriptorId: descriptor.id,
|
|
980
|
-
appRecord: getAppRecord(descriptor.app)
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
//#endregion
|
|
984
|
-
//#region ../devtools-kit/src/ctx/inspector.ts
|
|
985
|
-
target.__VUE_DEVTOOLS_KIT_INSPECTOR__ ??= [];
|
|
986
|
-
const devtoolsInspector = new Proxy(target.__VUE_DEVTOOLS_KIT_INSPECTOR__, { get(target, prop, receiver) {
|
|
987
|
-
return Reflect.get(target, prop, receiver);
|
|
988
|
-
} });
|
|
989
|
-
const callInspectorUpdatedHook = debounce(() => {
|
|
990
|
-
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_INSPECTOR_TO_CLIENT, getActiveInspectors());
|
|
991
|
-
});
|
|
992
|
-
function addInspector(inspector, descriptor) {
|
|
993
|
-
devtoolsInspector.push({
|
|
994
|
-
options: inspector,
|
|
995
|
-
descriptor,
|
|
996
|
-
treeFilterPlaceholder: inspector.treeFilterPlaceholder ?? "Search tree...",
|
|
997
|
-
stateFilterPlaceholder: inspector.stateFilterPlaceholder ?? "Search state...",
|
|
998
|
-
treeFilter: "",
|
|
999
|
-
selectedNodeId: "",
|
|
1000
|
-
appRecord: getAppRecord(descriptor.app)
|
|
1001
|
-
});
|
|
1002
|
-
callInspectorUpdatedHook();
|
|
1003
|
-
}
|
|
1004
|
-
function getActiveInspectors() {
|
|
1005
|
-
return devtoolsInspector.filter((inspector) => inspector.descriptor.app === activeAppRecord.value.app).filter((inspector) => inspector.descriptor.id !== "components").map((inspector) => {
|
|
1006
|
-
const descriptor = inspector.descriptor;
|
|
1007
|
-
const options = inspector.options;
|
|
1008
|
-
return {
|
|
1009
|
-
id: options.id,
|
|
1010
|
-
label: options.label,
|
|
1011
|
-
logo: descriptor.logo,
|
|
1012
|
-
icon: `custom-ic-baseline-${options?.icon?.replace(/_/g, "-")}`,
|
|
1013
|
-
packageName: descriptor.packageName,
|
|
1014
|
-
homepage: descriptor.homepage,
|
|
1015
|
-
pluginId: descriptor.id
|
|
1016
|
-
};
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
function getInspector(id, app) {
|
|
1020
|
-
return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
|
|
1021
|
-
}
|
|
1022
|
-
//#endregion
|
|
1023
|
-
//#region ../devtools-kit/src/ctx/hook.ts
|
|
1024
|
-
let DevToolsV6PluginAPIHookKeys = /* @__PURE__ */ function(DevToolsV6PluginAPIHookKeys) {
|
|
1025
|
-
DevToolsV6PluginAPIHookKeys["VISIT_COMPONENT_TREE"] = "visitComponentTree";
|
|
1026
|
-
DevToolsV6PluginAPIHookKeys["INSPECT_COMPONENT"] = "inspectComponent";
|
|
1027
|
-
DevToolsV6PluginAPIHookKeys["EDIT_COMPONENT_STATE"] = "editComponentState";
|
|
1028
|
-
DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_TREE"] = "getInspectorTree";
|
|
1029
|
-
DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_STATE"] = "getInspectorState";
|
|
1030
|
-
DevToolsV6PluginAPIHookKeys["EDIT_INSPECTOR_STATE"] = "editInspectorState";
|
|
1031
|
-
DevToolsV6PluginAPIHookKeys["INSPECT_TIMELINE_EVENT"] = "inspectTimelineEvent";
|
|
1032
|
-
DevToolsV6PluginAPIHookKeys["TIMELINE_CLEARED"] = "timelineCleared";
|
|
1033
|
-
DevToolsV6PluginAPIHookKeys["SET_PLUGIN_SETTINGS"] = "setPluginSettings";
|
|
1034
|
-
return DevToolsV6PluginAPIHookKeys;
|
|
1035
|
-
}({});
|
|
1036
|
-
let DevToolsContextHookKeys = /* @__PURE__ */ function(DevToolsContextHookKeys) {
|
|
1037
|
-
DevToolsContextHookKeys["ADD_INSPECTOR"] = "addInspector";
|
|
1038
|
-
DevToolsContextHookKeys["SEND_INSPECTOR_TREE"] = "sendInspectorTree";
|
|
1039
|
-
DevToolsContextHookKeys["SEND_INSPECTOR_STATE"] = "sendInspectorState";
|
|
1040
|
-
DevToolsContextHookKeys["CUSTOM_INSPECTOR_SELECT_NODE"] = "customInspectorSelectNode";
|
|
1041
|
-
DevToolsContextHookKeys["TIMELINE_LAYER_ADDED"] = "timelineLayerAdded";
|
|
1042
|
-
DevToolsContextHookKeys["TIMELINE_EVENT_ADDED"] = "timelineEventAdded";
|
|
1043
|
-
DevToolsContextHookKeys["GET_COMPONENT_INSTANCES"] = "getComponentInstances";
|
|
1044
|
-
DevToolsContextHookKeys["GET_COMPONENT_BOUNDS"] = "getComponentBounds";
|
|
1045
|
-
DevToolsContextHookKeys["GET_COMPONENT_NAME"] = "getComponentName";
|
|
1046
|
-
DevToolsContextHookKeys["COMPONENT_HIGHLIGHT"] = "componentHighlight";
|
|
1047
|
-
DevToolsContextHookKeys["COMPONENT_UNHIGHLIGHT"] = "componentUnhighlight";
|
|
1048
|
-
return DevToolsContextHookKeys;
|
|
1049
|
-
}({});
|
|
1050
|
-
let DevToolsMessagingHookKeys = /* @__PURE__ */ function(DevToolsMessagingHookKeys) {
|
|
1051
|
-
DevToolsMessagingHookKeys["SEND_INSPECTOR_TREE_TO_CLIENT"] = "sendInspectorTreeToClient";
|
|
1052
|
-
DevToolsMessagingHookKeys["SEND_INSPECTOR_STATE_TO_CLIENT"] = "sendInspectorStateToClient";
|
|
1053
|
-
DevToolsMessagingHookKeys["SEND_TIMELINE_EVENT_TO_CLIENT"] = "sendTimelineEventToClient";
|
|
1054
|
-
DevToolsMessagingHookKeys["SEND_INSPECTOR_TO_CLIENT"] = "sendInspectorToClient";
|
|
1055
|
-
DevToolsMessagingHookKeys["SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT"] = "sendActiveAppUpdatedToClient";
|
|
1056
|
-
DevToolsMessagingHookKeys["DEVTOOLS_STATE_UPDATED"] = "devtoolsStateUpdated";
|
|
1057
|
-
DevToolsMessagingHookKeys["DEVTOOLS_CONNECTED_UPDATED"] = "devtoolsConnectedUpdated";
|
|
1058
|
-
DevToolsMessagingHookKeys["ROUTER_INFO_UPDATED"] = "routerInfoUpdated";
|
|
1059
|
-
return DevToolsMessagingHookKeys;
|
|
1060
|
-
}({});
|
|
1061
|
-
function createDevToolsCtxHooks() {
|
|
1062
|
-
const hooks = createHooks();
|
|
1063
|
-
hooks.hook(DevToolsContextHookKeys.ADD_INSPECTOR, ({ inspector, plugin }) => {
|
|
1064
|
-
addInspector(inspector, plugin.descriptor);
|
|
1065
|
-
});
|
|
1066
|
-
const debounceSendInspectorTree = debounce(async ({ inspectorId, plugin }) => {
|
|
1067
|
-
if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
|
|
1068
|
-
const inspector = getInspector(inspectorId, plugin.descriptor.app);
|
|
1069
|
-
const _payload = {
|
|
1070
|
-
app: plugin.descriptor.app,
|
|
1071
|
-
inspectorId,
|
|
1072
|
-
filter: inspector?.treeFilter || "",
|
|
1073
|
-
rootNodes: []
|
|
1074
|
-
};
|
|
1075
|
-
await new Promise((resolve) => {
|
|
1076
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1077
|
-
await Promise.all(callbacks.map((cb) => cb(_payload)));
|
|
1078
|
-
resolve();
|
|
1079
|
-
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
|
|
1080
|
-
});
|
|
1081
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1082
|
-
await Promise.all(callbacks.map((cb) => cb({
|
|
1083
|
-
inspectorId,
|
|
1084
|
-
rootNodes: _payload.rootNodes
|
|
1085
|
-
})));
|
|
1086
|
-
}, DevToolsMessagingHookKeys.SEND_INSPECTOR_TREE_TO_CLIENT);
|
|
1087
|
-
}, 120);
|
|
1088
|
-
hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, debounceSendInspectorTree);
|
|
1089
|
-
const debounceSendInspectorState = debounce(async ({ inspectorId, plugin }) => {
|
|
1090
|
-
if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
|
|
1091
|
-
const inspector = getInspector(inspectorId, plugin.descriptor.app);
|
|
1092
|
-
const _payload = {
|
|
1093
|
-
app: plugin.descriptor.app,
|
|
1094
|
-
inspectorId,
|
|
1095
|
-
nodeId: inspector?.selectedNodeId || "",
|
|
1096
|
-
state: null
|
|
1097
|
-
};
|
|
1098
|
-
const ctx = { currentTab: `custom-inspector:${inspectorId}` };
|
|
1099
|
-
if (_payload.nodeId) await new Promise((resolve) => {
|
|
1100
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1101
|
-
await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
|
|
1102
|
-
resolve();
|
|
1103
|
-
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
|
|
1104
|
-
});
|
|
1105
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1106
|
-
await Promise.all(callbacks.map((cb) => cb({
|
|
1107
|
-
inspectorId,
|
|
1108
|
-
nodeId: _payload.nodeId,
|
|
1109
|
-
state: _payload.state
|
|
1110
|
-
})));
|
|
1111
|
-
}, DevToolsMessagingHookKeys.SEND_INSPECTOR_STATE_TO_CLIENT);
|
|
1112
|
-
}, 120);
|
|
1113
|
-
hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, debounceSendInspectorState);
|
|
1114
|
-
hooks.hook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, ({ inspectorId, nodeId, plugin }) => {
|
|
1115
|
-
const inspector = getInspector(inspectorId, plugin.descriptor.app);
|
|
1116
|
-
if (!inspector) return;
|
|
1117
|
-
inspector.selectedNodeId = nodeId;
|
|
1118
|
-
});
|
|
1119
|
-
hooks.hook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, ({ options, plugin }) => {
|
|
1120
|
-
addTimelineLayer(options, plugin.descriptor);
|
|
1121
|
-
});
|
|
1122
|
-
hooks.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
|
|
1123
|
-
if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
|
|
1124
|
-
"performance",
|
|
1125
|
-
"component-event",
|
|
1126
|
-
"keyboard",
|
|
1127
|
-
"mouse"
|
|
1128
|
-
].includes(options.layerId)) return;
|
|
1129
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1130
|
-
await Promise.all(callbacks.map((cb) => cb(options)));
|
|
1131
|
-
}, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
|
|
1132
|
-
});
|
|
1133
|
-
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, async ({ app }) => {
|
|
1134
|
-
const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
|
|
1135
|
-
if (!appRecord) return null;
|
|
1136
|
-
const appId = appRecord.id.toString();
|
|
1137
|
-
return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
|
|
1138
|
-
});
|
|
1139
|
-
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
|
|
1140
|
-
return getComponentBoundingRect(instance);
|
|
1141
|
-
});
|
|
1142
|
-
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
|
|
1143
|
-
return getInstanceName(instance);
|
|
1144
|
-
});
|
|
1145
|
-
hooks.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
|
|
1146
|
-
const instance = activeAppRecord.value.instanceMap.get(uid);
|
|
1147
|
-
if (instance) highlight(instance);
|
|
1148
|
-
});
|
|
1149
|
-
hooks.hook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT, () => {
|
|
1150
|
-
unhighlight();
|
|
1151
|
-
});
|
|
1152
|
-
return hooks;
|
|
1153
|
-
}
|
|
1154
|
-
//#endregion
|
|
1155
|
-
//#region ../devtools-kit/src/ctx/state.ts
|
|
1156
|
-
target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ ??= [];
|
|
1157
|
-
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ ??= {};
|
|
1158
|
-
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ ??= "";
|
|
1159
|
-
target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__ ??= [];
|
|
1160
|
-
target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__ ??= [];
|
|
1161
|
-
const STATE_KEY = "__VUE_DEVTOOLS_KIT_GLOBAL_STATE__";
|
|
1162
|
-
function initStateFactory() {
|
|
1163
|
-
return {
|
|
1164
|
-
connected: false,
|
|
1165
|
-
clientConnected: false,
|
|
1166
|
-
vitePluginDetected: true,
|
|
1167
|
-
appRecords: [],
|
|
1168
|
-
activeAppRecordId: "",
|
|
1169
|
-
tabs: [],
|
|
1170
|
-
commands: [],
|
|
1171
|
-
highPerfModeEnabled: true,
|
|
1172
|
-
devtoolsClientDetected: {},
|
|
1173
|
-
perfUniqueGroupId: 0,
|
|
1174
|
-
timelineLayersState: getTimelineLayersStateFromStorage()
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
target[STATE_KEY] ??= initStateFactory();
|
|
1178
|
-
const callStateUpdatedHook = debounce((state) => {
|
|
1179
|
-
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_STATE_UPDATED, { state });
|
|
1180
|
-
});
|
|
1181
|
-
debounce((state, oldState) => {
|
|
1182
|
-
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, {
|
|
1183
|
-
state,
|
|
1184
|
-
oldState
|
|
1185
|
-
});
|
|
1186
|
-
});
|
|
1187
|
-
const devtoolsAppRecords = new Proxy(target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, { get(_target, prop, receiver) {
|
|
1188
|
-
if (prop === "value") return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__;
|
|
1189
|
-
return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__[prop];
|
|
1190
|
-
} });
|
|
1191
|
-
const activeAppRecord = new Proxy(target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__, { get(_target, prop, receiver) {
|
|
1192
|
-
if (prop === "value") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__;
|
|
1193
|
-
else if (prop === "id") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__;
|
|
1194
|
-
return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__[prop];
|
|
1195
|
-
} });
|
|
1196
|
-
function updateAllStates() {
|
|
1197
|
-
callStateUpdatedHook({
|
|
1198
|
-
...target[STATE_KEY],
|
|
1199
|
-
appRecords: devtoolsAppRecords.value,
|
|
1200
|
-
activeAppRecordId: activeAppRecord.id,
|
|
1201
|
-
tabs: target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__,
|
|
1202
|
-
commands: target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
function setActiveAppRecord(app) {
|
|
1206
|
-
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ = app;
|
|
1207
|
-
updateAllStates();
|
|
1208
|
-
}
|
|
1209
|
-
function setActiveAppRecordId(id) {
|
|
1210
|
-
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ = id;
|
|
1211
|
-
updateAllStates();
|
|
1212
|
-
}
|
|
1213
|
-
const devtoolsState = new Proxy(target[STATE_KEY], {
|
|
1214
|
-
get(target$3, property) {
|
|
1215
|
-
if (property === "appRecords") return devtoolsAppRecords;
|
|
1216
|
-
else if (property === "activeAppRecordId") return activeAppRecord.id;
|
|
1217
|
-
else if (property === "tabs") return target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
|
|
1218
|
-
else if (property === "commands") return target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
|
|
1219
|
-
return target[STATE_KEY][property];
|
|
1220
|
-
},
|
|
1221
|
-
deleteProperty(target, property) {
|
|
1222
|
-
delete target[property];
|
|
1223
|
-
return true;
|
|
1224
|
-
},
|
|
1225
|
-
set(target$4, property, value) {
|
|
1226
|
-
target$4[property] = value;
|
|
1227
|
-
target[STATE_KEY][property] = value;
|
|
1228
|
-
return true;
|
|
1229
|
-
}
|
|
1230
|
-
});
|
|
1231
|
-
function onDevToolsConnected(fn) {
|
|
1232
|
-
return new Promise((resolve) => {
|
|
1233
|
-
if (devtoolsState.connected) {
|
|
1234
|
-
fn();
|
|
1235
|
-
resolve();
|
|
1236
|
-
}
|
|
1237
|
-
devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
|
|
1238
|
-
if (state.connected) {
|
|
1239
|
-
fn();
|
|
1240
|
-
resolve();
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
const resolveIcon = (icon) => {
|
|
1246
|
-
if (!icon) return;
|
|
1247
|
-
if (icon.startsWith("baseline-")) return `custom-ic-${icon}`;
|
|
1248
|
-
if (icon.startsWith("i-") || isUrlString(icon)) return icon;
|
|
1249
|
-
return `custom-ic-baseline-${icon}`;
|
|
1250
|
-
};
|
|
1251
|
-
function addCustomTab(tab) {
|
|
1252
|
-
const tabs = target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
|
|
1253
|
-
if (tabs.some((t) => t.name === tab.name)) return;
|
|
1254
|
-
tabs.push({
|
|
1255
|
-
...tab,
|
|
1256
|
-
icon: resolveIcon(tab.icon)
|
|
1257
|
-
});
|
|
1258
|
-
updateAllStates();
|
|
1259
|
-
}
|
|
1260
|
-
function addCustomCommand(action) {
|
|
1261
|
-
const commands = target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
|
|
1262
|
-
if (commands.some((t) => t.id === action.id)) return;
|
|
1263
|
-
commands.push({
|
|
1264
|
-
...action,
|
|
1265
|
-
icon: resolveIcon(action.icon),
|
|
1266
|
-
children: action.children ? action.children.map((child) => ({
|
|
1267
|
-
...child,
|
|
1268
|
-
icon: resolveIcon(child.icon)
|
|
1269
|
-
})) : void 0
|
|
1270
|
-
});
|
|
1271
|
-
updateAllStates();
|
|
1272
|
-
}
|
|
1273
|
-
function removeCustomCommand(actionId) {
|
|
1274
|
-
const commands = target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
|
|
1275
|
-
const index = commands.findIndex((t) => t.id === actionId);
|
|
1276
|
-
if (index === -1) return;
|
|
1277
|
-
commands.splice(index, 1);
|
|
1278
|
-
updateAllStates();
|
|
1279
|
-
}
|
|
1280
|
-
//#endregion
|
|
1281
|
-
//#region ../devtools-kit/src/core/open-in-editor/index.ts
|
|
1282
|
-
function openInEditor(options = {}) {
|
|
1283
|
-
const { file, host, baseUrl = window.location.origin, line = 0, column = 0 } = options;
|
|
1284
|
-
if (file) {
|
|
1285
|
-
if (host === "chrome-extension") {
|
|
1286
|
-
const fileName = file.replace(/\\/g, "\\\\");
|
|
1287
|
-
const _baseUrl = window.VUE_DEVTOOLS_CONFIG?.openInEditorHost ?? "/";
|
|
1288
|
-
fetch(`${_baseUrl}__open-in-editor?file=${encodeURI(file)}`).then((response) => {
|
|
1289
|
-
if (!response.ok) {
|
|
1290
|
-
const msg = `Opening component ${fileName} failed`;
|
|
1291
|
-
console.log(`%c${msg}`, "color:red");
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
} else if (devtoolsState.vitePluginDetected) {
|
|
1295
|
-
const _baseUrl = target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ ?? baseUrl;
|
|
1296
|
-
target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
//#endregion
|
|
1301
|
-
//#region ../devtools-kit/src/ctx/plugin.ts
|
|
1302
|
-
target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__ ??= [];
|
|
1303
|
-
const devtoolsPluginBuffer = new Proxy(target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__, { get(target, prop, receiver) {
|
|
1304
|
-
return Reflect.get(target, prop, receiver);
|
|
1305
|
-
} });
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region ../devtools-kit/src/core/plugin/plugin-settings.ts
|
|
1308
|
-
function _getSettings(settings) {
|
|
1309
|
-
const _settings = {};
|
|
1310
|
-
Object.keys(settings).forEach((key) => {
|
|
1311
|
-
_settings[key] = settings[key].defaultValue;
|
|
1312
|
-
});
|
|
1313
|
-
return _settings;
|
|
1314
|
-
}
|
|
1315
|
-
function getPluginLocalKey(pluginId) {
|
|
1316
|
-
return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
|
|
1317
|
-
}
|
|
1318
|
-
function getPluginSettingsOptions(pluginId) {
|
|
1319
|
-
return (devtoolsPluginBuffer.find((item) => item[0].id === pluginId && !!item[0]?.settings)?.[0] ?? null)?.settings ?? null;
|
|
1320
|
-
}
|
|
1321
|
-
function getPluginSettings(pluginId, fallbackValue) {
|
|
1322
|
-
const localKey = getPluginLocalKey(pluginId);
|
|
1323
|
-
if (localKey) {
|
|
1324
|
-
const localSettings = localStorage.getItem(localKey);
|
|
1325
|
-
if (localSettings) return JSON.parse(localSettings);
|
|
1326
|
-
}
|
|
1327
|
-
if (pluginId) return _getSettings((devtoolsPluginBuffer.find((item) => item[0].id === pluginId)?.[0] ?? null)?.settings ?? {});
|
|
1328
|
-
return _getSettings(fallbackValue);
|
|
1329
|
-
}
|
|
1330
|
-
function initPluginSettings(pluginId, settings) {
|
|
1331
|
-
const localKey = getPluginLocalKey(pluginId);
|
|
1332
|
-
if (!localStorage.getItem(localKey)) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
|
|
1333
|
-
}
|
|
1334
|
-
function setPluginSettings(pluginId, key, value) {
|
|
1335
|
-
const localKey = getPluginLocalKey(pluginId);
|
|
1336
|
-
const localSettings = localStorage.getItem(localKey);
|
|
1337
|
-
const parsedLocalSettings = JSON.parse(localSettings || "{}");
|
|
1338
|
-
const updated = {
|
|
1339
|
-
...parsedLocalSettings,
|
|
1340
|
-
[key]: value
|
|
1341
|
-
};
|
|
1342
|
-
localStorage.setItem(localKey, JSON.stringify(updated));
|
|
1343
|
-
devtoolsContext.hooks.callHookWith((callbacks) => {
|
|
1344
|
-
callbacks.forEach((cb) => cb({
|
|
1345
|
-
pluginId,
|
|
1346
|
-
key,
|
|
1347
|
-
oldValue: parsedLocalSettings[key],
|
|
1348
|
-
newValue: value,
|
|
1349
|
-
settings: updated
|
|
1350
|
-
}));
|
|
1351
|
-
}, DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS);
|
|
1352
|
-
}
|
|
1353
|
-
//#endregion
|
|
1354
|
-
//#region ../devtools-kit/src/types/hook.ts
|
|
1355
|
-
let DevToolsHooks = /* @__PURE__ */ function(DevToolsHooks) {
|
|
1356
|
-
DevToolsHooks["APP_INIT"] = "app:init";
|
|
1357
|
-
DevToolsHooks["APP_UNMOUNT"] = "app:unmount";
|
|
1358
|
-
DevToolsHooks["COMPONENT_UPDATED"] = "component:updated";
|
|
1359
|
-
DevToolsHooks["COMPONENT_ADDED"] = "component:added";
|
|
1360
|
-
DevToolsHooks["COMPONENT_REMOVED"] = "component:removed";
|
|
1361
|
-
DevToolsHooks["COMPONENT_EMIT"] = "component:emit";
|
|
1362
|
-
DevToolsHooks["PERFORMANCE_START"] = "perf:start";
|
|
1363
|
-
DevToolsHooks["PERFORMANCE_END"] = "perf:end";
|
|
1364
|
-
DevToolsHooks["ADD_ROUTE"] = "router:add-route";
|
|
1365
|
-
DevToolsHooks["REMOVE_ROUTE"] = "router:remove-route";
|
|
1366
|
-
DevToolsHooks["RENDER_TRACKED"] = "render:tracked";
|
|
1367
|
-
DevToolsHooks["RENDER_TRIGGERED"] = "render:triggered";
|
|
1368
|
-
DevToolsHooks["APP_CONNECTED"] = "app:connected";
|
|
1369
|
-
DevToolsHooks["SETUP_DEVTOOLS_PLUGIN"] = "devtools-plugin:setup";
|
|
1370
|
-
return DevToolsHooks;
|
|
1371
|
-
}({});
|
|
1372
|
-
//#endregion
|
|
1373
|
-
//#region ../devtools-kit/src/hook/index.ts
|
|
1374
|
-
const devtoolsHooks = target.__VUE_DEVTOOLS_HOOK ??= createHooks();
|
|
1375
|
-
const hook = {
|
|
1376
|
-
on: {
|
|
1377
|
-
vueAppInit(fn) {
|
|
1378
|
-
devtoolsHooks.hook(DevToolsHooks.APP_INIT, fn);
|
|
1379
|
-
},
|
|
1380
|
-
vueAppUnmount(fn) {
|
|
1381
|
-
devtoolsHooks.hook(DevToolsHooks.APP_UNMOUNT, fn);
|
|
1382
|
-
},
|
|
1383
|
-
vueAppConnected(fn) {
|
|
1384
|
-
devtoolsHooks.hook(DevToolsHooks.APP_CONNECTED, fn);
|
|
1385
|
-
},
|
|
1386
|
-
componentAdded(fn) {
|
|
1387
|
-
return devtoolsHooks.hook(DevToolsHooks.COMPONENT_ADDED, fn);
|
|
1388
|
-
},
|
|
1389
|
-
componentEmit(fn) {
|
|
1390
|
-
return devtoolsHooks.hook(DevToolsHooks.COMPONENT_EMIT, fn);
|
|
1391
|
-
},
|
|
1392
|
-
componentUpdated(fn) {
|
|
1393
|
-
return devtoolsHooks.hook(DevToolsHooks.COMPONENT_UPDATED, fn);
|
|
1394
|
-
},
|
|
1395
|
-
componentRemoved(fn) {
|
|
1396
|
-
return devtoolsHooks.hook(DevToolsHooks.COMPONENT_REMOVED, fn);
|
|
1397
|
-
},
|
|
1398
|
-
setupDevtoolsPlugin(fn) {
|
|
1399
|
-
devtoolsHooks.hook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, fn);
|
|
1400
|
-
},
|
|
1401
|
-
perfStart(fn) {
|
|
1402
|
-
return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_START, fn);
|
|
1403
|
-
},
|
|
1404
|
-
perfEnd(fn) {
|
|
1405
|
-
return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_END, fn);
|
|
1406
|
-
}
|
|
1407
|
-
},
|
|
1408
|
-
setupDevToolsPlugin(pluginDescriptor, setupFn) {
|
|
1409
|
-
return devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
|
|
1410
|
-
}
|
|
1411
|
-
};
|
|
1412
|
-
//#endregion
|
|
1413
|
-
//#region ../devtools-kit/src/api/v6/index.ts
|
|
1414
|
-
var DevToolsV6PluginAPI = class {
|
|
1415
|
-
constructor({ plugin, ctx }) {
|
|
1416
|
-
this.hooks = ctx.hooks;
|
|
1417
|
-
this.plugin = plugin;
|
|
1418
|
-
}
|
|
1419
|
-
get on() {
|
|
1420
|
-
return {
|
|
1421
|
-
visitComponentTree: (handler) => {
|
|
1422
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, handler);
|
|
1423
|
-
},
|
|
1424
|
-
inspectComponent: (handler) => {
|
|
1425
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_COMPONENT, handler);
|
|
1426
|
-
},
|
|
1427
|
-
editComponentState: (handler) => {
|
|
1428
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_COMPONENT_STATE, handler);
|
|
1429
|
-
},
|
|
1430
|
-
getInspectorTree: (handler) => {
|
|
1431
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE, handler);
|
|
1432
|
-
},
|
|
1433
|
-
getInspectorState: (handler) => {
|
|
1434
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE, handler);
|
|
1435
|
-
},
|
|
1436
|
-
editInspectorState: (handler) => {
|
|
1437
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE, handler);
|
|
1438
|
-
},
|
|
1439
|
-
inspectTimelineEvent: (handler) => {
|
|
1440
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_TIMELINE_EVENT, handler);
|
|
1441
|
-
},
|
|
1442
|
-
timelineCleared: (handler) => {
|
|
1443
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.TIMELINE_CLEARED, handler);
|
|
1444
|
-
},
|
|
1445
|
-
setPluginSettings: (handler) => {
|
|
1446
|
-
this.hooks.hook(DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS, handler);
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
notifyComponentUpdate(instance) {
|
|
1451
|
-
if (devtoolsState.highPerfModeEnabled) return;
|
|
1452
|
-
const inspector = getActiveInspectors().find((i) => i.packageName === this.plugin.descriptor.packageName);
|
|
1453
|
-
if (inspector?.id) {
|
|
1454
|
-
if (instance) {
|
|
1455
|
-
const args = [
|
|
1456
|
-
instance.appContext.app,
|
|
1457
|
-
instance.uid,
|
|
1458
|
-
instance.parent?.uid,
|
|
1459
|
-
instance
|
|
1460
|
-
];
|
|
1461
|
-
devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, ...args);
|
|
1462
|
-
} else devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED);
|
|
1463
|
-
this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
|
|
1464
|
-
inspectorId: inspector.id,
|
|
1465
|
-
plugin: this.plugin
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
addInspector(options) {
|
|
1470
|
-
this.hooks.callHook(DevToolsContextHookKeys.ADD_INSPECTOR, {
|
|
1471
|
-
inspector: options,
|
|
1472
|
-
plugin: this.plugin
|
|
1473
|
-
});
|
|
1474
|
-
if (this.plugin.descriptor.settings) initPluginSettings(options.id, this.plugin.descriptor.settings);
|
|
1475
|
-
}
|
|
1476
|
-
sendInspectorTree(inspectorId) {
|
|
1477
|
-
if (devtoolsState.highPerfModeEnabled) return;
|
|
1478
|
-
this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, {
|
|
1479
|
-
inspectorId,
|
|
1480
|
-
plugin: this.plugin
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
sendInspectorState(inspectorId) {
|
|
1484
|
-
if (devtoolsState.highPerfModeEnabled) return;
|
|
1485
|
-
this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
|
|
1486
|
-
inspectorId,
|
|
1487
|
-
plugin: this.plugin
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
selectInspectorNode(inspectorId, nodeId) {
|
|
1491
|
-
this.hooks.callHook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, {
|
|
1492
|
-
inspectorId,
|
|
1493
|
-
nodeId,
|
|
1494
|
-
plugin: this.plugin
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
visitComponentTree(payload) {
|
|
1498
|
-
return this.hooks.callHook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, payload);
|
|
1499
|
-
}
|
|
1500
|
-
now() {
|
|
1501
|
-
if (devtoolsState.highPerfModeEnabled) return 0;
|
|
1502
|
-
return Date.now();
|
|
1503
|
-
}
|
|
1504
|
-
addTimelineLayer(options) {
|
|
1505
|
-
this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, {
|
|
1506
|
-
options,
|
|
1507
|
-
plugin: this.plugin
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
addTimelineEvent(options) {
|
|
1511
|
-
if (devtoolsState.highPerfModeEnabled) return;
|
|
1512
|
-
this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, {
|
|
1513
|
-
options,
|
|
1514
|
-
plugin: this.plugin
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
getSettings(pluginId) {
|
|
1518
|
-
return getPluginSettings(pluginId ?? this.plugin.descriptor.id, this.plugin.descriptor.settings);
|
|
1519
|
-
}
|
|
1520
|
-
getComponentInstances(app) {
|
|
1521
|
-
return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, { app });
|
|
1522
|
-
}
|
|
1523
|
-
getComponentBounds(instance) {
|
|
1524
|
-
return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, { instance });
|
|
1525
|
-
}
|
|
1526
|
-
getComponentName(instance) {
|
|
1527
|
-
return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_NAME, { instance });
|
|
1528
|
-
}
|
|
1529
|
-
highlightElement(instance) {
|
|
1530
|
-
const uid = instance.__VUE_DEVTOOLS_NEXT_UID__;
|
|
1531
|
-
return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, { uid });
|
|
1532
|
-
}
|
|
1533
|
-
unhighlightElement() {
|
|
1534
|
-
return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT);
|
|
1535
|
-
}
|
|
1536
|
-
};
|
|
1537
|
-
//#endregion
|
|
1538
|
-
//#region ../devtools-kit/src/api/index.ts
|
|
1539
|
-
const DevToolsPluginAPI = DevToolsV6PluginAPI;
|
|
1540
|
-
//#endregion
|
|
1541
|
-
//#region ../devtools-kit/src/core/plugin/index.ts
|
|
1542
|
-
target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__ ??= /* @__PURE__ */ new Set();
|
|
1543
|
-
function setupDevToolsPlugin(pluginDescriptor, setupFn) {
|
|
1544
|
-
return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
|
|
1545
|
-
}
|
|
1546
|
-
function callDevToolsPluginSetupFn(plugin, app) {
|
|
1547
|
-
const [pluginDescriptor, setupFn] = plugin;
|
|
1548
|
-
if (pluginDescriptor.app !== app) return;
|
|
1549
|
-
const api = new DevToolsPluginAPI({
|
|
1550
|
-
plugin: {
|
|
1551
|
-
setupFn,
|
|
1552
|
-
descriptor: pluginDescriptor
|
|
1553
|
-
},
|
|
1554
|
-
ctx: devtoolsContext
|
|
1555
|
-
});
|
|
1556
|
-
if (pluginDescriptor.packageName === "vuex") api.on.editInspectorState((payload) => {
|
|
1557
|
-
api.sendInspectorState(payload.inspectorId);
|
|
1558
|
-
});
|
|
1559
|
-
setupFn(api);
|
|
1560
|
-
}
|
|
1561
|
-
function registerDevToolsPlugin(app, options) {
|
|
1562
|
-
if (target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.has(app)) return;
|
|
1563
|
-
if (devtoolsState.highPerfModeEnabled && !options?.inspectingComponent) return;
|
|
1564
|
-
target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.add(app);
|
|
1565
|
-
devtoolsPluginBuffer.forEach((plugin) => {
|
|
1566
|
-
callDevToolsPluginSetupFn(plugin, app);
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
//#endregion
|
|
1570
|
-
//#region ../devtools-kit/src/ctx/router.ts
|
|
1571
|
-
const ROUTER_KEY = "__VUE_DEVTOOLS_ROUTER__";
|
|
1572
|
-
const ROUTER_INFO_KEY = "__VUE_DEVTOOLS_ROUTER_INFO__";
|
|
1573
|
-
target[ROUTER_INFO_KEY] ??= {
|
|
1574
|
-
currentRoute: null,
|
|
1575
|
-
routes: []
|
|
1576
|
-
};
|
|
1577
|
-
target[ROUTER_KEY] ??= {};
|
|
1578
|
-
new Proxy(target[ROUTER_INFO_KEY], { get(target$1, property) {
|
|
1579
|
-
return target[ROUTER_INFO_KEY][property];
|
|
1580
|
-
} });
|
|
1581
|
-
new Proxy(target[ROUTER_KEY], { get(target$2, property) {
|
|
1582
|
-
if (property === "value") return target[ROUTER_KEY];
|
|
1583
|
-
} });
|
|
1584
|
-
//#endregion
|
|
1585
|
-
//#region ../devtools-kit/src/core/router/index.ts
|
|
1586
|
-
function getRoutes(router) {
|
|
1587
|
-
const routesMap = /* @__PURE__ */ new Map();
|
|
1588
|
-
return (router?.getRoutes() || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
|
|
1589
|
-
}
|
|
1590
|
-
function filterRoutes(routes) {
|
|
1591
|
-
return routes.map((item) => {
|
|
1592
|
-
let { path, name, children, meta } = item;
|
|
1593
|
-
if (children?.length) children = filterRoutes(children);
|
|
1594
|
-
return {
|
|
1595
|
-
path,
|
|
1596
|
-
name,
|
|
1597
|
-
children,
|
|
1598
|
-
meta
|
|
1599
|
-
};
|
|
1600
|
-
});
|
|
1601
|
-
}
|
|
1602
|
-
function filterCurrentRoute(route) {
|
|
1603
|
-
if (route) {
|
|
1604
|
-
const { fullPath, hash, href, path, name, matched, params, query } = route;
|
|
1605
|
-
return {
|
|
1606
|
-
fullPath,
|
|
1607
|
-
hash,
|
|
1608
|
-
href,
|
|
1609
|
-
path,
|
|
1610
|
-
name,
|
|
1611
|
-
params,
|
|
1612
|
-
query,
|
|
1613
|
-
matched: filterRoutes(matched)
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
return route;
|
|
1617
|
-
}
|
|
1618
|
-
function normalizeRouterInfo(appRecord, activeAppRecord) {
|
|
1619
|
-
function init() {
|
|
1620
|
-
const router = appRecord.app?.config.globalProperties.$router;
|
|
1621
|
-
const currentRoute = filterCurrentRoute(router?.currentRoute.value);
|
|
1622
|
-
const routes = filterRoutes(getRoutes(router));
|
|
1623
|
-
const c = console.warn;
|
|
1624
|
-
console.warn = () => {};
|
|
1625
|
-
target[ROUTER_INFO_KEY] = {
|
|
1626
|
-
currentRoute: currentRoute ? deepClone(currentRoute) : {},
|
|
1627
|
-
routes: deepClone(routes)
|
|
1628
|
-
};
|
|
1629
|
-
target[ROUTER_KEY] = router;
|
|
1630
|
-
console.warn = c;
|
|
1631
|
-
}
|
|
1632
|
-
init();
|
|
1633
|
-
hook.on.componentUpdated(debounce(() => {
|
|
1634
|
-
if (activeAppRecord.value?.app !== appRecord.app) return;
|
|
1635
|
-
init();
|
|
1636
|
-
if (devtoolsState.highPerfModeEnabled) return;
|
|
1637
|
-
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.ROUTER_INFO_UPDATED, { state: target[ROUTER_INFO_KEY] });
|
|
1638
|
-
}, 200));
|
|
1639
|
-
}
|
|
1640
|
-
//#endregion
|
|
1641
|
-
//#region ../devtools-kit/src/ctx/api.ts
|
|
1642
|
-
function createDevToolsApi(hooks) {
|
|
1643
|
-
return {
|
|
1644
|
-
async getInspectorTree(payload) {
|
|
1645
|
-
const _payload = {
|
|
1646
|
-
...payload,
|
|
1647
|
-
app: activeAppRecord.value.app,
|
|
1648
|
-
rootNodes: []
|
|
1649
|
-
};
|
|
1650
|
-
await new Promise((resolve) => {
|
|
1651
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1652
|
-
await Promise.all(callbacks.map((cb) => cb(_payload)));
|
|
1653
|
-
resolve();
|
|
1654
|
-
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
|
|
1655
|
-
});
|
|
1656
|
-
return _payload.rootNodes;
|
|
1657
|
-
},
|
|
1658
|
-
async getInspectorState(payload) {
|
|
1659
|
-
const _payload = {
|
|
1660
|
-
...payload,
|
|
1661
|
-
app: activeAppRecord.value.app,
|
|
1662
|
-
state: null
|
|
1663
|
-
};
|
|
1664
|
-
const ctx = { currentTab: `custom-inspector:${payload.inspectorId}` };
|
|
1665
|
-
await new Promise((resolve) => {
|
|
1666
|
-
hooks.callHookWith(async (callbacks) => {
|
|
1667
|
-
await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
|
|
1668
|
-
resolve();
|
|
1669
|
-
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
|
|
1670
|
-
});
|
|
1671
|
-
return _payload.state;
|
|
1672
|
-
},
|
|
1673
|
-
editInspectorState(payload) {
|
|
1674
|
-
const stateEditor = new StateEditor();
|
|
1675
|
-
const _payload = {
|
|
1676
|
-
...payload,
|
|
1677
|
-
app: activeAppRecord.value.app,
|
|
1678
|
-
set: (obj, path = payload.path, value = payload.state.value, cb) => {
|
|
1679
|
-
stateEditor.set(obj, path, value, cb || stateEditor.createDefaultSetCallback(payload.state));
|
|
1680
|
-
}
|
|
1681
|
-
};
|
|
1682
|
-
hooks.callHookWith((callbacks) => {
|
|
1683
|
-
callbacks.forEach((cb) => cb(_payload));
|
|
1684
|
-
}, DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE);
|
|
1685
|
-
},
|
|
1686
|
-
sendInspectorState(inspectorId) {
|
|
1687
|
-
const inspector = getInspector(inspectorId);
|
|
1688
|
-
hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
|
|
1689
|
-
inspectorId,
|
|
1690
|
-
plugin: {
|
|
1691
|
-
descriptor: inspector.descriptor,
|
|
1692
|
-
setupFn: () => ({})
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
},
|
|
1696
|
-
inspectComponentInspector() {
|
|
1697
|
-
return inspectComponentHighLighter();
|
|
1698
|
-
},
|
|
1699
|
-
cancelInspectComponentInspector() {
|
|
1700
|
-
return cancelInspectComponentHighLighter();
|
|
1701
|
-
},
|
|
1702
|
-
getComponentRenderCode(id) {
|
|
1703
|
-
const instance = getComponentInstance(activeAppRecord.value, id);
|
|
1704
|
-
if (instance) return !(typeof instance?.type === "function") ? instance.render.toString() : instance.type.toString();
|
|
1705
|
-
},
|
|
1706
|
-
scrollToComponent(id) {
|
|
1707
|
-
return scrollToComponent({ id });
|
|
1708
|
-
},
|
|
1709
|
-
openInEditor,
|
|
1710
|
-
getVueInspector: getComponentInspector,
|
|
1711
|
-
toggleApp(id, options) {
|
|
1712
|
-
const appRecord = devtoolsAppRecords.value.find((record) => record.id === id);
|
|
1713
|
-
if (appRecord) {
|
|
1714
|
-
setActiveAppRecordId(id);
|
|
1715
|
-
setActiveAppRecord(appRecord);
|
|
1716
|
-
normalizeRouterInfo(appRecord, activeAppRecord);
|
|
1717
|
-
callInspectorUpdatedHook();
|
|
1718
|
-
registerDevToolsPlugin(appRecord.app, options);
|
|
1719
|
-
}
|
|
1720
|
-
},
|
|
1721
|
-
inspectDOM(instanceId) {
|
|
1722
|
-
const instance = getComponentInstance(activeAppRecord.value, instanceId);
|
|
1723
|
-
if (instance) {
|
|
1724
|
-
const [el] = getRootElementsFromComponentInstance(instance);
|
|
1725
|
-
if (el) target.__VUE_DEVTOOLS_INSPECT_DOM_TARGET__ = el;
|
|
1726
|
-
}
|
|
1727
|
-
},
|
|
1728
|
-
updatePluginSettings(pluginId, key, value) {
|
|
1729
|
-
setPluginSettings(pluginId, key, value);
|
|
1730
|
-
},
|
|
1731
|
-
getPluginSettings(pluginId) {
|
|
1732
|
-
return {
|
|
1733
|
-
options: getPluginSettingsOptions(pluginId),
|
|
1734
|
-
values: getPluginSettings(pluginId)
|
|
1735
|
-
};
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
}
|
|
1739
|
-
//#endregion
|
|
1740
|
-
//#region ../devtools-kit/src/ctx/index.ts
|
|
1741
|
-
const hooks = createDevToolsCtxHooks();
|
|
1742
|
-
target.__VUE_DEVTOOLS_KIT_CONTEXT__ ??= {
|
|
1743
|
-
hooks,
|
|
1744
|
-
get state() {
|
|
1745
|
-
return {
|
|
1746
|
-
...devtoolsState,
|
|
1747
|
-
activeAppRecordId: activeAppRecord.id,
|
|
1748
|
-
activeAppRecord: activeAppRecord.value,
|
|
1749
|
-
appRecords: devtoolsAppRecords.value
|
|
1750
|
-
};
|
|
1751
|
-
},
|
|
1752
|
-
api: createDevToolsApi(hooks)
|
|
1753
|
-
};
|
|
1754
|
-
const devtoolsContext = target.__VUE_DEVTOOLS_KIT_CONTEXT__;
|
|
1755
|
-
//#endregion
|
|
1756
|
-
//#region ../devtools-kit/src/core/index.ts
|
|
1757
|
-
function onDevToolsClientConnected(fn) {
|
|
1758
|
-
return new Promise((resolve) => {
|
|
1759
|
-
if (devtoolsState.connected && devtoolsState.clientConnected) {
|
|
1760
|
-
fn();
|
|
1761
|
-
resolve();
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1764
|
-
devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
|
|
1765
|
-
if (state.connected && state.clientConnected) {
|
|
1766
|
-
fn();
|
|
1767
|
-
resolve();
|
|
1768
|
-
}
|
|
1769
|
-
});
|
|
1770
|
-
});
|
|
1771
|
-
}
|
|
1772
|
-
//#endregion
|
|
1773
|
-
exports.addCustomCommand = addCustomCommand;
|
|
1774
|
-
exports.addCustomTab = addCustomTab;
|
|
1775
|
-
exports.onDevToolsClientConnected = onDevToolsClientConnected;
|
|
1776
|
-
exports.onDevToolsConnected = onDevToolsConnected;
|
|
1777
|
-
exports.removeCustomCommand = removeCustomCommand;
|
|
1778
|
-
exports.setupDevToolsPlugin = setupDevToolsPlugin;
|
|
1779
|
-
exports.setupDevtoolsPlugin = setupDevToolsPlugin;
|
|
1780
|
-
return exports;
|
|
1781
|
-
})({});
|