vite-plugin-vue-devtools 0.5.0 → 1.0.0-alpha.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 (46) hide show
  1. package/client.d.ts +55 -0
  2. package/dist/client/assets/{VIcon.vue_vue_type_script_setup_true_lang-6cd486d4.js → Icon.vue_vue_type_script_setup_true_lang-f867c918.js} +2 -2
  3. package/dist/client/assets/{VIconButton.vue_vue_type_script_setup_true_lang-63abce3f.js → IconButton.vue_vue_type_script_setup_true_lang-74db1ae6.js} +4 -5
  4. package/dist/client/assets/{VIconTitle.vue_vue_type_script_setup_true_lang-1ad26587.js → IconTitle.vue_vue_type_script_setup_true_lang-d82eff77.js} +2 -2
  5. package/dist/client/assets/{IframeView.vue_vue_type_script_setup_true_lang-c6f176d1.js → IframeView.vue_vue_type_script_setup_true_lang-778923b2.js} +1 -1
  6. package/dist/client/assets/{VPanelGrids-4b915e62.js → PanelGrids-93648569.js} +1 -1
  7. package/dist/client/assets/SectionBlock-0024395a.css +18 -0
  8. package/dist/client/assets/{VSectionBlock-8dcfb48d.js → SectionBlock-a8928e3c.js} +11 -11
  9. package/dist/client/assets/{StateFields.vue_vue_type_script_setup_true_lang-617e4d70.js → StateFields.vue_vue_type_script_setup_true_lang-019c8d08.js} +13 -13
  10. package/dist/client/assets/{VSwitch.vue_vue_type_script_setup_true_lang-ed954339.js → Switch.vue_vue_type_script_setup_true_lang-3e126052.js} +6 -6
  11. package/dist/client/assets/{VTextInput.vue_vue_type_script_setup_true_lang-5edeb245.js → TextInput.vue_vue_type_script_setup_true_lang-13bb76a1.js} +5 -5
  12. package/dist/client/assets/{__eyedropper-67c21231.js → __eyedropper-44f84f34.js} +10 -6
  13. package/dist/client/assets/{assets-bf6dd9e4.js → assets-114c5f0e.js} +27 -28
  14. package/dist/client/assets/{component-docs-b2752be1.js → component-docs-6d7e057c.js} +9 -10
  15. package/dist/client/assets/{components-c9aae4bc.js → components-fc711123.js} +134 -21
  16. package/dist/client/assets/{documentations-e0b483de.js → documentations-4d7aa8fe.js} +4 -5
  17. package/dist/client/assets/{graph-f081d3a5.js → graph-0860970b.js} +8 -9
  18. package/dist/client/assets/{index-f977bcde.js → index-95398468.js} +1 -1
  19. package/dist/client/assets/{index-197edebf.js → index-9f1190d8.js} +475 -121
  20. package/dist/client/assets/index-d3dcbe9e.css +474 -0
  21. package/dist/client/assets/{inspect-8d04bb08.js → inspect-6bd0f86e.js} +2 -3
  22. package/dist/client/assets/{npm-73c6479f.js → npm-ee43d18c.js} +17 -18
  23. package/dist/client/assets/{overview-edc8c0a8.js → overview-8e63c4fa.js} +15 -16
  24. package/dist/client/assets/{pages-562d1ae5.js → pages-323386ca.js} +16 -16
  25. package/dist/client/assets/{pinia-89f6b4c0.js → pinia-58865e70.js} +6 -6
  26. package/dist/client/assets/{routes-ddddc2d7.js → routes-cd907bae.js} +13 -13
  27. package/dist/client/assets/{settings-3815e37a.css → settings-7bce89ae.css} +3 -3
  28. package/dist/client/assets/{settings-7722ba4d.js → settings-b93aee1f.js} +37 -39
  29. package/dist/client/assets/{splitpanes.es-2f5182b4.js → splitpanes.es-36fe45c8.js} +1 -1
  30. package/dist/client/assets/{timeline-bc5ea36f.js → timeline-8ce18510.js} +11 -11
  31. package/dist/client/index.html +2 -2
  32. package/dist/{index.cjs → vite.cjs} +9 -40
  33. package/dist/{index.mjs → vite.mjs} +7 -38
  34. package/package.json +26 -89
  35. package/src/app.js +4 -0
  36. package/src/{node/views → views}/ComponentInspector.vue +6 -6
  37. package/src/{node/views → views}/Main.vue +30 -24
  38. package/README.md +0 -166
  39. package/dist/client/assets/VSectionBlock-52804693.css +0 -18
  40. package/dist/client/assets/index-fb18df65.css +0 -474
  41. package/dist/client/assets/rpc-b9c94a3a.js +0 -145
  42. package/src/node/app.js +0 -31
  43. /package/dist/{index.d.ts → vite.d.ts} +0 -0
  44. /package/src/{node/views → views}/FrameBox.vue +0 -0
  45. /package/src/{node/views → views}/composables.ts +0 -0
  46. /package/src/{node/views → views}/utils.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { ar as h, o as openBlock, e as createElementBlock, f as renderSlot, l as normalizeStyle } from './index-197edebf.js';
1
+ import { ar as h, o as openBlock, e as createElementBlock, f as renderSlot, l as normalizeStyle } from './index-9f1190d8.js';
2
2
 
3
3
  const M = {
4
4
  name: "splitpanes",
@@ -1,11 +1,11 @@
1
- import { _ as _sfc_main$2 } from './StateFields.vue_vue_type_script_setup_true_lang-617e4d70.js';
2
- import { _ as __unplugin_components_0 } from './VPanelGrids-4b915e62.js';
3
- import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, _ as __unplugin_components_7, A as timelineLayer, B as activeTimelineEvents, C as activeTimelineEventIndex, D as toggleTimelineEventIndex, E as timelineEventDetails, G as activeLayerId, H as toggleTimelineLayer } from './index-197edebf.js';
1
+ import { _ as _sfc_main$2 } from './StateFields.vue_vue_type_script_setup_true_lang-019c8d08.js';
2
+ import { _ as __unplugin_components_0 } from './PanelGrids-93648569.js';
3
+ import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, _ as __unplugin_components_7, A as timelineLayer, B as activeTimelineEvents, C as activeTimelineEventIndex, D as toggleTimelineEventIndex, E as timelineEventDetails, G as activeLayerId, H as toggleTimelineLayer } from './index-9f1190d8.js';
4
4
  import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-65004790.js';
5
- import { g, M } from './splitpanes.es-2f5182b4.js';
6
- import './VIcon.vue_vue_type_script_setup_true_lang-6cd486d4.js';
7
- import './index-f977bcde.js';
8
- import './VIconButton.vue_vue_type_script_setup_true_lang-63abce3f.js';
5
+ import { g, M } from './splitpanes.es-36fe45c8.js';
6
+ import './Icon.vue_vue_type_script_setup_true_lang-f867c918.js';
7
+ import './index-95398468.js';
8
+ import './IconButton.vue_vue_type_script_setup_true_lang-74db1ae6.js';
9
9
 
10
10
  var dayjs_min = {exports: {}};/* Injected with object hook! */
11
11
 
@@ -1329,8 +1329,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1329
1329
  emits: ["update-selected"],
1330
1330
  setup(__props, { emit: emits }) {
1331
1331
  return (_ctx, _cache) => {
1332
- const _component_VCard = __unplugin_components_7;
1333
- const _component_VPanelGrids = __unplugin_components_0;
1332
+ const _component_VDCard = __unplugin_components_7;
1333
+ const _component_VDPanelGrids = __unplugin_components_0;
1334
1334
  return _ctx.data.length ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
1335
1335
  createVNode(unref(script$2), {
1336
1336
  items: _ctx.data,
@@ -1365,12 +1365,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1365
1365
  ]),
1366
1366
  _: 1
1367
1367
  }, 8, ["items"])
1368
- ])) : (openBlock(), createBlock(_component_VPanelGrids, {
1368
+ ])) : (openBlock(), createBlock(_component_VDPanelGrids, {
1369
1369
  key: 1,
1370
1370
  px5: ""
1371
1371
  }, {
1372
1372
  default: withCtx(() => [
1373
- createVNode(_component_VCard, {
1373
+ createVNode(_component_VDCard, {
1374
1374
  flex: "~ col gap2",
1375
1375
  "min-w-30": "",
1376
1376
  "items-center": "",
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <link rel="icon" href="/favicon.svg" type="image/svg+xml">
7
7
  <title>Vue DevTools</title>
8
- <script type="module" crossorigin src="./assets/index-197edebf.js"></script>
9
- <link rel="stylesheet" href="./assets/index-fb18df65.css">
8
+ <script type="module" crossorigin src="./assets/index-9f1190d8.js"></script>
9
+ <link rel="stylesheet" href="./assets/index-d3dcbe9e.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
@@ -6,7 +6,7 @@ const vite = require('vite');
6
6
  const sirv = require('sirv');
7
7
  const Inspect = require('vite-plugin-inspect');
8
8
  const VueInspector = require('vite-plugin-vue-inspector');
9
- const birpc = require('birpc');
9
+ const core$1 = require('@vite-plugin-vue-devtools/core');
10
10
  const fs$9 = require('node:fs/promises');
11
11
  const require$$0 = require('os');
12
12
  const require$$0$1 = require('path');
@@ -50,37 +50,7 @@ const require$$0$3__default = /*#__PURE__*/_interopDefaultCompat(require$$0$3$1)
50
50
  const require$$0$5__default = /*#__PURE__*/_interopDefaultCompat(require$$0$5);
51
51
  const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
52
52
 
53
- function createRPCServer(name, ws, functions) {
54
- const event = `${name}:rpc`;
55
- const group = birpc.createBirpcGroup(
56
- functions,
57
- () => birpc.cachedMap(
58
- Array.from(ws?.clients || []),
59
- (socket) => {
60
- return {
61
- on: (fn) => {
62
- ws.on(event, (data, source) => {
63
- if (socket === source)
64
- fn(data);
65
- });
66
- },
67
- post: (data) => {
68
- socket.send(event, data);
69
- }
70
- };
71
- }
72
- ),
73
- {
74
- timeout: -1
75
- }
76
- );
77
- ws.on("connection", () => {
78
- group.updateChannels();
79
- });
80
- return group.broadcast;
81
- }
82
-
83
- const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : path$3$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
53
+ const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : path$3$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('vite.cjs', document.baseURI).href))));
84
54
  const DIR_CLIENT = path$3$1.resolve(DIR_DIST, "../dist/client");
85
55
 
86
56
  async function getComponentsRelationships(rpc) {
@@ -13777,10 +13747,9 @@ async function getComponentInfo(root, filename) {
13777
13747
  });
13778
13748
  }
13779
13749
 
13780
- const NAME = "vite-plugin-vue-devtools";
13781
13750
  function getVueDevtoolsPath() {
13782
- const pluginPath = vite.normalizePath(path$3__default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)))));
13783
- return pluginPath.replace(/\/dist$/, "//src/node");
13751
+ const pluginPath = vite.normalizePath(path$3__default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('vite.cjs', document.baseURI).href)))));
13752
+ return pluginPath.replace(/\/dist$/, "//src");
13784
13753
  }
13785
13754
  function VitePluginVueDevTools(options = { appendTo: "" }) {
13786
13755
  const vueDevtoolsPath = getVueDevtoolsPath();
@@ -13794,9 +13763,10 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13794
13763
  single: true,
13795
13764
  dev: true
13796
13765
  }));
13797
- const rpc = createRPCServer("vite-plugin-vue-devtools", server.ws, {
13798
- componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13766
+ const rpc = core$1.createRPCServer(server.ws, {
13767
+ root: () => config.root,
13799
13768
  inspectClientUrl: () => `${config.base || "/"}__inspect/`,
13769
+ componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13800
13770
  staticAssets: () => getStaticAssets(config),
13801
13771
  getImageMeta,
13802
13772
  getTextAssetContent,
@@ -13824,12 +13794,11 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13824
13794
  else if (type === "exit")
13825
13795
  rpc.onTerminalExit({ data });
13826
13796
  }
13827
- }),
13828
- root: () => config.root
13797
+ })
13829
13798
  });
13830
13799
  }
13831
13800
  const plugin = {
13832
- name: NAME,
13801
+ name: core$1.PLUGIN_NAME,
13833
13802
  enforce: "pre",
13834
13803
  apply: "serve",
13835
13804
  configResolved(resolvedConfig) {
@@ -4,7 +4,7 @@ import { normalizePath } from 'vite';
4
4
  import sirv from 'sirv';
5
5
  import Inspect from 'vite-plugin-inspect';
6
6
  import VueInspector from 'vite-plugin-vue-inspector';
7
- import { createBirpcGroup, cachedMap } from 'birpc';
7
+ import { PLUGIN_NAME, createRPCServer } from '@vite-plugin-vue-devtools/core';
8
8
  import fs$9 from 'node:fs/promises';
9
9
  import require$$0 from 'os';
10
10
  import require$$0$1 from 'path';
@@ -24,36 +24,6 @@ import require$$0$5 from 'buffer';
24
24
  import { debuglog } from 'node:util';
25
25
  import require$$1 from 'tty';
26
26
 
27
- function createRPCServer(name, ws, functions) {
28
- const event = `${name}:rpc`;
29
- const group = createBirpcGroup(
30
- functions,
31
- () => cachedMap(
32
- Array.from(ws?.clients || []),
33
- (socket) => {
34
- return {
35
- on: (fn) => {
36
- ws.on(event, (data, source) => {
37
- if (socket === source)
38
- fn(data);
39
- });
40
- },
41
- post: (data) => {
42
- socket.send(event, data);
43
- }
44
- };
45
- }
46
- ),
47
- {
48
- timeout: -1
49
- }
50
- );
51
- ws.on("connection", () => {
52
- group.updateChannels();
53
- });
54
- return group.broadcast;
55
- }
56
-
57
27
  const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
58
28
  const DIR_CLIENT = resolve$1(DIR_DIST, "../dist/client");
59
29
 
@@ -13751,10 +13721,9 @@ async function getComponentInfo(root, filename) {
13751
13721
  });
13752
13722
  }
13753
13723
 
13754
- const NAME = "vite-plugin-vue-devtools";
13755
13724
  function getVueDevtoolsPath() {
13756
13725
  const pluginPath = normalizePath(path$3$1.dirname(fileURLToPath(import.meta.url)));
13757
- return pluginPath.replace(/\/dist$/, "//src/node");
13726
+ return pluginPath.replace(/\/dist$/, "//src");
13758
13727
  }
13759
13728
  function VitePluginVueDevTools(options = { appendTo: "" }) {
13760
13729
  const vueDevtoolsPath = getVueDevtoolsPath();
@@ -13768,9 +13737,10 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13768
13737
  single: true,
13769
13738
  dev: true
13770
13739
  }));
13771
- const rpc = createRPCServer("vite-plugin-vue-devtools", server.ws, {
13772
- componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13740
+ const rpc = createRPCServer(server.ws, {
13741
+ root: () => config.root,
13773
13742
  inspectClientUrl: () => `${config.base || "/"}__inspect/`,
13743
+ componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13774
13744
  staticAssets: () => getStaticAssets(config),
13775
13745
  getImageMeta,
13776
13746
  getTextAssetContent,
@@ -13798,12 +13768,11 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13798
13768
  else if (type === "exit")
13799
13769
  rpc.onTerminalExit({ data });
13800
13770
  }
13801
- }),
13802
- root: () => config.root
13771
+ })
13803
13772
  });
13804
13773
  }
13805
13774
  const plugin = {
13806
- name: NAME,
13775
+ name: PLUGIN_NAME,
13807
13776
  enforce: "pre",
13808
13777
  apply: "serve",
13809
13778
  configResolved(resolvedConfig) {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "vite-plugin-vue-devtools",
3
- "version": "0.5.0",
4
- "packageManager": "pnpm@8.6.7",
5
- "description": "A vite plugin for Vue Devtools",
3
+ "type": "module",
4
+ "version": "1.0.0-alpha.1",
5
+ "description": "A vite plugin for Vue DevTools",
6
6
  "author": "webfansplz",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/webfansplz/vite-plugin-vue-devtools#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/webfansplz/vite-plugin-vue-devtools.git"
11
+ "url": "git+https://github.com/webfansplz/vite-plugin-vue-devtools.git",
12
+ "directory": "packages/node"
12
13
  },
13
14
  "bugs": {
14
15
  "url": "https://github.com/webfansplz/vite-plugin-vue-devtools/issues"
@@ -21,111 +22,47 @@
21
22
  ],
22
23
  "exports": {
23
24
  ".": {
24
- "types": "./dist/index.d.ts",
25
- "require": "./dist/index.cjs",
26
- "import": "./dist/index.mjs"
25
+ "types": "./dist/vite.d.ts",
26
+ "require": "./dist/vite.cjs",
27
+ "import": "./dist/vite.mjs"
27
28
  },
28
- "./*": "./*"
29
+ "./*": "./*",
30
+ "./client": {
31
+ "types": "./client.d.ts"
32
+ }
29
33
  },
30
- "main": "dist/index.cjs",
31
- "module": "dist/index.mjs",
32
- "types": "dist/index.d.ts",
34
+ "main": "dist/vite.cjs",
35
+ "module": "dist/vite.mjs",
36
+ "types": "dist/vite.d.ts",
33
37
  "files": [
34
38
  "dist",
35
- "src/node/views/*",
36
- "src/node/app.js",
39
+ "./src/views/*",
40
+ "./src/app.js",
37
41
  "*.d.ts"
38
42
  ],
39
43
  "engines": {
40
- "node": ">=v14"
41
- },
42
- "scripts": {
43
- "build": "rimraf dist && run-s build:*",
44
- "build:client": "vite build src/client",
45
- "build:js": "unbuild",
46
- "dev": "nr stub && pnpm dev:client",
47
- "dev:client": "vite build src/client --watch",
48
- "play": "nr -C playground dev",
49
- "stub": "unbuild --stub",
50
- "lint": "eslint .",
51
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
52
- "prepublishOnly": "npm run build",
53
- "release": "bumpp && nr changelog && npm publish",
54
- "dep:up": "taze -I major"
44
+ "node": ">=v14.21.3"
55
45
  },
56
46
  "peerDependencies": {
57
47
  "vite": "^3.1.0 || ^4.0.0-0"
58
48
  },
59
49
  "dependencies": {
60
- "@vueuse/core": "^10.2.1",
61
- "@vueuse/integrations": "^10.2.1",
62
50
  "@webfansplz/vuedoc-parser": "^0.0.3",
63
- "algoliasearch": "^4.18.0",
64
51
  "birpc": "^0.2.12",
65
52
  "execa": "^7.1.1",
66
- "json-editor-vue": "^0.10.6",
67
- "minimatch": "^9.0.3",
68
- "nanoid": "^4.0.2",
69
53
  "sirv": "^2.0.3",
70
- "splitpanes": "^3.1.5",
71
- "vanilla-jsoneditor": "^0.17.8",
72
- "vite-hot-client": "^0.2.1",
73
- "vite-plugin-inspect": "^0.7.32",
54
+ "vite-plugin-inspect": "^0.7.33",
74
55
  "vite-plugin-vue-inspector": "^3.4.2",
75
- "vue-router": "^4.2.4",
76
- "vuedraggable": "^4.1.0",
77
- "xterm": "^5.2.1",
78
- "xterm-addon-fit": "^0.7.0"
56
+ "@vite-plugin-vue-devtools/core": "1.0.0-alpha.1"
79
57
  },
80
58
  "devDependencies": {
81
- "@algolia/client-search": "^4.18.0",
82
- "@antfu/eslint-config": "^0.39.7",
83
- "@antfu/ni": "^0.21.4",
84
- "@iconify/json": "^2.2.88",
85
- "@nuxt/devtools-ui-kit": "^0.6.7",
86
- "@types/codemirror": "^5.60.8",
87
- "@types/node": "^20.4.1",
88
- "@types/splitpanes": "^2.2.1",
89
- "@unocss/eslint-config": "^0.53.5",
90
- "@unocss/reset": "^0.53.5",
91
- "@vitejs/plugin-vue": "^4.2.3",
92
- "@vitejs/plugin-vue-jsx": "^3.0.1",
93
- "bumpp": "^9.1.1",
94
- "codemirror": "^6.0.1",
95
- "codemirror-theme-vars": "^0.1.2",
96
- "conventional-changelog-cli": "^3.0.0",
97
- "dayjs": "^1.11.9",
98
- "eslint": "8.44.0",
59
+ "@types/node": "^20.4.2",
99
60
  "fast-glob": "^3.3.0",
100
- "floating-vue": "2.0.0-beta.24",
101
- "fuse.js": "^6.6.2",
102
61
  "image-meta": "^0.1.1",
103
- "lint-staged": "^13.2.3",
104
- "npm-run-all": "^4.1.5",
105
- "ohash": "^1.1.2",
106
- "pathe": "^1.1.1",
107
- "pinia": "^2.1.4",
108
- "pnpm": "^8.6.7",
109
- "rimraf": "^5.0.1",
110
- "simple-git-hooks": "^2.8.1",
111
- "taze": "^0.11.2",
112
- "typescript": "^5.1.6",
113
- "unbuild": "^1.2.1",
114
- "unocss": "^0.53.5",
115
- "unplugin-auto-import": "^0.16.6",
116
- "unplugin-vue-components": "^0.25.1",
117
- "vis-data": "^7.1.6",
118
- "vis-network": "^9.1.6",
119
- "vite": "^4.4.2",
120
- "vite-dev-rpc": "^0.1.2",
121
- "vite-plugin-pages": "^0.31.0",
122
- "vue": "^3.3.4",
123
- "vue-virtual-scroller": "2.0.0-beta.8"
62
+ "pathe": "^1.1.1"
124
63
  },
125
- "simple-git-hooks": {
126
- "pre-commit": "pnpm lint-staged"
127
- },
128
- "lint-staged": {
129
- "*": "eslint --fix"
64
+ "scripts": {
65
+ "build": "unbuild",
66
+ "stub": "unbuild --stub"
130
67
  }
131
- }
68
+ }
package/src/app.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createDevToolsContainer } from '@vite-plugin-vue-devtools/core'
2
+ import App from 'virtual:vue-devtools-path:views/Main.vue'
3
+
4
+ createDevToolsContainer(App)
@@ -14,10 +14,10 @@ const props = defineProps<{
14
14
  const inspectorStyle = computed(() => {
15
15
  const { width, height, top, left } = props.bounds
16
16
  return {
17
- width: `${width}px`,
18
- height: `${height}px`,
19
- top: `${top}px`,
20
- left: `${left}px`,
17
+ width: `${Math.round(width)}px`,
18
+ height: `${Math.round(height)}px`,
19
+ top: `${Math.round(top)}px`,
20
+ left: `${Math.round(left)}px`,
21
21
  }
22
22
  })
23
23
  const inspectorCardStyle = computed(() => ({ top: props.bounds.top < 35 ? 0 : '-35px' }))
@@ -27,14 +27,14 @@ const inspectorCardStyle = computed(() => ({ top: props.bounds.top < 35 ? 0 : '-
27
27
  <div class="vue-devtools-component-inspector" :style="inspectorStyle">
28
28
  <span class="vue-devtools-component-inspector-card" :style="inspectorCardStyle">
29
29
  &lt;{{ name }}&gt;
30
- <i>{{ bounds.width }} x {{ bounds.height }}</i>
30
+ <i>{{ Math.round(bounds.width * 100) / 100 }} x {{ Math.round(bounds.height * 100) / 100 }}</i>
31
31
  </span>
32
32
  </div>
33
33
  </template>
34
34
 
35
35
  <style scoped>
36
36
  .vue-devtools-component-inspector {
37
- z-index: 2147483646;
37
+ z-index: 2147483640;
38
38
  position: fixed;
39
39
  background-color:#42b88325;
40
40
  border: 1px solid #42b88350;
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue'
3
3
 
4
4
  // @ts-expect-error virtual module
5
5
  import vueDevToolsOptions from 'virtual:vue-devtools-options'
6
+ import { DevToolsHooks, collectDevToolsHookBuffer } from '@vite-plugin-vue-devtools/core'
6
7
  import Frame from './FrameBox.vue'
7
8
  import ComponentInspector from './ComponentInspector.vue'
8
9
  import { useHighlightComponent, useIframe, useInspector, usePanelVisible, usePiPMode, usePosition } from './composables'
@@ -17,19 +18,7 @@ const props = defineProps({
17
18
 
18
19
  const hook = props.hook
19
20
 
20
- const DevToolsHooks = {
21
- APP_INIT: 'app:init',
22
- COMPONENT_UPDATED: 'component:updated',
23
- COMPONENT_ADDED: 'component:added',
24
- COMPONENT_REMOVED: 'component:removed',
25
- COMPONENT_EMIT: 'component:emit',
26
- PERF_START: 'perf:start',
27
- PERF_END: 'perf:end',
28
- ADD_ROUTE: 'router:add-route',
29
- REMOVE_ROUTE: 'router:remove-route',
30
- }
31
-
32
- const hookBuffer: [string, { args: any[] }][] = []
21
+ const { hookBuffer, collect } = collectDevToolsHookBuffer()
33
22
 
34
23
  let isAppCreated = false
35
24
  const panelState = ref<{
@@ -68,7 +57,7 @@ function waitForClientInjection(iframe: HTMLIFrameElement, retry = 50, timeout =
68
57
  }
69
58
  else if (retry-- <= 0) {
70
59
  clearInterval(interval)
71
- reject(Error('Vue Devtools client injection failed'))
60
+ reject(Error('Vue DevTools client injection failed'))
72
61
  }
73
62
  }, timeout)
74
63
  })
@@ -119,14 +108,25 @@ async function setupClient(iframe: HTMLIFrameElement) {
119
108
  componentInspector: {
120
109
  highlight,
121
110
  unHighlight,
111
+ scrollToComponent(bounds) {
112
+ const scrollTarget = document.createElement('div')
113
+ scrollTarget.style.position = 'absolute'
114
+ scrollTarget.style.width = `${Math.round(bounds.width * 100) / 100}px`
115
+ scrollTarget.style.height = `${Math.round(bounds.height * 100) / 100}px`
116
+ scrollTarget.style.top = `${Math.round(bounds.top * 100) / 100}px`
117
+ scrollTarget.style.left = `${Math.round(bounds.left * 100) / 100}px`
118
+ document.body.appendChild(scrollTarget)
119
+ scrollTarget.scrollIntoView({
120
+ behavior: 'smooth',
121
+ })
122
+ setTimeout(() => {
123
+ document.body.removeChild(scrollTarget)
124
+ }, 2000)
125
+ },
122
126
  },
123
127
  })
124
128
  }
125
129
 
126
- function updateHookBuffer(type, args) {
127
- hookBuffer.push([type, args])
128
- }
129
-
130
130
  function collectDynamicRoute(app) {
131
131
  const router = app?.config?.globalProperties?.$router
132
132
  if (!router)
@@ -137,7 +137,7 @@ function collectDynamicRoute(app) {
137
137
  const res = _addRoute(...args)
138
138
 
139
139
  if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
140
- updateHookBuffer(DevToolsHooks.ADD_ROUTE, {
140
+ collect(DevToolsHooks.ADD_ROUTE, {
141
141
  args: [...args],
142
142
  })
143
143
  }
@@ -150,7 +150,7 @@ function collectDynamicRoute(app) {
150
150
  const res = _removeRoute(...args)
151
151
 
152
152
  if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
153
- updateHookBuffer(DevToolsHooks.REMOVE_ROUTE, {
153
+ collect(DevToolsHooks.REMOVE_ROUTE, {
154
154
  args: [...args],
155
155
  })
156
156
  }
@@ -171,7 +171,7 @@ function collectHookBuffer() {
171
171
  return
172
172
 
173
173
  collectDynamicRoute(app)
174
- updateHookBuffer(DevToolsHooks.APP_INIT, {
174
+ collect(DevToolsHooks.APP_INIT, {
175
175
  app,
176
176
  })
177
177
  setTimeout(() => {
@@ -184,7 +184,7 @@ function collectHookBuffer() {
184
184
  // if (stopCollect(component))
185
185
  // return
186
186
 
187
- // updateHookBuffer(DevToolsHooks.COMPONENT_EMIT, {
187
+ // collect(DevToolsHooks.COMPONENT_EMIT, {
188
188
  // now: Date.now(),
189
189
  // app,
190
190
  // uid,
@@ -198,7 +198,7 @@ function collectHookBuffer() {
198
198
  // if (stopCollect(component))
199
199
  // return
200
200
 
201
- // updateHookBuffer(DevToolsHooks.PERF_END, {
201
+ // collect(DevToolsHooks.PERF_END, {
202
202
  // now: Date.now(),
203
203
  // app,
204
204
  // uid,
@@ -219,7 +219,7 @@ function collectHookBuffer() {
219
219
  if (!app || (typeof uid !== 'number' && !uid) || !component || stopCollect(component))
220
220
  return
221
221
 
222
- updateHookBuffer(item, {
222
+ collect(item, {
223
223
  app, uid, parentUid, component,
224
224
  })
225
225
  })
@@ -392,4 +392,10 @@ collectHookBuffer()
392
392
  opacity: 0.2;
393
393
  }
394
394
  }
395
+
396
+ @media print {
397
+ #vue-devtools-anchor {
398
+ display: none;
399
+ }
400
+ }
395
401
  </style>