@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.
Files changed (67) hide show
  1. package/lib/{api → cjs/api}/api.js +0 -1
  2. package/lib/{api → cjs/api}/app.js +0 -1
  3. package/lib/{api → cjs/api}/component.js +0 -1
  4. package/lib/{api → cjs/api}/context.js +0 -1
  5. package/lib/cjs/api/hooks.js +2 -0
  6. package/lib/{api → cjs/api}/index.js +1 -1
  7. package/lib/cjs/api/util.js +2 -0
  8. package/lib/cjs/const.js +5 -0
  9. package/lib/cjs/env.js +17 -0
  10. package/lib/{index.js → cjs/index.js} +13 -5
  11. package/lib/cjs/plugin.js +2 -0
  12. package/lib/cjs/proxy.js +105 -0
  13. package/lib/esm/api/api.d.ts +102 -0
  14. package/lib/esm/api/api.js +0 -0
  15. package/lib/esm/api/app.d.ts +3 -0
  16. package/lib/esm/api/app.js +0 -0
  17. package/lib/{api → esm/api}/component.d.ts +37 -19
  18. package/lib/esm/api/component.js +0 -0
  19. package/lib/esm/api/context.d.ts +5 -0
  20. package/lib/esm/api/context.js +0 -0
  21. package/lib/esm/api/hooks.d.ts +179 -0
  22. package/lib/esm/api/hooks.js +0 -0
  23. package/lib/{api → esm/api}/index.d.ts +1 -0
  24. package/lib/esm/api/index.js +6 -0
  25. package/lib/esm/api/util.d.ts +4 -0
  26. package/lib/esm/api/util.js +0 -0
  27. package/lib/esm/const.d.ts +2 -0
  28. package/lib/esm/const.js +2 -0
  29. package/lib/esm/env.d.ts +15 -0
  30. package/lib/esm/env.js +12 -0
  31. package/lib/esm/index.d.ts +7 -0
  32. package/lib/esm/index.js +24 -0
  33. package/lib/esm/plugin.d.ts +35 -0
  34. package/lib/esm/plugin.js +0 -0
  35. package/lib/esm/proxy.d.ts +20 -0
  36. package/lib/esm/proxy.js +101 -0
  37. package/package.json +18 -8
  38. package/.eslintrc.js +0 -14
  39. package/lib/api/api.d.ts +0 -48
  40. package/lib/api/api.js.map +0 -1
  41. package/lib/api/app.d.ts +0 -1
  42. package/lib/api/app.js.map +0 -1
  43. package/lib/api/component.js.map +0 -1
  44. package/lib/api/context.d.ts +0 -3
  45. package/lib/api/context.js.map +0 -1
  46. package/lib/api/hooks.d.ts +0 -94
  47. package/lib/api/hooks.js +0 -19
  48. package/lib/api/hooks.js.map +0 -1
  49. package/lib/api/index.js.map +0 -1
  50. package/lib/const.d.ts +0 -3
  51. package/lib/const.js +0 -8
  52. package/lib/const.js.map +0 -1
  53. package/lib/env.d.ts +0 -3
  54. package/lib/env.js +0 -11
  55. package/lib/env.js.map +0 -1
  56. package/lib/index.d.ts +0 -9
  57. package/lib/index.js.map +0 -1
  58. package/src/api/api.ts +0 -56
  59. package/src/api/app.ts +0 -1
  60. package/src/api/component.ts +0 -68
  61. package/src/api/context.ts +0 -5
  62. package/src/api/hooks.ts +0 -99
  63. package/src/api/index.ts +0 -5
  64. package/src/const.ts +0 -3
  65. package/src/env.ts +0 -7
  66. package/src/index.ts +0 -25
  67. package/tsconfig.json +0 -29
@@ -0,0 +1,24 @@
1
+ import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env';
2
+ import { HOOK_SETUP } from './const';
3
+ import { ApiProxy } from './proxy';
4
+ export * from './api';
5
+ export * from './plugin';
6
+ export function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
7
+ const target = getTarget();
8
+ const hook = getDevtoolsGlobalHook();
9
+ const enableProxy = isProxyAvailable && pluginDescriptor.enableEarlyProxy;
10
+ if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
11
+ hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
12
+ }
13
+ else {
14
+ const proxy = enableProxy ? new ApiProxy(pluginDescriptor, hook) : null;
15
+ const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
16
+ list.push({
17
+ pluginDescriptor,
18
+ setupFn,
19
+ proxy,
20
+ });
21
+ if (proxy)
22
+ setupFn(proxy.proxiedTarget);
23
+ }
24
+ }
@@ -0,0 +1,35 @@
1
+ import { App } from './api';
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
+ } & ({
22
+ type: 'boolean';
23
+ defaultValue: boolean;
24
+ } | {
25
+ type: 'choice';
26
+ defaultValue: string | number;
27
+ options: {
28
+ value: string | number;
29
+ label: string;
30
+ }[];
31
+ component?: 'select' | 'button-group';
32
+ } | {
33
+ type: 'text';
34
+ defaultValue: string;
35
+ });
File without changes
@@ -0,0 +1,20 @@
1
+ import { Context, DevtoolsPluginApi, Hookable } from './api';
2
+ import { PluginDescriptor } from './plugin';
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 {};
@@ -0,0 +1,101 @@
1
+ import { HOOK_PLUGIN_SETTINGS_SET } from './const';
2
+ export class ApiProxy {
3
+ constructor(plugin, hook) {
4
+ this.target = null;
5
+ this.targetQueue = [];
6
+ this.onQueue = [];
7
+ this.plugin = plugin;
8
+ this.hook = hook;
9
+ const defaultSettings = {};
10
+ if (plugin.settings) {
11
+ for (const id in plugin.settings) {
12
+ const item = plugin.settings[id];
13
+ defaultSettings[id] = item.defaultValue;
14
+ }
15
+ }
16
+ const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
17
+ let currentSettings = { ...defaultSettings };
18
+ try {
19
+ const raw = localStorage.getItem(localSettingsSaveId);
20
+ const data = JSON.parse(raw);
21
+ Object.assign(currentSettings, data);
22
+ }
23
+ catch (e) {
24
+ // noop
25
+ }
26
+ this.fallbacks = {
27
+ getSettings() {
28
+ return currentSettings;
29
+ },
30
+ setSettings(value) {
31
+ try {
32
+ localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
33
+ }
34
+ catch (e) {
35
+ // noop
36
+ }
37
+ currentSettings = value;
38
+ },
39
+ };
40
+ hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
41
+ if (pluginId === this.plugin.id) {
42
+ this.fallbacks.setSettings(value);
43
+ }
44
+ });
45
+ this.proxiedOn = new Proxy({}, {
46
+ get: (_target, prop) => {
47
+ if (this.target) {
48
+ return this.target.on[prop];
49
+ }
50
+ else {
51
+ return (...args) => {
52
+ this.onQueue.push({
53
+ method: prop,
54
+ args,
55
+ });
56
+ };
57
+ }
58
+ },
59
+ });
60
+ this.proxiedTarget = new Proxy({}, {
61
+ get: (_target, prop) => {
62
+ if (this.target) {
63
+ return this.target[prop];
64
+ }
65
+ else if (prop === 'on') {
66
+ return this.proxiedOn;
67
+ }
68
+ else if (Object.keys(this.fallbacks).includes(prop)) {
69
+ return (...args) => {
70
+ this.targetQueue.push({
71
+ method: prop,
72
+ args,
73
+ resolve: () => { },
74
+ });
75
+ return this.fallbacks[prop](...args);
76
+ };
77
+ }
78
+ else {
79
+ return (...args) => {
80
+ return new Promise(resolve => {
81
+ this.targetQueue.push({
82
+ method: prop,
83
+ args,
84
+ resolve,
85
+ });
86
+ });
87
+ };
88
+ }
89
+ },
90
+ });
91
+ }
92
+ async setRealTarget(target) {
93
+ this.target = target;
94
+ for (const item of this.onQueue) {
95
+ this.target.on[item.method](...item.args);
96
+ }
97
+ for (const item of this.targetQueue) {
98
+ item.resolve(await this.target[item.method](...item.args));
99
+ }
100
+ }
101
+ }
package/package.json CHANGED
@@ -1,10 +1,19 @@
1
1
  {
2
2
  "name": "@vue/devtools-api",
3
- "version": "6.0.0-beta.2",
3
+ "version": "6.0.0-beta.20",
4
4
  "description": "Interact with the Vue devtools from the page",
5
- "main": "./lib/index.js",
6
- "types": "./lib/index.d.ts",
7
- "author": "",
5
+ "main": "lib/cjs/index.js",
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
+ ],
8
17
  "license": "MIT",
9
18
  "repository": {
10
19
  "url": "https://github.com/vuejs/vue-devtools.git",
@@ -15,13 +24,14 @@
15
24
  "access": "public"
16
25
  },
17
26
  "scripts": {
18
- "build": "rimraf lib && yarn ts",
19
- "build:watch": "yarn ts -w",
20
- "ts": "tsc -d -outDir lib"
27
+ "build": "rimraf lib && yarn build:esm && yarn build:cjs",
28
+ "build:esm": "tsc --module es2015 --outDir lib/esm -d",
29
+ "build:cjs": "tsc --module commonjs --outDir lib/cjs",
30
+ "build:watch": "yarn tsc --module es2015 --outDir lib/esm -d -w --sourceMap"
21
31
  },
22
32
  "devDependencies": {
23
33
  "@types/node": "^13.9.1",
24
34
  "@types/webpack-env": "^1.15.1",
25
35
  "typescript": "^3.8.3"
26
36
  }
27
- }
37
+ }
package/.eslintrc.js DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- globals: {
3
- bridge: 'off'
4
- },
5
- rules: {
6
- 'no-restricted-syntax': [
7
- 'error',
8
- {
9
- selector: 'ForOfStatement',
10
- message: 'Not supported by bublé'
11
- }
12
- ]
13
- }
14
- }
package/lib/api/api.d.ts DELETED
@@ -1,48 +0,0 @@
1
- import { Hookable } from './hooks';
2
- import { Context } from './context';
3
- import { ComponentInstance, ComponentState, StateBase } from './component';
4
- export interface DevtoolsPluginApi {
5
- on: Hookable<Context>;
6
- notifyComponentUpdate(instance: ComponentInstance): any;
7
- addTimelineLayer(options: TimelineLayerOptions): any;
8
- addTimelineEvent(options: TimelineEventOptions): any;
9
- addInspector(options: CustomInspectorOptions): any;
10
- sendInspectorTree(inspectorId: string): any;
11
- sendInspectorState(inspectorId: string): any;
12
- }
13
- export interface TimelineLayerOptions {
14
- id: string;
15
- label: string;
16
- color: number;
17
- }
18
- export interface TimelineEventOptions {
19
- layerId: string;
20
- event: TimelineEvent;
21
- all?: boolean;
22
- }
23
- export interface TimelineEvent<TData = any, TMeta = any> {
24
- time: number;
25
- data: TData;
26
- meta: TMeta;
27
- }
28
- export interface CustomInspectorOptions {
29
- id: string;
30
- label: string;
31
- icon?: string;
32
- treeFilterPlaceholder?: string;
33
- stateFilterPlaceholder?: string;
34
- }
35
- export interface CustomInspectorNode {
36
- id: string;
37
- label: string;
38
- children?: CustomInspectorNode[];
39
- tags?: CustomInspectorNodeTag[];
40
- }
41
- export interface CustomInspectorNodeTag {
42
- label: string;
43
- textColor: number;
44
- backgroundColor: number;
45
- }
46
- export interface CustomInspectorState {
47
- [key: string]: (StateBase | ComponentState)[];
48
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":""}
package/lib/api/app.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare type App = any;
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/api/app.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/api/component.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export interface Context {
2
- currentTab: string;
3
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":""}
@@ -1,94 +0,0 @@
1
- import { ComponentTreeNode, InspectedComponentData, ComponentInstance } from './component';
2
- import { App } from './app';
3
- import { CustomInspectorNode, CustomInspectorState } from './api';
4
- export declare 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
- WALK_COMPONENT_PARENTS = "walkComponentParents",
11
- INSPECT_COMPONENT = "inspectComponent",
12
- GET_COMPONENT_BOUNDS = "getComponentBounds",
13
- GET_COMPONENT_NAME = "getComponentName",
14
- GET_ELEMENT_COMPONENT = "getElementComponent",
15
- GET_INSPECTOR_TREE = "getInspectorTree",
16
- GET_INSPECTOR_STATE = "getInspectorState"
17
- }
18
- export interface ComponentBounds {
19
- left: number;
20
- top: number;
21
- width: number;
22
- height: number;
23
- }
24
- export declare type HookPayloads = {
25
- [Hooks.TRANSFORM_CALL]: {
26
- callName: string;
27
- inArgs: any[];
28
- outArgs: any[];
29
- };
30
- [Hooks.GET_APP_RECORD_NAME]: {
31
- app: App;
32
- name: string;
33
- };
34
- [Hooks.GET_APP_ROOT_INSTANCE]: {
35
- app: App;
36
- root: ComponentInstance;
37
- };
38
- [Hooks.REGISTER_APPLICATION]: {
39
- app: App;
40
- };
41
- [Hooks.WALK_COMPONENT_TREE]: {
42
- componentInstance: ComponentInstance;
43
- componentTreeData: ComponentTreeNode;
44
- maxDepth: number;
45
- filter: string;
46
- };
47
- [Hooks.WALK_COMPONENT_PARENTS]: {
48
- componentInstance: ComponentInstance;
49
- parentInstances: ComponentInstance[];
50
- };
51
- [Hooks.INSPECT_COMPONENT]: {
52
- componentInstance: ComponentInstance;
53
- instanceData: InspectedComponentData;
54
- };
55
- [Hooks.GET_COMPONENT_BOUNDS]: {
56
- componentInstance: ComponentInstance;
57
- bounds: ComponentBounds;
58
- };
59
- [Hooks.GET_COMPONENT_NAME]: {
60
- componentInstance: ComponentInstance;
61
- name: string;
62
- };
63
- [Hooks.GET_ELEMENT_COMPONENT]: {
64
- element: HTMLElement | any;
65
- componentInstance: ComponentInstance;
66
- };
67
- [Hooks.GET_INSPECTOR_TREE]: {
68
- app: App;
69
- inspectorId: string;
70
- filter: string;
71
- rootNodes: CustomInspectorNode[];
72
- };
73
- [Hooks.GET_INSPECTOR_STATE]: {
74
- app: App;
75
- inspectorId: string;
76
- nodeId: string;
77
- state: CustomInspectorState;
78
- };
79
- };
80
- export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
81
- export interface Hookable<TContext> {
82
- transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any;
83
- getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any;
84
- getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any;
85
- registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any;
86
- walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any;
87
- walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any;
88
- inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any;
89
- getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any;
90
- getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any;
91
- getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any;
92
- getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any;
93
- getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any;
94
- }
package/lib/api/hooks.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hooks = void 0;
4
- var Hooks;
5
- (function (Hooks) {
6
- Hooks["TRANSFORM_CALL"] = "transformCall";
7
- Hooks["GET_APP_RECORD_NAME"] = "getAppRecordName";
8
- Hooks["GET_APP_ROOT_INSTANCE"] = "getAppRootInstance";
9
- Hooks["REGISTER_APPLICATION"] = "registerApplication";
10
- Hooks["WALK_COMPONENT_TREE"] = "walkComponentTree";
11
- Hooks["WALK_COMPONENT_PARENTS"] = "walkComponentParents";
12
- Hooks["INSPECT_COMPONENT"] = "inspectComponent";
13
- Hooks["GET_COMPONENT_BOUNDS"] = "getComponentBounds";
14
- Hooks["GET_COMPONENT_NAME"] = "getComponentName";
15
- Hooks["GET_ELEMENT_COMPONENT"] = "getElementComponent";
16
- Hooks["GET_INSPECTOR_TREE"] = "getInspectorTree";
17
- Hooks["GET_INSPECTOR_STATE"] = "getInspectorState";
18
- })(Hooks = exports.Hooks || (exports.Hooks = {}));
19
- //# sourceMappingURL=hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/api/hooks.ts"],"names":[],"mappings":";;;AAIA,IAAY,KAaX;AAbD,WAAY,KAAK;IACf,yCAAgC,CAAA;IAChC,iDAAwC,CAAA;IACxC,qDAA4C,CAAA;IAC5C,qDAA4C,CAAA;IAC5C,kDAAyC,CAAA;IACzC,wDAA+C,CAAA;IAC/C,+CAAsC,CAAA;IACtC,oDAA2C,CAAA;IAC3C,gDAAuC,CAAA;IACvC,sDAA6C,CAAA;IAC7C,gDAAuC,CAAA;IACvC,kDAAyC,CAAA;AAC3C,CAAC,EAbW,KAAK,GAAL,aAAK,KAAL,aAAK,QAahB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAqB;AACrB,wCAAqB;AACrB,8CAA2B;AAC3B,4CAAyB;AACzB,0CAAuB"}
package/lib/const.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare enum ApiHookEvents {
2
- SETUP_DEVTOOLS_PLUGIN = "devtools-plugin:setup"
3
- }
package/lib/const.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiHookEvents = void 0;
4
- var ApiHookEvents;
5
- (function (ApiHookEvents) {
6
- ApiHookEvents["SETUP_DEVTOOLS_PLUGIN"] = "devtools-plugin:setup";
7
- })(ApiHookEvents = exports.ApiHookEvents || (exports.ApiHookEvents = {}));
8
- //# sourceMappingURL=const.js.map
package/lib/const.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,gEAA+C,CAAA;AACjD,CAAC,EAFW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAExB"}
package/lib/env.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const isBrowser: boolean;
2
- export declare const target: any;
3
- export declare const hook: any;
package/lib/env.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hook = exports.target = exports.isBrowser = void 0;
4
- exports.isBrowser = typeof navigator !== 'undefined';
5
- exports.target = exports.isBrowser
6
- ? window
7
- : typeof global !== 'undefined'
8
- ? global
9
- : {};
10
- exports.hook = exports.target.__VUE_DEVTOOLS_GLOBAL_HOOK__;
11
- //# sourceMappingURL=env.js.map
package/lib/env.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,SAAS,KAAK,WAAW,CAAA;AAC5C,QAAA,MAAM,GAAQ,iBAAS;IAClC,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;QAC7B,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,EAAE,CAAA;AACK,QAAA,IAAI,GAAG,cAAM,CAAC,4BAA4B,CAAA"}
package/lib/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { DevtoolsPluginApi, App } from './api';
2
- export * from './api';
3
- export interface PluginDescriptor {
4
- id: string;
5
- label: string;
6
- app: App;
7
- }
8
- export declare type SetupFunction = (api: DevtoolsPluginApi) => void;
9
- export declare function setupDevtoolsPlugin(pluginDescriptor: PluginDescriptor, setupFn: SetupFunction): void;
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+BAAoC;AACpC,mCAAuC;AAGvC,wCAAqB;AAUrB,SAAgB,mBAAmB,CAAE,gBAAkC,EAAE,OAAsB;IAC7F,IAAI,UAAI,EAAE;QACR,UAAI,CAAC,IAAI,CAAC,qBAAa,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAA;KAC1E;SAAM;QACL,MAAM,IAAI,GAAG,YAAM,CAAC,wBAAwB,GAAG,YAAM,CAAC,wBAAwB,IAAI,EAAE,CAAA;QACpF,IAAI,CAAC,IAAI,CAAC;YACR,gBAAgB;YAChB,OAAO;SACR,CAAC,CAAA;KACH;AACH,CAAC;AAVD,kDAUC"}
package/src/api/api.ts DELETED
@@ -1,56 +0,0 @@
1
- import { Hookable } from './hooks'
2
- import { Context } from './context'
3
- import { ComponentInstance, ComponentState, StateBase } from './component'
4
-
5
- export interface DevtoolsPluginApi {
6
- on: Hookable<Context>
7
- notifyComponentUpdate (instance: ComponentInstance)
8
- addTimelineLayer (options: TimelineLayerOptions)
9
- addTimelineEvent (options: TimelineEventOptions)
10
- addInspector (options: CustomInspectorOptions)
11
- sendInspectorTree (inspectorId: string)
12
- sendInspectorState (inspectorId: string)
13
- }
14
-
15
- export interface TimelineLayerOptions {
16
- id: string
17
- label: string
18
- color: number
19
- }
20
-
21
- export interface TimelineEventOptions {
22
- layerId: string
23
- event: TimelineEvent
24
- all?: boolean
25
- }
26
-
27
- export interface TimelineEvent<TData = any, TMeta = any> {
28
- time: number
29
- data: TData
30
- meta: TMeta
31
- }
32
-
33
- export interface CustomInspectorOptions {
34
- id: string
35
- label: string
36
- icon?: string
37
- treeFilterPlaceholder?: string
38
- stateFilterPlaceholder?: string
39
- }
40
-
41
- export interface CustomInspectorNode {
42
- id: string
43
- label: string
44
- children?: CustomInspectorNode[]
45
- tags?: CustomInspectorNodeTag[]
46
- }
47
-
48
- export interface CustomInspectorNodeTag {
49
- label: string
50
- textColor: number
51
- backgroundColor: number
52
- }
53
-
54
- export interface CustomInspectorState {
55
- [key: string]: (StateBase | ComponentState)[]
56
- }
package/src/api/app.ts DELETED
@@ -1 +0,0 @@
1
- export type App = any // @TODO
@@ -1,68 +0,0 @@
1
- export type ComponentInstance = any // @TODO
2
-
3
- export interface ComponentTreeNode {
4
- uid: number
5
- id: string
6
- name: string
7
- renderKey: string
8
- inactive: boolean
9
- isFragment: boolean
10
- hasChildren: boolean
11
- children: ComponentTreeNode[]
12
- positionTop?: number
13
- consoleId?: string
14
- isRouterView?: boolean
15
- macthedRouteSegment?: string
16
- }
17
-
18
- export interface InspectedComponentData {
19
- id: string
20
- name: string
21
- file: string
22
- state: ComponentState[]
23
- functional?: boolean
24
- }
25
-
26
- export interface StateBase {
27
- key: string
28
- value: any
29
- editable: boolean
30
- objectType?: 'ref' | 'reactive' | 'computed' | 'other'
31
- raw?: string
32
- }
33
-
34
- export interface ComponentStateBase extends StateBase {
35
- type: string
36
- }
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
-
47
- export type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store'
48
-
49
- export interface ComponentCustomState extends ComponentStateBase {
50
- value: {
51
- _custom: {
52
- type: ComponentBuiltinCustomStateTypes | string
53
- display?: string
54
- tooltip?: string
55
- value?: any
56
- abstract?: boolean
57
- file?: string
58
- uid?: number
59
- readOnly?: boolean
60
- /** Configure immediate child fields */
61
- fields?: {
62
- abstract?: boolean
63
- }
64
- }
65
- }
66
- }
67
-
68
- export type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState
@@ -1,5 +0,0 @@
1
- import { DevtoolsPluginApi } from './api'
2
-
3
- export interface Context {
4
- currentTab: string
5
- }