vite-plugin-vue-inspector-plus 1.0.0-alpha.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -8
- package/dist/inspector/App.vue +17 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,17 +20,10 @@ This plugin needs to be used with [Vue Devtools](https://github.com/vuejs/devtoo
|
|
|
20
20
|
|
|
21
21
|
import { defineConfig } from 'vite';
|
|
22
22
|
import VueDevTools from 'vite-plugin-vue-devtools';
|
|
23
|
-
// import VueInspector from 'vite-plugin-vue-inspector';
|
|
24
23
|
import VueInspectorPlus from 'vite-plugin-vue-inspector-plus';
|
|
25
24
|
|
|
26
25
|
export default defineConfig({
|
|
27
|
-
plugins: [
|
|
28
|
-
VueDevTools(),
|
|
29
|
-
// VueInspector(),
|
|
30
|
-
VueInspectorPlus({
|
|
31
|
-
// options
|
|
32
|
-
}),
|
|
33
|
-
],
|
|
26
|
+
plugins: [VueDevTools(), VueInspectorPlus()],
|
|
34
27
|
});
|
|
35
28
|
```
|
|
36
29
|
|
package/dist/inspector/App.vue
CHANGED
|
@@ -20,16 +20,17 @@
|
|
|
20
20
|
[$style.element]: item.type === 'element',
|
|
21
21
|
[$style.component]: item.type === 'component',
|
|
22
22
|
[$style.route]: item.route,
|
|
23
|
-
[$style.
|
|
23
|
+
[$style.splitted]: item.file && item.location,
|
|
24
24
|
},
|
|
25
25
|
]"
|
|
26
26
|
v-for="(item, index) in stack"
|
|
27
27
|
:key="index"
|
|
28
|
+
:dataFile="item.file"
|
|
29
|
+
:dataLocation="item.location"
|
|
28
30
|
@mouseenter="handleItemMouseEnter(item)"
|
|
29
31
|
>
|
|
30
|
-
<span :class="$style.icon" @click="handleOpenLocation(item.file
|
|
32
|
+
<span v-if="item.file" :class="$style.icon" @click="handleOpenLocation(item.file)">
|
|
31
33
|
<svg
|
|
32
|
-
v-if="item.file"
|
|
33
34
|
xmlns="http://www.w3.org/2000/svg"
|
|
34
35
|
width="24"
|
|
35
36
|
height="24"
|
|
@@ -48,8 +49,9 @@
|
|
|
48
49
|
<path d="M12 12l8.73 -5.04" />
|
|
49
50
|
<path d="M3.27 6.96l8.73 5.04" />
|
|
50
51
|
</svg>
|
|
52
|
+
</span>
|
|
53
|
+
<span v-else :class="$style.icon" @click="handleOpenLocation(item.location)">
|
|
51
54
|
<svg
|
|
52
|
-
v-else
|
|
53
55
|
xmlns="http://www.w3.org/2000/svg"
|
|
54
56
|
width="24"
|
|
55
57
|
height="24"
|
|
@@ -69,12 +71,12 @@
|
|
|
69
71
|
<path d="M19 12l2 0" />
|
|
70
72
|
</svg>
|
|
71
73
|
</span>
|
|
72
|
-
<div :class="$style.main" @click="handleOpenLocation(item.location)">
|
|
74
|
+
<div :class="$style.main" @click="handleOpenLocation(item.location || item.file)">
|
|
73
75
|
<span :class="$style.title">
|
|
74
76
|
{{ item.title || 'Unknown' }}
|
|
75
77
|
</span>
|
|
76
78
|
<span :class="$style.location">
|
|
77
|
-
{{ toRelativePath(item.location) }}
|
|
79
|
+
{{ toRelativePath(item.location || item.file) }}
|
|
78
80
|
</span>
|
|
79
81
|
</div>
|
|
80
82
|
</li>
|
|
@@ -203,7 +205,7 @@ function getVueElement(el: VueHtmlElement) {
|
|
|
203
205
|
|
|
204
206
|
const location = vnode.props?.[DATA_KEY];
|
|
205
207
|
|
|
206
|
-
return { type: 'element', el, title, location };
|
|
208
|
+
return { type: 'element', el, title, file: undefined, location, route: undefined };
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
function getVueComponents(el: VueHtmlElement) {
|
|
@@ -223,16 +225,16 @@ function getVueComponents(el: VueHtmlElement) {
|
|
|
223
225
|
const el = vm.vnode.el;
|
|
224
226
|
const file = vm.type.__file;
|
|
225
227
|
const title = pascalize(vm.type.__name || vm.type.name || getFileName(file));
|
|
226
|
-
const location = vm.vnode.props?.[DATA_KEY]
|
|
228
|
+
const location = vm.vnode.props?.[DATA_KEY];
|
|
227
229
|
const route = vm.parent?.type.name === 'RouterView';
|
|
228
230
|
|
|
229
|
-
return { type: 'component', el, title,
|
|
231
|
+
return { type: 'component', el, title, file, location, route };
|
|
230
232
|
});
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
function getVueStack(el: VueHtmlElement) {
|
|
234
236
|
return [getVueElement(el), ...getVueComponents(el)].filter(
|
|
235
|
-
(item) => item && item.location,
|
|
237
|
+
(item) => item && (item.file || item.location),
|
|
236
238
|
) as VueStackItem[];
|
|
237
239
|
}
|
|
238
240
|
|
|
@@ -307,6 +309,7 @@ onUnmounted(() => {
|
|
|
307
309
|
background: rgba(66, 184, 131, 0.2);
|
|
308
310
|
pointer-events: none;
|
|
309
311
|
box-sizing: border-box;
|
|
312
|
+
transition: all 0.2s;
|
|
310
313
|
}
|
|
311
314
|
|
|
312
315
|
.dropdown {
|
|
@@ -320,7 +323,6 @@ onUnmounted(() => {
|
|
|
320
323
|
background: white;
|
|
321
324
|
box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
|
|
322
325
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
323
|
-
backdrop-filter: blur(12px) saturate(200%) contrast(100%) brightness(130%);
|
|
324
326
|
border-radius: 6px;
|
|
325
327
|
transition: top 0.2s, left 0.2s;
|
|
326
328
|
}
|
|
@@ -348,16 +350,16 @@ onUnmounted(() => {
|
|
|
348
350
|
color: #4b7eff;
|
|
349
351
|
}
|
|
350
352
|
|
|
351
|
-
.item.
|
|
353
|
+
.item.splitted .icon {
|
|
352
354
|
border-right-color: rgba(0, 0, 0, 0.06);
|
|
353
355
|
}
|
|
354
356
|
|
|
355
|
-
.item:not(.
|
|
356
|
-
.item:not(.
|
|
357
|
+
.item:not(.splitted):hover .icon,
|
|
358
|
+
.item:not(.splitted):hover .main {
|
|
357
359
|
background: rgba(0, 0, 0, 0.03);
|
|
358
360
|
}
|
|
359
361
|
|
|
360
|
-
.item:not(.
|
|
362
|
+
.item:not(.splitted):hover .main::after {
|
|
361
363
|
visibility: visible;
|
|
362
364
|
}
|
|
363
365
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vue-inspector-plus",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "Add a shortcut dropdown menu for Vue Inspector.",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
"vite": "^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0",
|
|
47
47
|
"vue": "^3.0.0"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|