import React, { CSSProperties } from 'react'; import { Rectangle, IPoint, Disposable } from '@flowgram.ai/utils'; import * as _flowgram_ai_core from '@flowgram.ai/core'; import { Layer, PlaygroundConfigEntity } from '@flowgram.ai/core'; import { FlowNodeTransformData, FlowDocumentTransformerEntity } from '@flowgram.ai/document'; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ interface MinimapCanvasStyle { canvasWidth: number; canvasHeight: number; canvasPadding: number; canvasBackground: string; canvasBorderRadius: number | undefined; viewportBackground: string; viewportBorderRadius: number | undefined; viewportBorderColor: string; viewportBorderWidth: number; viewportBorderDashLength: number | undefined; nodeColor: string; nodeBorderRadius: number | undefined; nodeBorderWidth: number; nodeBorderColor: string | undefined; overlayColor: string; } interface MinimapInactiveStyle { scale: number; opacity: number; translateX: number; translateY: number; } interface MinimapServiceOptions { canvasStyle: Partial; canvasClassName: string; enableDisplayAllNodes: boolean; activeThrottleTime: number; inactiveThrottleTime: number; } interface MinimapLayerOptions { disableLayer?: boolean; panelStyles?: CSSProperties; containerStyles?: CSSProperties; inactiveStyle?: Partial; } interface CreateMinimapPluginOptions extends MinimapLayerOptions, Partial { } interface MinimapRenderContext { canvas: HTMLCanvasElement; context2D: CanvasRenderingContext2D; nodeRects: Rectangle[]; viewRect: Rectangle; renderRect: Rectangle; canvasRect: Rectangle; scale: number; offset: IPoint; } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare class FlowMinimapService { private readonly document; private readonly playgroundConfig; readonly canvas: HTMLCanvasElement; readonly context2D: CanvasRenderingContext2D; activated: boolean; private onActiveCallbacks; private options; private toDispose; private initialized; private visible; private isDragging; private style; private dragStart?; constructor(); init(options?: Partial): void; dispose(): void; setVisible(visible: boolean): void; setActivate(activate: boolean): void; onActive: (callback: (activated: boolean) => void) => Disposable; private initStyle; private setThrottle; /** * 触发渲染 */ render: () => void; private _render; private createRenderContext; private renderCanvas; private calculateScaleAndOffset; private get transformVisibles(); private renderRect; private viewRect; /** 计算画布坐标系下的矩形 */ private rectOnCanvas; private isPointInRect; private addEventListeners; private removeEventListeners; private handleWheel; private handleStartDrag; private handleDragging; private handleEndDrag; private handleCursor; private isMouseInCanvas; private updateScrollPosition; } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ interface MinimapProps { service?: FlowMinimapService; panelStyles?: CSSProperties; containerStyles?: CSSProperties; inactiveStyle?: Partial; } declare const MinimapRender: React.FC; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare const MinimapDefaultCanvasStyle: MinimapCanvasStyle; declare const MinimapDefaultInactiveStyle: MinimapInactiveStyle; declare const MinimapDefaultOptions: MinimapServiceOptions; declare const createMinimapPlugin: _flowgram_ai_core.PluginCreator; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare class FlowMinimapLayer extends Layer { static type: string; private readonly service; transformDatas: FlowNodeTransformData[]; configEntity: PlaygroundConfigEntity; readonly documentTransformer: FlowDocumentTransformerEntity; readonly node: HTMLElement; private readonly className; constructor(); render(): JSX.Element; } export { type CreateMinimapPluginOptions, FlowMinimapLayer, FlowMinimapService, type MinimapCanvasStyle, MinimapDefaultCanvasStyle, MinimapDefaultInactiveStyle, MinimapDefaultOptions, type MinimapInactiveStyle, type MinimapLayerOptions, MinimapRender, type MinimapRenderContext, type MinimapServiceOptions, createMinimapPlugin };