@vue/devtools-api 6.0.0-beta.2 → 6.0.0-beta.20
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/lib/{api → cjs/api}/api.js +0 -1
- package/lib/{api → cjs/api}/app.js +0 -1
- package/lib/{api → cjs/api}/component.js +0 -1
- package/lib/{api → cjs/api}/context.js +0 -1
- package/lib/cjs/api/hooks.js +2 -0
- package/lib/{api → cjs/api}/index.js +1 -1
- package/lib/cjs/api/util.js +2 -0
- package/lib/cjs/const.js +5 -0
- package/lib/cjs/env.js +17 -0
- package/lib/{index.js → cjs/index.js} +13 -5
- package/lib/cjs/plugin.js +2 -0
- package/lib/cjs/proxy.js +105 -0
- package/lib/esm/api/api.d.ts +102 -0
- package/lib/esm/api/api.js +0 -0
- package/lib/esm/api/app.d.ts +3 -0
- package/lib/esm/api/app.js +0 -0
- package/lib/{api → esm/api}/component.d.ts +37 -19
- package/lib/esm/api/component.js +0 -0
- package/lib/esm/api/context.d.ts +5 -0
- package/lib/esm/api/context.js +0 -0
- package/lib/esm/api/hooks.d.ts +179 -0
- package/lib/esm/api/hooks.js +0 -0
- package/lib/{api → esm/api}/index.d.ts +1 -0
- package/lib/esm/api/index.js +6 -0
- package/lib/esm/api/util.d.ts +4 -0
- package/lib/esm/api/util.js +0 -0
- package/lib/esm/const.d.ts +2 -0
- package/lib/esm/const.js +2 -0
- package/lib/esm/env.d.ts +15 -0
- package/lib/esm/env.js +12 -0
- package/lib/esm/index.d.ts +7 -0
- package/lib/esm/index.js +24 -0
- package/lib/esm/plugin.d.ts +35 -0
- package/lib/esm/plugin.js +0 -0
- package/lib/esm/proxy.d.ts +20 -0
- package/lib/esm/proxy.js +101 -0
- package/package.json +18 -8
- package/.eslintrc.js +0 -14
- package/lib/api/api.d.ts +0 -48
- package/lib/api/api.js.map +0 -1
- package/lib/api/app.d.ts +0 -1
- package/lib/api/app.js.map +0 -1
- package/lib/api/component.js.map +0 -1
- package/lib/api/context.d.ts +0 -3
- package/lib/api/context.js.map +0 -1
- package/lib/api/hooks.d.ts +0 -94
- package/lib/api/hooks.js +0 -19
- package/lib/api/hooks.js.map +0 -1
- package/lib/api/index.js.map +0 -1
- package/lib/const.d.ts +0 -3
- package/lib/const.js +0 -8
- package/lib/const.js.map +0 -1
- package/lib/env.d.ts +0 -3
- package/lib/env.js +0 -11
- package/lib/env.js.map +0 -1
- package/lib/index.d.ts +0 -9
- package/lib/index.js.map +0 -1
- package/src/api/api.ts +0 -56
- package/src/api/app.ts +0 -1
- package/src/api/component.ts +0 -68
- package/src/api/context.ts +0 -5
- package/src/api/hooks.ts +0 -99
- package/src/api/index.ts +0 -5
- package/src/const.ts +0 -3
- package/src/env.ts +0 -7
- package/src/index.ts +0 -25
- package/tsconfig.json +0 -29
package/lib/cjs/const.js
ADDED
package/lib/cjs/env.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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';
|
|
@@ -13,18 +13,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.setupDevtoolsPlugin = void 0;
|
|
14
14
|
const env_1 = require("./env");
|
|
15
15
|
const const_1 = require("./const");
|
|
16
|
+
const proxy_1 = require("./proxy");
|
|
16
17
|
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./plugin"), exports);
|
|
17
19
|
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const target = env_1.getTarget();
|
|
21
|
+
const hook = env_1.getDevtoolsGlobalHook();
|
|
22
|
+
const enableProxy = env_1.isProxyAvailable && pluginDescriptor.enableEarlyProxy;
|
|
23
|
+
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|
24
|
+
hook.emit(const_1.HOOK_SETUP, pluginDescriptor, setupFn);
|
|
20
25
|
}
|
|
21
26
|
else {
|
|
22
|
-
const
|
|
27
|
+
const proxy = enableProxy ? new proxy_1.ApiProxy(pluginDescriptor, hook) : null;
|
|
28
|
+
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|
23
29
|
list.push({
|
|
24
30
|
pluginDescriptor,
|
|
25
|
-
setupFn
|
|
31
|
+
setupFn,
|
|
32
|
+
proxy,
|
|
26
33
|
});
|
|
34
|
+
if (proxy)
|
|
35
|
+
setupFn(proxy.proxiedTarget);
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/proxy.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiProxy = void 0;
|
|
4
|
+
const const_1 = require("./const");
|
|
5
|
+
class ApiProxy {
|
|
6
|
+
constructor(plugin, hook) {
|
|
7
|
+
this.target = null;
|
|
8
|
+
this.targetQueue = [];
|
|
9
|
+
this.onQueue = [];
|
|
10
|
+
this.plugin = plugin;
|
|
11
|
+
this.hook = hook;
|
|
12
|
+
const defaultSettings = {};
|
|
13
|
+
if (plugin.settings) {
|
|
14
|
+
for (const id in plugin.settings) {
|
|
15
|
+
const item = plugin.settings[id];
|
|
16
|
+
defaultSettings[id] = item.defaultValue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|
20
|
+
let currentSettings = { ...defaultSettings };
|
|
21
|
+
try {
|
|
22
|
+
const raw = localStorage.getItem(localSettingsSaveId);
|
|
23
|
+
const data = JSON.parse(raw);
|
|
24
|
+
Object.assign(currentSettings, data);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
// noop
|
|
28
|
+
}
|
|
29
|
+
this.fallbacks = {
|
|
30
|
+
getSettings() {
|
|
31
|
+
return currentSettings;
|
|
32
|
+
},
|
|
33
|
+
setSettings(value) {
|
|
34
|
+
try {
|
|
35
|
+
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
// noop
|
|
39
|
+
}
|
|
40
|
+
currentSettings = value;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
hook.on(const_1.HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
|
44
|
+
if (pluginId === this.plugin.id) {
|
|
45
|
+
this.fallbacks.setSettings(value);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.proxiedOn = new Proxy({}, {
|
|
49
|
+
get: (_target, prop) => {
|
|
50
|
+
if (this.target) {
|
|
51
|
+
return this.target.on[prop];
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return (...args) => {
|
|
55
|
+
this.onQueue.push({
|
|
56
|
+
method: prop,
|
|
57
|
+
args,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
this.proxiedTarget = new Proxy({}, {
|
|
64
|
+
get: (_target, prop) => {
|
|
65
|
+
if (this.target) {
|
|
66
|
+
return this.target[prop];
|
|
67
|
+
}
|
|
68
|
+
else if (prop === 'on') {
|
|
69
|
+
return this.proxiedOn;
|
|
70
|
+
}
|
|
71
|
+
else if (Object.keys(this.fallbacks).includes(prop)) {
|
|
72
|
+
return (...args) => {
|
|
73
|
+
this.targetQueue.push({
|
|
74
|
+
method: prop,
|
|
75
|
+
args,
|
|
76
|
+
resolve: () => { },
|
|
77
|
+
});
|
|
78
|
+
return this.fallbacks[prop](...args);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return (...args) => {
|
|
83
|
+
return new Promise(resolve => {
|
|
84
|
+
this.targetQueue.push({
|
|
85
|
+
method: prop,
|
|
86
|
+
args,
|
|
87
|
+
resolve,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async setRealTarget(target) {
|
|
96
|
+
this.target = target;
|
|
97
|
+
for (const item of this.onQueue) {
|
|
98
|
+
this.target.on[item.method](...item.args);
|
|
99
|
+
}
|
|
100
|
+
for (const item of this.targetQueue) {
|
|
101
|
+
item.resolve(await this.target[item.method](...item.args));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.ApiProxy = ApiProxy;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ComponentBounds, Hookable } from './hooks';
|
|
2
|
+
import { Context } from './context';
|
|
3
|
+
import { ComponentInstance, ComponentState, StateBase } from './component';
|
|
4
|
+
import { App } from './app';
|
|
5
|
+
import { ID } from './util';
|
|
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
|
+
/**
|
|
22
|
+
* @private Not implemented yet
|
|
23
|
+
*/
|
|
24
|
+
setSettings(values: TSettings): void;
|
|
25
|
+
}
|
|
26
|
+
export interface AppRecord {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
instanceMap: Map<string, ComponentInstance>;
|
|
30
|
+
rootInstance: ComponentInstance;
|
|
31
|
+
}
|
|
32
|
+
export interface TimelineLayerOptions<TData = any, TMeta = any> {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
color: number;
|
|
36
|
+
skipScreenshots?: boolean;
|
|
37
|
+
groupsOnly?: boolean;
|
|
38
|
+
ignoreNoDurationGroups?: boolean;
|
|
39
|
+
screenshotOverlayRender?: (event: TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent, ctx: ScreenshotOverlayRenderContext) => ScreenshotOverlayRenderResult | Promise<ScreenshotOverlayRenderResult>;
|
|
40
|
+
}
|
|
41
|
+
export interface ScreenshotOverlayEvent {
|
|
42
|
+
layerId: string;
|
|
43
|
+
renderMeta: any;
|
|
44
|
+
}
|
|
45
|
+
export interface ScreenshotOverlayRenderContext<TData = any, TMeta = any> {
|
|
46
|
+
screenshot: ScreenshotData;
|
|
47
|
+
events: (TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent)[];
|
|
48
|
+
index: number;
|
|
49
|
+
}
|
|
50
|
+
export declare type ScreenshotOverlayRenderResult = HTMLElement | string | false;
|
|
51
|
+
export interface ScreenshotData {
|
|
52
|
+
time: number;
|
|
53
|
+
}
|
|
54
|
+
export interface TimelineEventOptions {
|
|
55
|
+
layerId: string;
|
|
56
|
+
event: TimelineEvent;
|
|
57
|
+
all?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface TimelineEvent<TData = any, TMeta = any> {
|
|
60
|
+
time: number;
|
|
61
|
+
data: TData;
|
|
62
|
+
logType?: 'default' | 'warning' | 'error';
|
|
63
|
+
meta?: TMeta;
|
|
64
|
+
groupId?: ID;
|
|
65
|
+
title?: string;
|
|
66
|
+
subtitle?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface TimelineMarkerOptions {
|
|
69
|
+
id: string;
|
|
70
|
+
time: number;
|
|
71
|
+
color: number;
|
|
72
|
+
label: string;
|
|
73
|
+
all?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface CustomInspectorOptions {
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
icon?: string;
|
|
79
|
+
treeFilterPlaceholder?: string;
|
|
80
|
+
stateFilterPlaceholder?: string;
|
|
81
|
+
noSelectionText?: string;
|
|
82
|
+
actions?: {
|
|
83
|
+
icon: string;
|
|
84
|
+
tooltip?: string;
|
|
85
|
+
action: () => void | Promise<void>;
|
|
86
|
+
}[];
|
|
87
|
+
}
|
|
88
|
+
export interface CustomInspectorNode {
|
|
89
|
+
id: string;
|
|
90
|
+
label: string;
|
|
91
|
+
children?: CustomInspectorNode[];
|
|
92
|
+
tags?: InspectorNodeTag[];
|
|
93
|
+
}
|
|
94
|
+
export interface InspectorNodeTag {
|
|
95
|
+
label: string;
|
|
96
|
+
textColor: number;
|
|
97
|
+
backgroundColor: number;
|
|
98
|
+
tooltip?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface CustomInspectorState {
|
|
101
|
+
[key: string]: (StateBase | Omit<ComponentState, 'type'>)[];
|
|
102
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { InspectorNodeTag } from './api';
|
|
2
|
+
import { ID } from './util';
|
|
3
|
+
export declare type ComponentInstance = Record<string, any> & {
|
|
4
|
+
__component: true;
|
|
5
|
+
};
|
|
2
6
|
export interface ComponentTreeNode {
|
|
3
|
-
uid:
|
|
7
|
+
uid: ID;
|
|
4
8
|
id: string;
|
|
5
9
|
name: string;
|
|
6
|
-
renderKey: string;
|
|
10
|
+
renderKey: string | number;
|
|
7
11
|
inactive: boolean;
|
|
8
12
|
isFragment: boolean;
|
|
9
13
|
hasChildren: boolean;
|
|
10
14
|
children: ComponentTreeNode[];
|
|
11
|
-
|
|
15
|
+
domOrder?: number[];
|
|
12
16
|
consoleId?: string;
|
|
13
17
|
isRouterView?: boolean;
|
|
14
18
|
macthedRouteSegment?: string;
|
|
19
|
+
tags: InspectorNodeTag[];
|
|
20
|
+
meta?: any;
|
|
15
21
|
}
|
|
16
22
|
export interface InspectedComponentData {
|
|
17
23
|
id: string;
|
|
@@ -23,7 +29,7 @@ export interface InspectedComponentData {
|
|
|
23
29
|
export interface StateBase {
|
|
24
30
|
key: string;
|
|
25
31
|
value: any;
|
|
26
|
-
editable
|
|
32
|
+
editable?: boolean;
|
|
27
33
|
objectType?: 'ref' | 'reactive' | 'computed' | 'other';
|
|
28
34
|
raw?: string;
|
|
29
35
|
}
|
|
@@ -40,21 +46,33 @@ export interface ComponentPropState extends ComponentStateBase {
|
|
|
40
46
|
}
|
|
41
47
|
export declare type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
|
|
42
48
|
export interface ComponentCustomState extends ComponentStateBase {
|
|
43
|
-
value:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
value: CustomState;
|
|
50
|
+
}
|
|
51
|
+
export declare type CustomState = {
|
|
52
|
+
_custom: {
|
|
53
|
+
type: ComponentBuiltinCustomStateTypes | 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?: {
|
|
49
63
|
abstract?: boolean;
|
|
50
|
-
file?: string;
|
|
51
|
-
uid?: number;
|
|
52
|
-
readOnly?: boolean;
|
|
53
|
-
/** Configure immediate child fields */
|
|
54
|
-
fields?: {
|
|
55
|
-
abstract?: boolean;
|
|
56
|
-
};
|
|
57
64
|
};
|
|
65
|
+
id?: any;
|
|
66
|
+
actions?: {
|
|
67
|
+
icon: string;
|
|
68
|
+
tooltip?: string;
|
|
69
|
+
action: () => void | Promise<void>;
|
|
70
|
+
}[];
|
|
71
|
+
/** internal */
|
|
72
|
+
_reviveId?: number;
|
|
58
73
|
};
|
|
59
|
-
}
|
|
74
|
+
};
|
|
60
75
|
export declare type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
|
|
76
|
+
export interface ComponentDevtoolsOptions {
|
|
77
|
+
hide?: boolean;
|
|
78
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { ComponentTreeNode, InspectedComponentData, ComponentInstance, ComponentDevtoolsOptions } from './component';
|
|
2
|
+
import { App } from './app';
|
|
3
|
+
import { CustomInspectorNode, CustomInspectorState, TimelineEvent } from './api';
|
|
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
|
+
};
|
|
57
|
+
[Hooks.VISIT_COMPONENT_TREE]: {
|
|
58
|
+
app: App;
|
|
59
|
+
componentInstance: ComponentInstance;
|
|
60
|
+
treeNode: ComponentTreeNode;
|
|
61
|
+
filter: string;
|
|
62
|
+
};
|
|
63
|
+
[Hooks.WALK_COMPONENT_PARENTS]: {
|
|
64
|
+
componentInstance: ComponentInstance;
|
|
65
|
+
parentInstances: ComponentInstance[];
|
|
66
|
+
};
|
|
67
|
+
[Hooks.INSPECT_COMPONENT]: {
|
|
68
|
+
app: App;
|
|
69
|
+
componentInstance: ComponentInstance;
|
|
70
|
+
instanceData: InspectedComponentData;
|
|
71
|
+
};
|
|
72
|
+
[Hooks.GET_COMPONENT_BOUNDS]: {
|
|
73
|
+
componentInstance: ComponentInstance;
|
|
74
|
+
bounds: ComponentBounds;
|
|
75
|
+
};
|
|
76
|
+
[Hooks.GET_COMPONENT_NAME]: {
|
|
77
|
+
componentInstance: ComponentInstance;
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
80
|
+
[Hooks.GET_COMPONENT_INSTANCES]: {
|
|
81
|
+
app: App;
|
|
82
|
+
componentInstances: ComponentInstance[];
|
|
83
|
+
};
|
|
84
|
+
[Hooks.GET_ELEMENT_COMPONENT]: {
|
|
85
|
+
element: HTMLElement | any;
|
|
86
|
+
componentInstance: ComponentInstance;
|
|
87
|
+
};
|
|
88
|
+
[Hooks.GET_COMPONENT_ROOT_ELEMENTS]: {
|
|
89
|
+
componentInstance: ComponentInstance;
|
|
90
|
+
rootElements: (HTMLElement | any)[];
|
|
91
|
+
};
|
|
92
|
+
[Hooks.EDIT_COMPONENT_STATE]: {
|
|
93
|
+
app: App;
|
|
94
|
+
componentInstance: ComponentInstance;
|
|
95
|
+
path: string[];
|
|
96
|
+
type: string;
|
|
97
|
+
state: EditStatePayload;
|
|
98
|
+
set: (object: any, path?: string | (string[]), value?: any, cb?: (object: any, field: string, value: any) => void) => void;
|
|
99
|
+
};
|
|
100
|
+
[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS]: {
|
|
101
|
+
componentInstance: ComponentInstance;
|
|
102
|
+
options: ComponentDevtoolsOptions;
|
|
103
|
+
};
|
|
104
|
+
[Hooks.GET_COMPONENT_RENDER_CODE]: {
|
|
105
|
+
componentInstance: ComponentInstance;
|
|
106
|
+
code: string;
|
|
107
|
+
};
|
|
108
|
+
[Hooks.INSPECT_TIMELINE_EVENT]: {
|
|
109
|
+
app: App;
|
|
110
|
+
layerId: string;
|
|
111
|
+
event: TimelineEvent;
|
|
112
|
+
all?: boolean;
|
|
113
|
+
data: any;
|
|
114
|
+
};
|
|
115
|
+
[Hooks.TIMELINE_CLEARED]: Record<string, never>;
|
|
116
|
+
[Hooks.GET_INSPECTOR_TREE]: {
|
|
117
|
+
app: App;
|
|
118
|
+
inspectorId: string;
|
|
119
|
+
filter: string;
|
|
120
|
+
rootNodes: CustomInspectorNode[];
|
|
121
|
+
};
|
|
122
|
+
[Hooks.GET_INSPECTOR_STATE]: {
|
|
123
|
+
app: App;
|
|
124
|
+
inspectorId: string;
|
|
125
|
+
nodeId: string;
|
|
126
|
+
state: CustomInspectorState;
|
|
127
|
+
};
|
|
128
|
+
[Hooks.EDIT_INSPECTOR_STATE]: {
|
|
129
|
+
app: App;
|
|
130
|
+
inspectorId: string;
|
|
131
|
+
nodeId: string;
|
|
132
|
+
path: string[];
|
|
133
|
+
type: string;
|
|
134
|
+
state: EditStatePayload;
|
|
135
|
+
set: (object: any, path: string | (string[]), value: any, cb?: (object: any, field: string, value: any) => void) => void;
|
|
136
|
+
};
|
|
137
|
+
[Hooks.SET_PLUGIN_SETTINGS]: {
|
|
138
|
+
app: App;
|
|
139
|
+
pluginId: string;
|
|
140
|
+
key: string;
|
|
141
|
+
newValue: any;
|
|
142
|
+
oldValue: any;
|
|
143
|
+
settings: any;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export declare type EditStatePayload = {
|
|
147
|
+
value: any;
|
|
148
|
+
newKey?: string | null;
|
|
149
|
+
remove?: undefined | false;
|
|
150
|
+
} | {
|
|
151
|
+
value?: undefined;
|
|
152
|
+
newKey?: undefined;
|
|
153
|
+
remove: true;
|
|
154
|
+
};
|
|
155
|
+
export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
|
|
156
|
+
export interface Hookable<TContext> {
|
|
157
|
+
transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any;
|
|
158
|
+
getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any;
|
|
159
|
+
getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any;
|
|
160
|
+
registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any;
|
|
161
|
+
walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any;
|
|
162
|
+
visitComponentTree(handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>): any;
|
|
163
|
+
walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any;
|
|
164
|
+
inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any;
|
|
165
|
+
getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any;
|
|
166
|
+
getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any;
|
|
167
|
+
getComponentInstances(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>): any;
|
|
168
|
+
getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any;
|
|
169
|
+
getComponentRootElements(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>): any;
|
|
170
|
+
editComponentState(handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>): any;
|
|
171
|
+
getComponentDevtoolsOptions(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>): any;
|
|
172
|
+
getComponentRenderCode(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>): any;
|
|
173
|
+
inspectTimelineEvent(handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>): any;
|
|
174
|
+
timelineCleared(handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>): any;
|
|
175
|
+
getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any;
|
|
176
|
+
getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any;
|
|
177
|
+
editInspectorState(handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>): any;
|
|
178
|
+
setPluginSettings(handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>): any;
|
|
179
|
+
}
|
|
File without changes
|
|
File without changes
|
package/lib/esm/const.js
ADDED
package/lib/esm/env.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PluginDescriptor, SetupFunction } from '.';
|
|
2
|
+
import { ApiProxy } from './proxy';
|
|
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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DevtoolsPluginApi } from './api';
|
|
2
|
+
import { PluginDescriptor } from './plugin';
|
|
3
|
+
export * from './api';
|
|
4
|
+
export * from './plugin';
|
|
5
|
+
export { PluginQueueItem } from './env';
|
|
6
|
+
export declare type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
|
|
7
|
+
export declare function setupDevtoolsPlugin<TSettings = any>(pluginDescriptor: PluginDescriptor, setupFn: SetupFunction): void;
|