vite-plugin-vue-devtools 1.0.0-rc.8 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +8 -172
  2. package/dist/client/assets/css-a-KJtBLB.js +505 -0
  3. package/dist/client/assets/diff--l9-nN5b.js +1 -0
  4. package/dist/client/assets/html-5-AIf93y.js +74 -0
  5. package/dist/client/assets/index-NNrCE7Vx.css +1 -0
  6. package/dist/client/assets/index-U-H6nGkn.js +1080 -0
  7. package/dist/client/assets/javascript-Of8SnKfU.js +699 -0
  8. package/dist/client/assets/json-t1qiHl76.js +25 -0
  9. package/dist/client/assets/onig-mBJmD8D5.js +1 -0
  10. package/dist/client/assets/shellscript-h1L64xId.js +4 -0
  11. package/dist/client/assets/typescript-b1Nw_bQe.js +666 -0
  12. package/dist/client/assets/unocss-runtime-kftsoZPE.js +2 -0
  13. package/dist/client/assets/vitesse-dark-5VceXvs6.js +1 -0
  14. package/dist/client/assets/vitesse-light-HOMMxGxw.js +1 -0
  15. package/dist/client/assets/vue-apis-Nh9IahXf.js +1 -0
  16. package/dist/client/assets/vue-html-eJ6eRCYJ.js +1 -0
  17. package/dist/client/assets/vue-nOwTje1i.js +2002 -0
  18. package/dist/client/assets/yaml-FtfhlYqU.js +200 -0
  19. package/dist/client/color-scheme.js +6 -0
  20. package/dist/client/css-hXHVOlj5.js +511 -0
  21. package/dist/client/devtools-panel.css +1 -0
  22. package/dist/client/devtools-panel.js +77722 -0
  23. package/dist/client/diff-nydZCsp5.js +7 -0
  24. package/dist/client/html-r4dic7N6.js +84 -0
  25. package/dist/client/index.html +13 -21
  26. package/dist/client/javascript-iu2g-HpL.js +705 -0
  27. package/dist/client/json-6ED1Ntns.js +31 -0
  28. package/dist/client/onig-NuJRzyUz.js +4 -0
  29. package/dist/client/shellscript-lFevXvOp.js +10 -0
  30. package/dist/client/typescript-SzFP_hYV.js +672 -0
  31. package/dist/client/unocss-runtime-c8-Zzj4C.js +1974 -0
  32. package/dist/client/vitesse-dark-Q3b2Vb5y.js +683 -0
  33. package/dist/client/vitesse-light-T_UJmsth.js +681 -0
  34. package/dist/client/vue-apis-j7ljdRbm.js +1127 -0
  35. package/dist/client/vue-html-IdJrwrVJ.js +16 -0
  36. package/dist/client/vue-vFbCUJfs.js +2118 -0
  37. package/dist/client/yaml-n_HyS7lr.js +206 -0
  38. package/dist/vite.cjs +116 -13794
  39. package/dist/vite.d.cts +6 -9
  40. package/dist/vite.d.mts +6 -9
  41. package/dist/vite.d.ts +6 -9
  42. package/dist/vite.mjs +113 -13774
  43. package/package.json +18 -19
  44. package/src/overlay/devtools-overlay.css +1 -0
  45. package/src/overlay/devtools-overlay.js +4 -0
  46. package/src/overlay.js +77 -0
  47. package/README.zh-CN.md +0 -186
  48. package/client.d.ts +0 -63
  49. package/dist/client/assets/DrawerRight.vue_vue_type_script_setup_true_lang-99688d1e.js +0 -81
  50. package/dist/client/assets/IconButton.vue_vue_type_script_setup_true_lang-48a6bea2.js +0 -26
  51. package/dist/client/assets/IconTitle.vue_vue_type_script_setup_true_lang-adb17252.js +0 -30
  52. package/dist/client/assets/IframeView.vue_vue_type_script_setup_true_lang-4ccdbf42.js +0 -96
  53. package/dist/client/assets/PanelGrids-664603ce.js +0 -15
  54. package/dist/client/assets/SectionBlock-0024395a.css +0 -18
  55. package/dist/client/assets/SectionBlock-04b7ab1e.js +0 -109
  56. package/dist/client/assets/StateFields.vue_vue_type_script_setup_true_lang-48cf50ad.js +0 -381
  57. package/dist/client/assets/Switch.vue_vue_type_script_setup_true_lang-d74bf986.js +0 -87
  58. package/dist/client/assets/TextInput.vue_vue_type_script_setup_true_lang-65c09c69.js +0 -38
  59. package/dist/client/assets/__eyedropper-7bbec9b2.js +0 -149
  60. package/dist/client/assets/_commonjsHelpers-7e83dbf2.js +0 -34
  61. package/dist/client/assets/assets-641818bf.js +0 -1597
  62. package/dist/client/assets/component-docs-7bd37475.js +0 -195
  63. package/dist/client/assets/components-b0181ea4.js +0 -790
  64. package/dist/client/assets/data-8729d21a.js +0 -399
  65. package/dist/client/assets/dayjs.min-f03ccd82.js +0 -13
  66. package/dist/client/assets/documentations-7cba8670.js +0 -276
  67. package/dist/client/assets/fuse.esm-c317b696.js +0 -1782
  68. package/dist/client/assets/graph-edf83976.js +0 -52092
  69. package/dist/client/assets/index-77d53487.js +0 -18551
  70. package/dist/client/assets/index-b5475fe0.css +0 -482
  71. package/dist/client/assets/inspect-d17224a9.js +0 -20
  72. package/dist/client/assets/jse-theme-dark-333a4654.js +0 -1565
  73. package/dist/client/assets/jse-theme-dark-351d62d5.css +0 -114
  74. package/dist/client/assets/npm-076ecb7c.js +0 -550
  75. package/dist/client/assets/npm-832f3f2c.css +0 -209
  76. package/dist/client/assets/overview-d99e7f18.js +0 -303
  77. package/dist/client/assets/pages-fca7d8d3.js +0 -561
  78. package/dist/client/assets/pinia-3f5b6c57.js +0 -108
  79. package/dist/client/assets/pinia-7ed2c830.svg +0 -1
  80. package/dist/client/assets/rerender-trace-3afd48a1.css +0 -14
  81. package/dist/client/assets/rerender-trace-5fc6fb22.js +0 -436
  82. package/dist/client/assets/routes-9567a43f.js +0 -132
  83. package/dist/client/assets/settings-5a2e184c.js +0 -9652
  84. package/dist/client/assets/settings-7bce89ae.css +0 -11
  85. package/dist/client/assets/splitpanes.es-26cdc434.js +0 -343
  86. package/dist/client/assets/timeline-20d79e43.js +0 -1480
  87. package/dist/client/assets/timeline-b315b2e0.css +0 -1
  88. package/dist/client/assets/vue-5d4e674c.svg +0 -1
  89. package/dist/client/assets/vueuse-995374f6.svg +0 -1
  90. package/src/app.js +0 -4
  91. package/src/views/ComponentInspector.vue +0 -68
  92. package/src/views/FrameBox.vue +0 -231
  93. package/src/views/Main.vue +0 -435
  94. package/src/views/RerenderIndicator.vue +0 -37
  95. package/src/views/composables.ts +0 -630
  96. package/src/views/utils.ts +0 -241
@@ -1,790 +0,0 @@
1
- import { _ as __unplugin_components_0 } from './PanelGrids-664603ce.js';
2
- import { a$ as ref, a1 as computed, b8 as shallowRef, c6 as useDevToolsClient, cw as useThrottleFn, v as defineComponent, by as watch, r as resolveComponent, o as openBlock, e as createElementBlock, x as createBaseVNode, z as unref, c as createBlock, q as normalizeClass, y as toDisplayString, l as normalizeStyle, F as Fragment, i as renderList, g as createCommentVNode, cp as watchDebounced, aP as onMounted, cx as onVueInstanceUpdate, cu as useMagicKeys, bz as watchEffect, u as createVNode, h as withCtx, aC as isRef, c7 as rootPath, aZ as reactive, _ as __unplugin_components_7, cy as instance } from './index-77d53487.js';
3
- import { a as _sfc_main$2, _ as _sfc_main$4 } from './StateFields.vue_vue_type_script_setup_true_lang-48cf50ad.js';
4
- import { g as getInstanceName, c as classify, k as kebabize, i as isFragment, b as isBeingDestroyed, d as getUniqueComponentId, e as getRenderKey, f as getInstanceState, h as getInstanceDetails } from './data-8729d21a.js';
5
- import { _ as _sfc_main$3 } from './TextInput.vue_vue_type_script_setup_true_lang-65c09c69.js';
6
- import { g, M } from './splitpanes.es-26cdc434.js';
7
- import './IconButton.vue_vue_type_script_setup_true_lang-48a6bea2.js';
8
-
9
- const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e$1=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e$1(o.overflowY,n)||e$1(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o$1=(t,e,n,o,i,l,r,d)=>l<t&&r>e||l>t&&r<e?0:l<=t&&d<=n||r>=e&&d>=n?l-t-o:r>e&&d<n||l<t&&d>n?r-e+i:0,i=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},l=(e,l)=>{var r,d,s,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=l,m="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&m(W);){if(W=i(W),W===p){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const H=null!=(d=null==(r=window.visualViewport)?void 0:r.width)?d:innerWidth,b=null!=(h=null==(s=window.visualViewport)?void 0:s.height)?h:innerHeight,{scrollX:v,scrollY:y}=window,{height:E,width:M,top:x,right:I,bottom:C,left:R}=e.getBoundingClientRect();let T="start"===f||"nearest"===f?x:"end"===f?C:x+E/2,V="center"===u?R+M/2:"end"===u?I:R;const k=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:i,top:l,right:r,bottom:d,left:s}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&C<=b&&I<=H&&x>=l&&C<=d&&R>=s&&I<=r)return k;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),m=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let B=0,D=0;const L="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-m:0,S="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,X="offsetWidth"in e?0===e.offsetWidth?0:i/e.offsetWidth:0,Y="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(p===e)B="start"===f?T:"end"===f?T-b:"nearest"===f?o$1(y,y+b,b,g,W,y+T,y+T+E,E):T-b/2,D="start"===u?V:"center"===u?V-H/2:"end"===u?V-H:o$1(v,v+H,H,a,m,v+V,v+V+M,M),B=Math.max(0,B+y),D=Math.max(0,D+v);else {B="start"===f?T-l-g:"end"===f?T-d+W+S:"nearest"===f?o$1(l,d,n,g,W+S,T,T+E,E):T-(l+n/2)+S/2,D="start"===u?V-s-a:"center"===u?V-(s+i/2)+L/2:"end"===u?V-r+m+L:o$1(s,r,i,a,m+L,V,V+M,M);const{scrollLeft:t,scrollTop:h}=e;B=Math.max(0,Math.min(h+B/Y,e.scrollHeight-n/Y+S)),D=Math.max(0,Math.min(t+D/X,e.scrollWidth-i/X+L)),T+=h-B,V+=t-D;}k.push({el:e,top:B,left:D});}return k};
10
- /* Injected with object hook! */
11
-
12
- const o=t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"};function e(e,r){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return !0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode;}return !1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return {top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(r))return r.behavior(l(e,r));const l$1="boolean"==typeof r||null==r?void 0:r.behavior;for(const{el:a,top:i,left:s}of l(e,o(r))){const t=i-n.top+n.bottom,o=s-n.left+n.right;a.scroll({top:t,left:o,behavior:l$1});}}
13
- /* Injected with object hook! */
14
-
15
- class ComponentFilter {
16
- filter;
17
- constructor(filter) {
18
- this.filter = filter || "";
19
- }
20
- /**
21
- * Check if an instance is qualified.
22
- *
23
- * @param {Vue|Vnode} instance
24
- * @return {boolean}
25
- */
26
- isQualified(instance) {
27
- const name = getInstanceName(instance);
28
- return classify(name).toLowerCase().includes(this.filter) || kebabize(name).toLowerCase().includes(this.filter);
29
- }
30
- setFilter(filter) {
31
- this.filter = filter;
32
- }
33
- }
34
-
35
- /* Injected with object hook! */
36
-
37
- function getRootElementsFromComponentInstance(instance) {
38
- if (isFragment(instance))
39
- return getFragmentRootElements(instance.subTree);
40
- if (!instance.subTree)
41
- return [];
42
- return [instance.subTree.el];
43
- }
44
- function getFragmentRootElements(vnode) {
45
- if (!vnode.children)
46
- return [];
47
- const list = [];
48
- for (let i = 0, l = vnode.children.length; i < l; i++) {
49
- const childVnode = vnode.children[i];
50
- if (childVnode.component)
51
- list.push(...getRootElementsFromComponentInstance(childVnode.component));
52
- else if (childVnode.el)
53
- list.push(childVnode.el);
54
- }
55
- return list;
56
- }
57
- function getInstanceOrVnodeRect(instance) {
58
- const el = instance.subTree.el;
59
- if (typeof window === "undefined") {
60
- return;
61
- }
62
- if (isFragment(instance))
63
- return addIframePosition(getFragmentRect(instance.subTree), getElWindow(el));
64
- else if (el.nodeType === 1)
65
- return addIframePosition(el.getBoundingClientRect(), getElWindow(el));
66
- else if (instance.subTree.component)
67
- return getInstanceOrVnodeRect(instance.subTree.component);
68
- }
69
- function createRect() {
70
- const rect = {
71
- top: 0,
72
- bottom: 0,
73
- left: 0,
74
- right: 0,
75
- get width() {
76
- return rect.right - rect.left;
77
- },
78
- get height() {
79
- return rect.bottom - rect.top;
80
- }
81
- };
82
- return rect;
83
- }
84
- function mergeRects(a, b) {
85
- if (!a.top || b.top < a.top)
86
- a.top = b.top;
87
- if (!a.bottom || b.bottom > a.bottom)
88
- a.bottom = b.bottom;
89
- if (!a.left || b.left < a.left)
90
- a.left = b.left;
91
- if (!a.right || b.right > a.right)
92
- a.right = b.right;
93
- return a;
94
- }
95
- let range;
96
- function getTextRect(node) {
97
- if (!range)
98
- range = document.createRange();
99
- range.selectNode(node);
100
- return range.getBoundingClientRect();
101
- }
102
- function getFragmentRect(vnode) {
103
- const rect = createRect();
104
- if (!vnode.children)
105
- return rect;
106
- for (let i = 0, l = vnode.children.length; i < l; i++) {
107
- const childVnode = vnode.children[i];
108
- let childRect;
109
- if (childVnode.component) {
110
- childRect = getInstanceOrVnodeRect(childVnode.component);
111
- } else if (childVnode.el) {
112
- const el = childVnode.el;
113
- if (el.nodeType === 1 || el.getBoundingClientRect)
114
- childRect = el.getBoundingClientRect();
115
- else if (el.nodeType === 3 && el.data.trim())
116
- childRect = getTextRect(el);
117
- }
118
- if (childRect)
119
- mergeRects(rect, childRect);
120
- }
121
- return rect;
122
- }
123
- function getElWindow(el) {
124
- return el.ownerDocument.defaultView;
125
- }
126
- function addIframePosition(bounds, win) {
127
- if (win.__VUE_DEVTOOLS_IFRAME__) {
128
- const rect = mergeRects(createRect(), bounds);
129
- const iframeBounds = win.__VUE_DEVTOOLS_IFRAME__.getBoundingClientRect();
130
- rect.top += iframeBounds.top;
131
- rect.bottom += iframeBounds.top;
132
- rect.left += iframeBounds.left;
133
- rect.right += iframeBounds.left;
134
- if (win.parent)
135
- return addIframePosition(rect, win.parent);
136
- return rect;
137
- }
138
- return bounds;
139
- }
140
-
141
- /* Injected with object hook! */
142
-
143
- const InstanceMap = /* @__PURE__ */ new Map();
144
- const UidToTreeNodeMap = /* @__PURE__ */ new Map();
145
- class ComponentWalker {
146
- maxDepth;
147
- recursively;
148
- componentFilter;
149
- // Dedupe instances
150
- // Some instances may be both on a component and on a child abstract/functional component
151
- captureIds;
152
- constructor(maxDepth, filter, recursively) {
153
- this.maxDepth = maxDepth;
154
- this.recursively = recursively;
155
- this.componentFilter = new ComponentFilter(filter);
156
- this.captureIds = /* @__PURE__ */ new Map();
157
- }
158
- getComponentTree(instance) {
159
- this.captureIds = /* @__PURE__ */ new Map();
160
- return this.findQualifiedChildren(instance, 0);
161
- }
162
- getComponentParents(instance) {
163
- this.captureIds = /* @__PURE__ */ new Map();
164
- const parents = [];
165
- this.captureId(instance);
166
- let parent = instance;
167
- while (parent = parent.parent) {
168
- this.captureId(parent);
169
- parents.push(parent);
170
- }
171
- return parents;
172
- }
173
- /**
174
- * Find qualified children from a single instance.
175
- * If the instance itself is qualified, just return itself.
176
- * This is ok because [].concat works in both cases.
177
- *
178
- * @param {Vue|Vnode} instance
179
- * @return {Vue|Array}
180
- */
181
- async findQualifiedChildren(instance, depth) {
182
- if (this.componentFilter.isQualified(instance) && !instance.type.devtools?.hide) {
183
- return [await this.capture(instance, [], depth)];
184
- } else if (instance.subTree) {
185
- const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
186
- return this.findQualifiedChildrenFromList(list, depth);
187
- } else {
188
- return [];
189
- }
190
- }
191
- /**
192
- * Iterate through an array of instances and flatten it into
193
- * an array of qualified instances. This is a depth-first
194
- * traversal - e.g. if an instance is not matched, we will
195
- * recursively go deeper until a qualified child is found.
196
- *
197
- * @param {Array} instances
198
- * @return {Array}
199
- */
200
- async findQualifiedChildrenFromList(instances, depth) {
201
- instances = instances.filter((child) => !isBeingDestroyed(child));
202
- if (!this.componentFilter.filter)
203
- return Promise.all(instances.map((child, index, list) => this.capture(child, list, depth)));
204
- else
205
- return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
206
- }
207
- /**
208
- * Get children from a component instance.
209
- */
210
- getInternalInstanceChildren(subTree, suspense = null) {
211
- const list = [];
212
- if (subTree) {
213
- if (subTree.component) {
214
- !suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
215
- } else if (subTree.suspense) {
216
- const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
217
- list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
218
- } else if (Array.isArray(subTree.children)) {
219
- subTree.children.forEach((childSubTree) => {
220
- if (childSubTree?.component)
221
- !suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
222
- else
223
- list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
224
- });
225
- }
226
- }
227
- return list.filter((child) => !isBeingDestroyed(child));
228
- }
229
- captureId(instance) {
230
- if (!instance)
231
- return null;
232
- const id = getUniqueComponentId(instance);
233
- if (this.captureIds.has(id))
234
- return null;
235
- else
236
- this.captureIds.set(id, void 0);
237
- return id;
238
- }
239
- /**
240
- * Capture the meta information of an instance. (recursive)
241
- *
242
- * @param {Vue} instance
243
- * @return {object}
244
- */
245
- async capture(instance, list, depth) {
246
- if (!instance)
247
- return null;
248
- const id = this.captureId(instance);
249
- const name = getInstanceName(instance);
250
- const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
251
- const parents = this.getComponentParents(instance) || [];
252
- const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
253
- const treeNode = {
254
- uid: instance.uid,
255
- id,
256
- name,
257
- renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
258
- inactive,
259
- hasChildren: !!children.length,
260
- children: [],
261
- isFragment: isFragment(instance),
262
- // TODO: functional components, suspense
263
- tags: [],
264
- autoOpen: this.recursively,
265
- instance: null
266
- };
267
- const uids = [];
268
- if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
269
- treeNode.children = await Promise.all(children.map((child, index, list2) => this.capture(child, list2, depth + 1)).filter(Boolean));
270
- uids.push(...treeNode.children.map((child) => child.uid));
271
- }
272
- if (this.isKeepAlive(instance)) {
273
- const cachedComponents = this.getKeepAliveCachedInstances(instance);
274
- for (const cachedChild of cachedComponents) {
275
- const node = await this.capture({ ...cachedChild, isDeactivated: true }, [], depth + 1);
276
- const uid = node.uid;
277
- if (node && !uids.includes(uid))
278
- treeNode.children.push(node);
279
- }
280
- }
281
- const rootElements = getRootElementsFromComponentInstance(instance);
282
- const firstElement = rootElements[0];
283
- if (firstElement?.parentElement) {
284
- const parentInstance = instance.parent;
285
- const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
286
- let el = firstElement;
287
- const indexList = [];
288
- do {
289
- indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
290
- el = el.parentElement;
291
- } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
292
- treeNode.domOrder = indexList.reverse();
293
- } else {
294
- treeNode.domOrder = [-1];
295
- }
296
- InstanceMap.set(treeNode.id, getInstanceState(instance));
297
- UidToTreeNodeMap.set(treeNode.uid, treeNode);
298
- treeNode.instance = instance;
299
- return treeNode;
300
- }
301
- isKeepAlive(instance) {
302
- return instance.type.__isKeepAlive && instance.__v_cache;
303
- }
304
- getKeepAliveCachedInstances(instance) {
305
- return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
306
- }
307
- }
308
-
309
- /* Injected with object hook! */
310
-
311
- const selected = ref("vue-devtools:root");
312
- const selectedComponentName = ref("");
313
- const selectedComponentNode = ref();
314
- const selectedComponentNodeFilePath = computed(() => selectedComponentNode.value?.instance ? getInstanceDetails(selectedComponentNode.value.instance)?.file : null);
315
- const expandedMap = ref({
316
- "vue-devtools:root": true
317
- });
318
- ref();
319
- const selectedComponentState = shallowRef([]);
320
- function selectComponentTreeNode(data) {
321
- selected.value = data.id;
322
- selectedComponentName.value = data.name;
323
- selectedComponentState.value = InstanceMap.get(data.id);
324
- selectedComponentNode.value = data;
325
- }
326
- function setExpanded(id, expanded) {
327
- expandedMap.value[id] = expanded;
328
- }
329
- function useComponent(instance) {
330
- function toggleExpand(id) {
331
- expandedMap.value[id] = !expandedMap.value[id];
332
- }
333
- const isSelected = computed(() => selected.value === instance.id);
334
- const isExpanded = computed(() => expandedMap.value[instance.id]);
335
- return { isSelected, select: selectComponentTreeNode, isExpanded, toggleExpand };
336
- }
337
- function useHighlightComponent(node) {
338
- const client = useDevToolsClient();
339
- const highlight = useThrottleFn(() => {
340
- const instance = node.instance;
341
- const bounds = getInstanceOrVnodeRect(instance);
342
- const name = getInstanceName(instance);
343
- client.value?.componentInspector.highlight(name, bounds);
344
- }, 300);
345
- const unhighlight = () => {
346
- client.value?.componentInspector.unHighlight();
347
- };
348
- return {
349
- highlight,
350
- unhighlight
351
- };
352
- }
353
- scrollToComponent.timer = null;
354
- function scrollToComponent() {
355
- if (scrollToComponent.timer)
356
- clearTimeout(scrollToComponent.timer);
357
- const client = useDevToolsClient();
358
- const { highlight, unhighlight } = useHighlightComponent(selectedComponentNode.value);
359
- const instance = selectedComponentNode.value.instance;
360
- const [el] = getRootElementsFromComponentInstance(instance);
361
- if (typeof el.scrollIntoView === "function") {
362
- el.scrollIntoView({
363
- behavior: "smooth"
364
- });
365
- } else {
366
- const _bounds = getInstanceOrVnodeRect(instance);
367
- client.value.componentInspector.scrollToComponent(_bounds);
368
- }
369
- scrollToComponent.timer = setTimeout(() => {
370
- highlight();
371
- scrollToComponent.timer = setTimeout(() => {
372
- unhighlight();
373
- scrollToComponent.timer = null;
374
- }, 1500);
375
- }, 1200);
376
- }
377
-
378
- /* Injected with object hook! */
379
-
380
- const _hoisted_1$1 = {
381
- key: 1,
382
- "inline-block": "",
383
- "h-6": "",
384
- "w-6": ""
385
- };
386
- const _hoisted_2$1 = { key: 0 };
387
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
388
- __name: "ComponentTreeNode",
389
- props: {
390
- data: {},
391
- depth: { default: 0 }
392
- },
393
- setup(__props) {
394
- const props = __props;
395
- const { isSelected, select, isExpanded, toggleExpand } = useComponent(props.data);
396
- const { highlight, unhighlight } = useHighlightComponent(props.data);
397
- const toggleEl = ref();
398
- function autoScroll() {
399
- if (isSelected.value && toggleEl.value) {
400
- const el = toggleEl.value;
401
- e(el, {
402
- scrollMode: "if-needed",
403
- block: "center",
404
- behavior: "smooth",
405
- inline: "nearest"
406
- });
407
- }
408
- }
409
- watch(isSelected, () => autoScroll());
410
- watch(toggleEl, () => autoScroll());
411
- return (_ctx, _cache) => {
412
- const _component_VDExpandIcon = _sfc_main$2;
413
- const _component_ComponentTreeNode = resolveComponent("ComponentTreeNode", true);
414
- return openBlock(), createElementBlock(Fragment, null, [
415
- createBaseVNode("div", {
416
- style: normalizeStyle({
417
- paddingLeft: `${_ctx.depth * 15 + 4}px`
418
- }),
419
- "vue-block": "",
420
- class: normalizeClass([unref(isSelected) ? "vue-block-active" : "vue-block-hover"]),
421
- onClick: _cache[1] || (_cache[1] = ($event) => unref(select)(_ctx.data)),
422
- onMouseover: _cache[2] || (_cache[2] = //@ts-ignore
423
- (...args) => unref(highlight) && unref(highlight)(...args)),
424
- onMouseleave: _cache[3] || (_cache[3] = //@ts-ignore
425
- (...args) => unref(unhighlight) && unref(unhighlight)(...args))
426
- }, [
427
- createBaseVNode("h3", {
428
- ref_key: "toggleEl",
429
- ref: toggleEl,
430
- "vue-block-title": "",
431
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.data.hasChildren ? unref(toggleExpand)(_ctx.data.id) : () => {
432
- })
433
- }, [
434
- _ctx.data.hasChildren ? (openBlock(), createBlock(_component_VDExpandIcon, {
435
- key: 0,
436
- value: unref(isExpanded)
437
- }, null, 8, ["value"])) : (openBlock(), createElementBlock("i", _hoisted_1$1)),
438
- createBaseVNode("span", {
439
- class: normalizeClass([
440
- unref(isSelected) ? "vue-tag-symbol-active" : "vue-tag-symbol"
441
- ])
442
- }, "<", 2),
443
- createBaseVNode("span", {
444
- class: normalizeClass([unref(isSelected) && "text-white"])
445
- }, toDisplayString(_ctx.data.name), 3),
446
- createBaseVNode("span", {
447
- class: normalizeClass([
448
- unref(isSelected) ? "vue-tag-symbol-active" : "vue-tag-symbol"
449
- ])
450
- }, ">", 2)
451
- ], 512)
452
- ], 38),
453
- unref(isExpanded) && _ctx.data.hasChildren ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
454
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.children, (item) => {
455
- return openBlock(), createBlock(_component_ComponentTreeNode, {
456
- key: item.id,
457
- data: item,
458
- depth: _ctx.depth + 1
459
- }, null, 8, ["data", "depth"]);
460
- }), 128))
461
- ])) : createCommentVNode("", true)
462
- ], 64);
463
- };
464
- }
465
- });
466
-
467
- /* Injected with object hook! */
468
-
469
- const _hoisted_1 = {
470
- "h-screen": "",
471
- "n-panel-grids": ""
472
- };
473
- const _hoisted_2 = {
474
- key: 0,
475
- sticky: "",
476
- "left-0": "",
477
- "top-0": "",
478
- "z-300": "",
479
- "w-full": "",
480
- flex: "",
481
- gap2: "",
482
- px10px: "",
483
- py12px: "",
484
- "bg-base": ""
485
- };
486
- const _hoisted_3 = /* @__PURE__ */ createBaseVNode("g", {
487
- fill: "none",
488
- stroke: "currentColor",
489
- "stroke-linecap": "round",
490
- "stroke-linejoin": "round",
491
- "stroke-width": "2"
492
- }, [
493
- /* @__PURE__ */ createBaseVNode("circle", {
494
- cx: "12",
495
- cy: "12",
496
- r: ".5",
497
- fill: "currentColor"
498
- }),
499
- /* @__PURE__ */ createBaseVNode("path", { d: "M5 12a7 7 0 1 0 14 0a7 7 0 1 0-14 0m7-9v2m-9 7h2m7 7v2m7-9h2" })
500
- ], -1);
501
- const _hoisted_4 = [
502
- _hoisted_3
503
- ];
504
- const _hoisted_5 = {
505
- "h-screen": "",
506
- "select-none": "",
507
- "overflow-scroll": "",
508
- "p-2": "",
509
- class: "no-scrollbar"
510
- };
511
- const _hoisted_6 = {
512
- key: 0,
513
- border: "b base",
514
- flex: "",
515
- "justify-between": "",
516
- "px-4": "",
517
- "py-2": ""
518
- };
519
- const _hoisted_7 = {
520
- key: 0,
521
- "text-sm": "",
522
- "text-primary": "",
523
- op90: ""
524
- };
525
- const _hoisted_8 = { flex: "" };
526
- const _hoisted_9 = /* @__PURE__ */ createBaseVNode("p", {
527
- "text-xs": "",
528
- "op-50": ""
529
- }, " Scroll to component ", -1);
530
- const _hoisted_10 = {
531
- key: 0,
532
- "pl-2": ""
533
- };
534
- const _hoisted_11 = {
535
- "text-xs": "",
536
- "op-50": ""
537
- };
538
- const _hoisted_12 = {
539
- key: 1,
540
- "h-screen": "",
541
- "select-none": "",
542
- "overflow-scroll": "",
543
- "p-2": "",
544
- class: "no-scrollbar"
545
- };
546
- const _hoisted_13 = /* @__PURE__ */ createBaseVNode("h1", {
547
- "text-sm": "",
548
- italic: "",
549
- op50: ""
550
- }, " No Data ", -1);
551
- const _sfc_main = /* @__PURE__ */ defineComponent({
552
- __name: "components",
553
- setup(__props) {
554
- const componentTree = ref([]);
555
- const filterName = ref("");
556
- const componentWalker = shallowRef(null);
557
- watchDebounced(filterName, (value) => {
558
- value = value.trim().toLowerCase();
559
- componentWalker.value.componentFilter.setFilter(value);
560
- componentWalker.value.getComponentTree(instance.value).then((res) => {
561
- componentTree.value = res;
562
- });
563
- }, { debounce: 200 });
564
- function normalizeComponentState(value, type) {
565
- if (type === "Reactive")
566
- return reactive(value);
567
- else if (type === "Computed")
568
- return computed(() => value);
569
- else if (type === "Ref")
570
- return ref(value);
571
- else
572
- return value;
573
- }
574
- const normalizedComponentState = computed(() => {
575
- const list = [];
576
- selectedComponentState.value.forEach((item) => {
577
- if (list.some((i) => i.key === item.type)) {
578
- const index = list.findIndex((i) => i.key === item.type);
579
- list[index].value = {
580
- ...list[index].value,
581
- [item.key]: normalizeComponentState(item.value, item.objectType)
582
- };
583
- } else {
584
- list.push({
585
- key: item.type,
586
- value: {
587
- [item.key]: normalizeComponentState(item.value, item.objectType)
588
- }
589
- });
590
- }
591
- });
592
- return list;
593
- });
594
- function findComponentNode(treeNode, uid) {
595
- for (const node of treeNode) {
596
- if (node.uid === uid) {
597
- return node;
598
- } else if (node.children) {
599
- const findNode = findComponentNode(node.children, uid);
600
- if (findNode)
601
- return findNode;
602
- }
603
- }
604
- return void 0;
605
- }
606
- function init() {
607
- componentWalker.value = new ComponentWalker(500, null, true);
608
- componentWalker.value.getComponentTree(instance.value).then((res) => {
609
- const currentNode = findComponentNode(res, selectedComponentNode.value?.uid || 0) || res[0];
610
- componentTree.value = res;
611
- selected.value = currentNode.id;
612
- selectedComponentName.value = currentNode.name;
613
- selectedComponentNode.value = currentNode;
614
- selectedComponentState.value = getInstanceState(currentNode.instance);
615
- });
616
- }
617
- onMounted(() => {
618
- onVueInstanceUpdate((v) => {
619
- if (v)
620
- init();
621
- });
622
- });
623
- function openInEditor() {
624
- const client2 = useDevToolsClient();
625
- client2.value.openInEditor(selectedComponentNodeFilePath.value);
626
- }
627
- const client = useDevToolsClient();
628
- const inspectorEnabled = ref(false);
629
- function inspectComponentClick(instance2) {
630
- inspectorEnabled.value = false;
631
- const treeNode = UidToTreeNodeMap.get(instance2.uid);
632
- if (treeNode) {
633
- selectComponentTreeNode(treeNode);
634
- const walker = new ComponentWalker(0, null, false);
635
- const parents = walker.getComponentParents(instance2);
636
- parents.reverse().forEach((instance3) => {
637
- const id = getUniqueComponentId(instance3);
638
- if (id.endsWith("root"))
639
- return;
640
- setExpanded(id, true);
641
- });
642
- }
643
- }
644
- function toggleInspector(target) {
645
- inspectorEnabled.value = target ?? !inspectorEnabled.value;
646
- if (inspectorEnabled.value)
647
- client.value.componentInspector.startInspect(inspectComponentClick);
648
- else
649
- client.value.componentInspector.stopInspect();
650
- }
651
- const { control, c, escape } = useMagicKeys();
652
- watchEffect(() => {
653
- if (control.value && c.value || escape.value)
654
- toggleInspector(false);
655
- });
656
- return (_ctx, _cache) => {
657
- const _component_VDTextInput = _sfc_main$3;
658
- const _component_ComponentTreeNode = _sfc_main$1;
659
- const _component_VTooltip = resolveComponent("VTooltip");
660
- const _component_StateFields = _sfc_main$4;
661
- const _component_VDCard = __unplugin_components_7;
662
- const _component_VDPanelGrids = __unplugin_components_0;
663
- return openBlock(), createElementBlock("div", _hoisted_1, [
664
- createVNode(unref(M), null, {
665
- default: withCtx(() => [
666
- createVNode(unref(g), {
667
- flex: "",
668
- "flex-col": "",
669
- border: "r base"
670
- }, {
671
- default: withCtx(() => [
672
- unref(componentWalker) ? (openBlock(), createElementBlock("div", _hoisted_2, [
673
- createVNode(_component_VDTextInput, {
674
- modelValue: unref(filterName),
675
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(filterName) ? filterName.value = $event : null),
676
- placeholder: "Find components...",
677
- "flex-1": ""
678
- }, null, 8, ["modelValue"]),
679
- createBaseVNode("button", {
680
- p2: "",
681
- onClick: _cache[1] || (_cache[1] = () => toggleInspector())
682
- }, [
683
- (openBlock(), createElementBlock("svg", {
684
- xmlns: "http://www.w3.org/2000/svg",
685
- style: normalizeStyle([{ "height": "1.1em", "width": "1.1em", "opacity": "0.5" }, unref(inspectorEnabled) ? "opacity:1;color:#00dc82" : ""]),
686
- viewBox: "0 0 24 24"
687
- }, _hoisted_4, 4))
688
- ])
689
- ])) : createCommentVNode("", true),
690
- createBaseVNode("div", _hoisted_5, [
691
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(componentTree), (item) => {
692
- return openBlock(), createBlock(_component_ComponentTreeNode, {
693
- key: item.id,
694
- data: item
695
- }, null, 8, ["data"]);
696
- }), 128))
697
- ])
698
- ]),
699
- _: 1
700
- }),
701
- createVNode(unref(g), {
702
- flex: "",
703
- "flex-col": ""
704
- }, {
705
- default: withCtx(() => [
706
- unref(normalizedComponentState).length ? (openBlock(), createElementBlock("div", _hoisted_6, [
707
- unref(selectedComponentName) ? (openBlock(), createElementBlock("span", _hoisted_7, "<" + toDisplayString(unref(selectedComponentName)) + ">", 1)) : createCommentVNode("", true),
708
- createBaseVNode("p", _hoisted_8, [
709
- createBaseVNode("span", null, [
710
- createVNode(_component_VTooltip, { placement: "bottom" }, {
711
- popper: withCtx(() => [
712
- _hoisted_9
713
- ]),
714
- default: withCtx(() => [
715
- createBaseVNode("i", {
716
- "gg:scroll-h": "",
717
- "cursor-pointer": "",
718
- "text-xl": "",
719
- op70: "",
720
- hover: "op100",
721
- onClick: _cache[2] || (_cache[2] = //@ts-ignore
722
- (...args) => unref(scrollToComponent) && unref(scrollToComponent)(...args))
723
- })
724
- ]),
725
- _: 1
726
- })
727
- ]),
728
- unref(selectedComponentNodeFilePath) ? (openBlock(), createElementBlock("span", _hoisted_10, [
729
- createVNode(_component_VTooltip, { placement: "bottom" }, {
730
- popper: withCtx(() => [
731
- createBaseVNode("p", _hoisted_11, " Open " + toDisplayString(unref(selectedComponentNodeFilePath).replace(unref(rootPath), "")) + " in editor ", 1)
732
- ]),
733
- default: withCtx(() => [
734
- createBaseVNode("i", {
735
- "carbon-launch": "",
736
- "cursor-pointer": "",
737
- "text-sm": "",
738
- op70: "",
739
- hover: "op100",
740
- onClick: openInEditor
741
- })
742
- ]),
743
- _: 1
744
- })
745
- ])) : createCommentVNode("", true)
746
- ])
747
- ])) : createCommentVNode("", true),
748
- unref(normalizedComponentState).length ? (openBlock(), createElementBlock("div", _hoisted_12, [
749
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedComponentState), (item, index) => {
750
- return openBlock(), createBlock(_component_StateFields, {
751
- id: index,
752
- key: item.key,
753
- data: item
754
- }, null, 8, ["id", "data"]);
755
- }), 128))
756
- ])) : (openBlock(), createBlock(_component_VDPanelGrids, {
757
- key: 2,
758
- px5: ""
759
- }, {
760
- default: withCtx(() => [
761
- createVNode(_component_VDCard, {
762
- flex: "~ col gap2",
763
- "min-w-30": "",
764
- "items-center": "",
765
- p3: ""
766
- }, {
767
- default: withCtx(() => [
768
- _hoisted_13
769
- ]),
770
- _: 1
771
- })
772
- ]),
773
- _: 1
774
- }))
775
- ]),
776
- _: 1
777
- })
778
- ]),
779
- _: 1
780
- })
781
- ]);
782
- };
783
- }
784
- });
785
-
786
- /* Injected with object hook! */
787
-
788
- /* Injected with object hook! */
789
-
790
- export { _sfc_main as default };