@nuxt/devtools 0.5.5 → 0.6.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/chunks/module-main.mjs +145 -35
- package/dist/chunks/vscode.mjs +5 -2
- package/dist/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/__blank/index.html +7 -0
- package/dist/client/_nuxt/AuthRequiredPanel.vue.19da182f.js +1 -0
- package/dist/client/_nuxt/{Badge.e58c5f84.js → Badge.067326d6.js} +1 -1
- package/dist/client/_nuxt/CodeSnippets.vue.2f33c6d1.js +1 -0
- package/dist/client/_nuxt/DrawerRight.vue.aa1fd47b.js +1 -0
- package/dist/client/_nuxt/DurationDisplay.vue.4afc40a4.js +1 -0
- package/dist/client/_nuxt/FilepathItem.vue.3587ec1f.js +1 -0
- package/dist/client/_nuxt/{HelpFab.vue.044c905c.js → HelpFab.vue.dbb954dd.js} +1 -1
- package/dist/client/_nuxt/LaunchPage.vue.f137554e.js +1 -0
- package/dist/client/_nuxt/NCheckbox.vue.060051ad.js +1 -0
- package/dist/client/_nuxt/NCodeBlock.vue.e44529a6.js +2 -0
- package/dist/client/_nuxt/NIconButton.vue.ac7efd0c.js +1 -0
- package/dist/client/_nuxt/NIconTitle.vue.ace3a05a.js +1 -0
- package/dist/client/_nuxt/NLink.vue.372e1ca0.js +1 -0
- package/dist/client/_nuxt/NMarkdown.vue.9f252ec4.js +1 -0
- package/dist/client/_nuxt/{NPanelGrids.923427b0.js → NPanelGrids.54ee09bc.js} +1 -1
- package/dist/client/_nuxt/NSectionBlock.012f83f1.css +1 -0
- package/dist/client/_nuxt/NSectionBlock.9cbe0175.js +1 -0
- package/dist/client/_nuxt/NSelect.vue.3956d7b1.js +1 -0
- package/dist/client/_nuxt/NSwitch.vue.f0f70131.js +1 -0
- package/dist/client/_nuxt/NTip.vue.f50fcd60.js +1 -0
- package/dist/client/_nuxt/{Navbar.vue.1eab843e.js → Navbar.vue.bd98686f.js} +1 -1
- package/dist/client/_nuxt/NpmVersionCheck.vue.78bff2df.js +1 -0
- package/dist/client/_nuxt/{PanelLeftRight.vue.5807516f.js → PanelLeftRight.vue.8031c7d4.js} +1 -1
- package/dist/client/_nuxt/StateEditor.vue.4439d43c.js +1 -0
- package/dist/client/_nuxt/__blank.944beb26.js +1 -0
- package/dist/client/_nuxt/analyze-build.fd781999.js +1 -0
- package/dist/client/_nuxt/assets.f876e2b9.js +16 -0
- package/dist/client/_nuxt/{client.4ef5790f.js → client.d6464981.js} +1 -1
- package/dist/client/_nuxt/{components.1cc22fdb.js → components.d23cd7b8.js} +27 -27
- package/dist/client/_nuxt/custom-_name_.3701152b.js +1 -0
- package/dist/client/_nuxt/{default.2805e636.js → default.809c6e7c.js} +1 -1
- package/dist/client/_nuxt/editor.aee50e2c.js +1 -0
- package/dist/client/_nuxt/entry.717f6486.css +1 -0
- package/dist/client/_nuxt/entry.a0dd6aac.js +19 -0
- package/dist/client/_nuxt/{error-404.61da4836.js → error-404.d560629e.js} +1 -1
- package/dist/client/_nuxt/{error-500.68195134.js → error-500.d7ca8dd1.js} +1 -1
- package/dist/client/_nuxt/{error-component.db5245e7.js → error-component.15e0d602.js} +2 -2
- package/dist/client/_nuxt/{full.cfa15ba5.js → full.76363f3f.js} +1 -1
- package/dist/client/_nuxt/hooks.3a3b761d.js +1 -0
- package/dist/client/_nuxt/imports.e0b9437d.js +1 -0
- package/dist/client/_nuxt/{index.e17aa9ce.js → index.25d3cd66.js} +1 -1
- package/dist/client/_nuxt/{index.476fd219.js → index.d7252ef5.js} +1 -1
- package/dist/client/_nuxt/json-editor-vue.b8dc29b2.js +137 -0
- package/dist/client/_nuxt/{middleware.10bb56a6.js → middleware.cbbbe53d.js} +1 -1
- package/dist/client/_nuxt/modules.092674af.js +4 -0
- package/dist/client/_nuxt/{none.a68953c7.js → none.0a084ac9.js} +1 -1
- package/dist/client/_nuxt/nuxt-docs.100caa70.js +1 -0
- package/dist/client/_nuxt/open-graph.3563ee56.js +3 -0
- package/dist/client/_nuxt/overview.e4073f57.js +1 -0
- package/dist/client/_nuxt/pages.e4cfc065.js +1 -0
- package/dist/client/_nuxt/payload.0be0c356.js +1 -0
- package/dist/client/_nuxt/plugins.88ff2e07.js +1 -0
- package/dist/client/_nuxt/runtime-configs.7810c90a.js +1 -0
- package/dist/client/_nuxt/server-routes.911ca1ca.js +9 -0
- package/dist/client/_nuxt/settings.80338150.js +1 -0
- package/dist/client/_nuxt/state-components.3e562e84.js +1 -0
- package/dist/client/_nuxt/storage.4d3f94ab.js +1 -0
- package/dist/client/_nuxt/terminals.e433a70a.js +1 -0
- package/dist/client/_nuxt/{unocss-runtime.7eface6f.js → unocss-runtime.9d0d2556.js} +2 -2
- package/dist/client/_nuxt/{virtual-files.3e66a8af.js → virtual-files.ae241a9c.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/modules/analyze-build/index.html +2 -2
- package/dist/client/modules/assets/index.html +2 -2
- package/dist/client/modules/components/index.html +2 -2
- package/dist/client/modules/hooks/index.html +2 -2
- package/dist/client/modules/imports/index.html +2 -2
- package/dist/client/modules/middleware/index.html +2 -2
- package/dist/client/modules/modules/index.html +2 -2
- package/dist/client/modules/open-graph/index.html +2 -2
- package/dist/client/modules/overview/index.html +2 -2
- package/dist/client/modules/pages/index.html +2 -2
- package/dist/client/modules/payload/index.html +2 -2
- package/dist/client/modules/plugins/index.html +2 -2
- package/dist/client/modules/runtime-configs/index.html +2 -2
- package/dist/client/modules/server-routes/index.html +2 -2
- package/dist/client/modules/storage/index.html +2 -2
- package/dist/client/modules/terminals/index.html +2 -2
- package/dist/client/modules/virtual-files/index.html +2 -2
- package/dist/client/settings/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/auth/index.html +71 -0
- package/dist/runtime/nitro/inline.d.ts +3 -0
- package/dist/runtime/nitro/inline.mjs +6 -0
- package/dist/runtime/plugins/devtools.client.d.ts +8 -0
- package/dist/runtime/plugins/devtools.client.mjs +73 -8
- package/dist/runtime/plugins/devtools.server.d.ts +2 -0
- package/dist/runtime/plugins/devtools.server.mjs +8 -0
- package/dist/runtime/plugins/view/Frame.vue +31 -228
- package/dist/runtime/plugins/view/FrameBox.vue +167 -0
- package/dist/runtime/plugins/view/Main.vue +360 -0
- package/dist/runtime/plugins/view/client.d.ts +3 -0
- package/dist/runtime/plugins/view/client.mjs +45 -0
- package/dist/runtime/plugins/view/state.d.ts +2 -3
- package/dist/runtime/plugins/view/state.mjs +12 -9
- package/dist/runtime/plugins/view/utils.d.ts +1 -0
- package/dist/runtime/plugins/view/utils.mjs +9 -0
- package/dist/shared/{devtools.345c630c.mjs → devtools.7ab40af4.mjs} +3 -1
- package/dist/types.d.ts +1 -1
- package/package.json +30 -29
- package/dist/client/__inspecting/index.html +0 -7
- package/dist/client/_nuxt/CodeSnippets.vue.22b03a10.js +0 -1
- package/dist/client/_nuxt/DrawerRight.vue.58044cee.js +0 -1
- package/dist/client/_nuxt/DurationDisplay.vue.0d87f5bf.js +0 -1
- package/dist/client/_nuxt/FilepathItem.vue.063a2cdd.js +0 -1
- package/dist/client/_nuxt/LaunchPage.vue.59383ce6.js +0 -1
- package/dist/client/_nuxt/NCheckbox.vue.f53d5fde.js +0 -1
- package/dist/client/_nuxt/NCodeBlock.vue.e2044e41.js +0 -2
- package/dist/client/_nuxt/NIconButton.vue.6924c323.js +0 -1
- package/dist/client/_nuxt/NIconTitle.vue.19793f87.js +0 -1
- package/dist/client/_nuxt/NLink.vue.dddf8805.js +0 -1
- package/dist/client/_nuxt/NMarkdown.vue.2a7f337d.js +0 -1
- package/dist/client/_nuxt/NSectionBlock.2937e558.js +0 -1
- package/dist/client/_nuxt/NSectionBlock.63c19da9.css +0 -1
- package/dist/client/_nuxt/NSelect.vue.6bc1e782.js +0 -1
- package/dist/client/_nuxt/NSwitch.vue.e15ba847.js +0 -1
- package/dist/client/_nuxt/NTip.vue.16191ba5.js +0 -1
- package/dist/client/_nuxt/NpmVersionCheck.vue.47b612aa.js +0 -1
- package/dist/client/_nuxt/StateEditor.vue.d28666b8.js +0 -1
- package/dist/client/_nuxt/__inspecting.324d8c7c.js +0 -1
- package/dist/client/_nuxt/analyze-build.9257b30a.js +0 -1
- package/dist/client/_nuxt/assets.c3e8e0f3.js +0 -16
- package/dist/client/_nuxt/custom-_name_.e1ada273.js +0 -1
- package/dist/client/_nuxt/editor.721868d4.js +0 -1
- package/dist/client/_nuxt/entry.bf8a0e33.css +0 -1
- package/dist/client/_nuxt/entry.f02d2ccc.js +0 -19
- package/dist/client/_nuxt/hooks.a0b5858b.js +0 -1
- package/dist/client/_nuxt/imports.c13274b4.js +0 -1
- package/dist/client/_nuxt/json-editor-vue.3c153669.js +0 -137
- package/dist/client/_nuxt/modules.41d22931.js +0 -4
- package/dist/client/_nuxt/open-graph.87c9ce95.js +0 -3
- package/dist/client/_nuxt/overview.e078ddfd.js +0 -1
- package/dist/client/_nuxt/pages.2011bfab.js +0 -1
- package/dist/client/_nuxt/payload.aa12c647.js +0 -1
- package/dist/client/_nuxt/plugins.2722f367.js +0 -1
- package/dist/client/_nuxt/runtime-configs.1c597722.js +0 -1
- package/dist/client/_nuxt/server-routes.be515b73.js +0 -9
- package/dist/client/_nuxt/settings.bdc2ea51.js +0 -1
- package/dist/client/_nuxt/state-components.97be2043.js +0 -1
- package/dist/client/_nuxt/storage.b1a77fa3.js +0 -1
- package/dist/client/_nuxt/terminals.ce48c24d.js +0 -9
- package/dist/client/_nuxt/terminals.d1dcf297.css +0 -32
- package/dist/runtime/plugins/view/Container.vue +0 -97
|
@@ -1,57 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import type { NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, NuxtDevtoolsGlobal as NuxtDevtoolsViewGlobal } from '../../../types'
|
|
6
|
-
import { PANEL_MAX, PANEL_MIN, PANEL_PADDING, closePanel, state, viewMode } from './state'
|
|
2
|
+
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
|
|
3
|
+
import type { NuxtDevtoolsHostClient, NuxtDevtoolsGlobal as NuxtDevtoolsViewGlobal } from '../../../types'
|
|
4
|
+
import { closePanel, state } from './state'
|
|
7
5
|
import { useEventListener } from './utils'
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
client: Object as PropType<NuxtDevtoolsHostClient>,
|
|
14
|
-
})
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
client: NuxtDevtoolsHostClient
|
|
9
|
+
}>()
|
|
15
10
|
|
|
16
11
|
const CLIENT_PATH = '/__nuxt_devtools__/client'
|
|
17
12
|
|
|
18
13
|
const initialUrl = CLIENT_PATH + state.value.route
|
|
19
14
|
const iframe = ref<HTMLIFrameElement>()
|
|
20
|
-
const isDragging = ref<false | 'vertical' | 'horizontal' | 'both'>(false)
|
|
21
|
-
|
|
22
|
-
const frameStyle = computed(() => {
|
|
23
|
-
if (viewMode.value === 'component-inspector') {
|
|
24
|
-
return {
|
|
25
|
-
bottom: `${PANEL_PADDING}px`,
|
|
26
|
-
left: '50%',
|
|
27
|
-
transform: 'translateX(-50%)',
|
|
28
|
-
height: '80px',
|
|
29
|
-
width: '400px',
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const height = `calc(${state.value.height}vh - ${PANEL_PADDING * 2}px)`
|
|
34
|
-
const width = `calc(${state.value.width}vw - ${PANEL_PADDING * 2}px)`
|
|
35
|
-
|
|
36
|
-
if (state.value.position === 'left' || state.value.position === 'right') {
|
|
37
|
-
return {
|
|
38
|
-
[state.value.position]: `${PANEL_PADDING}px`,
|
|
39
|
-
borderRadius: '0.5rem',
|
|
40
|
-
top: `calc(${(100 - state.value.height) / 2}vh + ${PANEL_PADDING}px)`,
|
|
41
|
-
height,
|
|
42
|
-
width,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return {
|
|
47
|
-
[state.value.position || 'bottom']: `${PANEL_PADDING}px`,
|
|
48
|
-
borderRadius: '0.5rem',
|
|
49
|
-
left: `calc(${(100 - state.value.width) / 2}vw + ${PANEL_PADDING}px)`,
|
|
50
|
-
height,
|
|
51
|
-
width,
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
15
|
|
|
56
16
|
async function onLoad() {
|
|
57
17
|
await waitForClientInjection()
|
|
@@ -84,138 +44,50 @@ function refreshReactivity() {
|
|
|
84
44
|
}
|
|
85
45
|
|
|
86
46
|
function setupClient() {
|
|
87
|
-
|
|
88
|
-
|
|
47
|
+
const client = computed(() => props.client)
|
|
48
|
+
|
|
49
|
+
watch(() => [
|
|
50
|
+
client.value?.nuxt.payload,
|
|
51
|
+
client.value.colorMode.value,
|
|
52
|
+
client.value.loadingTimeMetrics,
|
|
53
|
+
], () => {
|
|
89
54
|
refreshReactivity()
|
|
90
55
|
}, { deep: true })
|
|
91
56
|
|
|
92
57
|
// trigger update for route change
|
|
93
|
-
|
|
58
|
+
client.value?.nuxt.vueApp.config.globalProperties?.$router?.afterEach(() => {
|
|
94
59
|
refreshReactivity()
|
|
95
60
|
})
|
|
96
61
|
|
|
97
62
|
// trigger update for app mounted
|
|
98
|
-
|
|
63
|
+
client.value?.nuxt.hook('app:mounted', () => {
|
|
99
64
|
refreshReactivity()
|
|
100
65
|
})
|
|
101
66
|
|
|
102
67
|
updateClient()
|
|
103
68
|
}
|
|
104
69
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (componentInspector) {
|
|
110
|
-
componentInspector.openInEditor = async (baseUrl, file, line, column) => {
|
|
111
|
-
disableComponentInspector()
|
|
112
|
-
await props.client!.hooks.callHook('host:inspector:click', baseUrl, file, line, column)
|
|
113
|
-
}
|
|
114
|
-
componentInspector.onUpdated = () => {
|
|
115
|
-
props.client!.hooks.callHook('host:inspector:update', {
|
|
116
|
-
...componentInspector.linkParams,
|
|
117
|
-
...componentInspector.position,
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
injection?.setClient({
|
|
123
|
-
...props.client as any,
|
|
124
|
-
inspector: {
|
|
125
|
-
enable: enableComponentInspector,
|
|
126
|
-
disable: disableComponentInspector,
|
|
127
|
-
instance: componentInspector,
|
|
128
|
-
},
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
props.client?.hooks.hook('devtools:navigate', (path) => {
|
|
70
|
+
onMounted(() => {
|
|
71
|
+
props.client.refreshState()
|
|
72
|
+
props.client.hooks.hook('devtools:navigate', (path) => {
|
|
132
73
|
state.value.route = path
|
|
133
74
|
})
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function enableComponentInspector() {
|
|
137
|
-
window.__VUE_INSPECTOR__?.enable()
|
|
138
|
-
viewMode.value = 'component-inspector'
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function disableComponentInspector() {
|
|
142
|
-
if (!window.__VUE_INSPECTOR__?.enabled)
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
window.__VUE_INSPECTOR__?.disable()
|
|
146
|
-
props.client?.hooks.callHook('host:inspector:close')
|
|
147
|
-
if (viewMode.value === 'component-inspector')
|
|
148
|
-
viewMode.value = 'default'
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
useEventListener(window, 'mousemove', (e: MouseEvent) => {
|
|
152
|
-
if (!isDragging.value)
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
const alignSide = state.value.position === 'left' || state.value.position === 'right'
|
|
156
|
-
|
|
157
|
-
if (isDragging.value === 'horizontal' || isDragging.value === 'both') {
|
|
158
|
-
const y = state.value.position === 'top'
|
|
159
|
-
? window.innerHeight - e.clientY
|
|
160
|
-
: e.clientY
|
|
161
|
-
const boxHeight = window.innerHeight - PANEL_PADDING * 2
|
|
162
|
-
const value = alignSide
|
|
163
|
-
? (Math.abs(y - (window.innerHeight / 2)) - PANEL_PADDING) / boxHeight * 100 * 2
|
|
164
|
-
: (window.innerHeight - y - PANEL_PADDING) / boxHeight * 100
|
|
165
|
-
state.value.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (isDragging.value === 'vertical' || isDragging.value === 'both') {
|
|
169
|
-
const x = state.value.position === 'left'
|
|
170
|
-
? window.innerWidth - e.clientX
|
|
171
|
-
: e.clientX
|
|
172
|
-
const boxWidth = window.innerWidth - PANEL_PADDING * 2
|
|
173
|
-
const value = alignSide
|
|
174
|
-
? (window.innerWidth - x - PANEL_PADDING) / boxWidth * 100
|
|
175
|
-
: (Math.abs(x - (window.innerWidth / 2)) - PANEL_PADDING) / boxWidth * 100 * 2
|
|
176
|
-
state.value.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
useEventListener(window, 'mouseup', () => {
|
|
181
|
-
isDragging.value = false
|
|
182
75
|
})
|
|
183
76
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
77
|
+
function updateClient() {
|
|
78
|
+
const injection = iframe.value?.contentWindow?.__NUXT_DEVTOOLS_VIEW__ as NuxtDevtoolsViewGlobal
|
|
79
|
+
props.client.refreshState()
|
|
80
|
+
injection?.setClient(props.client)
|
|
81
|
+
}
|
|
187
82
|
|
|
188
83
|
useEventListener(window, 'keydown', (e: KeyboardEvent) => {
|
|
189
|
-
if (e.key === 'Escape' &&
|
|
190
|
-
|
|
84
|
+
if (e.key === 'Escape' && props.client.inspector?.isEnabled.value) {
|
|
85
|
+
e.preventDefault()
|
|
86
|
+
props.client.inspector?.disable()
|
|
191
87
|
closePanel()
|
|
192
88
|
}
|
|
193
89
|
})
|
|
194
90
|
|
|
195
|
-
// Close panel on outside click (when enabled)
|
|
196
|
-
useEventListener(window, 'mousedown', (e: MouseEvent) => {
|
|
197
|
-
if (!state.value.closeOnOutsideClick)
|
|
198
|
-
return
|
|
199
|
-
if (!state.value.open || isDragging.value || viewMode.value !== 'default')
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
const matched = e.composedPath().find((_el) => {
|
|
203
|
-
const el = _el as HTMLElement
|
|
204
|
-
return Array.from(el.classList || []).some(c => c.startsWith('nuxt-devtools-'))
|
|
205
|
-
|| el.tagName?.toLowerCase() === 'iframe'
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
if (!matched)
|
|
209
|
-
state.value.open = false
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
watch(viewMode, (mode) => {
|
|
213
|
-
if (mode === 'component-inspector')
|
|
214
|
-
enableComponentInspector()
|
|
215
|
-
else
|
|
216
|
-
disableComponentInspector()
|
|
217
|
-
}, { immediate: true })
|
|
218
|
-
|
|
219
91
|
watchEffect(() => {
|
|
220
92
|
if (!state.value.open)
|
|
221
93
|
iframe.value?.blur()
|
|
@@ -224,79 +96,10 @@ watchEffect(() => {
|
|
|
224
96
|
})
|
|
225
97
|
</script>
|
|
226
98
|
|
|
227
|
-
<script lang="ts">
|
|
228
|
-
declare global {
|
|
229
|
-
interface Window {
|
|
230
|
-
__NUXT_DEVTOOLS_VIEW__?: NuxtDevtoolsViewGlobal
|
|
231
|
-
__NUXT_DEVTOOLS__?: NuxtDevtoolsIframeClient
|
|
232
|
-
__VUE_INSPECTOR__?: VueInspectorClient
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
</script>
|
|
236
|
-
|
|
237
99
|
<template>
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
'pointer-events': isDragging ? 'none' : 'auto',
|
|
244
|
-
}"
|
|
245
|
-
@load="onLoad"
|
|
246
|
-
/>
|
|
247
|
-
<template v-if="viewMode === 'default'">
|
|
248
|
-
<div v-if="state.position !== 'top'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ top: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
|
|
249
|
-
<div v-if="state.position !== 'bottom'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ bottom: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
|
|
250
|
-
<div v-if="state.position !== 'left'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ left: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
|
|
251
|
-
<div v-if="state.position !== 'right'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ right: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
|
|
252
|
-
<div v-if="state.position !== 'top' && state.position !== 'left'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner" :style="{ top: 0, left: 0, cursor: 'nwse-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
|
|
253
|
-
<div v-if="state.position !== 'top' && state.position !== 'right'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner" :style="{ top: 0, right: 0, cursor: 'nesw-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
|
|
254
|
-
<div v-if="state.position !== 'bottom' && state.position !== 'right'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner" :style="{ bottom: 0, right: 0, cursor: 'nwse-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
|
|
255
|
-
<div v-if="state.position !== 'bottom' && state.position !== 'left'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner" :style="{ bottom: 0, left: 0, cursor: 'nesw-resize' }" @mousedown.prevent="() => isDragging = 'both'" />
|
|
256
|
-
</template>
|
|
257
|
-
</div>
|
|
100
|
+
<iframe
|
|
101
|
+
ref="iframe"
|
|
102
|
+
:src="initialUrl"
|
|
103
|
+
@load="onLoad"
|
|
104
|
+
/>
|
|
258
105
|
</template>
|
|
259
|
-
|
|
260
|
-
<style scoped>
|
|
261
|
-
.nuxt-devtools-frame {
|
|
262
|
-
position: fixed;
|
|
263
|
-
z-index: 2147483645;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.nuxt-devtools-frame iframe {
|
|
267
|
-
width: 100%;
|
|
268
|
-
height: 100%;
|
|
269
|
-
outline: none;
|
|
270
|
-
border: 1px solid rgba(125,125,125,0.2);
|
|
271
|
-
border-radius: 10px;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.nuxt-devtools-resize-handle-horizontal {
|
|
275
|
-
position: absolute;
|
|
276
|
-
left: 6px;
|
|
277
|
-
right: 6px;
|
|
278
|
-
height: 10px;
|
|
279
|
-
margin: -5px 0;
|
|
280
|
-
cursor: ns-resize;
|
|
281
|
-
border-radius: 5px;
|
|
282
|
-
}
|
|
283
|
-
.nuxt-devtools-resize-handle-vertical {
|
|
284
|
-
position: absolute;
|
|
285
|
-
top: 6px;
|
|
286
|
-
bottom: 0;
|
|
287
|
-
width: 10px;
|
|
288
|
-
margin: 0 -5px;
|
|
289
|
-
cursor: ew-resize;
|
|
290
|
-
border-radius: 5px;
|
|
291
|
-
}
|
|
292
|
-
.nuxt-devtools-resize-handle-corner {
|
|
293
|
-
position: absolute;
|
|
294
|
-
width: 14px;
|
|
295
|
-
height: 14px;
|
|
296
|
-
margin: -6px;
|
|
297
|
-
border-radius: 6px;
|
|
298
|
-
}
|
|
299
|
-
.nuxt-devtools-resize-handle:hover {
|
|
300
|
-
background: rgba(125,125,125,0.1);
|
|
301
|
-
}
|
|
302
|
-
</style>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { VueInspectorClient } from 'vite-plugin-vue-inspector'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
|
+
import type { NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, NuxtDevtoolsGlobal as NuxtDevtoolsViewGlobal } from '../../../types'
|
|
5
|
+
import { PANEL_MAX, PANEL_MIN, isInitialized, state } from './state'
|
|
6
|
+
import { useEventListener } from './utils'
|
|
7
|
+
import Frame from './Frame.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
client: NuxtDevtoolsHostClient
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const frame = ref<InstanceType<typeof Frame>>()
|
|
14
|
+
const frameEl = computed(() => frame.value?.$el as HTMLElement | undefined)
|
|
15
|
+
const isDragging = ref<false | { top?: boolean; left?: boolean; right?: boolean; bottom?: boolean }>(false)
|
|
16
|
+
|
|
17
|
+
// Close panel on outside click (when enabled)
|
|
18
|
+
useEventListener(window, 'mousedown', (e: MouseEvent) => {
|
|
19
|
+
if (!state.value.closeOnOutsideClick)
|
|
20
|
+
return
|
|
21
|
+
if (!state.value.open || isDragging.value || props.client.inspector?.isEnabled.value)
|
|
22
|
+
return
|
|
23
|
+
|
|
24
|
+
const matched = e.composedPath().find((_el) => {
|
|
25
|
+
const el = _el as HTMLElement
|
|
26
|
+
return Array.from(el.classList || []).some(c => c.startsWith('nuxt-devtools-'))
|
|
27
|
+
|| el.tagName?.toLowerCase() === 'iframe'
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
if (!matched)
|
|
31
|
+
state.value.open = false
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
useEventListener(window, 'mousemove', (e: MouseEvent) => {
|
|
35
|
+
if (!isDragging.value)
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
const box = frameEl.value?.getBoundingClientRect()
|
|
39
|
+
|
|
40
|
+
if (isDragging.value.right) {
|
|
41
|
+
const widthPx = Math.abs(e.clientX - (box?.left || 0))
|
|
42
|
+
const width = widthPx / window.innerWidth * 100
|
|
43
|
+
state.value.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, width))
|
|
44
|
+
}
|
|
45
|
+
else if (isDragging.value.left) {
|
|
46
|
+
const widthPx = Math.abs((box?.right || 0) - e.clientX)
|
|
47
|
+
const width = widthPx / window.innerWidth * 100
|
|
48
|
+
state.value.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, width))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isDragging.value.top) {
|
|
52
|
+
const heightPx = Math.abs((box?.bottom || 0) - e.clientY)
|
|
53
|
+
const height = heightPx / window.innerHeight * 100
|
|
54
|
+
state.value.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, height))
|
|
55
|
+
}
|
|
56
|
+
else if (isDragging.value.bottom) {
|
|
57
|
+
const heightPx = Math.abs(e.clientY - (box?.top || 0))
|
|
58
|
+
const height = heightPx / window.innerHeight * 100
|
|
59
|
+
state.value.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, height))
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
useEventListener(window, 'mouseup', () => {
|
|
64
|
+
isDragging.value = false
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
useEventListener(window, 'mouseleave', () => {
|
|
68
|
+
isDragging.value = false
|
|
69
|
+
})
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<script lang="ts">
|
|
73
|
+
declare global {
|
|
74
|
+
interface Window {
|
|
75
|
+
__NUXT_DEVTOOLS_VIEW__?: NuxtDevtoolsViewGlobal
|
|
76
|
+
__NUXT_DEVTOOLS__?: NuxtDevtoolsIframeClient
|
|
77
|
+
__VUE_INSPECTOR__?: VueInspectorClient
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<div v-show="state.open && !client.inspector?.isEnabled.value" class="nuxt-devtools-frame">
|
|
84
|
+
<Frame
|
|
85
|
+
v-if="isInitialized"
|
|
86
|
+
ref="frame"
|
|
87
|
+
:client="client"
|
|
88
|
+
:style="{
|
|
89
|
+
pointerEvents: isDragging ? 'none' : undefined,
|
|
90
|
+
}"
|
|
91
|
+
/>
|
|
92
|
+
<!-- Handlers -->
|
|
93
|
+
<div v-if="state.position !== 'top'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ top: 0 }" @mousedown.prevent="() => isDragging = { top: true }" />
|
|
94
|
+
<div v-if="state.position !== 'bottom'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ bottom: 0 }" @mousedown.prevent="() => isDragging = { bottom: true }" />
|
|
95
|
+
<div v-if="state.position !== 'left'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ left: 0 }" @mousedown.prevent="() => isDragging = { left: true }" />
|
|
96
|
+
<div v-if="state.position !== 'right'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ right: 0 }" @mousedown.prevent="() => isDragging = { right: true }" />
|
|
97
|
+
<div
|
|
98
|
+
v-if="state.position !== 'top' && state.position !== 'left'"
|
|
99
|
+
class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner"
|
|
100
|
+
:style="{ top: 0, left: 0, cursor: 'nwse-resize' }"
|
|
101
|
+
@mousedown.prevent="() => isDragging = { top: true, left: true }"
|
|
102
|
+
/>
|
|
103
|
+
<div
|
|
104
|
+
v-if="state.position !== 'top' && state.position !== 'right'"
|
|
105
|
+
class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner"
|
|
106
|
+
:style="{ top: 0, right: 0, cursor: 'nesw-resize' }"
|
|
107
|
+
@mousedown.prevent="() => isDragging = { top: true, right: true }"
|
|
108
|
+
/>
|
|
109
|
+
<div
|
|
110
|
+
v-if="state.position !== 'bottom' && state.position !== 'left'"
|
|
111
|
+
class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner"
|
|
112
|
+
:style="{ bottom: 0, left: 0, cursor: 'nesw-resize' }"
|
|
113
|
+
@mousedown.prevent="() => isDragging = { bottom: true, left: true }"
|
|
114
|
+
/>
|
|
115
|
+
<div
|
|
116
|
+
v-if="state.position !== 'bottom' && state.position !== 'right'"
|
|
117
|
+
class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-corner"
|
|
118
|
+
:style="{ bottom: 0, right: 0, cursor: 'nwse-resize' }"
|
|
119
|
+
@mousedown.prevent="() => isDragging = { bottom: true, right: true }"
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<style scoped>
|
|
125
|
+
.nuxt-devtools-frame {
|
|
126
|
+
position: fixed;
|
|
127
|
+
z-index: 2147483645;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.nuxt-devtools-frame :deep(iframe) {
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
outline: none;
|
|
134
|
+
background: var(--nuxt-devtools-widget-bg);
|
|
135
|
+
border: 1px solid rgba(125,125,125,0.2);
|
|
136
|
+
border-radius: 10px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nuxt-devtools-resize-handle-horizontal {
|
|
140
|
+
position: absolute;
|
|
141
|
+
left: 6px;
|
|
142
|
+
right: 6px;
|
|
143
|
+
height: 10px;
|
|
144
|
+
margin: -5px 0;
|
|
145
|
+
cursor: ns-resize;
|
|
146
|
+
border-radius: 5px;
|
|
147
|
+
}
|
|
148
|
+
.nuxt-devtools-resize-handle-vertical {
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 6px;
|
|
151
|
+
bottom: 0;
|
|
152
|
+
width: 10px;
|
|
153
|
+
margin: 0 -5px;
|
|
154
|
+
cursor: ew-resize;
|
|
155
|
+
border-radius: 5px;
|
|
156
|
+
}
|
|
157
|
+
.nuxt-devtools-resize-handle-corner {
|
|
158
|
+
position: absolute;
|
|
159
|
+
width: 14px;
|
|
160
|
+
height: 14px;
|
|
161
|
+
margin: -6px;
|
|
162
|
+
border-radius: 6px;
|
|
163
|
+
}
|
|
164
|
+
.nuxt-devtools-resize-handle:hover {
|
|
165
|
+
background: rgba(125,125,125,0.1);
|
|
166
|
+
}
|
|
167
|
+
</style>
|