@nuxt/devtools 0.0.1 → 0.1.0

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 (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +242 -0
  3. package/cli.mjs +1 -1
  4. package/dist/chunks/index.mjs +47749 -0
  5. package/dist/chunks/module-main.mjs +8424 -0
  6. package/dist/chunks/vite-inspect.mjs +49 -0
  7. package/dist/chunks/vscode.mjs +40137 -0
  8. package/dist/chunks/vue-inspector.mjs +14 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.mjs +66 -0
  11. package/dist/client/200.html +7 -0
  12. package/dist/client/404.html +7 -0
  13. package/dist/client/__inspecting/index.html +7 -0
  14. package/dist/client/_nuxt/Badge.23dc2d8f.js +1 -0
  15. package/dist/client/_nuxt/ComponentItem.f7b53cb0.js +1 -0
  16. package/dist/client/_nuxt/ComponentItem.vue.d48d83d8.js +1 -0
  17. package/dist/client/_nuxt/ComponentsGraph.94420499.js +1 -0
  18. package/dist/client/_nuxt/ComponentsGraph.vue.687b60ce.js +1 -0
  19. package/dist/client/_nuxt/ComponentsList.27e171d0.js +1 -0
  20. package/dist/client/_nuxt/ComponentsList.vue.24e7149d.js +1 -0
  21. package/dist/client/_nuxt/ComposableItem.a0f590b3.js +1 -0
  22. package/dist/client/_nuxt/ComposableItem.vue.645a2668.js +1 -0
  23. package/dist/client/_nuxt/ComposableTree.08cf808f.js +1 -0
  24. package/dist/client/_nuxt/ComposableTree.vue.a160c715.js +1 -0
  25. package/dist/client/_nuxt/CurrentRoute.4a32c426.js +1 -0
  26. package/dist/client/_nuxt/Drawer.6d261f16.js +1 -0
  27. package/dist/client/_nuxt/Drawer.vue.4d7d190a.js +1 -0
  28. package/dist/client/_nuxt/DrawerItem.0c4e93e1.js +1 -0
  29. package/dist/client/_nuxt/DrawerItem.vue.30f032f8.js +1 -0
  30. package/dist/client/_nuxt/FileIcon.4f6c385a.js +1 -0
  31. package/dist/client/_nuxt/FileIcon.vue.e650fe14.js +1 -0
  32. package/dist/client/_nuxt/FilepathItem.6f861b0b.js +1 -0
  33. package/dist/client/_nuxt/FilepathItem.vue.fcbe3a7a.js +1 -0
  34. package/dist/client/_nuxt/HooksTable.e9c5c41d.js +1 -0
  35. package/dist/client/_nuxt/HooksTable.vue.93af23f8.js +1 -0
  36. package/dist/client/_nuxt/IconTitle.576c2413.js +1 -0
  37. package/dist/client/_nuxt/IconTitle.vue.909d2a6b.js +1 -0
  38. package/dist/client/_nuxt/IframeView.d58e614f.js +1 -0
  39. package/dist/client/_nuxt/IframeView.vue.46f9c325.js +1 -0
  40. package/dist/client/_nuxt/LaunchPage.7f56830a.js +1 -0
  41. package/dist/client/_nuxt/LaunchPage.vue.29133098.js +1 -0
  42. package/dist/client/_nuxt/ModuleItem.9523008d.js +1 -0
  43. package/dist/client/_nuxt/ModuleItem.vue.07190cb3.js +1 -0
  44. package/dist/client/_nuxt/ModuleTreeNode.040f6e05.js +1 -0
  45. package/dist/client/_nuxt/NButton.d5a0d397.js +1 -0
  46. package/dist/client/_nuxt/NButton.vue.3df758c5.js +1 -0
  47. package/dist/client/_nuxt/NCard.47038127.js +1 -0
  48. package/dist/client/_nuxt/NCheckbox.ec4f225e.js +1 -0
  49. package/dist/client/_nuxt/NCheckbox.vue.25b386b6.js +1 -0
  50. package/dist/client/_nuxt/NDarkToggle.46f06112.js +1 -0
  51. package/dist/client/_nuxt/NDarkToggle.vue.c227b1bd.js +1 -0
  52. package/dist/client/_nuxt/NDialog.09638209.js +7 -0
  53. package/dist/client/_nuxt/NDropdown.d94508d4.js +1 -0
  54. package/dist/client/_nuxt/NIcon.e9d8d4d5.js +1 -0
  55. package/dist/client/_nuxt/NIcon.vue.2481694f.js +1 -0
  56. package/dist/client/_nuxt/NLink.34fc60fd.js +1 -0
  57. package/dist/client/_nuxt/NLink.vue.17c2cd3a.js +1 -0
  58. package/dist/client/_nuxt/NRadio.a5c0205d.js +1 -0
  59. package/dist/client/_nuxt/NSwitch.4c2c96d6.js +1 -0
  60. package/dist/client/_nuxt/NSwitch.vue.36ec57ea.js +1 -0
  61. package/dist/client/_nuxt/NTextInput.3c1a9b08.js +1 -0
  62. package/dist/client/_nuxt/NTextInput.vue.2d3f9e19.js +1 -0
  63. package/dist/client/_nuxt/NTip.ff4fea4e.js +1 -0
  64. package/dist/client/_nuxt/Notification.f594eb13.js +1 -0
  65. package/dist/client/_nuxt/Notification.vue.b0304237.js +1 -0
  66. package/dist/client/_nuxt/NuxtContentLogo.1ca13565.js +1 -0
  67. package/dist/client/_nuxt/NuxtExampleLayout.904da69e.js +1 -0
  68. package/dist/client/_nuxt/NuxtLogo.acbeec62.js +1 -0
  69. package/dist/client/_nuxt/PluginItem.78f70695.js +1 -0
  70. package/dist/client/_nuxt/PluginItem.vue.a18a8580.js +1 -0
  71. package/dist/client/_nuxt/RoutePathItem.77ebd238.js +1 -0
  72. package/dist/client/_nuxt/RoutePathItem.vue.a16a2a5a.js +1 -0
  73. package/dist/client/_nuxt/RoutesTable.3a51b11e.js +1 -0
  74. package/dist/client/_nuxt/RoutesTable.vue.66423aa5.js +1 -0
  75. package/dist/client/_nuxt/SectionBlock.6bf10c9f.js +1 -0
  76. package/dist/client/_nuxt/SectionBlock.a75bb023.css +1 -0
  77. package/dist/client/_nuxt/Settings.ceefb680.js +1 -0
  78. package/dist/client/_nuxt/Settings.vue.6d6be237.js +1 -0
  79. package/dist/client/_nuxt/StateEditor.b25ca4bb.js +1 -0
  80. package/dist/client/_nuxt/StateEditor.f3649b84.css +1 -0
  81. package/dist/client/_nuxt/StateEditor.vue.4c95ce8f.js +135 -0
  82. package/dist/client/_nuxt/StateEditor.vue.94361847.js +1 -0
  83. package/dist/client/_nuxt/StateGroup.03356999.js +1 -0
  84. package/dist/client/_nuxt/StateGroup.vue.2dd6ea33.js +1 -0
  85. package/dist/client/_nuxt/TabIcon.0eec1314.js +1 -0
  86. package/dist/client/_nuxt/TabIcon.vue.8a3fdf6c.js +1 -0
  87. package/dist/client/_nuxt/UnoIcon.58399ac9.js +1 -0
  88. package/dist/client/_nuxt/__inspecting.06a43aaf.js +1 -0
  89. package/dist/client/_nuxt/_plugin-vue_export-helper.c27b6911.js +1 -0
  90. package/dist/client/_nuxt/app.config.a09258b3.js +1 -0
  91. package/dist/client/_nuxt/asyncData.0d07d609.js +1 -0
  92. package/dist/client/_nuxt/client-only.57dcb5bd.js +4 -0
  93. package/dist/client/_nuxt/client.ef9805ed.js +1 -0
  94. package/dist/client/_nuxt/color-mode-options.00c15dd1.js +1 -0
  95. package/dist/client/_nuxt/component.vue3.70214810.js +1 -0
  96. package/dist/client/_nuxt/components.238910b6.js +1 -0
  97. package/dist/client/_nuxt/components.bcdd3ff8.js +1 -0
  98. package/dist/client/_nuxt/components.client.73756aea.js +113 -0
  99. package/dist/client/_nuxt/composables.3d6ee8a2.js +1 -0
  100. package/dist/client/_nuxt/composables.7fd231ea.js +1 -0
  101. package/dist/client/_nuxt/context.dc73232e.js +1 -0
  102. package/dist/client/_nuxt/custom-_name_.3a92fd5f.js +1 -0
  103. package/dist/client/_nuxt/default.d86039a2.js +1 -0
  104. package/dist/client/_nuxt/dev-only.fb81821a.js +1 -0
  105. package/dist/client/_nuxt/editor.9a00fe97.js +1 -0
  106. package/dist/client/_nuxt/entry.1076cab0.js +1 -0
  107. package/dist/client/_nuxt/entry.53569115.css +1 -0
  108. package/dist/client/_nuxt/error-404.1469f10f.css +1 -0
  109. package/dist/client/_nuxt/error-404.f7be8ae4.js +1 -0
  110. package/dist/client/_nuxt/error-500.31030cf5.js +1 -0
  111. package/dist/client/_nuxt/error-500.92b94fae.css +1 -0
  112. package/dist/client/_nuxt/error-component.916ef420.js +3 -0
  113. package/dist/client/_nuxt/error.10b092f1.js +1 -0
  114. package/dist/client/_nuxt/fuse.esm.88e2763d.js +1 -0
  115. package/dist/client/_nuxt/hooks.03df1882.js +1 -0
  116. package/dist/client/_nuxt/icons.7b11eba5.js +1 -0
  117. package/dist/client/_nuxt/icons.d5925320.js +1 -0
  118. package/dist/client/_nuxt/icons.eca62571.js +1 -0
  119. package/dist/client/_nuxt/imports.0ab9b18e.js +1 -0
  120. package/dist/client/_nuxt/index.6cafd97e.js +1 -0
  121. package/dist/client/_nuxt/index.7c6751e3.js +1 -0
  122. package/dist/client/_nuxt/index.96e42b53.js +1 -0
  123. package/dist/client/_nuxt/index.a6656ecb.js +17 -0
  124. package/dist/client/_nuxt/index.adfbbcc3.js +1 -0
  125. package/dist/client/_nuxt/layout.50e89109.js +1 -0
  126. package/dist/client/_nuxt/layouts.22623cd4.js +1 -0
  127. package/dist/client/_nuxt/middleware.8875601d.js +1 -0
  128. package/dist/client/_nuxt/modules.4e9ddad7.js +1 -0
  129. package/dist/client/_nuxt/none.1c37aed4.js +1 -0
  130. package/dist/client/_nuxt/nuxt-error-boundary.fc4d7c25.js +1 -0
  131. package/dist/client/_nuxt/nuxt-link.724f8a66.js +1 -0
  132. package/dist/client/_nuxt/nuxt-loading-indicator.494ea32c.js +1 -0
  133. package/dist/client/_nuxt/overview.dca34e56.js +1 -0
  134. package/dist/client/_nuxt/page.8df04ed4.js +1 -0
  135. package/dist/client/_nuxt/pages.bdf1c147.js +1 -0
  136. package/dist/client/_nuxt/payload.8cf95895.js +1 -0
  137. package/dist/client/_nuxt/plugins.bb7d1e18.js +1 -0
  138. package/dist/client/_nuxt/rpc.65a41b65.js +1 -0
  139. package/dist/client/_nuxt/runtime-configs.e1c67255.js +1 -0
  140. package/dist/client/_nuxt/runtime-core.esm-bundler.5019e930.js +1 -0
  141. package/dist/client/_nuxt/runtime-dom.esm-bundler.b0076367.js +1 -0
  142. package/dist/client/_nuxt/server-placeholder.735ae8e9.js +1 -0
  143. package/dist/client/_nuxt/server-routes.ff745565.js +1 -0
  144. package/dist/client/_nuxt/state.5364a68a.js +1 -0
  145. package/dist/client/_nuxt/state.68f6a8e0.js +1 -0
  146. package/dist/client/_nuxt/storage.82519452.js +1 -0
  147. package/dist/client/_nuxt/unocss-runtime.cde2ffdd.js +2 -0
  148. package/dist/client/_nuxt/utils.3921fcc0.js +5 -0
  149. package/dist/client/_nuxt/utils.c2a3506b.js +1 -0
  150. package/dist/client/_nuxt/virtual-files.8b6129f7.js +9 -0
  151. package/dist/client/_nuxt/virtual-files.a8748389.css +1 -0
  152. package/dist/client/_nuxt/welcome.432c9232.js +1 -0
  153. package/dist/client/_nuxt/welcome.db724adb.css +1 -0
  154. package/dist/client/index.html +7 -0
  155. package/dist/client/modules/components/index.html +7 -0
  156. package/dist/client/modules/hooks/index.html +7 -0
  157. package/dist/client/modules/imports/index.html +7 -0
  158. package/dist/client/modules/layouts/index.html +7 -0
  159. package/dist/client/modules/middleware/index.html +7 -0
  160. package/dist/client/modules/modules/index.html +7 -0
  161. package/dist/client/modules/overview/index.html +7 -0
  162. package/dist/client/modules/pages/index.html +7 -0
  163. package/dist/client/modules/payload/index.html +7 -0
  164. package/dist/client/modules/plugins/index.html +7 -0
  165. package/dist/client/modules/runtime-configs/index.html +7 -0
  166. package/dist/client/modules/server-routes/index.html +7 -0
  167. package/dist/client/modules/virtual-files/index.html +7 -0
  168. package/dist/client/nuxt.svg +3 -0
  169. package/dist/dirs.d.ts +6 -0
  170. package/dist/dirs.mjs +9 -0
  171. package/dist/iframe-client.d.ts +13 -0
  172. package/dist/iframe-client.mjs +30 -0
  173. package/dist/module.cjs +5 -0
  174. package/dist/module.d.ts +33 -0
  175. package/dist/module.json +5 -0
  176. package/dist/module.mjs +6 -0
  177. package/dist/runtime/plugins/devtools.client.d.ts +2 -0
  178. package/dist/runtime/plugins/devtools.client.mjs +36 -0
  179. package/dist/runtime/plugins/view/Container.vue +95 -0
  180. package/dist/runtime/plugins/view/Frame.vue +270 -0
  181. package/dist/runtime/plugins/view/state.d.ts +10 -0
  182. package/dist/runtime/plugins/view/state.mjs +30 -0
  183. package/dist/runtime/plugins/view/utils.d.ts +4 -0
  184. package/dist/runtime/plugins/view/utils.mjs +39 -0
  185. package/dist/runtime/shared/hooks.d.ts +3 -0
  186. package/dist/runtime/shared/hooks.mjs +32 -0
  187. package/dist/shared/devtools.34d9e53a.mjs +68 -0
  188. package/dist/shared/devtools.7127abb3.mjs +4 -0
  189. package/dist/shared/devtools.8467d016.mjs +1504 -0
  190. package/dist/shared/devtools.861712a3.mjs +337 -0
  191. package/dist/types.d.ts +313 -0
  192. package/dist/types.mjs +1 -0
  193. package/iframe-client.d.ts +1 -0
  194. package/package.json +104 -2
  195. package/types.d.ts +1 -0
@@ -0,0 +1,270 @@
1
+ <script setup lang="ts">
2
+ import type { VueInspectorClient } from 'vite-plugin-vue-inspector'
3
+ import type { PropType } from 'vue'
4
+ import { computed, ref, watch, watchEffect } from 'vue'
5
+ import type { NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, NuxtDevtoolsGlobal as NuxtDevtoolsViewGlobal } from '../../../types'
6
+ import { PANEL_MAX, PANEL_MIN, PANEL_PADDING, closePanel, state, viewMode } from './state'
7
+ import { useEventListener } from './utils'
8
+
9
+ // Can't use reactivity transform here because this file is shipped as-is,
10
+ // where we can't guarantee that the user has the reactivity transform enabled.
11
+ // Same for not using auto imports.
12
+ const props = defineProps({
13
+ client: Object as PropType<NuxtDevtoolsHostClient>,
14
+ })
15
+
16
+ const CLIENT_PATH = '/__nuxt_devtools__/client'
17
+
18
+ const initialUrl = CLIENT_PATH + state.value.route
19
+ 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
+
56
+ async function onLoad() {
57
+ await waitForClientInjection()
58
+ setupClient()
59
+ }
60
+
61
+ function waitForClientInjection(retry = 10, timeout = 200) {
62
+ const test = () => !!iframe.value?.contentWindow?.__NUXT_DEVTOOLS_VIEW__
63
+
64
+ if (test())
65
+ return
66
+
67
+ return new Promise<void>((resolve, reject) => {
68
+ const interval = setInterval(() => {
69
+ if (test()) {
70
+ clearInterval(interval)
71
+ resolve()
72
+ }
73
+ else if (retry-- <= 0) {
74
+ clearInterval(interval)
75
+ // eslint-disable-next-line prefer-promise-reject-errors
76
+ reject('Nuxt Devtools client injection failed')
77
+ }
78
+ }, timeout)
79
+ })
80
+ }
81
+
82
+ function setupClient() {
83
+ // trigger update for payload change
84
+ watch(() => props.client?.nuxt.payload, () => {
85
+ props.client!.hooks.callHook('host:update:reactivity')
86
+ }, { deep: true })
87
+
88
+ // trigger update for route change
89
+ props.client?.nuxt.vueApp.config.globalProperties?.$router?.afterEach(() => {
90
+ props.client!.hooks.callHook('host:update:reactivity')
91
+ })
92
+
93
+ updateClient()
94
+ }
95
+
96
+ function updateClient() {
97
+ const injection = iframe.value?.contentWindow?.__NUXT_DEVTOOLS_VIEW__ as NuxtDevtoolsViewGlobal
98
+ const componentInspector = window.__VUE_INSPECTOR__ as VueInspectorClient
99
+
100
+ if (componentInspector) {
101
+ componentInspector.openInEditor = async (baseUrl, file, line, column) => {
102
+ await props.client!.hooks.callHook('host:inspector:click', baseUrl, file, line, column)
103
+ disableComponentInspector()
104
+ }
105
+ componentInspector.onUpdated = () => {
106
+ props.client!.hooks.callHook('host:inspector:update', {
107
+ ...componentInspector.linkParams,
108
+ ...componentInspector.position,
109
+ })
110
+ }
111
+ }
112
+
113
+ injection?.setClient({
114
+ ...props.client as any,
115
+ inspector: {
116
+ enable: enableComponentInspector,
117
+ instance: componentInspector,
118
+ },
119
+ })
120
+
121
+ props.client?.hooks.hook('devtools:navigate', (path) => {
122
+ state.value.route = path
123
+ })
124
+ }
125
+
126
+ function enableComponentInspector() {
127
+ window.__VUE_INSPECTOR__?.enable()
128
+ viewMode.value = 'component-inspector'
129
+ }
130
+
131
+ function disableComponentInspector() {
132
+ window.__VUE_INSPECTOR__?.disable()
133
+ props.client?.hooks.callHook('host:inspector:close')
134
+ if (viewMode.value === 'component-inspector')
135
+ viewMode.value = 'default'
136
+ }
137
+
138
+ useEventListener(window, 'mousemove', (e: MouseEvent) => {
139
+ if (!isDragging.value)
140
+ return
141
+
142
+ const alignSide = state.value.position === 'left' || state.value.position === 'right'
143
+
144
+ if (isDragging.value === 'horizontal' || isDragging.value === 'both') {
145
+ const y = state.value.position === 'top'
146
+ ? window.innerHeight - e.clientY
147
+ : e.clientY
148
+ const boxHeight = window.innerHeight - PANEL_PADDING * 2
149
+ const value = alignSide
150
+ ? (Math.abs(y - (window.innerHeight / 2)) - PANEL_PADDING) / boxHeight * 100 * 2
151
+ : (window.innerHeight - y - PANEL_PADDING) / boxHeight * 100
152
+ state.value.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
153
+ }
154
+
155
+ if (isDragging.value === 'vertical' || isDragging.value === 'both') {
156
+ const x = state.value.position === 'left'
157
+ ? window.innerWidth - e.clientX
158
+ : e.clientX
159
+ const boxWidth = window.innerWidth - PANEL_PADDING * 2
160
+ const value = alignSide
161
+ ? (window.innerWidth - x - PANEL_PADDING) / boxWidth * 100
162
+ : (Math.abs(x - (window.innerWidth / 2)) - PANEL_PADDING) / boxWidth * 100 * 2
163
+ state.value.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, value))
164
+ }
165
+ })
166
+
167
+ useEventListener(window, 'mouseup', () => {
168
+ isDragging.value = false
169
+ })
170
+
171
+ useEventListener(window, 'mouseleave', () => {
172
+ isDragging.value = false
173
+ })
174
+
175
+ useEventListener(window, 'keydown', (e: KeyboardEvent) => {
176
+ if (e.key === 'Escape')
177
+ closePanel()
178
+ })
179
+
180
+ watch(viewMode, (mode) => {
181
+ if (mode === 'component-inspector')
182
+ enableComponentInspector()
183
+ else
184
+ disableComponentInspector()
185
+ }, { immediate: true })
186
+
187
+ watchEffect(() => {
188
+ if (!state.value.open)
189
+ iframe.value?.blur()
190
+ else
191
+ iframe.value?.focus()
192
+ })
193
+ </script>
194
+
195
+ <script lang="ts">
196
+ declare global {
197
+ interface Window {
198
+ __NUXT_DEVTOOLS_VIEW__?: NuxtDevtoolsViewGlobal
199
+ __NUXT_DEVTOOLS__?: NuxtDevtoolsIframeClient
200
+ __VUE_INSPECTOR__?: VueInspectorClient
201
+ }
202
+ }
203
+ </script>
204
+
205
+ <template>
206
+ <div v-show="state.open" class="frame" :style="frameStyle">
207
+ <iframe
208
+ ref="iframe"
209
+ :src="initialUrl"
210
+ :style="{
211
+ 'pointer-events': isDragging ? 'none' : 'auto',
212
+ }"
213
+ @load="onLoad"
214
+ />
215
+ <template v-if="viewMode === 'default'">
216
+ <div v-if="state.position !== 'top'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ top: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
217
+ <div v-if="state.position !== 'bottom'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-horizontal" :style="{ bottom: 0 }" @mousedown.prevent="() => isDragging = 'horizontal'" />
218
+ <div v-if="state.position !== 'left'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ left: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
219
+ <div v-if="state.position !== 'right'" class="nuxt-devtools-resize-handle nuxt-devtools-resize-handle-vertical" :style="{ right: 0 }" @mousedown.prevent="() => isDragging = 'vertical'" />
220
+ <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'" />
221
+ <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'" />
222
+ <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'" />
223
+ <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'" />
224
+ </template>
225
+ </div>
226
+ </template>
227
+
228
+ <style scoped>
229
+ .frame {
230
+ position: fixed;
231
+ z-index: 2147483646;
232
+ }
233
+
234
+ .frame iframe {
235
+ width: 100%;
236
+ height: 100%;
237
+ outline: none;
238
+ border: 1px solid rgba(125,125,125,0.2);
239
+ border-radius: 0.5rem;
240
+ }
241
+
242
+ .nuxt-devtools-resize-handle-horizontal {
243
+ position: absolute;
244
+ left: 6px;
245
+ right: 6px;
246
+ height: 10px;
247
+ margin: -5px 0;
248
+ cursor: ns-resize;
249
+ border-radius: 5px;
250
+ }
251
+ .nuxt-devtools-resize-handle-vertical {
252
+ position: absolute;
253
+ top: 6px;
254
+ bottom: 0;
255
+ width: 10px;
256
+ margin: 0 -5px;
257
+ cursor: ew-resize;
258
+ border-radius: 5px;
259
+ }
260
+ .nuxt-devtools-resize-handle-corner {
261
+ position: absolute;
262
+ width: 14px;
263
+ height: 14px;
264
+ margin: -6px;
265
+ border-radius: 6px;
266
+ }
267
+ .nuxt-devtools-resize-handle:hover {
268
+ background: rgba(125,125,125,0.1);
269
+ }
270
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { DevToolsFrameState } from '../../../types';
2
+ export declare const PANEL_PADDING = 10;
3
+ export declare const PANEL_MIN = 15;
4
+ export declare const PANEL_MAX = 100;
5
+ export type ViewMode = 'default' | 'component-inspector';
6
+ export declare const viewMode: import("vue").Ref<ViewMode>;
7
+ export declare const state: import("vue").Ref<DevToolsFrameState>;
8
+ export declare function togglePanel(): void;
9
+ export declare function closePanel(): void;
10
+ export declare function openPanel(): void;
@@ -0,0 +1,30 @@
1
+ import { ref } from "vue";
2
+ import { useObjectStorage } from "./utils.mjs";
3
+ export const PANEL_PADDING = 10;
4
+ export const PANEL_MIN = 15;
5
+ export const PANEL_MAX = 100;
6
+ export const viewMode = ref("default");
7
+ export const state = useObjectStorage("nuxt-devtools-frame-state", {
8
+ width: 80,
9
+ height: 60,
10
+ bottom: 0,
11
+ left: 0,
12
+ open: false,
13
+ route: "/",
14
+ position: "bottom"
15
+ });
16
+ export function togglePanel() {
17
+ if (state.value.open)
18
+ closePanel();
19
+ else
20
+ openPanel();
21
+ }
22
+ export function closePanel() {
23
+ if (viewMode.value !== "default")
24
+ viewMode.value = "default";
25
+ else
26
+ state.value.open = false;
27
+ }
28
+ export function openPanel() {
29
+ state.value.open = true;
30
+ }
@@ -0,0 +1,4 @@
1
+ import type { Ref } from 'vue';
2
+ export declare function useObjectStorage<T>(key: string, initial: T): Ref<T>;
3
+ export declare function useTransform<F, T>(data: Ref<F>, to: (data: F) => T, from: (data: T) => F): Ref<T>;
4
+ export declare function useEventListener(target: EventTarget, type: string, listener: any, options?: boolean | AddEventListenerOptions): void;
@@ -0,0 +1,39 @@
1
+ import { computed, getCurrentScope, onScopeDispose, ref, watch } from "vue";
2
+ export function useObjectStorage(key, initial) {
3
+ const raw = localStorage.getItem(key);
4
+ const data = ref(raw ? JSON.parse(raw) : initial);
5
+ for (const key2 in initial) {
6
+ if (data.value[key2] === void 0)
7
+ data.value[key2] = initial[key2];
8
+ }
9
+ let updating = false;
10
+ let wrote = "";
11
+ watch(data, (value) => {
12
+ if (updating)
13
+ return;
14
+ wrote = JSON.stringify(value);
15
+ localStorage.setItem(key, wrote);
16
+ }, { deep: true, flush: "sync" });
17
+ useEventListener(window, "storage", (e) => {
18
+ if (e.key === key && e.newValue && e.newValue !== wrote) {
19
+ updating = true;
20
+ data.value = JSON.parse(e.newValue);
21
+ updating = false;
22
+ }
23
+ });
24
+ return data;
25
+ }
26
+ export function useTransform(data, to, from) {
27
+ return computed({
28
+ get() {
29
+ return to(data.value);
30
+ },
31
+ set(value) {
32
+ data.value = from(value);
33
+ }
34
+ });
35
+ }
36
+ export function useEventListener(target, type, listener, options) {
37
+ target.addEventListener(type, listener, options);
38
+ getCurrentScope() && onScopeDispose(() => target.removeEventListener(type, listener, options));
39
+ }
@@ -0,0 +1,3 @@
1
+ import type { Hookable } from 'hookable';
2
+ import type { HookInfo } from '../../types';
3
+ export declare function setupHooksDebug<T extends Hookable<any>>(hooks: T): Record<string, HookInfo>;
@@ -0,0 +1,32 @@
1
+ export function setupHooksDebug(hooks) {
2
+ const serverHooks = {};
3
+ hooks.beforeEach((event) => {
4
+ if (!serverHooks[event.name]) {
5
+ serverHooks[event.name] = {
6
+ name: event.name,
7
+ start: performance.now(),
8
+ // @ts-expect-error private field
9
+ listeners: hooks._hooks[event.name]?.length || 0,
10
+ executions: []
11
+ };
12
+ } else {
13
+ const hook = serverHooks[event.name];
14
+ if (hook.duration != null)
15
+ hook.executions.push(hook.duration);
16
+ hook.start = performance.now();
17
+ hook.end = void 0;
18
+ hook.duration = void 0;
19
+ }
20
+ });
21
+ hooks.afterEach((event) => {
22
+ const hook = serverHooks[event.name];
23
+ if (!hook)
24
+ return;
25
+ hook.end = performance.now();
26
+ hook.duration = hook.end - hook.start;
27
+ const listeners = hooks._hooks[event.name]?.length;
28
+ if (listeners != null)
29
+ hook.listeners = listeners;
30
+ });
31
+ return serverHooks;
32
+ }
@@ -0,0 +1,68 @@
1
+ import { defineNuxtModule } from '@nuxt/kit';
2
+ import require$$0__default from 'fs';
3
+ import { g as globalDirs$1 } from './devtools.861712a3.mjs';
4
+ import require$$1 from 'path';
5
+
6
+
7
+
8
+ // -- Unbuild CommonJS Shims --
9
+ import __cjs_url__ from 'url';
10
+ import __cjs_path__ from 'path';
11
+ import __cjs_mod__ from 'module';
12
+ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
13
+ const __dirname = __cjs_path__.dirname(__filename);
14
+ const require = __cjs_mod__.createRequire(import.meta.url);
15
+ const path = require$$1;
16
+
17
+ var isPathInside$1 = (childPath, parentPath) => {
18
+ const relation = path.relative(parentPath, childPath);
19
+ return Boolean(
20
+ relation &&
21
+ relation !== '..' &&
22
+ !relation.startsWith(`..${path.sep}`) &&
23
+ relation !== path.resolve(childPath)
24
+ );
25
+ };
26
+
27
+ const fs = require$$0__default;
28
+ const globalDirs = globalDirs$1;
29
+ const isPathInside = isPathInside$1;
30
+
31
+ var isInstalledGlobally = (() => {
32
+ try {
33
+ return (
34
+ isPathInside(__dirname, globalDirs.yarn.packages) ||
35
+ isPathInside(__dirname, fs.realpathSync(globalDirs.npm.packages))
36
+ );
37
+ } catch {
38
+ return false;
39
+ }
40
+ })();
41
+
42
+ const module = defineNuxtModule({
43
+ meta: {
44
+ name: "@nuxt/devtools",
45
+ configKey: "devtools"
46
+ },
47
+ defaults: {
48
+ enabled: void 0,
49
+ vscode: {
50
+ enabled: true,
51
+ startOnBoot: false,
52
+ port: 3080,
53
+ reuseExistingServer: true
54
+ }
55
+ },
56
+ setup(options, nuxt) {
57
+ if (options.enabled === false)
58
+ return;
59
+ if (isInstalledGlobally) {
60
+ const globalOptions = nuxt.options.devtoolsGlobal || {};
61
+ if (options.enabled !== true && !globalOptions.projects?.includes(nuxt.options.rootDir))
62
+ return;
63
+ }
64
+ return import('../chunks/module-main.mjs').then(function (n) { return n.m; }).then(({ enableModule }) => enableModule(options, nuxt));
65
+ }
66
+ });
67
+
68
+ export { isInstalledGlobally as i, module as m };
@@ -0,0 +1,4 @@
1
+ const name = "@nuxt/devtools";
2
+ const version = "0.1.0";
3
+
4
+ export { name as n, version as v };