@vue/devtools-api 6.5.1 → 7.0.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.
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.cjs +40 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +17 -0
- package/package.json +22 -27
- package/lib/cjs/api/api.js +0 -2
- package/lib/cjs/api/app.js +0 -2
- package/lib/cjs/api/component.js +0 -2
- package/lib/cjs/api/context.js +0 -2
- package/lib/cjs/api/hooks.js +0 -2
- package/lib/cjs/api/index.js +0 -22
- package/lib/cjs/api/util.js +0 -2
- package/lib/cjs/const.js +0 -5
- package/lib/cjs/env.js +0 -17
- package/lib/cjs/index.js +0 -44
- package/lib/cjs/plugin.js +0 -2
- package/lib/cjs/proxy.js +0 -111
- package/lib/cjs/time.js +0 -28
- package/lib/esm/api/api.d.ts +0 -108
- package/lib/esm/api/api.js +0 -1
- package/lib/esm/api/app.d.ts +0 -1
- package/lib/esm/api/app.js +0 -1
- package/lib/esm/api/component.d.ts +0 -78
- package/lib/esm/api/component.js +0 -1
- package/lib/esm/api/context.d.ts +0 -5
- package/lib/esm/api/context.js +0 -1
- package/lib/esm/api/hooks.d.ts +0 -180
- package/lib/esm/api/hooks.js +0 -1
- package/lib/esm/api/index.d.ts +0 -6
- package/lib/esm/api/index.js +0 -6
- package/lib/esm/api/util.d.ts +0 -4
- package/lib/esm/api/util.js +0 -1
- package/lib/esm/const.d.ts +0 -2
- package/lib/esm/const.js +0 -2
- package/lib/esm/env.d.ts +0 -15
- package/lib/esm/env.js +0 -12
- package/lib/esm/index.d.ts +0 -18
- package/lib/esm/index.js +0 -26
- package/lib/esm/plugin.d.ts +0 -47
- package/lib/esm/plugin.js +0 -1
- package/lib/esm/proxy.d.ts +0 -20
- package/lib/esm/proxy.js +0 -107
- package/lib/esm/time.d.ts +0 -2
- package/lib/esm/time.js +0 -23
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 webfansplz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
addCustomCommand: () => import_devtools_kit.addCustomCommand,
|
|
24
|
+
addCustomTab: () => import_devtools_kit.addCustomTab,
|
|
25
|
+
onDevToolsClientConnected: () => import_devtools_kit.onDevToolsClientConnected,
|
|
26
|
+
onDevToolsConnected: () => import_devtools_kit.onDevToolsConnected,
|
|
27
|
+
removeCustomCommand: () => import_devtools_kit.removeCustomCommand,
|
|
28
|
+
setupDevToolsPlugin: () => import_devtools_kit.setupDevToolsPlugin
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_devtools_kit = require("@vue/devtools-kit");
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
addCustomCommand,
|
|
35
|
+
addCustomTab,
|
|
36
|
+
onDevToolsClientConnected,
|
|
37
|
+
onDevToolsConnected,
|
|
38
|
+
removeCustomCommand,
|
|
39
|
+
setupDevToolsPlugin
|
|
40
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomCommand, CustomTab, addCustomCommand, addCustomTab, onDevToolsClientConnected, onDevToolsConnected, removeCustomCommand, setupDevToolsPlugin } from '@vue/devtools-kit';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomCommand, CustomTab, addCustomCommand, addCustomTab, onDevToolsClientConnected, onDevToolsConnected, removeCustomCommand, setupDevToolsPlugin } from '@vue/devtools-kit';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
onDevToolsConnected,
|
|
4
|
+
onDevToolsClientConnected,
|
|
5
|
+
setupDevToolsPlugin,
|
|
6
|
+
addCustomTab,
|
|
7
|
+
addCustomCommand,
|
|
8
|
+
removeCustomCommand
|
|
9
|
+
} from "@vue/devtools-kit";
|
|
10
|
+
export {
|
|
11
|
+
addCustomCommand,
|
|
12
|
+
addCustomTab,
|
|
13
|
+
onDevToolsClientConnected,
|
|
14
|
+
onDevToolsConnected,
|
|
15
|
+
removeCustomCommand,
|
|
16
|
+
setupDevToolsPlugin
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/devtools-api",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"browser": "lib/esm/index.js",
|
|
7
|
-
"module": "lib/esm/index.js",
|
|
8
|
-
"types": "lib/esm/index.d.ts",
|
|
9
|
-
"sideEffects": false,
|
|
10
|
-
"author": {
|
|
11
|
-
"name": "Guillaume Chau"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"lib/esm",
|
|
15
|
-
"lib/cjs"
|
|
16
|
-
],
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "7.0.0",
|
|
5
|
+
"author": "webfansplz",
|
|
17
6
|
"license": "MIT",
|
|
18
7
|
"repository": {
|
|
19
|
-
"
|
|
8
|
+
"directory": "packages/devtools-api",
|
|
20
9
|
"type": "git",
|
|
21
|
-
"
|
|
10
|
+
"url": "git+https://github.com/vuejs/devtools-next.git"
|
|
22
11
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
25
17
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@vue/devtools-kit": "^7.0.0"
|
|
31
26
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup --clean",
|
|
29
|
+
"prepare:type": "tsup --dts-only",
|
|
30
|
+
"stub": "tsup --watch --onSuccess 'tsup --dts-only'"
|
|
36
31
|
}
|
|
37
32
|
}
|
package/lib/cjs/api/api.js
DELETED
package/lib/cjs/api/app.js
DELETED
package/lib/cjs/api/component.js
DELETED
package/lib/cjs/api/context.js
DELETED
package/lib/cjs/api/hooks.js
DELETED
package/lib/cjs/api/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api.js"), exports);
|
|
18
|
-
__exportStar(require("./app.js"), exports);
|
|
19
|
-
__exportStar(require("./component.js"), exports);
|
|
20
|
-
__exportStar(require("./context.js"), exports);
|
|
21
|
-
__exportStar(require("./hooks.js"), exports);
|
|
22
|
-
__exportStar(require("./util.js"), exports);
|
package/lib/cjs/api/util.js
DELETED
package/lib/cjs/const.js
DELETED
package/lib/cjs/env.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isProxyAvailable = exports.getTarget = exports.getDevtoolsGlobalHook = void 0;
|
|
4
|
-
function getDevtoolsGlobalHook() {
|
|
5
|
-
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
6
|
-
}
|
|
7
|
-
exports.getDevtoolsGlobalHook = getDevtoolsGlobalHook;
|
|
8
|
-
function getTarget() {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
|
|
11
|
-
? window
|
|
12
|
-
: typeof global !== 'undefined'
|
|
13
|
-
? global
|
|
14
|
-
: {};
|
|
15
|
-
}
|
|
16
|
-
exports.getTarget = getTarget;
|
|
17
|
-
exports.isProxyAvailable = typeof Proxy === 'function';
|
package/lib/cjs/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.setupDevtoolsPlugin = void 0;
|
|
18
|
-
const env_js_1 = require("./env.js");
|
|
19
|
-
const const_js_1 = require("./const.js");
|
|
20
|
-
const proxy_js_1 = require("./proxy.js");
|
|
21
|
-
__exportStar(require("./api/index.js"), exports);
|
|
22
|
-
__exportStar(require("./plugin.js"), exports);
|
|
23
|
-
__exportStar(require("./time.js"), exports);
|
|
24
|
-
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
25
|
-
const descriptor = pluginDescriptor;
|
|
26
|
-
const target = (0, env_js_1.getTarget)();
|
|
27
|
-
const hook = (0, env_js_1.getDevtoolsGlobalHook)();
|
|
28
|
-
const enableProxy = env_js_1.isProxyAvailable && descriptor.enableEarlyProxy;
|
|
29
|
-
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|
30
|
-
hook.emit(const_js_1.HOOK_SETUP, pluginDescriptor, setupFn);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const proxy = enableProxy ? new proxy_js_1.ApiProxy(descriptor, hook) : null;
|
|
34
|
-
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|
35
|
-
list.push({
|
|
36
|
-
pluginDescriptor: descriptor,
|
|
37
|
-
setupFn,
|
|
38
|
-
proxy,
|
|
39
|
-
});
|
|
40
|
-
if (proxy)
|
|
41
|
-
setupFn(proxy.proxiedTarget);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;
|
package/lib/cjs/plugin.js
DELETED
package/lib/cjs/proxy.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiProxy = void 0;
|
|
4
|
-
const const_js_1 = require("./const.js");
|
|
5
|
-
const time_js_1 = require("./time.js");
|
|
6
|
-
class ApiProxy {
|
|
7
|
-
constructor(plugin, hook) {
|
|
8
|
-
this.target = null;
|
|
9
|
-
this.targetQueue = [];
|
|
10
|
-
this.onQueue = [];
|
|
11
|
-
this.plugin = plugin;
|
|
12
|
-
this.hook = hook;
|
|
13
|
-
const defaultSettings = {};
|
|
14
|
-
if (plugin.settings) {
|
|
15
|
-
for (const id in plugin.settings) {
|
|
16
|
-
const item = plugin.settings[id];
|
|
17
|
-
defaultSettings[id] = item.defaultValue;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|
21
|
-
let currentSettings = Object.assign({}, defaultSettings);
|
|
22
|
-
try {
|
|
23
|
-
const raw = localStorage.getItem(localSettingsSaveId);
|
|
24
|
-
const data = JSON.parse(raw);
|
|
25
|
-
Object.assign(currentSettings, data);
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
// noop
|
|
29
|
-
}
|
|
30
|
-
this.fallbacks = {
|
|
31
|
-
getSettings() {
|
|
32
|
-
return currentSettings;
|
|
33
|
-
},
|
|
34
|
-
setSettings(value) {
|
|
35
|
-
try {
|
|
36
|
-
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
// noop
|
|
40
|
-
}
|
|
41
|
-
currentSettings = value;
|
|
42
|
-
},
|
|
43
|
-
now() {
|
|
44
|
-
return (0, time_js_1.now)();
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
if (hook) {
|
|
48
|
-
hook.on(const_js_1.HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
|
49
|
-
if (pluginId === this.plugin.id) {
|
|
50
|
-
this.fallbacks.setSettings(value);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
this.proxiedOn = new Proxy({}, {
|
|
55
|
-
get: (_target, prop) => {
|
|
56
|
-
if (this.target) {
|
|
57
|
-
return this.target.on[prop];
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return (...args) => {
|
|
61
|
-
this.onQueue.push({
|
|
62
|
-
method: prop,
|
|
63
|
-
args,
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
this.proxiedTarget = new Proxy({}, {
|
|
70
|
-
get: (_target, prop) => {
|
|
71
|
-
if (this.target) {
|
|
72
|
-
return this.target[prop];
|
|
73
|
-
}
|
|
74
|
-
else if (prop === 'on') {
|
|
75
|
-
return this.proxiedOn;
|
|
76
|
-
}
|
|
77
|
-
else if (Object.keys(this.fallbacks).includes(prop)) {
|
|
78
|
-
return (...args) => {
|
|
79
|
-
this.targetQueue.push({
|
|
80
|
-
method: prop,
|
|
81
|
-
args,
|
|
82
|
-
resolve: () => { },
|
|
83
|
-
});
|
|
84
|
-
return this.fallbacks[prop](...args);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
return (...args) => {
|
|
89
|
-
return new Promise(resolve => {
|
|
90
|
-
this.targetQueue.push({
|
|
91
|
-
method: prop,
|
|
92
|
-
args,
|
|
93
|
-
resolve,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
async setRealTarget(target) {
|
|
102
|
-
this.target = target;
|
|
103
|
-
for (const item of this.onQueue) {
|
|
104
|
-
this.target.on[item.method](...item.args);
|
|
105
|
-
}
|
|
106
|
-
for (const item of this.targetQueue) {
|
|
107
|
-
item.resolve(await this.target[item.method](...item.args));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.ApiProxy = ApiProxy;
|
package/lib/cjs/time.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.now = exports.isPerformanceSupported = void 0;
|
|
4
|
-
let supported;
|
|
5
|
-
let perf;
|
|
6
|
-
function isPerformanceSupported() {
|
|
7
|
-
var _a;
|
|
8
|
-
if (supported !== undefined) {
|
|
9
|
-
return supported;
|
|
10
|
-
}
|
|
11
|
-
if (typeof window !== 'undefined' && window.performance) {
|
|
12
|
-
supported = true;
|
|
13
|
-
perf = window.performance;
|
|
14
|
-
}
|
|
15
|
-
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
16
|
-
supported = true;
|
|
17
|
-
perf = global.perf_hooks.performance;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
supported = false;
|
|
21
|
-
}
|
|
22
|
-
return supported;
|
|
23
|
-
}
|
|
24
|
-
exports.isPerformanceSupported = isPerformanceSupported;
|
|
25
|
-
function now() {
|
|
26
|
-
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
27
|
-
}
|
|
28
|
-
exports.now = now;
|
package/lib/esm/api/api.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { ComponentBounds, Hookable } from './hooks.js';
|
|
2
|
-
import type { Context } from './context.js';
|
|
3
|
-
import type { ComponentInstance, ComponentState, StateBase } from './component.js';
|
|
4
|
-
import type { App } from './app.js';
|
|
5
|
-
import type { ID } from './util.js';
|
|
6
|
-
export interface DevtoolsPluginApi<TSettings> {
|
|
7
|
-
on: Hookable<Context>;
|
|
8
|
-
notifyComponentUpdate(instance?: ComponentInstance): void;
|
|
9
|
-
addTimelineLayer(options: TimelineLayerOptions): void;
|
|
10
|
-
addTimelineEvent(options: TimelineEventOptions): void;
|
|
11
|
-
addInspector(options: CustomInspectorOptions): void;
|
|
12
|
-
sendInspectorTree(inspectorId: string): void;
|
|
13
|
-
sendInspectorState(inspectorId: string): void;
|
|
14
|
-
selectInspectorNode(inspectorId: string, nodeId: string): void;
|
|
15
|
-
getComponentBounds(instance: ComponentInstance): Promise<ComponentBounds>;
|
|
16
|
-
getComponentName(instance: ComponentInstance): Promise<string>;
|
|
17
|
-
getComponentInstances(app: App): Promise<ComponentInstance[]>;
|
|
18
|
-
highlightElement(instance: ComponentInstance): void;
|
|
19
|
-
unhighlightElement(): void;
|
|
20
|
-
getSettings(pluginId?: string): TSettings;
|
|
21
|
-
now(): number;
|
|
22
|
-
/**
|
|
23
|
-
* @private Not implemented yet
|
|
24
|
-
*/
|
|
25
|
-
setSettings(values: TSettings): void;
|
|
26
|
-
}
|
|
27
|
-
export interface AppRecord {
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
instanceMap: Map<string, ComponentInstance>;
|
|
31
|
-
rootInstance: ComponentInstance;
|
|
32
|
-
}
|
|
33
|
-
export interface TimelineLayerOptions<TData = any, TMeta = any> {
|
|
34
|
-
id: string;
|
|
35
|
-
label: string;
|
|
36
|
-
color: number;
|
|
37
|
-
skipScreenshots?: boolean;
|
|
38
|
-
groupsOnly?: boolean;
|
|
39
|
-
ignoreNoDurationGroups?: boolean;
|
|
40
|
-
screenshotOverlayRender?: (event: TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent, ctx: ScreenshotOverlayRenderContext) => ScreenshotOverlayRenderResult | Promise<ScreenshotOverlayRenderResult>;
|
|
41
|
-
}
|
|
42
|
-
export interface ScreenshotOverlayEvent {
|
|
43
|
-
layerId: string;
|
|
44
|
-
renderMeta: any;
|
|
45
|
-
}
|
|
46
|
-
export interface ScreenshotOverlayRenderContext<TData = any, TMeta = any> {
|
|
47
|
-
screenshot: ScreenshotData;
|
|
48
|
-
events: (TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent)[];
|
|
49
|
-
index: number;
|
|
50
|
-
}
|
|
51
|
-
export declare type ScreenshotOverlayRenderResult = HTMLElement | string | false;
|
|
52
|
-
export interface ScreenshotData {
|
|
53
|
-
time: number;
|
|
54
|
-
}
|
|
55
|
-
export interface TimelineEventOptions {
|
|
56
|
-
layerId: string;
|
|
57
|
-
event: TimelineEvent;
|
|
58
|
-
all?: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface TimelineEvent<TData = any, TMeta = any> {
|
|
61
|
-
time: number;
|
|
62
|
-
data: TData;
|
|
63
|
-
logType?: 'default' | 'warning' | 'error';
|
|
64
|
-
meta?: TMeta;
|
|
65
|
-
groupId?: ID;
|
|
66
|
-
title?: string;
|
|
67
|
-
subtitle?: string;
|
|
68
|
-
}
|
|
69
|
-
export interface TimelineMarkerOptions {
|
|
70
|
-
id: string;
|
|
71
|
-
time: number;
|
|
72
|
-
color: number;
|
|
73
|
-
label: string;
|
|
74
|
-
all?: boolean;
|
|
75
|
-
}
|
|
76
|
-
export interface CustomInspectorOptions {
|
|
77
|
-
id: string;
|
|
78
|
-
label: string;
|
|
79
|
-
icon?: string;
|
|
80
|
-
treeFilterPlaceholder?: string;
|
|
81
|
-
stateFilterPlaceholder?: string;
|
|
82
|
-
noSelectionText?: string;
|
|
83
|
-
actions?: {
|
|
84
|
-
icon: string;
|
|
85
|
-
tooltip?: string;
|
|
86
|
-
action: () => void | Promise<void>;
|
|
87
|
-
}[];
|
|
88
|
-
nodeActions?: {
|
|
89
|
-
icon: string;
|
|
90
|
-
tooltip?: string;
|
|
91
|
-
action: (nodeId: string) => void | Promise<void>;
|
|
92
|
-
}[];
|
|
93
|
-
}
|
|
94
|
-
export interface CustomInspectorNode {
|
|
95
|
-
id: string;
|
|
96
|
-
label: string;
|
|
97
|
-
children?: CustomInspectorNode[];
|
|
98
|
-
tags?: InspectorNodeTag[];
|
|
99
|
-
}
|
|
100
|
-
export interface InspectorNodeTag {
|
|
101
|
-
label: string;
|
|
102
|
-
textColor: number;
|
|
103
|
-
backgroundColor: number;
|
|
104
|
-
tooltip?: string;
|
|
105
|
-
}
|
|
106
|
-
export interface CustomInspectorState {
|
|
107
|
-
[key: string]: (StateBase | Omit<ComponentState, 'type'>)[];
|
|
108
|
-
}
|
package/lib/esm/api/api.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/api/app.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type App = any;
|
package/lib/esm/api/app.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { InspectorNodeTag } from './api.js';
|
|
2
|
-
import type { ID } from './util.js';
|
|
3
|
-
export declare type ComponentInstance = any;
|
|
4
|
-
export interface ComponentTreeNode {
|
|
5
|
-
uid: ID;
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
renderKey: string | number;
|
|
9
|
-
inactive: boolean;
|
|
10
|
-
isFragment: boolean;
|
|
11
|
-
hasChildren: boolean;
|
|
12
|
-
children: ComponentTreeNode[];
|
|
13
|
-
domOrder?: number[];
|
|
14
|
-
consoleId?: string;
|
|
15
|
-
isRouterView?: boolean;
|
|
16
|
-
macthedRouteSegment?: string;
|
|
17
|
-
tags: InspectorNodeTag[];
|
|
18
|
-
autoOpen: boolean;
|
|
19
|
-
meta?: any;
|
|
20
|
-
}
|
|
21
|
-
export interface InspectedComponentData {
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
file: string;
|
|
25
|
-
state: ComponentState[];
|
|
26
|
-
functional?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface StateBase {
|
|
29
|
-
key: string;
|
|
30
|
-
value: any;
|
|
31
|
-
editable?: boolean;
|
|
32
|
-
objectType?: 'ref' | 'reactive' | 'computed' | 'other';
|
|
33
|
-
raw?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface ComponentStateBase extends StateBase {
|
|
36
|
-
type: string;
|
|
37
|
-
}
|
|
38
|
-
export interface ComponentPropState extends ComponentStateBase {
|
|
39
|
-
meta?: {
|
|
40
|
-
type: string;
|
|
41
|
-
required: boolean;
|
|
42
|
-
/** Vue 1 only */
|
|
43
|
-
mode?: 'default' | 'sync' | 'once';
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export declare type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
|
|
47
|
-
export interface ComponentCustomState extends ComponentStateBase {
|
|
48
|
-
value: CustomState;
|
|
49
|
-
}
|
|
50
|
-
export declare type CustomState = {
|
|
51
|
-
_custom: {
|
|
52
|
-
type: ComponentBuiltinCustomStateTypes | string;
|
|
53
|
-
objectType?: string;
|
|
54
|
-
display?: string;
|
|
55
|
-
tooltip?: string;
|
|
56
|
-
value?: any;
|
|
57
|
-
abstract?: boolean;
|
|
58
|
-
file?: string;
|
|
59
|
-
uid?: number;
|
|
60
|
-
readOnly?: boolean;
|
|
61
|
-
/** Configure immediate child fields */
|
|
62
|
-
fields?: {
|
|
63
|
-
abstract?: boolean;
|
|
64
|
-
};
|
|
65
|
-
id?: any;
|
|
66
|
-
actions?: {
|
|
67
|
-
icon: string;
|
|
68
|
-
tooltip?: string;
|
|
69
|
-
action: () => void | Promise<void>;
|
|
70
|
-
}[];
|
|
71
|
-
/** internal */
|
|
72
|
-
_reviveId?: number;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
export declare type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
|
|
76
|
-
export interface ComponentDevtoolsOptions {
|
|
77
|
-
hide?: boolean;
|
|
78
|
-
}
|
package/lib/esm/api/component.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/api/context.d.ts
DELETED
package/lib/esm/api/context.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/api/hooks.d.ts
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { ComponentTreeNode, InspectedComponentData, ComponentInstance, ComponentDevtoolsOptions } from './component.js';
|
|
2
|
-
import type { App } from './app.js';
|
|
3
|
-
import type { CustomInspectorNode, CustomInspectorState, TimelineEvent } from './api.js';
|
|
4
|
-
export declare const enum Hooks {
|
|
5
|
-
TRANSFORM_CALL = "transformCall",
|
|
6
|
-
GET_APP_RECORD_NAME = "getAppRecordName",
|
|
7
|
-
GET_APP_ROOT_INSTANCE = "getAppRootInstance",
|
|
8
|
-
REGISTER_APPLICATION = "registerApplication",
|
|
9
|
-
WALK_COMPONENT_TREE = "walkComponentTree",
|
|
10
|
-
VISIT_COMPONENT_TREE = "visitComponentTree",
|
|
11
|
-
WALK_COMPONENT_PARENTS = "walkComponentParents",
|
|
12
|
-
INSPECT_COMPONENT = "inspectComponent",
|
|
13
|
-
GET_COMPONENT_BOUNDS = "getComponentBounds",
|
|
14
|
-
GET_COMPONENT_NAME = "getComponentName",
|
|
15
|
-
GET_COMPONENT_INSTANCES = "getComponentInstances",
|
|
16
|
-
GET_ELEMENT_COMPONENT = "getElementComponent",
|
|
17
|
-
GET_COMPONENT_ROOT_ELEMENTS = "getComponentRootElements",
|
|
18
|
-
EDIT_COMPONENT_STATE = "editComponentState",
|
|
19
|
-
GET_COMPONENT_DEVTOOLS_OPTIONS = "getAppDevtoolsOptions",
|
|
20
|
-
GET_COMPONENT_RENDER_CODE = "getComponentRenderCode",
|
|
21
|
-
INSPECT_TIMELINE_EVENT = "inspectTimelineEvent",
|
|
22
|
-
TIMELINE_CLEARED = "timelineCleared",
|
|
23
|
-
GET_INSPECTOR_TREE = "getInspectorTree",
|
|
24
|
-
GET_INSPECTOR_STATE = "getInspectorState",
|
|
25
|
-
EDIT_INSPECTOR_STATE = "editInspectorState",
|
|
26
|
-
SET_PLUGIN_SETTINGS = "setPluginSettings"
|
|
27
|
-
}
|
|
28
|
-
export interface ComponentBounds {
|
|
29
|
-
left: number;
|
|
30
|
-
top: number;
|
|
31
|
-
width: number;
|
|
32
|
-
height: number;
|
|
33
|
-
}
|
|
34
|
-
export declare type HookPayloads = {
|
|
35
|
-
[Hooks.TRANSFORM_CALL]: {
|
|
36
|
-
callName: string;
|
|
37
|
-
inArgs: any[];
|
|
38
|
-
outArgs: any[];
|
|
39
|
-
};
|
|
40
|
-
[Hooks.GET_APP_RECORD_NAME]: {
|
|
41
|
-
app: App;
|
|
42
|
-
name: string;
|
|
43
|
-
};
|
|
44
|
-
[Hooks.GET_APP_ROOT_INSTANCE]: {
|
|
45
|
-
app: App;
|
|
46
|
-
root: ComponentInstance;
|
|
47
|
-
};
|
|
48
|
-
[Hooks.REGISTER_APPLICATION]: {
|
|
49
|
-
app: App;
|
|
50
|
-
};
|
|
51
|
-
[Hooks.WALK_COMPONENT_TREE]: {
|
|
52
|
-
componentInstance: ComponentInstance;
|
|
53
|
-
componentTreeData: ComponentTreeNode[];
|
|
54
|
-
maxDepth: number;
|
|
55
|
-
filter: string;
|
|
56
|
-
recursively: boolean;
|
|
57
|
-
};
|
|
58
|
-
[Hooks.VISIT_COMPONENT_TREE]: {
|
|
59
|
-
app: App;
|
|
60
|
-
componentInstance: ComponentInstance;
|
|
61
|
-
treeNode: ComponentTreeNode;
|
|
62
|
-
filter: string;
|
|
63
|
-
};
|
|
64
|
-
[Hooks.WALK_COMPONENT_PARENTS]: {
|
|
65
|
-
componentInstance: ComponentInstance;
|
|
66
|
-
parentInstances: ComponentInstance[];
|
|
67
|
-
};
|
|
68
|
-
[Hooks.INSPECT_COMPONENT]: {
|
|
69
|
-
app: App;
|
|
70
|
-
componentInstance: ComponentInstance;
|
|
71
|
-
instanceData: InspectedComponentData;
|
|
72
|
-
};
|
|
73
|
-
[Hooks.GET_COMPONENT_BOUNDS]: {
|
|
74
|
-
componentInstance: ComponentInstance;
|
|
75
|
-
bounds: ComponentBounds;
|
|
76
|
-
};
|
|
77
|
-
[Hooks.GET_COMPONENT_NAME]: {
|
|
78
|
-
componentInstance: ComponentInstance;
|
|
79
|
-
name: string;
|
|
80
|
-
};
|
|
81
|
-
[Hooks.GET_COMPONENT_INSTANCES]: {
|
|
82
|
-
app: App;
|
|
83
|
-
componentInstances: ComponentInstance[];
|
|
84
|
-
};
|
|
85
|
-
[Hooks.GET_ELEMENT_COMPONENT]: {
|
|
86
|
-
element: HTMLElement | any;
|
|
87
|
-
componentInstance: ComponentInstance;
|
|
88
|
-
};
|
|
89
|
-
[Hooks.GET_COMPONENT_ROOT_ELEMENTS]: {
|
|
90
|
-
componentInstance: ComponentInstance;
|
|
91
|
-
rootElements: (HTMLElement | any)[];
|
|
92
|
-
};
|
|
93
|
-
[Hooks.EDIT_COMPONENT_STATE]: {
|
|
94
|
-
app: App;
|
|
95
|
-
componentInstance: ComponentInstance;
|
|
96
|
-
path: string[];
|
|
97
|
-
type: string;
|
|
98
|
-
state: EditStatePayload;
|
|
99
|
-
set: (object: any, path?: string | (string[]), value?: any, cb?: (object: any, field: string, value: any) => void) => void;
|
|
100
|
-
};
|
|
101
|
-
[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS]: {
|
|
102
|
-
componentInstance: ComponentInstance;
|
|
103
|
-
options: ComponentDevtoolsOptions;
|
|
104
|
-
};
|
|
105
|
-
[Hooks.GET_COMPONENT_RENDER_CODE]: {
|
|
106
|
-
componentInstance: ComponentInstance;
|
|
107
|
-
code: string;
|
|
108
|
-
};
|
|
109
|
-
[Hooks.INSPECT_TIMELINE_EVENT]: {
|
|
110
|
-
app: App;
|
|
111
|
-
layerId: string;
|
|
112
|
-
event: TimelineEvent;
|
|
113
|
-
all?: boolean;
|
|
114
|
-
data: any;
|
|
115
|
-
};
|
|
116
|
-
[Hooks.TIMELINE_CLEARED]: Record<string, never>;
|
|
117
|
-
[Hooks.GET_INSPECTOR_TREE]: {
|
|
118
|
-
app: App;
|
|
119
|
-
inspectorId: string;
|
|
120
|
-
filter: string;
|
|
121
|
-
rootNodes: CustomInspectorNode[];
|
|
122
|
-
};
|
|
123
|
-
[Hooks.GET_INSPECTOR_STATE]: {
|
|
124
|
-
app: App;
|
|
125
|
-
inspectorId: string;
|
|
126
|
-
nodeId: string;
|
|
127
|
-
state: CustomInspectorState;
|
|
128
|
-
};
|
|
129
|
-
[Hooks.EDIT_INSPECTOR_STATE]: {
|
|
130
|
-
app: App;
|
|
131
|
-
inspectorId: string;
|
|
132
|
-
nodeId: string;
|
|
133
|
-
path: string[];
|
|
134
|
-
type: string;
|
|
135
|
-
state: EditStatePayload;
|
|
136
|
-
set: (object: any, path?: string | (string[]), value?: any, cb?: (object: any, field: string, value: any) => void) => void;
|
|
137
|
-
};
|
|
138
|
-
[Hooks.SET_PLUGIN_SETTINGS]: {
|
|
139
|
-
app: App;
|
|
140
|
-
pluginId: string;
|
|
141
|
-
key: string;
|
|
142
|
-
newValue: any;
|
|
143
|
-
oldValue: any;
|
|
144
|
-
settings: any;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
export declare type EditStatePayload = {
|
|
148
|
-
value: any;
|
|
149
|
-
newKey?: string | null;
|
|
150
|
-
remove?: undefined | false;
|
|
151
|
-
} | {
|
|
152
|
-
value?: undefined;
|
|
153
|
-
newKey?: undefined;
|
|
154
|
-
remove: true;
|
|
155
|
-
};
|
|
156
|
-
export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
|
|
157
|
-
export interface Hookable<TContext> {
|
|
158
|
-
transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any;
|
|
159
|
-
getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any;
|
|
160
|
-
getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any;
|
|
161
|
-
registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any;
|
|
162
|
-
walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any;
|
|
163
|
-
visitComponentTree(handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>): any;
|
|
164
|
-
walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any;
|
|
165
|
-
inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any;
|
|
166
|
-
getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any;
|
|
167
|
-
getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any;
|
|
168
|
-
getComponentInstances(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>): any;
|
|
169
|
-
getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any;
|
|
170
|
-
getComponentRootElements(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>): any;
|
|
171
|
-
editComponentState(handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>): any;
|
|
172
|
-
getComponentDevtoolsOptions(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>): any;
|
|
173
|
-
getComponentRenderCode(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>): any;
|
|
174
|
-
inspectTimelineEvent(handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>): any;
|
|
175
|
-
timelineCleared(handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>): any;
|
|
176
|
-
getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any;
|
|
177
|
-
getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any;
|
|
178
|
-
editInspectorState(handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>): any;
|
|
179
|
-
setPluginSettings(handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>): any;
|
|
180
|
-
}
|
package/lib/esm/api/hooks.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/api/index.d.ts
DELETED
package/lib/esm/api/index.js
DELETED
package/lib/esm/api/util.d.ts
DELETED
package/lib/esm/api/util.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/const.d.ts
DELETED
package/lib/esm/const.js
DELETED
package/lib/esm/env.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PluginDescriptor, SetupFunction } from './index.js';
|
|
2
|
-
import type { ApiProxy } from './proxy.js';
|
|
3
|
-
export interface PluginQueueItem {
|
|
4
|
-
pluginDescriptor: PluginDescriptor;
|
|
5
|
-
setupFn: SetupFunction;
|
|
6
|
-
proxy?: ApiProxy;
|
|
7
|
-
}
|
|
8
|
-
interface GlobalTarget {
|
|
9
|
-
__VUE_DEVTOOLS_PLUGINS__?: PluginQueueItem[];
|
|
10
|
-
__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function getDevtoolsGlobalHook(): any;
|
|
13
|
-
export declare function getTarget(): GlobalTarget;
|
|
14
|
-
export declare const isProxyAvailable: boolean;
|
|
15
|
-
export {};
|
package/lib/esm/env.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function getDevtoolsGlobalHook() {
|
|
2
|
-
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
3
|
-
}
|
|
4
|
-
export function getTarget() {
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
|
|
7
|
-
? window
|
|
8
|
-
: typeof global !== 'undefined'
|
|
9
|
-
? global
|
|
10
|
-
: {};
|
|
11
|
-
}
|
|
12
|
-
export const isProxyAvailable = typeof Proxy === 'function';
|
package/lib/esm/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DevtoolsPluginApi } from './api/index.js';
|
|
2
|
-
import type { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin.js';
|
|
3
|
-
export * from './api/index.js';
|
|
4
|
-
export * from './plugin.js';
|
|
5
|
-
export * from './time.js';
|
|
6
|
-
export { PluginQueueItem } from './env.js';
|
|
7
|
-
declare type Cast<A, B> = A extends B ? A : B;
|
|
8
|
-
declare type Narrowable = string | number | bigint | boolean;
|
|
9
|
-
declare type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({
|
|
10
|
-
[K in keyof A]: Narrow<A[K]>;
|
|
11
|
-
})>;
|
|
12
|
-
declare type Exact<C, T> = {
|
|
13
|
-
[K in keyof C]: K extends keyof T ? T[K] : never;
|
|
14
|
-
};
|
|
15
|
-
export declare type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
|
|
16
|
-
export declare function setupDevtoolsPlugin<TDescriptor extends Exact<TDescriptor, PluginDescriptor>, TSettings = ExtractSettingsTypes<TDescriptor extends {
|
|
17
|
-
settings: infer S;
|
|
18
|
-
} ? S extends Record<string, PluginSettingsItem> ? S : Record<string, PluginSettingsItem> : Record<string, PluginSettingsItem>>>(pluginDescriptor: Narrow<TDescriptor>, setupFn: SetupFunction<TSettings>): void;
|
package/lib/esm/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env.js';
|
|
2
|
-
import { HOOK_SETUP } from './const.js';
|
|
3
|
-
import { ApiProxy } from './proxy.js';
|
|
4
|
-
export * from './api/index.js';
|
|
5
|
-
export * from './plugin.js';
|
|
6
|
-
export * from './time.js';
|
|
7
|
-
export function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
8
|
-
const descriptor = pluginDescriptor;
|
|
9
|
-
const target = getTarget();
|
|
10
|
-
const hook = getDevtoolsGlobalHook();
|
|
11
|
-
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
|
|
12
|
-
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|
13
|
-
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
|
|
17
|
-
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|
18
|
-
list.push({
|
|
19
|
-
pluginDescriptor: descriptor,
|
|
20
|
-
setupFn,
|
|
21
|
-
proxy,
|
|
22
|
-
});
|
|
23
|
-
if (proxy)
|
|
24
|
-
setupFn(proxy.proxiedTarget);
|
|
25
|
-
}
|
|
26
|
-
}
|
package/lib/esm/plugin.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { App } from './api/index.js';
|
|
2
|
-
export interface PluginDescriptor {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
app: App;
|
|
6
|
-
packageName?: string;
|
|
7
|
-
homepage?: string;
|
|
8
|
-
componentStateTypes?: string[];
|
|
9
|
-
logo?: string;
|
|
10
|
-
disableAppScope?: boolean;
|
|
11
|
-
disablePluginScope?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Run the plugin setup and expose the api even if the devtools is not opened yet.
|
|
14
|
-
* Useful to record timeline events early.
|
|
15
|
-
*/
|
|
16
|
-
enableEarlyProxy?: boolean;
|
|
17
|
-
settings?: Record<string, PluginSettingsItem>;
|
|
18
|
-
}
|
|
19
|
-
export declare type PluginSettingsItem = {
|
|
20
|
-
label: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
} & ({
|
|
23
|
-
type: 'boolean';
|
|
24
|
-
defaultValue: boolean;
|
|
25
|
-
} | {
|
|
26
|
-
type: 'choice';
|
|
27
|
-
defaultValue: string | number;
|
|
28
|
-
options: {
|
|
29
|
-
value: string | number;
|
|
30
|
-
label: string;
|
|
31
|
-
}[];
|
|
32
|
-
component?: 'select' | 'button-group';
|
|
33
|
-
} | {
|
|
34
|
-
type: 'text';
|
|
35
|
-
defaultValue: string;
|
|
36
|
-
});
|
|
37
|
-
declare type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{
|
|
38
|
-
type: 'boolean';
|
|
39
|
-
}] ? boolean : [T] extends [{
|
|
40
|
-
type: 'choice';
|
|
41
|
-
}] ? T['options'][number]['value'] : [T] extends [{
|
|
42
|
-
type: 'text';
|
|
43
|
-
}] ? string : unknown;
|
|
44
|
-
export declare type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = {
|
|
45
|
-
[K in keyof O]: InferSettingsType<O[K]>;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
package/lib/esm/plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/proxy.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Context, DevtoolsPluginApi, Hookable } from './api/index.js';
|
|
2
|
-
import type { PluginDescriptor } from './plugin.js';
|
|
3
|
-
interface QueueItem {
|
|
4
|
-
method: string;
|
|
5
|
-
args: any[];
|
|
6
|
-
resolve?: (value?: any) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class ApiProxy<TTarget extends DevtoolsPluginApi<any> = DevtoolsPluginApi<any>> {
|
|
9
|
-
target: TTarget | null;
|
|
10
|
-
targetQueue: QueueItem[];
|
|
11
|
-
proxiedTarget: TTarget;
|
|
12
|
-
onQueue: QueueItem[];
|
|
13
|
-
proxiedOn: Hookable<Context>;
|
|
14
|
-
plugin: PluginDescriptor;
|
|
15
|
-
hook: any;
|
|
16
|
-
fallbacks: Record<string, any>;
|
|
17
|
-
constructor(plugin: PluginDescriptor, hook: any);
|
|
18
|
-
setRealTarget(target: TTarget): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/lib/esm/proxy.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { HOOK_PLUGIN_SETTINGS_SET } from './const.js';
|
|
2
|
-
import { now } from './time.js';
|
|
3
|
-
export class ApiProxy {
|
|
4
|
-
constructor(plugin, hook) {
|
|
5
|
-
this.target = null;
|
|
6
|
-
this.targetQueue = [];
|
|
7
|
-
this.onQueue = [];
|
|
8
|
-
this.plugin = plugin;
|
|
9
|
-
this.hook = hook;
|
|
10
|
-
const defaultSettings = {};
|
|
11
|
-
if (plugin.settings) {
|
|
12
|
-
for (const id in plugin.settings) {
|
|
13
|
-
const item = plugin.settings[id];
|
|
14
|
-
defaultSettings[id] = item.defaultValue;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|
18
|
-
let currentSettings = Object.assign({}, defaultSettings);
|
|
19
|
-
try {
|
|
20
|
-
const raw = localStorage.getItem(localSettingsSaveId);
|
|
21
|
-
const data = JSON.parse(raw);
|
|
22
|
-
Object.assign(currentSettings, data);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
// noop
|
|
26
|
-
}
|
|
27
|
-
this.fallbacks = {
|
|
28
|
-
getSettings() {
|
|
29
|
-
return currentSettings;
|
|
30
|
-
},
|
|
31
|
-
setSettings(value) {
|
|
32
|
-
try {
|
|
33
|
-
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
// noop
|
|
37
|
-
}
|
|
38
|
-
currentSettings = value;
|
|
39
|
-
},
|
|
40
|
-
now() {
|
|
41
|
-
return now();
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
if (hook) {
|
|
45
|
-
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
|
46
|
-
if (pluginId === this.plugin.id) {
|
|
47
|
-
this.fallbacks.setSettings(value);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
this.proxiedOn = new Proxy({}, {
|
|
52
|
-
get: (_target, prop) => {
|
|
53
|
-
if (this.target) {
|
|
54
|
-
return this.target.on[prop];
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return (...args) => {
|
|
58
|
-
this.onQueue.push({
|
|
59
|
-
method: prop,
|
|
60
|
-
args,
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
this.proxiedTarget = new Proxy({}, {
|
|
67
|
-
get: (_target, prop) => {
|
|
68
|
-
if (this.target) {
|
|
69
|
-
return this.target[prop];
|
|
70
|
-
}
|
|
71
|
-
else if (prop === 'on') {
|
|
72
|
-
return this.proxiedOn;
|
|
73
|
-
}
|
|
74
|
-
else if (Object.keys(this.fallbacks).includes(prop)) {
|
|
75
|
-
return (...args) => {
|
|
76
|
-
this.targetQueue.push({
|
|
77
|
-
method: prop,
|
|
78
|
-
args,
|
|
79
|
-
resolve: () => { },
|
|
80
|
-
});
|
|
81
|
-
return this.fallbacks[prop](...args);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
return (...args) => {
|
|
86
|
-
return new Promise(resolve => {
|
|
87
|
-
this.targetQueue.push({
|
|
88
|
-
method: prop,
|
|
89
|
-
args,
|
|
90
|
-
resolve,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
async setRealTarget(target) {
|
|
99
|
-
this.target = target;
|
|
100
|
-
for (const item of this.onQueue) {
|
|
101
|
-
this.target.on[item.method](...item.args);
|
|
102
|
-
}
|
|
103
|
-
for (const item of this.targetQueue) {
|
|
104
|
-
item.resolve(await this.target[item.method](...item.args));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
package/lib/esm/time.d.ts
DELETED
package/lib/esm/time.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
let supported;
|
|
2
|
-
let perf;
|
|
3
|
-
export function isPerformanceSupported() {
|
|
4
|
-
var _a;
|
|
5
|
-
if (supported !== undefined) {
|
|
6
|
-
return supported;
|
|
7
|
-
}
|
|
8
|
-
if (typeof window !== 'undefined' && window.performance) {
|
|
9
|
-
supported = true;
|
|
10
|
-
perf = window.performance;
|
|
11
|
-
}
|
|
12
|
-
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
13
|
-
supported = true;
|
|
14
|
-
perf = global.perf_hooks.performance;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
supported = false;
|
|
18
|
-
}
|
|
19
|
-
return supported;
|
|
20
|
-
}
|
|
21
|
-
export function now() {
|
|
22
|
-
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
23
|
-
}
|