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 { on: Hookable 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 getComponentName (instance: ComponentInstance): Promise getComponentInstances (app: App): Promise 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 rootInstance: ComponentInstance } export interface TimelineLayerOptions { id: string label: string color: number skipScreenshots?: boolean groupsOnly?: boolean ignoreNoDurationGroups?: boolean screenshotOverlayRender?: (event: TimelineEvent & ScreenshotOverlayEvent, ctx: ScreenshotOverlayRenderContext) => ScreenshotOverlayRenderResult | Promise } export interface ScreenshotOverlayEvent { layerId: string renderMeta: any } export interface ScreenshotOverlayRenderContext { screenshot: ScreenshotData events: (TimelineEvent & 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 { 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 }[] nodeActions?: { icon: string tooltip?: string action: (nodeId: string) => void | Promise }[] } 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)[] }