vite-plugin-vue-inspector-plus 1.0.0-alpha.0 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.file]: !!item.file,
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 || item.location)">
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] || file;
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, location, file, route };
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
 
@@ -279,6 +281,7 @@ const handleOpenLocation = (location?: string) => {
279
281
  };
280
282
 
281
283
  const handleItemMouseEnter = (item: VueStackItem) => {
284
+ if (!stack.value.length) return;
282
285
  activeItem.value = item;
283
286
  };
284
287
 
@@ -306,6 +309,7 @@ onUnmounted(() => {
306
309
  background: rgba(66, 184, 131, 0.2);
307
310
  pointer-events: none;
308
311
  box-sizing: border-box;
312
+ transition: all 0.2s;
309
313
  }
310
314
 
311
315
  .dropdown {
@@ -319,7 +323,6 @@ onUnmounted(() => {
319
323
  background: white;
320
324
  box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
321
325
  0px 3px 6px -4px rgba(0, 0, 0, 0.12);
322
- backdrop-filter: blur(12px) saturate(200%) contrast(100%) brightness(130%);
323
326
  border-radius: 6px;
324
327
  transition: top 0.2s, left 0.2s;
325
328
  }
@@ -347,16 +350,16 @@ onUnmounted(() => {
347
350
  color: #4b7eff;
348
351
  }
349
352
 
350
- .item.file .icon {
353
+ .item.splitted .icon {
351
354
  border-right-color: rgba(0, 0, 0, 0.06);
352
355
  }
353
356
 
354
- .item:not(.file):hover .icon,
355
- .item:not(.file):hover .main {
357
+ .item:not(.splitted):hover .icon,
358
+ .item:not(.splitted):hover .main {
356
359
  background: rgba(0, 0, 0, 0.03);
357
360
  }
358
361
 
359
- .item:not(.file):hover .main::after {
362
+ .item:not(.splitted):hover .main::after {
360
363
  visibility: visible;
361
364
  }
362
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-alpha.0",
4
+ "version": "1.0.0-alpha.2",
5
5
  "description": "Add a shortcut dropdown menu for Vue Inspector.",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",