@nuxt/devtools-nightly 0.0.0 → 2.0.0-beta.0-28940159.3b2c84c
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/LICENSE +21 -0
- package/README.md +129 -0
- package/cli.mjs +2 -0
- package/dist/chunks/analyze-build.mjs +58 -0
- package/dist/chunks/module-main.mjs +2044 -0
- package/dist/chunks/plugin-metrics.mjs +68 -0
- package/dist/chunks/timeline.mjs +73 -0
- package/dist/chunks/vite-inspect.mjs +57 -0
- package/dist/chunks/vscode.mjs +195 -0
- package/dist/chunks/vue-devtools.mjs +30 -0
- package/dist/chunks/vue-inspector.mjs +15 -0
- package/dist/client/200.html +20 -0
- package/dist/client/404.html +20 -0
- package/dist/client/_nuxt/__blank-f4f9nu4d.js +1 -0
- package/dist/client/_nuxt/analyze-build-d4ocz87m.js +1 -0
- package/dist/client/_nuxt/assets-accfst8t.js +16 -0
- package/dist/client/_nuxt/assets.css-hmxl533k.css +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/078b774d-b96e-484e-b4d5-b349c23c7fd7.json +1 -0
- package/dist/client/_nuxt/c5gs2ah3.js +17 -0
- package/dist/client/_nuxt/client-ihvctios.js +1 -0
- package/dist/client/_nuxt/code-diff.vue-dfkrd13w.js +8 -0
- package/dist/client/_nuxt/code-snippets.vue-lcfqth8k.js +1 -0
- package/dist/client/_nuxt/components-oghrvkye.js +1 -0
- package/dist/client/_nuxt/components-tree-knr0y8qe.js +1 -0
- package/dist/client/_nuxt/composable-item.vue-lu13s905.js +1 -0
- package/dist/client/_nuxt/constants-b32h69zq.js +1 -0
- package/dist/client/_nuxt/custom-_name_-fup3n0cu.js +1 -0
- package/dist/client/_nuxt/default-i1yqd2to.js +1 -0
- package/dist/client/_nuxt/duration-display.vue-e5ntxkcx.js +1 -0
- package/dist/client/_nuxt/entry.css-kxi58hys.css +1 -0
- package/dist/client/_nuxt/error-404-ci0xzyd6.js +1 -0
- package/dist/client/_nuxt/error-404.css-b3x40x40.css +1 -0
- package/dist/client/_nuxt/error-500-ny17oe9i.js +1 -0
- package/dist/client/_nuxt/error-500.css-hilpkhd4.css +1 -0
- package/dist/client/_nuxt/error-nhdqe6i6.js +9 -0
- package/dist/client/_nuxt/filepath-item.vue-mcgdbj53.js +1 -0
- package/dist/client/_nuxt/full-nb67w4v9.js +1 -0
- package/dist/client/_nuxt/help-fab.css-ms50khsu.css +1 -0
- package/dist/client/_nuxt/help-fab.vue-opvnmtcj.js +1 -0
- package/dist/client/_nuxt/hooks-kfudy7r2.js +1 -0
- package/dist/client/_nuxt/imports-eo3khgic.js +1 -0
- package/dist/client/_nuxt/index-m4vf8cbo.js +2 -0
- package/dist/client/_nuxt/index-ow49s53n.js +1 -0
- package/dist/client/_nuxt/launch-page.vue-iesvi41s.js +1 -0
- package/dist/client/_nuxt/modules-bjoacevh.js +1 -0
- package/dist/client/_nuxt/nbadge-hknag3xt.js +1 -0
- package/dist/client/_nuxt/ncheckbox.vue-ms3v2bv8.js +1 -0
- package/dist/client/_nuxt/ncode-block.css-c9cb29at.css +1 -0
- package/dist/client/_nuxt/ncode-block.vue-ls06c06q.js +2 -0
- package/dist/client/_nuxt/ndrawer.vue-pawnvrjc.js +1 -0
- package/dist/client/_nuxt/ndropdown.vue-dbst6ukt.js +1 -0
- package/dist/client/_nuxt/nicon-title.vue-ipq3avx6.js +1 -0
- package/dist/client/_nuxt/nlink.vue-e8l6ggyt.js +1 -0
- package/dist/client/_nuxt/nmarkdown.vue-lp7ya0j6.js +1 -0
- package/dist/client/_nuxt/nnavbar.vue-lykocirm.js +1 -0
- package/dist/client/_nuxt/none-dgqlebv3.js +1 -0
- package/dist/client/_nuxt/nsection-block-o11p8ted.js +1 -0
- package/dist/client/_nuxt/nsection-block.css-e7kbjm7k.css +1 -0
- package/dist/client/_nuxt/nselect-tabs.vue-otuk7xnz.js +1 -0
- package/dist/client/_nuxt/nselect.vue-bjzfjabo.js +1 -0
- package/dist/client/_nuxt/open-graph-bfgokib7.js +3 -0
- package/dist/client/_nuxt/open-graph.css-e21qzmvj.css +1 -0
- package/dist/client/_nuxt/overview-klilnch0.js +1 -0
- package/dist/client/_nuxt/pages-jvi3fi1o.js +1 -0
- package/dist/client/_nuxt/payload-nznxtz0n.js +1 -0
- package/dist/client/_nuxt/pinia-dvjxs68v.js +1 -0
- package/dist/client/_nuxt/plugins-1i3hudxm.js +1 -0
- package/dist/client/_nuxt/runtime-configs-zuvf8944.js +1 -0
- package/dist/client/_nuxt/server-route-inputs.vue-mus15xmu.js +1 -0
- package/dist/client/_nuxt/server-routes-g18npbq7.js +9 -0
- package/dist/client/_nuxt/server-tasks-mvftg09y.js +1 -0
- package/dist/client/_nuxt/settings-hux8x7fu.js +1 -0
- package/dist/client/_nuxt/stacktrace-list.vue-k97c53ud.js +1 -0
- package/dist/client/_nuxt/state-components-hjf5pd61.js +1 -0
- package/dist/client/_nuxt/state-editor.vue-h67wwxtf.js +1 -0
- package/dist/client/_nuxt/state-modules-c2e21x4m.js +1 -0
- package/dist/client/_nuxt/storage-fh94um93.js +1 -0
- package/dist/client/_nuxt/terminals-l9qfrdfc.js +1 -0
- package/dist/client/_nuxt/terminals.css-mejv43xm.css +1 -0
- package/dist/client/_nuxt/timeline-cb92pqd1.js +31 -0
- package/dist/client/_nuxt/timeline.css-lhkpu01p.css +1 -0
- package/dist/client/_nuxt/unocss-runtime-jzfgcoxk.js +1 -0
- package/dist/client/_nuxt/vendor/json-editor-vue-c3wisb33.js +3818 -0
- package/dist/client/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css +1 -0
- package/dist/client/_nuxt/vendor/markdown-it-fvu08dbs.js +16 -0
- package/dist/client/_nuxt/vendor/shiki-bnvxb5wv.js +147 -0
- package/dist/client/_nuxt/vendor/unocss-3uirpnla.js +2 -0
- package/dist/client/_nuxt/vendor/unocss.css-mhvipxpl.css +1 -0
- package/dist/client/_nuxt/vendor/vis-dlwijd5n.js +98 -0
- package/dist/client/_nuxt/vendor/xterm-dbpzgj7s.js +9 -0
- package/dist/client/_nuxt/vendor/xterm.css-egmhki83.css +32 -0
- package/dist/client/_nuxt/virtual-files-idfl2dwx.js +1 -0
- package/dist/client/_nuxt/virtual-files.css-gqpg2wnb.css +1 -0
- package/dist/client/_nuxt/vue-virtual-scroller.esm-md1d6mcg.js +2 -0
- package/dist/client/index.html +20 -0
- package/dist/client/nuxt.svg +3 -0
- package/dist/dirs.d.mts +7 -0
- package/dist/dirs.d.ts +7 -0
- package/dist/dirs.mjs +28 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +9 -0
- package/dist/module.d.ts +9 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +6 -0
- package/dist/runtime/auth/index.html +76 -0
- package/dist/runtime/function-metrics-helpers.d.ts +3 -0
- package/dist/runtime/function-metrics-helpers.js +69 -0
- package/dist/runtime/nitro/inline.d.ts +3 -0
- package/dist/runtime/nitro/inline.js +6 -0
- package/dist/runtime/plugins/devtools.client.d.ts +2 -0
- package/dist/runtime/plugins/devtools.client.js +56 -0
- package/dist/runtime/plugins/devtools.server.d.ts +2 -0
- package/dist/runtime/plugins/devtools.server.js +7 -0
- package/dist/runtime/plugins/view/FrameBox.vue +167 -0
- package/dist/runtime/plugins/view/Main.vue +422 -0
- package/dist/runtime/plugins/view/client.d.ts +12 -0
- package/dist/runtime/plugins/view/client.js +332 -0
- package/dist/runtime/plugins/view/state.d.ts +5 -0
- package/dist/runtime/plugins/view/state.js +17 -0
- package/dist/runtime/plugins/view/utils.d.ts +31 -0
- package/dist/runtime/plugins/view/utils.js +156 -0
- package/dist/runtime/settings.d.ts +4 -0
- package/dist/runtime/settings.js +2 -0
- package/dist/runtime/shared/hooks.d.ts +2 -0
- package/dist/runtime/shared/hooks.js +33 -0
- package/dist/runtime/use-nuxt-devtools.d.ts +8 -0
- package/dist/runtime/use-nuxt-devtools.js +23 -0
- package/dist/runtime/vue-devtools/overlay.d.ts +1 -0
- package/dist/runtime/vue-devtools/overlay.js +8 -0
- package/dist/shared/devtools-nightly.2a48a9e5.d.mts +62 -0
- package/dist/shared/devtools-nightly.2a48a9e5.d.ts +62 -0
- package/dist/shared/devtools-nightly.5ac54dae.mjs +121 -0
- package/dist/types.d.mts +42 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.mjs +1 -0
- package/package.json +123 -2
- package/types.d.ts +1 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NuxtDevtoolsHostClient } from '@nuxt/devtools/types'
|
|
3
|
+
import type { CSSProperties } from 'vue'
|
|
4
|
+
import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
|
|
5
|
+
import { settings } from '../../settings'
|
|
6
|
+
import FrameBox from './FrameBox.vue'
|
|
7
|
+
import { state } from './state'
|
|
8
|
+
import { millisecondToHumanreadable, useElementBounding, useEventListener, useScreenSafeArea } from './utils'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
client: NuxtDevtoolsHostClient
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const panelMargins = reactive({
|
|
15
|
+
left: 10,
|
|
16
|
+
top: 10,
|
|
17
|
+
right: 10,
|
|
18
|
+
bottom: 10,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const safeArea = useScreenSafeArea()
|
|
22
|
+
|
|
23
|
+
const isSafari = navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')
|
|
24
|
+
let isInit = true
|
|
25
|
+
|
|
26
|
+
watchEffect(() => {
|
|
27
|
+
if (state.value.open)
|
|
28
|
+
isInit = false
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
watchEffect(() => {
|
|
32
|
+
panelMargins.left = safeArea.left.value + 10
|
|
33
|
+
panelMargins.top = safeArea.top.value + 10
|
|
34
|
+
panelMargins.right = safeArea.right.value + 10
|
|
35
|
+
panelMargins.bottom = safeArea.bottom.value + 10
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const SNAP_THRESHOLD = 2
|
|
39
|
+
|
|
40
|
+
const vars = computed(() => {
|
|
41
|
+
const dark = props.client.app.colorMode.value === 'dark'
|
|
42
|
+
return {
|
|
43
|
+
'--nuxt-devtools-widget-bg': dark ? '#111' : '#ffffff',
|
|
44
|
+
'--nuxt-devtools-widget-fg': dark ? '#F5F5F5' : '#111',
|
|
45
|
+
'--nuxt-devtools-widget-border': dark ? '#3336' : '#efefef',
|
|
46
|
+
'--nuxt-devtools-widget-shadow': dark ? 'rgba(0,0,0,0.3)' : 'rgba(128,128,128,0.1)',
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const frameBox = ref<HTMLDivElement>()
|
|
51
|
+
const panelEl = ref<HTMLDivElement>()
|
|
52
|
+
const anchorEl = ref<HTMLDivElement>()
|
|
53
|
+
|
|
54
|
+
const windowSize = reactive({ width: 0, height: 0 })
|
|
55
|
+
const isDragging = ref(false)
|
|
56
|
+
const draggingOffset = reactive({ x: 0, y: 0 })
|
|
57
|
+
const mousePosition = reactive({ x: 0, y: 0 })
|
|
58
|
+
|
|
59
|
+
function onPointerDown(e: PointerEvent) {
|
|
60
|
+
if (!panelEl.value)
|
|
61
|
+
return
|
|
62
|
+
isDragging.value = true
|
|
63
|
+
const { left, top, width, height } = panelEl.value!.getBoundingClientRect()
|
|
64
|
+
draggingOffset.x = e.clientX - left - width / 2
|
|
65
|
+
draggingOffset.y = e.clientY - top - height / 2
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
windowSize.width = window.innerWidth
|
|
70
|
+
windowSize.height = window.innerHeight
|
|
71
|
+
|
|
72
|
+
useEventListener(window, 'resize', () => {
|
|
73
|
+
windowSize.width = window.innerWidth
|
|
74
|
+
windowSize.height = window.innerHeight
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
useEventListener(window, 'pointermove', (e: PointerEvent) => {
|
|
78
|
+
if (!isDragging.value)
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
const centerX = windowSize.width / 2
|
|
82
|
+
const centerY = windowSize.height / 2
|
|
83
|
+
|
|
84
|
+
const x = e.clientX - draggingOffset.x
|
|
85
|
+
const y = e.clientY - draggingOffset.y
|
|
86
|
+
|
|
87
|
+
mousePosition.x = x
|
|
88
|
+
mousePosition.y = y
|
|
89
|
+
|
|
90
|
+
// Get position
|
|
91
|
+
const deg = Math.atan2(y - centerY, x - centerX)
|
|
92
|
+
const HORIZONTAL_MARGIN = 70
|
|
93
|
+
const TL = Math.atan2(0 - centerY + HORIZONTAL_MARGIN, 0 - centerX)
|
|
94
|
+
const TR = Math.atan2(0 - centerY + HORIZONTAL_MARGIN, windowSize.width - centerX)
|
|
95
|
+
const BL = Math.atan2(windowSize.height - HORIZONTAL_MARGIN - centerY, 0 - centerX)
|
|
96
|
+
const BR = Math.atan2(windowSize.height - HORIZONTAL_MARGIN - centerY, windowSize.width - centerX)
|
|
97
|
+
|
|
98
|
+
state.value.position = deg >= TL && deg <= TR
|
|
99
|
+
? 'top'
|
|
100
|
+
: deg >= TR && deg <= BR
|
|
101
|
+
? 'right'
|
|
102
|
+
: deg >= BR && deg <= BL
|
|
103
|
+
? 'bottom'
|
|
104
|
+
: 'left'
|
|
105
|
+
|
|
106
|
+
state.value.left = snapToPoints(x / windowSize.width * 100)
|
|
107
|
+
state.value.top = snapToPoints(y / windowSize.height * 100)
|
|
108
|
+
})
|
|
109
|
+
useEventListener(window, 'pointerup', () => {
|
|
110
|
+
isDragging.value = false
|
|
111
|
+
})
|
|
112
|
+
useEventListener(window, 'pointerleave', () => {
|
|
113
|
+
isDragging.value = false
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
function snapToPoints(value: number) {
|
|
118
|
+
if (value < 5)
|
|
119
|
+
return 0
|
|
120
|
+
if (value > 95)
|
|
121
|
+
return 100
|
|
122
|
+
if (Math.abs(value - 50) < SNAP_THRESHOLD)
|
|
123
|
+
return 50
|
|
124
|
+
return value
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function clamp(value: number, min: number, max: number) {
|
|
128
|
+
return Math.min(Math.max(value, min), max)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const isHovering = ref(false)
|
|
132
|
+
const isVertical = computed(() => state.value.position === 'left' || state.value.position === 'right')
|
|
133
|
+
|
|
134
|
+
const anchorPos = computed(() => {
|
|
135
|
+
const halfWidth = (panelEl.value?.clientWidth || 0) / 2
|
|
136
|
+
const halfHeight = (panelEl.value?.clientHeight || 0) / 2
|
|
137
|
+
|
|
138
|
+
const left = state.value.left * windowSize.width / 100
|
|
139
|
+
const top = state.value.top * windowSize.height / 100
|
|
140
|
+
|
|
141
|
+
switch (state.value.position) {
|
|
142
|
+
case 'top':
|
|
143
|
+
return {
|
|
144
|
+
left: clamp(left, halfWidth + panelMargins.left, windowSize.width - halfWidth - panelMargins.right),
|
|
145
|
+
top: panelMargins.top + halfHeight,
|
|
146
|
+
}
|
|
147
|
+
case 'right':
|
|
148
|
+
return {
|
|
149
|
+
left: windowSize.width - panelMargins.right - halfHeight,
|
|
150
|
+
top: clamp(top, halfWidth + panelMargins.top, windowSize.height - halfWidth - panelMargins.bottom),
|
|
151
|
+
}
|
|
152
|
+
case 'left':
|
|
153
|
+
return {
|
|
154
|
+
left: panelMargins.left + halfHeight,
|
|
155
|
+
top: clamp(top, halfWidth + panelMargins.top, windowSize.height - halfWidth - panelMargins.bottom),
|
|
156
|
+
}
|
|
157
|
+
case 'bottom':
|
|
158
|
+
default:
|
|
159
|
+
return {
|
|
160
|
+
left: clamp(left, halfWidth + panelMargins.left, windowSize.width - halfWidth - panelMargins.right),
|
|
161
|
+
top: windowSize.height - panelMargins.bottom - halfHeight,
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
let _timer: ReturnType<typeof setTimeout> | null = null
|
|
167
|
+
function bringUp() {
|
|
168
|
+
isHovering.value = true
|
|
169
|
+
if (state.value.minimizePanelInactive < 0)
|
|
170
|
+
return
|
|
171
|
+
if (_timer)
|
|
172
|
+
clearTimeout(_timer)
|
|
173
|
+
_timer = setTimeout(() => {
|
|
174
|
+
isHovering.value = false
|
|
175
|
+
}, +state.value.minimizePanelInactive || 0)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const isHidden = computed(() => {
|
|
179
|
+
if (state.value.open)
|
|
180
|
+
return false
|
|
181
|
+
if (settings.ui.showPanel === true)
|
|
182
|
+
return false
|
|
183
|
+
if (settings.ui.showPanel === false)
|
|
184
|
+
return true
|
|
185
|
+
// If not explicitly set, hide the panel on first load
|
|
186
|
+
return isInit
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
const isMinimized = computed(() => {
|
|
190
|
+
if (state.value.minimizePanelInactive < 0)
|
|
191
|
+
return false
|
|
192
|
+
if (state.value.minimizePanelInactive === 0)
|
|
193
|
+
return true
|
|
194
|
+
// @ts-expect-error compatibility
|
|
195
|
+
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
|
|
196
|
+
return !isDragging.value
|
|
197
|
+
&& !state.value.open
|
|
198
|
+
&& !isHovering.value
|
|
199
|
+
&& !isTouchDevice
|
|
200
|
+
&& state.value.minimizePanelInactive
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
const anchorStyle = computed(() => {
|
|
204
|
+
return {
|
|
205
|
+
left: `${anchorPos.value.left}px`,
|
|
206
|
+
top: `${anchorPos.value.top}px`,
|
|
207
|
+
pointerEvents: isHidden.value ? 'none' : 'auto',
|
|
208
|
+
} as const
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
const panelStyle = computed(() => {
|
|
212
|
+
const style: any = {
|
|
213
|
+
transform: isVertical.value
|
|
214
|
+
? `translate(${isMinimized.value ? `calc(-50% ${state.value.position === 'right' ? '+' : '-'} 15px)` : '-50%'}, -50%) rotate(90deg)`
|
|
215
|
+
: `translate(-50%, ${isMinimized.value ? `calc(-50% ${state.value.position === 'top' ? '-' : '+'} 15px)` : '-50%'})`,
|
|
216
|
+
}
|
|
217
|
+
if (isHidden.value) {
|
|
218
|
+
style.opacity = 0
|
|
219
|
+
style.pointerEvents = 'none'
|
|
220
|
+
}
|
|
221
|
+
if (isMinimized.value) {
|
|
222
|
+
switch (state.value.position) {
|
|
223
|
+
case 'top':
|
|
224
|
+
case 'right':
|
|
225
|
+
style.borderTopLeftRadius = '0'
|
|
226
|
+
style.borderTopRightRadius = '0'
|
|
227
|
+
break
|
|
228
|
+
case 'bottom':
|
|
229
|
+
case 'left':
|
|
230
|
+
style.borderBottomLeftRadius = '0'
|
|
231
|
+
style.borderBottomRightRadius = '0'
|
|
232
|
+
break
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (isDragging.value)
|
|
236
|
+
style.transition = 'none !important'
|
|
237
|
+
return style
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
const { width: frameWidth, height: frameHeight } = useElementBounding(frameBox)
|
|
241
|
+
|
|
242
|
+
const iframeStyle = computed(() => {
|
|
243
|
+
// eslint-disable-next-line no-sequences, ts/no-unused-expressions
|
|
244
|
+
mousePosition.x, mousePosition.y
|
|
245
|
+
|
|
246
|
+
const halfHeight = (panelEl.value?.clientHeight || 0) / 2
|
|
247
|
+
|
|
248
|
+
const frameMargin = {
|
|
249
|
+
left: panelMargins.left + halfHeight,
|
|
250
|
+
top: panelMargins.top + halfHeight,
|
|
251
|
+
right: panelMargins.right + halfHeight,
|
|
252
|
+
bottom: panelMargins.bottom + halfHeight,
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const marginHorizontal = frameMargin.left + frameMargin.right
|
|
256
|
+
const marginVertical = frameMargin.top + frameMargin.bottom
|
|
257
|
+
|
|
258
|
+
const maxWidth = windowSize.width - marginHorizontal
|
|
259
|
+
const maxHeight = windowSize.height - marginVertical
|
|
260
|
+
|
|
261
|
+
const style: CSSProperties = {
|
|
262
|
+
position: 'fixed',
|
|
263
|
+
zIndex: -1,
|
|
264
|
+
pointerEvents: isDragging.value || !state.value.open ? 'none' : 'auto',
|
|
265
|
+
width: `min(${state.value.width}vw, calc(100vw - ${marginHorizontal}px))`,
|
|
266
|
+
height: `min(${state.value.height}vh, calc(100vh - ${marginVertical}px))`,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const anchor = anchorPos.value
|
|
270
|
+
const width = Math.min(maxWidth, state.value.width * windowSize.width / 100)
|
|
271
|
+
const height = Math.min(maxHeight, state.value.height * windowSize.height / 100)
|
|
272
|
+
|
|
273
|
+
const anchorX = anchor?.left || 0
|
|
274
|
+
const anchorY = anchor?.top || 0
|
|
275
|
+
|
|
276
|
+
switch (state.value.position) {
|
|
277
|
+
case 'top':
|
|
278
|
+
case 'bottom':
|
|
279
|
+
style.left = `${-frameWidth.value / 2}px`
|
|
280
|
+
style.transform = 'translate(0, 0)'
|
|
281
|
+
if ((anchorX - frameMargin.left) < width / 2)
|
|
282
|
+
style.left = `${width / 2 - anchorX + frameMargin.left - frameWidth.value / 2}px`
|
|
283
|
+
else if ((windowSize.width - anchorX - frameMargin.right) < width / 2)
|
|
284
|
+
style.left = `${windowSize.width - anchorX - width / 2 - frameMargin.right - frameWidth.value / 2}px`
|
|
285
|
+
break
|
|
286
|
+
case 'right':
|
|
287
|
+
case 'left':
|
|
288
|
+
style.top = `${-frameHeight.value / 2}px`
|
|
289
|
+
style.transform = 'translate(0, 0)'
|
|
290
|
+
if ((anchorY - frameMargin.top) < height / 2)
|
|
291
|
+
style.top = `${height / 2 - anchorY + frameMargin.top - frameHeight.value / 2}px`
|
|
292
|
+
else if ((windowSize.height - anchorY - frameMargin.bottom) < height / 2)
|
|
293
|
+
style.top = `${windowSize.height - anchorY - height / 2 - frameMargin.bottom - frameHeight.value / 2}px`
|
|
294
|
+
break
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
switch (state.value.position) {
|
|
298
|
+
case 'top':
|
|
299
|
+
style.top = 0
|
|
300
|
+
break
|
|
301
|
+
case 'right':
|
|
302
|
+
style.right = 0
|
|
303
|
+
break
|
|
304
|
+
case 'left':
|
|
305
|
+
style.left = 0
|
|
306
|
+
break
|
|
307
|
+
case 'bottom':
|
|
308
|
+
default:
|
|
309
|
+
style.bottom = 0
|
|
310
|
+
break
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return style
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
const time = computed(() => {
|
|
317
|
+
let type = ''
|
|
318
|
+
const metric = props.client.metrics.loading()
|
|
319
|
+
let time = -1
|
|
320
|
+
if (metric.pageEnd && metric.pageStart) {
|
|
321
|
+
time = metric.pageEnd - metric.pageStart
|
|
322
|
+
type = 'Page'
|
|
323
|
+
}
|
|
324
|
+
else if (metric.appLoad && metric.appInit) {
|
|
325
|
+
time = metric.appLoad - metric.appInit
|
|
326
|
+
type = 'App'
|
|
327
|
+
}
|
|
328
|
+
bringUp()
|
|
329
|
+
if (time < 0)
|
|
330
|
+
return [type, '', '-']
|
|
331
|
+
return [type, ...millisecondToHumanreadable(time)]
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
onMounted(() => {
|
|
335
|
+
bringUp()
|
|
336
|
+
})
|
|
337
|
+
</script>
|
|
338
|
+
|
|
339
|
+
<template>
|
|
340
|
+
<div
|
|
341
|
+
id="nuxt-devtools-anchor"
|
|
342
|
+
ref="anchorEl"
|
|
343
|
+
:style="[anchorStyle, vars]"
|
|
344
|
+
:class="{
|
|
345
|
+
'nuxt-devtools-vertical': isVertical,
|
|
346
|
+
'nuxt-devtools-hide': isMinimized,
|
|
347
|
+
}"
|
|
348
|
+
@mousemove="bringUp"
|
|
349
|
+
>
|
|
350
|
+
<div
|
|
351
|
+
v-if="!isSafari"
|
|
352
|
+
class="nuxt-devtools-glowing"
|
|
353
|
+
:style="isDragging ? 'opacity: 0.6 !important' : ''"
|
|
354
|
+
/>
|
|
355
|
+
<div
|
|
356
|
+
ref="panelEl"
|
|
357
|
+
class="nuxt-devtools-panel"
|
|
358
|
+
:style="panelStyle"
|
|
359
|
+
@pointerdown="onPointerDown"
|
|
360
|
+
>
|
|
361
|
+
<button
|
|
362
|
+
class="nuxt-devtools-icon-button nuxt-devtools-nuxt-button"
|
|
363
|
+
title="Toggle Nuxt DevTools"
|
|
364
|
+
:style="state.open ? '' : 'filter:saturate(0)'"
|
|
365
|
+
@click="client.devtools.toggle()"
|
|
366
|
+
>
|
|
367
|
+
<svg
|
|
368
|
+
viewBox="0 0 324 324" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
369
|
+
style="margin-top:-1px; height: 1.2em; width: 1.2em;"
|
|
370
|
+
>
|
|
371
|
+
<path d="M181.767 270H302.211C306.037 270 309.795 269.003 313.108 267.107C316.421 265.211 319.172 262.484 321.084 259.2C322.996 255.915 324.002 252.19 324 248.399C323.998 244.607 322.989 240.883 321.074 237.601L240.187 98.7439C238.275 95.4607 235.525 92.7342 232.213 90.8385C228.901 88.9429 225.143 87.9449 221.318 87.9449C217.494 87.9449 213.736 88.9429 210.424 90.8385C207.112 92.7342 204.361 95.4607 202.449 98.7439L181.767 134.272L141.329 64.7975C139.416 61.5145 136.664 58.7884 133.351 56.8931C130.038 54.9978 126.28 54 122.454 54C118.629 54 114.871 54.9978 111.558 56.8931C108.245 58.7884 105.493 61.5145 103.58 64.7975L2.92554 237.601C1.01067 240.883 0.00166657 244.607 2.06272e-06 248.399C-0.00166244 252.19 1.00407 255.915 2.91605 259.2C4.82803 262.484 7.57884 265.211 10.8918 267.107C14.2047 269.003 17.963 270 21.7886 270H97.3936C127.349 270 149.44 256.959 164.641 231.517L201.546 168.172L221.313 134.272L280.637 236.1H201.546L181.767 270ZM96.1611 236.065L43.3984 236.054L122.49 100.291L161.953 168.172L135.531 213.543C125.436 230.051 113.968 236.065 96.1611 236.065Z" fill="#00DC82" />
|
|
372
|
+
</svg>
|
|
373
|
+
</button>
|
|
374
|
+
<div
|
|
375
|
+
style="border-left: 1px solid #8883;width:1px;height:10px;"
|
|
376
|
+
class="nuxt-devtools-panel-content"
|
|
377
|
+
/>
|
|
378
|
+
<div
|
|
379
|
+
class="nuxt-devtools-panel-content nuxt-devtools-label"
|
|
380
|
+
:title="`${time[0]} load time`"
|
|
381
|
+
>
|
|
382
|
+
<div class="nuxt-devtools-label-main">
|
|
383
|
+
{{ time[1] }}
|
|
384
|
+
</div>
|
|
385
|
+
<span class="nuxt-devtools-label-secondary">
|
|
386
|
+
{{ time[2] }}
|
|
387
|
+
</span>
|
|
388
|
+
</div>
|
|
389
|
+
<template v-if="client.inspector">
|
|
390
|
+
<div
|
|
391
|
+
style="border-left: 1px solid #8883;width:1px;height:10px;"
|
|
392
|
+
class="nuxt-devtools-panel-content"
|
|
393
|
+
/>
|
|
394
|
+
<button class="nuxt-devtools-icon-button nuxt-devtools-panel-content" title="Toggle Component Inspector" @click="client.inspector.toggle">
|
|
395
|
+
<svg
|
|
396
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
397
|
+
style="height: 1.2em; width: 1.2em; opacity:0.5;"
|
|
398
|
+
:style="client.inspector.isEnabled.value ? 'opacity:1;color:#00dc82' : ''"
|
|
399
|
+
viewBox="0 0 24 24"
|
|
400
|
+
>
|
|
401
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r=".5" fill="currentColor" /><path d="M5 12a7 7 0 1 0 14 0a7 7 0 1 0-14 0m7-9v2m-9 7h2m7 7v2m7-9h2" /></g>
|
|
402
|
+
</svg>
|
|
403
|
+
</button>
|
|
404
|
+
</template>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div
|
|
408
|
+
v-show="!client.inspector?.isEnabled.value"
|
|
409
|
+
ref="frameBox"
|
|
410
|
+
:style="iframeStyle"
|
|
411
|
+
>
|
|
412
|
+
<FrameBox
|
|
413
|
+
:client="client"
|
|
414
|
+
:is-dragging="isDragging"
|
|
415
|
+
/>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
</template>
|
|
419
|
+
|
|
420
|
+
<style scoped>
|
|
421
|
+
#nuxt-devtools-anchor{box-sizing:border-box;font-family:Arial,Helvetica,sans-serif;font-size:15px!important;position:fixed;transform:translate(-50%,-50%) rotate(0);transform-origin:center center;width:0;z-index:2147483645}#nuxt-devtools-anchor *{box-sizing:border-box}#nuxt-devtools-anchor button{background:none;border:none;color:inherit;cursor:pointer;margin:0;outline:none;padding:0}#nuxt-devtools-anchor .nuxt-devtools-label{align-items:center;display:flex;font-size:.8em;gap:3px;justify-items:center;line-height:1em;padding:0 7px 0 8px}#nuxt-devtools-anchor .nuxt-devtools-label .nuxt-devtools-label-main{opacity:.8}#nuxt-devtools-anchor .nuxt-devtools-label .nuxt-devtools-label-secondary{font-size:.8em;line-height:.6em;opacity:.5}#nuxt-devtools-anchor .nuxt-devtools-nuxt-button{flex:none}#nuxt-devtools-anchor.nuxt-devtools-vertical .nuxt-devtools-nuxt-button{transform:rotate(-90deg)}#nuxt-devtools-anchor.nuxt-devtools-vertical .nuxt-devtools-label{flex-direction:column;gap:2px;padding:0 10px;transform:rotate(-90deg)}#nuxt-devtools-anchor .nuxt-devtools-panel{align-items:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--nuxt-devtools-widget-bg);border:1px solid var(--nuxt-devtools-widget-border);border-radius:100px;box-shadow:2px 2px 8px var(--nuxt-devtools-widget-shadow);color:var(--nuxt-devtools-widget-fg);display:flex;gap:2px;height:30px;justify-content:flex-start;left:0;max-width:150px;overflow:hidden;padding:2px 2px 2px 2.5px;position:absolute;top:0;touch-action:none;transform:translate(-50%,-50%);transition:all .6s ease,max-width .6s ease,padding .5s ease,transform .4s ease,opacity .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}#nuxt-devtools-anchor.nuxt-devtools-hide .nuxt-devtools-panel{max-width:32px;padding:2px 0}#nuxt-devtools-anchor.nuxt-devtools-vertical .nuxt-devtools-panel{box-shadow:2px -2px 8px var(--nuxt-devtools-widget-shadow);transform:translate(-50%,-50%) rotate(90deg)}#nuxt-devtools-anchor .nuxt-devtools-panel-content{transition:opacity .4s ease}#nuxt-devtools-anchor.nuxt-devtools-hide .nuxt-devtools-panel-content{opacity:0}#nuxt-devtools-anchor .nuxt-devtools-icon-button{align-items:center;border-radius:100%;border-width:0;display:flex;height:30px;justify-content:center;opacity:.8;transition:opacity .2s ease-in-out;width:30px}#nuxt-devtools-anchor .nuxt-devtools-icon-button:hover{opacity:1}#nuxt-devtools-anchor:hover .nuxt-devtools-glowing{opacity:.6}#nuxt-devtools-anchor .nuxt-devtools-glowing{background-image:linear-gradient(45deg,#00dc82,#00dc82,#00dc82);border-radius:9999px;filter:blur(60px);height:160px;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transform:translate(-50%,-50%);transition:all 1s ease;width:160px;z-index:-1}@media print{#nuxt-devtools-anchor{display:none}}
|
|
422
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { Router } from 'vue-router';
|
|
3
|
+
declare const clientRef: import("vue").ShallowRef<any, any>;
|
|
4
|
+
export { clientRef as client };
|
|
5
|
+
export type ColorScheme = 'dark' | 'light';
|
|
6
|
+
export declare function setupDevToolsClient({ nuxt, clientHooks, timeMetric, router, }: {
|
|
7
|
+
nuxt: any;
|
|
8
|
+
clientHooks: any;
|
|
9
|
+
timeMetric: any;
|
|
10
|
+
router: Router;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
export declare function useClientColorMode(): Ref<ColorScheme>;
|