vite-plugin-vue-devtools 0.3.1 → 0.4.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/dist/client/assets/{IframeView.vue_vue_type_script_setup_true_lang-fad49b28.js → IframeView.vue_vue_type_script_setup_true_lang-07716658.js} +1 -1
- package/dist/client/assets/{StateFields.vue_vue_type_script_setup_true_lang-766dc2da.js → StateFields.vue_vue_type_script_setup_true_lang-321ed214.js} +4 -4
- package/dist/client/assets/{VIcon.vue_vue_type_script_setup_true_lang-8e1bce76.js → VIcon.vue_vue_type_script_setup_true_lang-22026580.js} +1 -1
- package/dist/client/assets/{VIconButton.vue_vue_type_script_setup_true_lang-1dfaade2.js → VIconButton.vue_vue_type_script_setup_true_lang-325f26b6.js} +2 -2
- package/dist/client/assets/{VIconTitle.vue_vue_type_script_setup_true_lang-3891436f.js → VIconTitle.vue_vue_type_script_setup_true_lang-93fee085.js} +1 -1
- package/dist/client/assets/{VPanelGrids-5c36b027.js → VPanelGrids-ea1fc6cc.js} +1 -1
- package/dist/client/assets/{VSectionBlock-de05a5a5.js → VSectionBlock-22944be5.js} +3 -3
- package/dist/client/assets/{VTextInput.vue_vue_type_script_setup_true_lang-1c3b455d.js → VTextInput.vue_vue_type_script_setup_true_lang-4c7997d1.js} +2 -2
- package/dist/client/assets/{__eyedropper-8918265a.js → __eyedropper-1e766935.js} +2 -2
- package/dist/client/assets/{assets-6e057331.js → assets-ed629e80.js} +8 -8
- package/dist/client/assets/{component-docs-52802cb1.js → component-docs-df825434.js} +5 -5
- package/dist/client/assets/{components-0083a223.js → components-8882d725.js} +7 -7
- package/dist/client/assets/{documentations-1d60f0ff.js → documentations-37907b83.js} +6 -6
- package/dist/client/assets/{graph-97eb4fb0.js → graph-7d844661.js} +2 -2
- package/dist/client/assets/{index-0158f749.js → index-9875586e.js} +39 -51
- package/dist/client/assets/{index-5b7de771.css → index-99f31726.css} +1 -1
- package/dist/client/assets/{index-32549096.js → index-dc7de915.js} +1 -1
- package/dist/client/assets/{inspect-d5e39a6a.js → inspect-952aeb0a.js} +3 -3
- package/dist/client/assets/{npm-8ea47586.js → npm-ec7132af.js} +6 -6
- package/dist/client/assets/{overview-3bc4fc18.js → overview-eb213ef4.js} +5 -5
- package/dist/client/assets/{pages-e0bd078d.js → pages-acabe249.js} +5 -5
- package/dist/client/assets/{pinia-0490bdb1.js → pinia-9bb95365.js} +6 -6
- package/dist/client/assets/{routes-b5c90320.js → routes-c562ae44.js} +7 -7
- package/dist/client/assets/{rpc-6610a4d4.js → rpc-a89d2eca.js} +2 -2
- package/dist/client/assets/{settings-68a6aaae.js → settings-e845812f.js} +3 -3
- package/dist/client/assets/{splitpanes.es-398427c7.js → splitpanes.es-b88bf7fe.js} +1 -1
- package/dist/client/assets/{timeline-f8284402.js → timeline-0f12b727.js} +7 -7
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/src/node/app.js +1 -1
- package/dist/client/assets/__inspecting-9ed1189b.js +0 -51
- package/src/node/Container.vue +0 -604
package/src/node/Container.vue
DELETED
|
@@ -1,604 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, onMounted, ref, watchEffect } from 'vue'
|
|
3
|
-
import vueDevToolsOptions from 'virtual:vue-devtools-options'
|
|
4
|
-
|
|
5
|
-
// Reuse @vuejs/devtools instance first
|
|
6
|
-
|
|
7
|
-
const props = defineProps({
|
|
8
|
-
hook: {
|
|
9
|
-
type: Object,
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const hook = props.hook
|
|
14
|
-
|
|
15
|
-
const DevToolsHooks = {
|
|
16
|
-
APP_INIT: 'app:init',
|
|
17
|
-
COMPONENT_UPDATED: 'component:updated',
|
|
18
|
-
COMPONENT_ADDED: 'component:added',
|
|
19
|
-
COMPONENT_REMOVED: 'component:removed',
|
|
20
|
-
COMPONENT_EMIT: 'component:emit',
|
|
21
|
-
PERF_START: 'perf:start',
|
|
22
|
-
PERF_END: 'perf:end',
|
|
23
|
-
ADD_ROUTE: 'router:add-route',
|
|
24
|
-
REMOVE_ROUTE: 'router:remove-route',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const PANEL_MIN = 15
|
|
28
|
-
const PANEL_MAX = 100
|
|
29
|
-
const PANEL_PADDING = 10
|
|
30
|
-
|
|
31
|
-
const clientUrl = `${vueDevToolsOptions.base || '/'}__devtools__/`
|
|
32
|
-
const iframe = ref()
|
|
33
|
-
const isDragging = ref(false)
|
|
34
|
-
const modalRef = ref(null)
|
|
35
|
-
const isInPopup = ref(false)
|
|
36
|
-
|
|
37
|
-
const hookBuffer = []
|
|
38
|
-
let isAppCreated = false
|
|
39
|
-
let innerIframe = null
|
|
40
|
-
|
|
41
|
-
/** -----panel start-----**/
|
|
42
|
-
const panelVisible = ref(false)
|
|
43
|
-
const panelState = ref({
|
|
44
|
-
position: 'bottom',
|
|
45
|
-
viewMode: 'default',
|
|
46
|
-
width: 80,
|
|
47
|
-
height: 60,
|
|
48
|
-
})
|
|
49
|
-
const panelStyle = computed(() => {
|
|
50
|
-
const height = `calc(${panelState.value.height}vh - ${PANEL_PADDING}px)`
|
|
51
|
-
const width = `calc(${panelState.value.width}vw - ${PANEL_PADDING}px)`
|
|
52
|
-
if (panelState.value.viewMode === 'xs') {
|
|
53
|
-
return {
|
|
54
|
-
bottom: `${PANEL_PADDING}px`,
|
|
55
|
-
left: '50%',
|
|
56
|
-
transform: 'translateX(-50%)',
|
|
57
|
-
height: '80px',
|
|
58
|
-
width: '400px',
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (panelState.value.position === 'bottom') {
|
|
63
|
-
return {
|
|
64
|
-
transform: 'translateX(-50%)',
|
|
65
|
-
bottom: `${PANEL_PADDING}px`,
|
|
66
|
-
left: '50%',
|
|
67
|
-
height,
|
|
68
|
-
width,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else if (panelState.value.position === 'top') {
|
|
72
|
-
return {
|
|
73
|
-
transform: 'translateX(-50%)',
|
|
74
|
-
top: `${PANEL_PADDING}px`,
|
|
75
|
-
left: '50%',
|
|
76
|
-
height,
|
|
77
|
-
width,
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else if (panelState.value.position === 'left') {
|
|
81
|
-
return {
|
|
82
|
-
transform: 'translateY(-50%)',
|
|
83
|
-
top: '50%',
|
|
84
|
-
left: `${PANEL_PADDING}px`,
|
|
85
|
-
height,
|
|
86
|
-
width,
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
return {
|
|
91
|
-
transform: 'translateY(-50%)',
|
|
92
|
-
top: '50%',
|
|
93
|
-
right: `${PANEL_PADDING}px`,
|
|
94
|
-
height,
|
|
95
|
-
width,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
const toggleButtonPosition = computed(() => {
|
|
100
|
-
if (panelState.value.position === 'left') {
|
|
101
|
-
return {
|
|
102
|
-
'left': '-8px',
|
|
103
|
-
'top': 'calc(50% - 25px)',
|
|
104
|
-
'height': '35px',
|
|
105
|
-
'width': '35px',
|
|
106
|
-
'borderRadius': '0 100px 100px 0',
|
|
107
|
-
'--hover-translate': 'translateX(3px)',
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (panelState.value.position === 'right') {
|
|
111
|
-
return {
|
|
112
|
-
'right': '-8px',
|
|
113
|
-
'top': 'calc(50% - 25px)',
|
|
114
|
-
'height': '35px',
|
|
115
|
-
'width': '35px',
|
|
116
|
-
'borderRadius': '100px 0 0 100px',
|
|
117
|
-
'--hover-translate': 'translateX(-3px)',
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (panelState.value.position === 'top') {
|
|
121
|
-
return {
|
|
122
|
-
'top': '-3px',
|
|
123
|
-
'left': 'calc(50% - 25px)',
|
|
124
|
-
'borderRadius': '0 0 100px 100px',
|
|
125
|
-
'height': '30px',
|
|
126
|
-
'width': '40px',
|
|
127
|
-
'--hover-translate': 'translate(0, 3px)',
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
'bottom': '-5px',
|
|
132
|
-
'left': 'calc(50% - 25px)',
|
|
133
|
-
'borderRadius': '100px 100px 0 0',
|
|
134
|
-
'height': '30px',
|
|
135
|
-
'width': '40px',
|
|
136
|
-
'--hover-translate': 'translate(0, -3px)',
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
const panelPosition = computed(() =>
|
|
140
|
-
panelVisible.value
|
|
141
|
-
? panelStyle.value
|
|
142
|
-
: { zIndex: -100000, left: '-9999px', top: '-9999px' },
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
function togglePanel() {
|
|
146
|
-
panelVisible.value = !panelVisible.value
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function initPanelPosition() {
|
|
150
|
-
const frameState = localStorage.getItem('__vue-devtools-frame-state__')
|
|
151
|
-
if (frameState) {
|
|
152
|
-
const parsedFrameState = JSON.parse(frameState)
|
|
153
|
-
panelState.value.position = parsedFrameState.position
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function getIframe() {
|
|
158
|
-
iframe.value = document.createElement('iframe')
|
|
159
|
-
iframe.value.id = 'vue-devtools-iframe'
|
|
160
|
-
iframe.value.src = clientUrl
|
|
161
|
-
iframe.value.setAttribute('data-v-inspector-ignore', 'true')
|
|
162
|
-
iframe.value.onload = async () => {
|
|
163
|
-
await waitForClientInjection()
|
|
164
|
-
setupClient()
|
|
165
|
-
}
|
|
166
|
-
return iframe.value
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
watchEffect(() => {
|
|
170
|
-
if (!modalRef.value || isInPopup.value)
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
if (panelVisible.value) {
|
|
174
|
-
const iframe = getIframe()
|
|
175
|
-
iframe.style.pointerEvents = isDragging.value ? 'none' : 'auto'
|
|
176
|
-
|
|
177
|
-
if (!innerIframe && Array.from(modalRef.value.children).every(el => el !== iframe))
|
|
178
|
-
modalRef.value.appendChild(iframe)
|
|
179
|
-
|
|
180
|
-
innerIframe = iframe
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
// Experimental: Picture-in-Picture mode
|
|
185
|
-
// https://developer.chrome.com/docs/web-platform/document-picture-in-picture/
|
|
186
|
-
const documentPictureInPicture = window.documentPictureInPicture
|
|
187
|
-
async function popup() {
|
|
188
|
-
const iframe = getIframe()
|
|
189
|
-
const pip = await documentPictureInPicture.requestWindow({
|
|
190
|
-
width: Math.round(window.innerWidth * 80 / 100),
|
|
191
|
-
height: Math.round(window.innerHeight * 60 / 100),
|
|
192
|
-
})
|
|
193
|
-
const style = pip.document.createElement('style')
|
|
194
|
-
style.innerHTML = `
|
|
195
|
-
body {
|
|
196
|
-
margin: 0;
|
|
197
|
-
padding: 0;
|
|
198
|
-
}
|
|
199
|
-
iframe {
|
|
200
|
-
width: 100vw;
|
|
201
|
-
height: 100vh;
|
|
202
|
-
border: none;
|
|
203
|
-
outline: none;
|
|
204
|
-
}
|
|
205
|
-
`
|
|
206
|
-
pip.__VUE_DEVTOOLS_GLOBAL_HOOK__ = props.hook
|
|
207
|
-
pip.__VUE_DEVTOOLS_IS_POPUP__ = true
|
|
208
|
-
pip.document.title = 'Vue DevTools'
|
|
209
|
-
pip.document.head.appendChild(style)
|
|
210
|
-
pip.document.body.appendChild(iframe)
|
|
211
|
-
pip.addEventListener('resize', () => {
|
|
212
|
-
})
|
|
213
|
-
pip.addEventListener('pagehide', () => {
|
|
214
|
-
pip.close()
|
|
215
|
-
isInPopup.value = false
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/** -----resize start-----**/
|
|
220
|
-
const resizeBaseClassName = 'vue-devtools-resize-handle'
|
|
221
|
-
const resizeVerticalClassName = [resizeBaseClassName, `${resizeBaseClassName}-vertical`]
|
|
222
|
-
const resizeHorizontalClassName = [resizeBaseClassName, `${resizeBaseClassName}-horizontal`]
|
|
223
|
-
const resizeCornerClassName = [resizeBaseClassName, `${resizeBaseClassName}-corner`]
|
|
224
|
-
function toggleDragging(direction) {
|
|
225
|
-
isDragging.value = direction
|
|
226
|
-
}
|
|
227
|
-
document.addEventListener('mouseup', () => {
|
|
228
|
-
isDragging.value = false
|
|
229
|
-
})
|
|
230
|
-
document.addEventListener('mouseleave', () => {
|
|
231
|
-
isDragging.value = false
|
|
232
|
-
})
|
|
233
|
-
document.addEventListener('mousemove', (e) => {
|
|
234
|
-
if (!isDragging.value)
|
|
235
|
-
return
|
|
236
|
-
|
|
237
|
-
const alignSide = panelState.value.position === 'left' || panelState.value.position === 'right'
|
|
238
|
-
|
|
239
|
-
if (isDragging.value === 'horizontal' || isDragging.value === 'both') {
|
|
240
|
-
const y = panelState.value.position === 'top'
|
|
241
|
-
? window.innerHeight - e.clientY
|
|
242
|
-
: e.clientY
|
|
243
|
-
const boxHeight = window.innerHeight
|
|
244
|
-
const value = alignSide
|
|
245
|
-
? (Math.abs(y - (window.innerHeight / 2))) / boxHeight * 100 * 2
|
|
246
|
-
: (window.innerHeight - y) / boxHeight * 100
|
|
247
|
-
panelState.value.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (isDragging.value === 'vertical' || isDragging.value === 'both') {
|
|
251
|
-
const x = panelState.value.position === 'left'
|
|
252
|
-
? window.innerWidth - e.clientX
|
|
253
|
-
: e.clientX
|
|
254
|
-
const boxWidth = window.innerWidth
|
|
255
|
-
const value = alignSide
|
|
256
|
-
? (window.innerWidth - x) / boxWidth * 100
|
|
257
|
-
: (Math.abs(x - (window.innerWidth / 2))) / boxWidth * 100 * 2
|
|
258
|
-
panelState.value.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
|
|
259
|
-
}
|
|
260
|
-
})
|
|
261
|
-
/** -----resize end-----**/
|
|
262
|
-
|
|
263
|
-
/** -----panel end-----**/
|
|
264
|
-
|
|
265
|
-
/** -----inspector end-----**/
|
|
266
|
-
|
|
267
|
-
function toggleViewMode(state) {
|
|
268
|
-
if (state) {
|
|
269
|
-
panelState.value.viewMode = state
|
|
270
|
-
return
|
|
271
|
-
}
|
|
272
|
-
if (panelState.value.viewMode === 'xs')
|
|
273
|
-
panelState.value.viewMode = 'default'
|
|
274
|
-
|
|
275
|
-
else
|
|
276
|
-
panelState.value.viewMode = 'xs'
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function enableComponentInspector() {
|
|
280
|
-
window.__VUE_INSPECTOR__?.enable()
|
|
281
|
-
panelState.value.viewMode = 'xs'
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function disableComponentInspector() {
|
|
285
|
-
window.__VUE_INSPECTOR__?.disable()
|
|
286
|
-
hook.emit('host:inspector:close')
|
|
287
|
-
if (panelState.value.viewMode === 'xs')
|
|
288
|
-
panelState.value.viewMode = 'default'
|
|
289
|
-
}
|
|
290
|
-
/** -----inspector end-----**/
|
|
291
|
-
|
|
292
|
-
/** -----client start-----**/
|
|
293
|
-
function waitForClientInjection(retry = 50, timeout = 200) {
|
|
294
|
-
const test = () => !!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__ && isAppCreated
|
|
295
|
-
|
|
296
|
-
if (test())
|
|
297
|
-
return
|
|
298
|
-
|
|
299
|
-
return new Promise((resolve, reject) => {
|
|
300
|
-
const interval = setInterval(() => {
|
|
301
|
-
if (test()) {
|
|
302
|
-
clearInterval(interval)
|
|
303
|
-
resolve()
|
|
304
|
-
}
|
|
305
|
-
else if (retry-- <= 0) {
|
|
306
|
-
clearInterval(interval)
|
|
307
|
-
reject(Error('Vue Devtools client injection failed'))
|
|
308
|
-
}
|
|
309
|
-
}, timeout)
|
|
310
|
-
})
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function setupClient() {
|
|
314
|
-
const injection = iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__
|
|
315
|
-
const componentInspector = window.__VUE_INSPECTOR__
|
|
316
|
-
if (componentInspector) {
|
|
317
|
-
const _openInEditor = componentInspector.openInEditor
|
|
318
|
-
componentInspector.openInEditor = async (...params) => {
|
|
319
|
-
disableComponentInspector()
|
|
320
|
-
_openInEditor(...params)
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
injection.setClient({
|
|
324
|
-
hook,
|
|
325
|
-
hookBuffer,
|
|
326
|
-
inspector: {
|
|
327
|
-
enable: enableComponentInspector,
|
|
328
|
-
disable: disableComponentInspector,
|
|
329
|
-
},
|
|
330
|
-
panel: {
|
|
331
|
-
toggleViewMode,
|
|
332
|
-
toggle: togglePanel,
|
|
333
|
-
togglePosition(position) {
|
|
334
|
-
if (position === 'popup') {
|
|
335
|
-
isInPopup.value = true
|
|
336
|
-
popup()
|
|
337
|
-
return
|
|
338
|
-
}
|
|
339
|
-
panelState.value.position = position
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
})
|
|
343
|
-
}
|
|
344
|
-
/** -----client end-----**/
|
|
345
|
-
|
|
346
|
-
function updateHookBuffer(type, args) {
|
|
347
|
-
hookBuffer.push([type, args])
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function collectDynamicRoute(app) {
|
|
351
|
-
const router = app?.config?.globalProperties?.$router
|
|
352
|
-
if (!router)
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
const _addRoute = router.addRoute
|
|
356
|
-
router.addRoute = (...args) => {
|
|
357
|
-
const res = _addRoute(...args)
|
|
358
|
-
|
|
359
|
-
if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
|
|
360
|
-
updateHookBuffer(DevToolsHooks.ADD_ROUTE, {
|
|
361
|
-
args: [...args],
|
|
362
|
-
})
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return res
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
const _removeRoute = router.removeRoute
|
|
369
|
-
router.removeRoute = (...args) => {
|
|
370
|
-
const res = _removeRoute(...args)
|
|
371
|
-
|
|
372
|
-
if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
|
|
373
|
-
updateHookBuffer(DevToolsHooks.REMOVE_ROUTE, {
|
|
374
|
-
args: [...args],
|
|
375
|
-
})
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return res
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function collectHookBuffer() {
|
|
383
|
-
// const sortId = 0
|
|
384
|
-
|
|
385
|
-
function stopCollect(component) {
|
|
386
|
-
return component?.root?.type?.devtools?.hide || iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
hook.on(DevToolsHooks.APP_INIT, (app) => {
|
|
390
|
-
if (!app || app._instance.type?.devtools?.hide)
|
|
391
|
-
return
|
|
392
|
-
|
|
393
|
-
collectDynamicRoute(app)
|
|
394
|
-
updateHookBuffer(DevToolsHooks.APP_INIT, {
|
|
395
|
-
app,
|
|
396
|
-
})
|
|
397
|
-
setTimeout(() => {
|
|
398
|
-
isAppCreated = true
|
|
399
|
-
}, 80)
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
// close perf to avoid performance issue (#9)
|
|
403
|
-
// hook.on(DevToolsHooks.PERF_START, (app, uid, component, type, time) => {
|
|
404
|
-
// if (stopCollect(component))
|
|
405
|
-
// return
|
|
406
|
-
|
|
407
|
-
// updateHookBuffer(DevToolsHooks.COMPONENT_EMIT, {
|
|
408
|
-
// now: Date.now(),
|
|
409
|
-
// app,
|
|
410
|
-
// uid,
|
|
411
|
-
// component,
|
|
412
|
-
// type,
|
|
413
|
-
// time,
|
|
414
|
-
// sortId: sortId++,
|
|
415
|
-
// })
|
|
416
|
-
// })
|
|
417
|
-
// hook.on(DevToolsHooks.PERF_END, (app, uid, component, type, time) => {
|
|
418
|
-
// if (stopCollect(component))
|
|
419
|
-
// return
|
|
420
|
-
|
|
421
|
-
// updateHookBuffer(DevToolsHooks.PERF_END, {
|
|
422
|
-
// now: Date.now(),
|
|
423
|
-
// app,
|
|
424
|
-
// uid,
|
|
425
|
-
// component,
|
|
426
|
-
// type,
|
|
427
|
-
// time,
|
|
428
|
-
// sortId: sortId++,
|
|
429
|
-
// })
|
|
430
|
-
// })
|
|
431
|
-
|
|
432
|
-
[
|
|
433
|
-
DevToolsHooks.COMPONENT_UPDATED,
|
|
434
|
-
DevToolsHooks.COMPONENT_ADDED,
|
|
435
|
-
DevToolsHooks.COMPONENT_REMOVED,
|
|
436
|
-
DevToolsHooks.COMPONENT_EMIT,
|
|
437
|
-
].forEach((item) => {
|
|
438
|
-
hook.on(item, (app, uid, parentUid, component) => {
|
|
439
|
-
if (!app || (typeof uid !== 'number' && !uid) || !component || stopCollect(component))
|
|
440
|
-
return
|
|
441
|
-
|
|
442
|
-
updateHookBuffer(item, {
|
|
443
|
-
app, uid, parentUid, component,
|
|
444
|
-
})
|
|
445
|
-
})
|
|
446
|
-
})
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
// init
|
|
450
|
-
collectHookBuffer()
|
|
451
|
-
initPanelPosition()
|
|
452
|
-
|
|
453
|
-
onMounted(() => {
|
|
454
|
-
window.addEventListener('keydown', (e) => {
|
|
455
|
-
if (e.code === 'KeyD' && e.altKey && e.shiftKey)
|
|
456
|
-
togglePanel()
|
|
457
|
-
})
|
|
458
|
-
})
|
|
459
|
-
|
|
460
|
-
const toggleButtonRef = ref(null)
|
|
461
|
-
|
|
462
|
-
window.addEventListener('click', (event) => {
|
|
463
|
-
if (isInPopup.value)
|
|
464
|
-
return
|
|
465
|
-
const modalEl = modalRef.value
|
|
466
|
-
const toggleButtonEl = toggleButtonRef.value
|
|
467
|
-
if (!modalEl || !toggleButtonEl || event.composedPath().includes(modalEl) || event.composedPath().includes(toggleButtonEl))
|
|
468
|
-
return
|
|
469
|
-
const frameState = localStorage.getItem('__vue-devtools-frame-state__')
|
|
470
|
-
if (frameState) {
|
|
471
|
-
const parsedFrameState = JSON.parse(frameState)
|
|
472
|
-
if (parsedFrameState.closeOnOutsideClick)
|
|
473
|
-
panelVisible.value = false
|
|
474
|
-
}
|
|
475
|
-
})
|
|
476
|
-
</script>
|
|
477
|
-
|
|
478
|
-
<template>
|
|
479
|
-
<div v-show="!isInPopup" ref="modalRef" class="vue-devtools-panel" :style="panelPosition">
|
|
480
|
-
<!-- resize -->
|
|
481
|
-
<template v-if="panelState.viewMode === 'default'">
|
|
482
|
-
<template v-if="panelState.position !== 'top'">
|
|
483
|
-
<div :class="resizeHorizontalClassName" :style="{ top: 0 }" @mousedown.prevent="toggleDragging('horizontal')" />
|
|
484
|
-
<div
|
|
485
|
-
v-if="panelState.position !== 'left'" :class="resizeCornerClassName"
|
|
486
|
-
:style="{ top: 0, left: 0, cursor: 'nwse-resize' }" @mousedown.prevent="toggleDragging('both')"
|
|
487
|
-
/>
|
|
488
|
-
<div
|
|
489
|
-
v-if="panelState.position !== 'right'" :class="resizeCornerClassName"
|
|
490
|
-
:style="{ top: 0, right: 0, cursor: 'nesw-resize' }" @mousedown.prevent="toggleDragging('both')"
|
|
491
|
-
/>
|
|
492
|
-
</template>
|
|
493
|
-
|
|
494
|
-
<template v-if="panelState.position !== 'bottom'">
|
|
495
|
-
<div
|
|
496
|
-
:class="resizeHorizontalClassName" :style="{ bottom: 0 }"
|
|
497
|
-
@mousedown.prevent="toggleDragging('horizontal')"
|
|
498
|
-
/>
|
|
499
|
-
<div
|
|
500
|
-
v-if="panelState.position !== 'right'" :class="resizeCornerClassName"
|
|
501
|
-
:style="{ bottom: 0, right: 0, cursor: 'nwse-resize' }" @mousedown.prevent="toggleDragging('both')"
|
|
502
|
-
/>
|
|
503
|
-
<div
|
|
504
|
-
v-if="panelState.position !== 'left'" :class="resizeCornerClassName"
|
|
505
|
-
:style="{ bottom: 0, left: 0, cursor: 'nesw-resize' }" @mousedown.prevent="toggleDragging('both')"
|
|
506
|
-
/>
|
|
507
|
-
</template>
|
|
508
|
-
|
|
509
|
-
<div
|
|
510
|
-
v-if="panelState.position !== 'left'" :class="resizeVerticalClassName" :style="{ left: 0 }"
|
|
511
|
-
@mousedown.prevent="toggleDragging('vertical')"
|
|
512
|
-
/>
|
|
513
|
-
<div
|
|
514
|
-
v-if="panelState.position !== 'right'" :class="resizeVerticalClassName" :style="{ right: 0 }"
|
|
515
|
-
@mousedown.prevent="toggleDragging('vertical')"
|
|
516
|
-
/>
|
|
517
|
-
</template>
|
|
518
|
-
</div>
|
|
519
|
-
<!-- toggle button -->
|
|
520
|
-
<button
|
|
521
|
-
v-show="!isInPopup" ref="toggleButtonRef" class="vue-devtools-toggle" aria-label="Toggle devtools panel"
|
|
522
|
-
:style="toggleButtonPosition" @click.prevent="togglePanel"
|
|
523
|
-
>
|
|
524
|
-
<svg viewBox="0 0 256 198" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
525
|
-
<path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z" />
|
|
526
|
-
<path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z" />
|
|
527
|
-
<path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z" />
|
|
528
|
-
</svg>
|
|
529
|
-
</button>
|
|
530
|
-
</template>
|
|
531
|
-
|
|
532
|
-
<style scoped>
|
|
533
|
-
.vue-devtools-panel {
|
|
534
|
-
position: fixed;
|
|
535
|
-
z-index: 2147483645;
|
|
536
|
-
width: calc(80vw - 20px);
|
|
537
|
-
height: calc(60vh - 20px);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
.vue-devtools-panel :deep(iframe) {
|
|
541
|
-
width: 100%;
|
|
542
|
-
height: 100%;
|
|
543
|
-
outline: 0;
|
|
544
|
-
border: 1px solid rgba(125, 125, 125, 0.2);
|
|
545
|
-
border-radius: 8px;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
.vue-devtools-toggle {
|
|
549
|
-
position: fixed;
|
|
550
|
-
background: #0C0C0C;
|
|
551
|
-
border: 1px solid rgba(125, 125, 125, 0.2);
|
|
552
|
-
box-shadow: 3px 5px 10px rgba(0, 0, 0, 0.1);
|
|
553
|
-
z-index: 2147483645;
|
|
554
|
-
cursor: pointer;
|
|
555
|
-
opacity: 0.8;
|
|
556
|
-
padding: 0;
|
|
557
|
-
transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
|
|
558
|
-
outline: 0;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
.vue-devtools-toggle:hover {
|
|
562
|
-
transform: var(--hover-translate);
|
|
563
|
-
opacity: 1;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
.vue-devtools-toggle svg {
|
|
567
|
-
width: 16px;
|
|
568
|
-
height: 16px;
|
|
569
|
-
margin: auto;
|
|
570
|
-
margin-top: 3px;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
.vue-devtools-resize-handle:hover {
|
|
574
|
-
background: rgba(125, 125, 125, 0.1);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
.vue-devtools-resize-handle-horizontal {
|
|
578
|
-
position: absolute;
|
|
579
|
-
left: 6px;
|
|
580
|
-
right: 6px;
|
|
581
|
-
height: 10px;
|
|
582
|
-
margin: -5px 0;
|
|
583
|
-
cursor: ns-resize;
|
|
584
|
-
border-radius: 5px;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
.vue-devtools-resize-handle-corner {
|
|
588
|
-
position: absolute;
|
|
589
|
-
width: 14px;
|
|
590
|
-
height: 14px;
|
|
591
|
-
margin: -6px;
|
|
592
|
-
border-radius: 6px;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.vue-devtools-resize-handle-vertical {
|
|
596
|
-
position: absolute;
|
|
597
|
-
top: 6px;
|
|
598
|
-
bottom: 0;
|
|
599
|
-
width: 10px;
|
|
600
|
-
margin: 0 -5px;
|
|
601
|
-
cursor: ew-resize;
|
|
602
|
-
border-radius: 5px;
|
|
603
|
-
}
|
|
604
|
-
</style>
|