vite-plugin-vue-devtools 0.0.3 → 0.0.5

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 (28) hide show
  1. package/README.md +17 -9
  2. package/dist/client/assets/{VCard-13907a46.js → VCard-8dda4b89.js} +1 -1
  3. package/dist/client/assets/{VIcon.vue_vue_type_script_setup_true_lang-4c0f4564.js → VIcon.vue_vue_type_script_setup_true_lang-b9e1052c.js} +1 -1
  4. package/dist/client/assets/{VIconTitle.vue_vue_type_script_setup_true_lang-52a154e6.js → VIconTitle.vue_vue_type_script_setup_true_lang-ec1b3b7a.js} +1 -1
  5. package/dist/client/assets/{VPanelGrids-a4608de3.js → VPanelGrids-eb4fe74d.js} +1 -1
  6. package/dist/client/assets/{VTextInput.vue_vue_type_script_setup_true_lang-cb2bd7f3.js → VTextInput.vue_vue_type_script_setup_true_lang-14bfbfbb.js} +3 -3
  7. package/dist/client/assets/{__inspecting-b4c46d4c.js → __inspecting-b8697c3c.js} +2 -2
  8. package/dist/client/assets/{assets-91d26c5a.js → assets-9ac104fb.js} +7 -7
  9. package/dist/client/assets/{components-82bf5bc7.js → components-b3ff2252.js} +6 -5
  10. package/dist/client/assets/{graph-f1653469.js → graph-74eabf92.js} +2 -5
  11. package/dist/client/assets/{index-b6d93299.js → index-03df0916.js} +25 -19
  12. package/dist/client/assets/index-e9e51318.js +45 -0
  13. package/dist/client/assets/{index-f0fa9f81.css → index-fceca701.css} +1 -1
  14. package/dist/client/assets/{inspect-6024fe00.js → inspect-efa81d08.js} +2 -2
  15. package/dist/client/assets/{overview-287c2c9c.js → overview-642d4475.js} +10 -8
  16. package/dist/client/assets/{pages-414480b4.js → pages-4f6946a5.js} +4 -4
  17. package/dist/client/assets/{pinia-3952f28a.js → pinia-7b31943d.js} +4 -4
  18. package/dist/client/assets/{routes-736ebb1f.js → routes-39cb7889.js} +6 -5
  19. package/dist/client/assets/{rpc-dc061b6e.js → rpc-c1c125a2.js} +1 -1
  20. package/dist/client/assets/{settings-c0ffed60.js → settings-6c9c579a.js} +8 -9
  21. package/dist/client/assets/{splitpanes.es-fe752aba.js → splitpanes.es-00d9608c.js} +3 -40
  22. package/dist/client/assets/{timeline-cda2b315.js → timeline-a7dd8994.js} +6 -5
  23. package/dist/client/index.html +2 -2
  24. package/dist/index.cjs +3 -1
  25. package/dist/index.mjs +3 -1
  26. package/package.json +3 -3
  27. package/src/node/Container.vue +129 -15
  28. package/src/node/app.js +4 -4
@@ -1,8 +1,9 @@
1
- import { g, M, _ as _sfc_main$2 } from './splitpanes.es-fe752aba.js';
2
- import { _ as __unplugin_components_0 } from './VPanelGrids-a4608de3.js';
3
- import { _ as __unplugin_components_7 } from './VCard-13907a46.js';
4
- import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, A as onMounted, B as onUnmounted, C as timelineLayer, D as activeTimelineEvents, E as activeTimelineEventIndex, G as toggleTimelineEventIndex, H as timelineEventDetails, I as activeLayerId, J as toggleTimelineLayer } from './index-b6d93299.js';
5
- import './VIcon.vue_vue_type_script_setup_true_lang-4c0f4564.js';
1
+ import { g, M, _ as _sfc_main$2 } from './splitpanes.es-00d9608c.js';
2
+ import { _ as __unplugin_components_0 } from './VPanelGrids-eb4fe74d.js';
3
+ import { _ as __unplugin_components_7 } from './VCard-8dda4b89.js';
4
+ import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, A as onMounted, B as onUnmounted, C as timelineLayer, D as activeTimelineEvents, E as activeTimelineEventIndex, G as toggleTimelineEventIndex, H as timelineEventDetails, I as activeLayerId, J as toggleTimelineLayer } from './index-03df0916.js';
5
+ import './VIcon.vue_vue_type_script_setup_true_lang-b9e1052c.js';
6
+ import './index-e9e51318.js';
6
7
 
7
8
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
9
 
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <link rel="icon" href="/favicon.svg" type="image/svg+xml">
7
7
  <title>Vue Devtools</title>
8
- <script type="module" crossorigin src="./assets/index-b6d93299.js"></script>
9
- <link rel="stylesheet" href="./assets/index-f0fa9f81.css">
8
+ <script type="module" crossorigin src="./assets/index-03df0916.js"></script>
9
+ <link rel="stylesheet" href="./assets/index-fceca701.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
package/dist/index.cjs CHANGED
@@ -7695,7 +7695,9 @@ function getVueDevtoolsPath() {
7695
7695
  }
7696
7696
  function PluginVueDevtools() {
7697
7697
  const vueDevtoolsPath = getVueDevtoolsPath();
7698
- const inspect = Inspect__default();
7698
+ const inspect = Inspect__default({
7699
+ silent: true
7700
+ });
7699
7701
  let config;
7700
7702
  function configureServer(server) {
7701
7703
  const base = server.config.base || "/";
package/dist/index.mjs CHANGED
@@ -7679,7 +7679,9 @@ function getVueDevtoolsPath() {
7679
7679
  }
7680
7680
  function PluginVueDevtools() {
7681
7681
  const vueDevtoolsPath = getVueDevtoolsPath();
7682
- const inspect = Inspect();
7682
+ const inspect = Inspect({
7683
+ silent: true
7684
+ });
7683
7685
  let config;
7684
7686
  function configureServer(server) {
7685
7687
  const base = server.config.base || "/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vue-devtools",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "packageManager": "pnpm@8.4.0",
5
5
  "description": "A vite plugin for Vue Devtools",
6
6
  "author": "webfansplz",
@@ -47,7 +47,7 @@
47
47
  "dev:client": "vite build src/client --watch",
48
48
  "play": "nr -C playground dev",
49
49
  "stub": "unbuild --stub",
50
- "lint": "eslint . --fix",
50
+ "lint": "eslint .",
51
51
  "prepublishOnly": "npm run build",
52
52
  "release": "bumpp && npm publish"
53
53
  },
@@ -60,7 +60,7 @@
60
60
  "sirv": "^2.0.3",
61
61
  "splitpanes": "^3.1.5",
62
62
  "vite-hot-client": "^0.2.1",
63
- "vite-plugin-inspect": "^0.7.25",
63
+ "vite-plugin-inspect": "^0.7.26",
64
64
  "vite-plugin-vue-inspector": "^3.4.1",
65
65
  "vue-router": "^4.1.6"
66
66
  },
@@ -12,6 +12,20 @@ window.__VUE_DEVTOOLS_GLOBAL_HOOKS__ = function () {
12
12
  return props.hook
13
13
  }
14
14
 
15
+ const isDragging = ref(false)
16
+
17
+ document.addEventListener('mouseup', () => {
18
+ isDragging.value = false
19
+ })
20
+
21
+ document.addEventListener('mouseleave', () => {
22
+ isDragging.value = false
23
+ })
24
+
25
+ const PANEL_MIN = 15
26
+ const PANEL_MAX = 100
27
+ const PANEL_PADDING = 10
28
+
15
29
  const clientUrl = `${vueDevtoolsOptions.base || '/'}__devtools/`
16
30
  const iframe = ref()
17
31
  const panelState = ref({
@@ -21,43 +35,57 @@ const panelState = ref({
21
35
  const panelVisible = ref(false)
22
36
  const hookBuffer = []
23
37
  let isAppCreated = false
38
+
39
+ const panelHight = ref(60)
40
+ const panelWidth = ref(80)
41
+
24
42
  const panelStyle = computed(() => {
43
+ const height = `calc(${panelHight.value}vh - ${PANEL_PADDING}px)`
44
+ const width = `calc(${panelWidth.value}vw - ${PANEL_PADDING}px)`
25
45
  if (panelState.value.viewMode === 'component-inspector') {
26
46
  return {
27
- bottom: '10px',
47
+ bottom: `${PANEL_PADDING}px`,
28
48
  left: '50%',
29
49
  transform: 'translateX(-50%)',
30
- height: '80px',
31
- width: '400px',
50
+ height,
51
+ width,
32
52
  }
33
53
  }
34
54
 
35
55
  if (panelState.value.position === 'bottom') {
36
56
  return {
37
57
  transform: 'translateX(-50%)',
38
- bottom: '10px',
58
+ bottom: `${PANEL_PADDING}px`,
39
59
  left: '50%',
60
+ height,
61
+ width,
40
62
  }
41
63
  }
42
64
  else if (panelState.value.position === 'top') {
43
65
  return {
44
66
  transform: 'translateX(-50%)',
45
- top: '10px',
67
+ top: `${PANEL_PADDING}px`,
46
68
  left: '50%',
69
+ height,
70
+ width,
47
71
  }
48
72
  }
49
73
  else if (panelState.value.position === 'left') {
50
74
  return {
51
75
  transform: 'translateY(-50%)',
52
76
  top: '50%',
53
- left: '10px',
77
+ left: `${PANEL_PADDING}px`,
78
+ height,
79
+ width,
54
80
  }
55
81
  }
56
82
  else {
57
83
  return {
58
84
  transform: 'translateY(-50%)',
59
85
  top: '50%',
60
- right: '10px',
86
+ right: `${PANEL_PADDING}px`,
87
+ height,
88
+ width,
61
89
  }
62
90
  }
63
91
  })
@@ -101,7 +129,40 @@ const toggleButtonPosition = computed(() => {
101
129
  '--hover-translate': 'translate(0, -3px)',
102
130
  }
103
131
  })
104
- const panelPosition = computed(() => panelVisible.value ? panelStyle.value : { zIndex: -100000, left: '-9999px', top: '-9999px' })
132
+ const panelPosition = computed(() =>
133
+ panelVisible.value
134
+ ? panelStyle.value
135
+ : { zIndex: -100000, left: '-9999px', top: '-9999px' },
136
+ )
137
+
138
+ document.addEventListener('mousemove', (e) => {
139
+ if (!isDragging.value)
140
+ return
141
+
142
+ const alignSide = panelState.value.position === 'left' || panelState.value.position === 'right'
143
+
144
+ if (isDragging.value === 'horizontal' || isDragging.value === 'both') {
145
+ const y = panelState.value.position === 'top'
146
+ ? window.innerHeight - e.clientY
147
+ : e.clientY
148
+ const boxHeight = window.innerHeight
149
+ const value = alignSide
150
+ ? (Math.abs(y - (window.innerHeight / 2))) / boxHeight * 100 * 2
151
+ : (window.innerHeight - y) / boxHeight * 100
152
+ panelHight.value = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
153
+ }
154
+
155
+ if (isDragging.value === 'vertical' || isDragging.value === 'both') {
156
+ const x = panelState.value.position === 'left'
157
+ ? window.innerWidth - e.clientX
158
+ : e.clientX
159
+ const boxWidth = window.innerWidth
160
+ const value = alignSide
161
+ ? (window.innerWidth - x) / boxWidth * 100
162
+ : (Math.abs(x - (window.innerWidth / 2))) / boxWidth * 100 * 2
163
+ panelWidth.value = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
164
+ }
165
+ })
105
166
 
106
167
  function togglePanel() {
107
168
  panelVisible.value = !panelVisible.value
@@ -163,7 +224,8 @@ function setupClient() {
163
224
  disable: disableComponentInspector,
164
225
  },
165
226
  panel: {
166
- toggle(position) {
227
+ toggle: togglePanel,
228
+ togglePosition(position) {
167
229
  panelState.value.position = position
168
230
  },
169
231
  },
@@ -264,9 +326,29 @@ initPanelPosition()
264
326
 
265
327
  <template>
266
328
  <div class="vue-devtools-panel" :style="panelPosition">
267
- <iframe ref="iframe" :src="clientUrl" @load="onLoad" />
329
+ <iframe
330
+ ref="iframe"
331
+ :src="clientUrl"
332
+ :style="{
333
+ 'pointer-events': isDragging ? 'none' : 'auto',
334
+ }"
335
+ @load="onLoad"
336
+ />
337
+ <template v-if="panelState.viewMode === 'default'">
338
+ <div v-if="panelState.position !== 'top'" class="vue-devtools-resize-handle vue-devtools-resize-handle-horizontal" :style="{ top: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
339
+ <div v-if="panelState.position !== 'bottom'" class="vue-devtools-resize-handle vue-devtools-resize-handle-horizontal" :style="{ bottom: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
340
+ <div v-if="panelState.position !== 'left'" class="vue-devtools-resize-handle vue-devtools-resize-handle-vertical" :style="{ left: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
341
+ <div v-if="panelState.position !== 'right'" class="vue-devtools-resize-handle vue-devtools-resize-handle-vertical" :style="{ right: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
342
+ <div v-if="panelState.position !== 'top' && panelState.position !== 'left'" class="vue-devtools-resize-handle vue-devtools-resize-handle-corner" :style="{ top: 0, left: 0, cursor: 'nwse-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
343
+ <div v-if="panelState.position !== 'top' && panelState.position !== 'right'" class="vue-devtools-resize-handle vue-devtools-resize-handle-corner" :style="{ top: 0, right: 0, cursor: 'nesw-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
344
+ <div v-if="panelState.position !== 'bottom' && panelState.position !== 'right'" class="vue-devtools-resize-handle vue-devtools-resize-handle-corner" :style="{ bottom: 0, right: 0, cursor: 'nwse-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
345
+ <div v-if="panelState.position !== 'bottom' && panelState.position !== 'left'" class="vue-devtools-resize-handle vue-devtools-resize-handle-corner" :style="{ bottom: 0, left: 0, cursor: 'nesw-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
346
+ </template>
268
347
  </div>
269
- <button class="vue-devtools-toggle" aria-label="Toggle devtools panel" :style="toggleButtonPosition" @click.prevent="togglePanel">
348
+ <button
349
+ class="vue-devtools-toggle" aria-label="Toggle devtools panel" :style="toggleButtonPosition"
350
+ @click.prevent="togglePanel"
351
+ >
270
352
  <svg viewBox="0 0 256 198" fill="none" xmlns="http://www.w3.org/2000/svg">
271
353
  <path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z" />
272
354
  <path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z" />
@@ -287,15 +369,15 @@ initPanelPosition()
287
369
  width: 100%;
288
370
  height: 100%;
289
371
  outline: 0;
290
- border:1px solid rgba(125,125,125,0.2);
372
+ border: 1px solid rgba(125, 125, 125, 0.2);
291
373
  border-radius: 8px;
292
374
  }
293
375
 
294
376
  .vue-devtools-toggle {
295
377
  position: fixed;
296
378
  background: #0C0C0C;
297
- border: 1px solid rgba(125,125,125,0.2);
298
- box-shadow: 3px 5px 10px rgba(0,0,0,0.1);
379
+ border: 1px solid rgba(125, 125, 125, 0.2);
380
+ box-shadow: 3px 5px 10px rgba(0, 0, 0, 0.1);
299
381
  z-index: 2147483647;
300
382
  cursor: pointer;
301
383
  opacity: 0.8;
@@ -314,6 +396,38 @@ initPanelPosition()
314
396
  width: 16px;
315
397
  height: 16px;
316
398
  margin: auto;
317
- margin-top:3px;
399
+ margin-top: 3px;
400
+ }
401
+
402
+ .vue-devtools-resize-handle:hover {
403
+ background: rgba(125,125,125,0.1);
404
+ }
405
+
406
+ .vue-devtools-resize-handle-horizontal {
407
+ position: absolute;
408
+ left: 6px;
409
+ right: 6px;
410
+ height: 10px;
411
+ margin: -5px 0;
412
+ cursor: ns-resize;
413
+ border-radius: 5px;
414
+ }
415
+
416
+ .vue-devtools-resize-handle-corner {
417
+ position: absolute;
418
+ width: 14px;
419
+ height: 14px;
420
+ margin: -6px;
421
+ border-radius: 6px;
422
+ }
423
+
424
+ .vue-devtools-resize-handle-vertical{
425
+ position: absolute;
426
+ top: 6px;
427
+ bottom: 0;
428
+ width: 10px;
429
+ margin: 0 -5px;
430
+ cursor: ew-resize;
431
+ border-radius: 5px;
318
432
  }
319
433
  </style>
package/src/node/app.js CHANGED
@@ -27,7 +27,7 @@ function load() {
27
27
  devtools: {
28
28
  hide: true,
29
29
  },
30
- }).mount(`#${CONTAINER_ID}`)
30
+ }).mount(el)
31
31
  }
32
32
  load()
33
33
 
@@ -36,6 +36,6 @@ window.print = (...s) => {
36
36
  console.log('print', ...s)
37
37
  }
38
38
 
39
- hook.on('app:init', (app) => {
40
- // console.log('init', app)
41
- })
39
+ // hook.on('app:init', (app) => {
40
+ // console.log('init', app)
41
+ // })