forked from vuejs/devtools-v6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.ts
More file actions
122 lines (108 loc) · 3.21 KB
/
api.ts
File metadata and controls
122 lines (108 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import type { ComponentBounds, Hookable } from './hooks.js'
import type { Context } from './context.js'
import type { ComponentInstance, ComponentState, StateBase } from './component.js'
import type { App } from './app.js'
import type { ID } from './util.js'
export interface DevtoolsPluginApi<TSettings> {
on: Hookable<Context>
notifyComponentUpdate (instance?: ComponentInstance): void
addTimelineLayer (options: TimelineLayerOptions): void
addTimelineEvent (options: TimelineEventOptions): void
addInspector (options: CustomInspectorOptions): void
sendInspectorTree (inspectorId: string): void
sendInspectorState (inspectorId: string): void
selectInspectorNode (inspectorId: string, nodeId: string): void
getComponentBounds (instance: ComponentInstance): Promise<ComponentBounds>
getComponentName (instance: ComponentInstance): Promise<string>
getComponentInstances (app: App): Promise<ComponentInstance[]>
highlightElement (instance: ComponentInstance): void
unhighlightElement (): void
getSettings (pluginId?: string): TSettings
now (): number
/**
* @private Not implemented yet
*/
setSettings (values: TSettings): void
}
export interface AppRecord {
id: string
name: string
instanceMap: Map<string, ComponentInstance>
rootInstance: ComponentInstance
}
export interface TimelineLayerOptions<TData = any, TMeta = any> {
id: string
label: string
color: number
skipScreenshots?: boolean
groupsOnly?: boolean
ignoreNoDurationGroups?: boolean
screenshotOverlayRender?: (event: TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent, ctx: ScreenshotOverlayRenderContext) => ScreenshotOverlayRenderResult | Promise<ScreenshotOverlayRenderResult>
}
export interface ScreenshotOverlayEvent {
layerId: string
renderMeta: any
}
export interface ScreenshotOverlayRenderContext<TData = any, TMeta = any> {
screenshot: ScreenshotData
events: (TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent)[]
index: number
}
export type ScreenshotOverlayRenderResult = HTMLElement | string | false
export interface ScreenshotData {
time: number
}
export interface TimelineEventOptions {
layerId: string
event: TimelineEvent
all?: boolean
}
export interface TimelineEvent<TData = any, TMeta = any> {
time: number
data: TData
logType?: 'default' | 'warning' | 'error'
meta?: TMeta
groupId?: ID
title?: string
subtitle?: string
}
export interface TimelineMarkerOptions {
id: string
time: number
color: number
label: string
all?: boolean
}
export interface CustomInspectorOptions {
id: string
label: string
icon?: string
treeFilterPlaceholder?: string
stateFilterPlaceholder?: string
noSelectionText?: string
actions?: {
icon: string
tooltip?: string
action: () => void | Promise<void>
}[]
nodeActions?: {
icon: string
tooltip?: string
action: (nodeId: string) => void | Promise<void>
}[]
}
export interface CustomInspectorNode {
id: string
label: string
children?: CustomInspectorNode[]
tags?: InspectorNodeTag[]
}
export interface InspectorNodeTag {
label: string
textColor: number
backgroundColor: number
tooltip?: string
}
export interface CustomInspectorState {
[key: string]: (StateBase | Omit<ComponentState, 'type'>)[]
}