vite-plugin-vue-devtools 1.0.0-rc.8 → 7.0.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.
Files changed (79) hide show
  1. package/README.md +8 -172
  2. package/dist/client/assets/css-a-KJtBLB.js +505 -0
  3. package/dist/client/assets/diff--l9-nN5b.js +1 -0
  4. package/dist/client/assets/html-5-AIf93y.js +74 -0
  5. package/dist/client/assets/index-NNrCE7Vx.css +1 -0
  6. package/dist/client/assets/index-oq63TS6O.js +1080 -0
  7. package/dist/client/assets/javascript-Of8SnKfU.js +699 -0
  8. package/dist/client/assets/json-t1qiHl76.js +25 -0
  9. package/dist/client/assets/onig-mBJmD8D5.js +1 -0
  10. package/dist/client/assets/shellscript-h1L64xId.js +4 -0
  11. package/dist/client/assets/typescript-b1Nw_bQe.js +666 -0
  12. package/dist/client/assets/unocss-runtime-kftsoZPE.js +2 -0
  13. package/dist/client/assets/vitesse-dark-5VceXvs6.js +1 -0
  14. package/dist/client/assets/vitesse-light-HOMMxGxw.js +1 -0
  15. package/dist/client/assets/vue-apis-Nh9IahXf.js +1 -0
  16. package/dist/client/assets/vue-html-eJ6eRCYJ.js +1 -0
  17. package/dist/client/assets/vue-nOwTje1i.js +2002 -0
  18. package/dist/client/assets/yaml-FtfhlYqU.js +200 -0
  19. package/dist/client/color-scheme.js +6 -0
  20. package/dist/client/index.html +13 -21
  21. package/dist/vite.cjs +116 -13794
  22. package/dist/vite.d.cts +6 -9
  23. package/dist/vite.d.mts +6 -9
  24. package/dist/vite.d.ts +6 -9
  25. package/dist/vite.mjs +113 -13774
  26. package/package.json +18 -19
  27. package/src/overlay/devtools-overlay.css +1 -0
  28. package/src/overlay/devtools-overlay.js +4 -0
  29. package/src/overlay.js +77 -0
  30. package/README.zh-CN.md +0 -186
  31. package/client.d.ts +0 -63
  32. package/dist/client/assets/DrawerRight.vue_vue_type_script_setup_true_lang-99688d1e.js +0 -81
  33. package/dist/client/assets/IconButton.vue_vue_type_script_setup_true_lang-48a6bea2.js +0 -26
  34. package/dist/client/assets/IconTitle.vue_vue_type_script_setup_true_lang-adb17252.js +0 -30
  35. package/dist/client/assets/IframeView.vue_vue_type_script_setup_true_lang-4ccdbf42.js +0 -96
  36. package/dist/client/assets/PanelGrids-664603ce.js +0 -15
  37. package/dist/client/assets/SectionBlock-0024395a.css +0 -18
  38. package/dist/client/assets/SectionBlock-04b7ab1e.js +0 -109
  39. package/dist/client/assets/StateFields.vue_vue_type_script_setup_true_lang-48cf50ad.js +0 -381
  40. package/dist/client/assets/Switch.vue_vue_type_script_setup_true_lang-d74bf986.js +0 -87
  41. package/dist/client/assets/TextInput.vue_vue_type_script_setup_true_lang-65c09c69.js +0 -38
  42. package/dist/client/assets/__eyedropper-7bbec9b2.js +0 -149
  43. package/dist/client/assets/_commonjsHelpers-7e83dbf2.js +0 -34
  44. package/dist/client/assets/assets-641818bf.js +0 -1597
  45. package/dist/client/assets/component-docs-7bd37475.js +0 -195
  46. package/dist/client/assets/components-b0181ea4.js +0 -790
  47. package/dist/client/assets/data-8729d21a.js +0 -399
  48. package/dist/client/assets/dayjs.min-f03ccd82.js +0 -13
  49. package/dist/client/assets/documentations-7cba8670.js +0 -276
  50. package/dist/client/assets/fuse.esm-c317b696.js +0 -1782
  51. package/dist/client/assets/graph-edf83976.js +0 -52092
  52. package/dist/client/assets/index-77d53487.js +0 -18551
  53. package/dist/client/assets/index-b5475fe0.css +0 -482
  54. package/dist/client/assets/inspect-d17224a9.js +0 -20
  55. package/dist/client/assets/jse-theme-dark-333a4654.js +0 -1565
  56. package/dist/client/assets/jse-theme-dark-351d62d5.css +0 -114
  57. package/dist/client/assets/npm-076ecb7c.js +0 -550
  58. package/dist/client/assets/npm-832f3f2c.css +0 -209
  59. package/dist/client/assets/overview-d99e7f18.js +0 -303
  60. package/dist/client/assets/pages-fca7d8d3.js +0 -561
  61. package/dist/client/assets/pinia-3f5b6c57.js +0 -108
  62. package/dist/client/assets/pinia-7ed2c830.svg +0 -1
  63. package/dist/client/assets/rerender-trace-3afd48a1.css +0 -14
  64. package/dist/client/assets/rerender-trace-5fc6fb22.js +0 -436
  65. package/dist/client/assets/routes-9567a43f.js +0 -132
  66. package/dist/client/assets/settings-5a2e184c.js +0 -9652
  67. package/dist/client/assets/settings-7bce89ae.css +0 -11
  68. package/dist/client/assets/splitpanes.es-26cdc434.js +0 -343
  69. package/dist/client/assets/timeline-20d79e43.js +0 -1480
  70. package/dist/client/assets/timeline-b315b2e0.css +0 -1
  71. package/dist/client/assets/vue-5d4e674c.svg +0 -1
  72. package/dist/client/assets/vueuse-995374f6.svg +0 -1
  73. package/src/app.js +0 -4
  74. package/src/views/ComponentInspector.vue +0 -68
  75. package/src/views/FrameBox.vue +0 -231
  76. package/src/views/Main.vue +0 -435
  77. package/src/views/RerenderIndicator.vue +0 -37
  78. package/src/views/composables.ts +0 -630
  79. package/src/views/utils.ts +0 -241
@@ -1,435 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, ref } from 'vue'
3
-
4
- // @ts-expect-error virtual module
5
- import vueDevToolsOptions from 'virtual:vue-devtools-options'
6
- import { DevToolsHooks, collectDevToolsHookBuffer } from '@vite-plugin-vue-devtools/core'
7
- import Frame from './FrameBox.vue'
8
- import ComponentInspector from './ComponentInspector.vue'
9
- import { useHighlightComponent, useIframe, useInspector, usePanelVisible, usePiPMode, usePosition, useRerenderHighlight } from './composables'
10
- import { checkIsSafari, useColorScheme, usePreferredColorScheme, warn } from './utils'
11
- import RerenderIndicator from './RerenderIndicator.vue'
12
-
13
- const props = defineProps({
14
- hook: {
15
- type: Object,
16
- required: true,
17
- },
18
- })
19
-
20
- const hook = props.hook
21
-
22
- const { hookBuffer, collect } = collectDevToolsHookBuffer()
23
-
24
- let isAppCreated = false
25
- const panelState = ref<{
26
- viewMode: ViewMode
27
- }>({
28
- viewMode: 'default',
29
- })
30
-
31
- const { togglePanelVisible, closePanel, panelVisible } = usePanelVisible()
32
- const panelEl = ref<HTMLDivElement>()
33
- const { onPointerDown, bringUp, anchorStyle, iframeStyle, isDragging, isVertical, isHidden, panelStyle } = usePosition(panelEl)
34
- const vars = computed(() => {
35
- const colorScheme = useColorScheme()
36
- const dark = colorScheme.value === 'auto'
37
- ? usePreferredColorScheme().value === 'dark'
38
- : colorScheme.value === 'dark'
39
- return {
40
- '--vue-devtools-widget-bg': dark ? '#111' : '#ffffff',
41
- '--vue-devtools-widget-fg': dark ? '#F5F5F5' : '#111',
42
- '--vue-devtools-widget-border': dark ? '#3336' : '#efefef',
43
- '--vue-devtools-widget-shadow': dark ? 'rgba(0,0,0,0.3)' : 'rgba(128,128,128,0.1)',
44
- }
45
- })
46
-
47
- function waitForClientInjection(iframe: HTMLIFrameElement, retry = 50, timeout = 200): Promise<void> | void {
48
- const test = () => !!iframe?.contentWindow?.__VUE_DEVTOOLS_VIEW__ && isAppCreated
49
-
50
- if (test())
51
- return
52
-
53
- return new Promise((resolve, reject) => {
54
- const interval = setInterval(() => {
55
- if (test()) {
56
- clearInterval(interval)
57
- resolve()
58
- }
59
- else if (retry-- <= 0) {
60
- clearInterval(interval)
61
- reject(Error('Vue DevTools client injection failed'))
62
- }
63
- }, timeout)
64
- })
65
- }
66
-
67
- const {
68
- toggleInspector, inspectorLoaded,
69
- inspectorEnabled, disableInspector,
70
- openInEditor, waitForInspectorInit,
71
- } = useInspector()
72
-
73
- const clientUrl = `${vueDevToolsOptions.base || '/'}__devtools__/`
74
- const { iframe, getIframe } = useIframe(clientUrl, async () => {
75
- const iframe = getIframe()
76
- await waitForClientInjection(iframe)
77
- setupClient(iframe)
78
- })
79
-
80
- // Picture-in-Picture mode
81
- const { popup } = usePiPMode(getIframe, hook)
82
- const { overlayVisible, name: componentName, bounds, highlight, unHighlight, stopInspect, startInspect } = useHighlightComponent()
83
- const { updateRerenderHighlightInfo } = useRerenderHighlight()
84
-
85
- async function setupClient(iframe: HTMLIFrameElement) {
86
- const injection: any = iframe?.contentWindow?.__VUE_DEVTOOLS_VIEW__
87
- if (!inspectorLoaded.value)
88
- waitForInspectorInit()
89
-
90
- injection.setClient({
91
- hook,
92
- hookBuffer,
93
- panel: {
94
- toggleViewMode: (mode?: ViewMode) => {
95
- panelState.value.viewMode = mode ?? 'default'
96
- },
97
- toggle: togglePanelVisible,
98
- popup,
99
- },
100
- openInEditor: openInEditor.value ?? (() => {
101
- warn('Unable to load inspector, open-in-editor is not available.')
102
- }),
103
- componentInspector: {
104
- highlight,
105
- unHighlight,
106
- startInspect,
107
- stopInspect,
108
- scrollToComponent(bounds) {
109
- const scrollTarget = document.createElement('div')
110
- scrollTarget.style.position = 'absolute'
111
- scrollTarget.style.width = `${Math.round(bounds.width * 100) / 100}px`
112
- scrollTarget.style.height = `${Math.round(bounds.height * 100) / 100}px`
113
- scrollTarget.style.top = `${Math.round(bounds.top * 100) / 100}px`
114
- scrollTarget.style.left = `${Math.round(bounds.left * 100) / 100}px`
115
- document.body.appendChild(scrollTarget)
116
- scrollTarget.scrollIntoView({
117
- behavior: 'smooth',
118
- })
119
- setTimeout(() => {
120
- document.body.removeChild(scrollTarget)
121
- }, 2000)
122
- },
123
- },
124
- rerenderHighlight: {
125
- updateInfo: updateRerenderHighlightInfo,
126
- },
127
- })
128
- }
129
-
130
- function collectDynamicRoute(app) {
131
- const router = app?.config?.globalProperties?.$router
132
- if (!router)
133
- return
134
-
135
- const _addRoute = router.addRoute
136
- router.addRoute = (...args) => {
137
- const res = _addRoute(...args)
138
-
139
- if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
140
- collect(DevToolsHooks.ADD_ROUTE, {
141
- args: [...args],
142
- })
143
- }
144
-
145
- return res
146
- }
147
-
148
- const _removeRoute = router.removeRoute
149
- router.removeRoute = (...args) => {
150
- const res = _removeRoute(...args)
151
-
152
- if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
153
- collect(DevToolsHooks.REMOVE_ROUTE, {
154
- args: [...args],
155
- })
156
- }
157
-
158
- return res
159
- }
160
- }
161
-
162
- function collectHookBuffer() {
163
- // const sortId = 0
164
-
165
- function stopCollect(component) {
166
- return component?.root?.type?.devtools?.hide || iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded
167
- }
168
-
169
- hook.on(DevToolsHooks.APP_INIT, (app) => {
170
- if (!app || app._instance.type?.devtools?.hide)
171
- return
172
-
173
- collectDynamicRoute(app)
174
- collect(DevToolsHooks.APP_INIT, {
175
- app,
176
- })
177
- setTimeout(() => {
178
- isAppCreated = true
179
- }, 80)
180
- });
181
-
182
- // close perf to avoid performance issue (#9)
183
- // hook.on(DevToolsHooks.PERF_START, (app, uid, component, type, time) => {
184
- // if (stopCollect(component))
185
- // return
186
-
187
- // collect(DevToolsHooks.COMPONENT_EMIT, {
188
- // now: Date.now(),
189
- // app,
190
- // uid,
191
- // component,
192
- // type,
193
- // time,
194
- // sortId: sortId++,
195
- // })
196
- // })
197
- // hook.on(DevToolsHooks.PERF_END, (app, uid, component, type, time) => {
198
- // if (stopCollect(component))
199
- // return
200
-
201
- // collect(DevToolsHooks.PERF_END, {
202
- // now: Date.now(),
203
- // app,
204
- // uid,
205
- // component,
206
- // type,
207
- // time,
208
- // sortId: sortId++,
209
- // })
210
- // })
211
-
212
- [
213
- DevToolsHooks.COMPONENT_UPDATED,
214
- DevToolsHooks.COMPONENT_ADDED,
215
- DevToolsHooks.COMPONENT_REMOVED,
216
- DevToolsHooks.COMPONENT_EMIT,
217
- ].forEach((item) => {
218
- hook.on(item, (app, uid, parentUid, component) => {
219
- if (!app || (typeof uid !== 'number' && !uid) || !component || stopCollect(component))
220
- return
221
-
222
- collect(item, {
223
- app, uid, parentUid, component,
224
- })
225
- })
226
- })
227
- }
228
-
229
- // init
230
- collectHookBuffer()
231
- </script>
232
-
233
- <template>
234
- <div
235
- id="vue-devtools-anchor"
236
- :style="[anchorStyle, vars]"
237
- :class="{
238
- 'vue-devtools-vertical': isVertical,
239
- 'vue-devtools-hide': isHidden,
240
- 'fullscreen': panelState.viewMode === 'fullscreen',
241
- }"
242
- @mousemove="bringUp"
243
- >
244
- <!-- toggle button -->
245
- <div v-if="!checkIsSafari()" class="vue-devtools-glowing" :style="isDragging ? 'opacity: 0.6 !important' : ''" />
246
- <div ref="panelEl" class="vue-devtools-panel" :style="panelStyle" @pointerdown="onPointerDown">
247
- <div
248
- class="vue-devtools-icon-button vue-devtools-vue-button"
249
- title="Toggle Vue DevTools" aria-label="Toggle devtools panel"
250
- :style="panelVisible ? '' : 'filter:saturate(0)'"
251
- @click="togglePanelVisible"
252
- >
253
- <svg viewBox="0 0 256 198" fill="none" xmlns="http://www.w3.org/2000/svg">
254
- <path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z" />
255
- <path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z" />
256
- <path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z" />
257
- </svg>
258
- </div>
259
- <div style="border-left: 1px solid #8883;width:1px;height:10px;" class="vue-devtools-panel-content" />
260
- <div
261
- class="vue-devtools-icon-button vue-devtools-panel-content vue-devtools-inspector-button"
262
- :class="{ disabled: !inspectorLoaded }"
263
- :disabled="!inspectorLoaded"
264
- title="Toggle Component Inspector" @click="toggleInspector"
265
- >
266
- <svg
267
- xmlns="http://www.w3.org/2000/svg"
268
- style="height: 1.1em; width: 1.1em; opacity:0.5;"
269
- :style="inspectorEnabled ? 'opacity:1;color:#00dc82' : ''"
270
- viewBox="0 0 24 24"
271
- >
272
- <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>
273
- </svg>
274
- </div>
275
- </div>
276
- <!-- iframe -->
277
- <Frame
278
- :style="iframeStyle" :is-dragging="isDragging"
279
- :client="{
280
- close: closePanel,
281
- inspector: {
282
- disable: disableInspector,
283
- isEnabled: ref(inspectorEnabled),
284
- },
285
- getIFrame: getIframe,
286
- }"
287
- :view-mode="panelState.viewMode"
288
- />
289
- </div>
290
- <!-- component inspector -->
291
- <ComponentInspector v-if="overlayVisible && bounds" :bounds="bounds" :name="componentName" />
292
- <RerenderIndicator />
293
- </template>
294
-
295
- <style scoped>
296
- #vue-devtools-anchor {
297
- position: fixed;
298
- z-index: 2147483645;
299
- transform-origin: center center;
300
- transform: translate(-50%, -50%) rotate(0);
301
- }
302
- #vue-devtools-anchor.fullscreen {
303
- transform: none !important;
304
- left: 0 !important;
305
- }
306
-
307
- #vue-devtools-anchor .vue-devtools-icon-button {
308
- border: none;
309
- background: none;
310
- padding: 0;
311
- margin: 0;
312
- cursor: pointer;
313
- outline: none;
314
- color: inherit;
315
- }
316
-
317
- #vue-devtools-anchor.vue-devtools-hide .vue-devtools-panel {
318
- max-width: 32px;
319
- padding: 2px 0;
320
- }
321
-
322
- #vue-devtools-anchor .vue-devtools-panel-content {
323
- transition: opacity 0.4s ease;
324
- }
325
-
326
- #vue-devtools-anchor .vue-devtools-hide .vue-devtools-panel-content {
327
- opacity: 0;
328
- }
329
-
330
- #vue-devtools-anchor .vue-devtools-glowing {
331
- position: absolute;
332
- left: 0;
333
- top: 0;
334
- transform: translate(-50%, -50%);
335
- width: 160px;
336
- height: 160px;
337
- opacity: 0;
338
- transition: all 1s ease;
339
- pointer-events: none;
340
- z-index: -1;
341
- border-radius: 9999px;
342
- background-image: linear-gradient(45deg,#00dc82,#36e4da,#0047e1);
343
- filter: blur(60px);
344
- }
345
-
346
- #vue-devtools-anchor .vue-devtools-icon-button {
347
- border-radius: 100%;
348
- border-width: 0;
349
- width: 30px;
350
- height: 30px;
351
- display: flex;
352
- justify-content: center;
353
- align-items: center;
354
- opacity: 0.8;
355
- transition: opacity 0.2s ease-in-out;
356
- }
357
- #vue-devtools-anchor .vue-devtools-icon-button:hover {
358
- opacity: 1;
359
- }
360
-
361
- #vue-devtools-anchor .vue-devtools-icon-button svg {
362
- width: 14px;
363
- height: 14px;
364
- }
365
-
366
- #vue-devtools-anchor:hover .vue-devtools-glowing {
367
- opacity: 0.6;
368
- }
369
-
370
- #vue-devtools-anchor .vue-devtools-panel {
371
- position: absolute;
372
- left: 0;
373
- top: 0;
374
- transform: translate(-50%, -50%);
375
- display: flex;
376
- justify-content: flex-start;
377
- overflow: hidden;
378
- align-items: center;
379
- gap: 2px;
380
- height: 30px;
381
- padding: 4px 4px 4px 5px;
382
- box-sizing: border-box;
383
- border: 1px solid var(--vue-devtools-widget-border);
384
- border-radius: 20px;
385
- background-color: var(--vue-devtools-widget-bg);
386
- backdrop-filter: blur(10px);
387
- color: var(--vue-devtools-widget-fg);
388
- box-shadow: 2px 2px 8px var(--vue-devtools-widget-shadow);
389
- user-select: none;
390
- max-width: 150px;
391
- transition: max-width 0.4s ease, padding 0.5s ease, transform 0.3s ease, all 0.4s ease;
392
- }
393
-
394
- #vue-devtools-anchor .vue-devtools-vue-button {
395
- flex: none;
396
- }
397
-
398
- #vue-devtools-anchor.vue-devtools-vertical .vue-devtools-vue-button {
399
- transform: rotate(-90deg);
400
- }
401
-
402
- #vue-devtools-anchor.vue-devtools-hide .vue-devtools-panel {
403
- max-width: 32px;
404
- padding: 2px 0;
405
- }
406
-
407
- #vue-devtools-anchor.vue-devtools-vertical .vue-devtools-panel {
408
- transform: translate(-50%, -50%) rotate(90deg);
409
- box-shadow: 2px -2px 8px var(--vue-devtools-widget-shadow);
410
- }
411
-
412
- #vue-devtools-anchor .vue-devtools-inspector-button.disabled {
413
- opacity: 0.2;
414
- cursor: not-allowed;
415
- animation: blink 1.5s linear infinite;
416
- }
417
-
418
- @keyframes blink {
419
- 0% {
420
- opacity: 0.2;
421
- }
422
- 50% {
423
- opacity: 0.6;
424
- }
425
- 100% {
426
- opacity: 0.2;
427
- }
428
- }
429
-
430
- @media print {
431
- #vue-devtools-anchor {
432
- display: none;
433
- }
434
- }
435
- </style>
@@ -1,37 +0,0 @@
1
- <script setup lang="ts">
2
- import ComponentInspector from './ComponentInspector.vue'
3
- import { useRerenderHighlight } from './composables'
4
-
5
- const { rerenderHighlightMap } = useRerenderHighlight()
6
-
7
- const colors = [
8
- ['#ff5555', 50],
9
- ['#fff888', 20],
10
- ] as const
11
-
12
- function getColors(times: number) {
13
- const [color] = colors.find(([_, t]) => times >= t) || '#fff'
14
- return color as string
15
- }
16
- </script>
17
-
18
- <template>
19
- <template v-for="[uid, { bound, rerenderCount, name }] in rerenderHighlightMap.entries()" :key="uid">
20
- <ComponentInspector
21
- :bounds="bound"
22
- :name="name"
23
- >
24
- <template #header-extra>
25
- <span
26
- v-if="rerenderCount"
27
- >
28
- (Rerender Count: <span
29
- :style="{
30
- color: getColors(rerenderCount),
31
- }"
32
- >{{ rerenderCount + 1 }})</span>
33
- </span>
34
- </template>
35
- </ComponentInspector>
36
- </template>
37
- </template>