import * as _plait_core from '@plait/core'; import { PlaitElement, Direction, PlaitBoard, OnContextChanged, PlaitPluginElementContext, XYPosition, PlaitPlugin, Path, RectangleClient, Point } from '@plait/core'; import * as slate from 'slate'; import { Element as Element$1 } from 'slate'; import { Generator, CommonElementFlavour, TextManage, GeneratorOptions, PlaitCommonElementRef, RenderComponentRef } from '@plait/common'; import { Options } from 'roughjs/bin/core'; import * as _plait_flow from '@plait/flow'; declare enum FlowElementType { node = "node", edge = "edge" } interface FlowHandle { position: Direction; handleId?: string; offsetX?: number; offsetY?: number; } interface FlowElementStyles { stroke?: string; strokeWidth?: number; fill?: string; fillStyle?: string; activeStroke?: string; activeFill?: string; borderRadius?: number; hoverStroke?: string; } interface FlowBaseData { text?: Element$1; icon?: string; } declare const isFlowElement: (value: PlaitElement) => value is FlowElement; interface FlowElement extends PlaitElement { id: string; type: FlowElementType; data?: T; undeletable?: boolean; styles?: FlowElementStyles; } declare const FlowElement: { isFlowElement: (value: PlaitElement) => value is FlowElement; }; interface FlowNodeHandle extends FlowHandle { } declare const isFlowNodeElement: (value: FlowElement) => value is FlowNode; interface FlowNode extends FlowElement { width: number; height: number; handles?: FlowNodeHandle[]; } declare const FlowNode: { isFlowNodeElement: (value: FlowElement) => value is FlowNode; }; declare enum NodeState { 'hovering' = "hovering", '' = "" } declare class NodeGenerator extends Generator { static key: string; constructor(board: PlaitBoard); canDraw(element: FlowNode): boolean; draw(element: FlowNode): SVGGElement; } interface NodeActiveData { selected: boolean; hovered: boolean; } declare class NodeActiveGenerator extends Generator { static key: string; constructor(board: PlaitBoard); canDraw(element: FlowNode, data: NodeActiveData): boolean; draw(element: FlowNode, data: NodeActiveData): SVGGElement; } declare class FlowNodeComponent extends CommonElementFlavour> implements OnContextChanged { nodeGenerator: NodeGenerator; nodeActiveGenerator: NodeActiveGenerator; textManage: TextManage; constructor(); initialize(): void; initializeGenerator(): void; onContextChanged(value: PlaitPluginElementContext, previous: PlaitPluginElementContext): void; drawText(element?: FlowNode): void; updateText(): void; destroyText(): void; destroy(): void; } type FlowEdgeMarkerType = 'arrow' | 'none'; type FlowEdgeHandleType = 'source' | 'target'; declare enum FlowEdgeShape { straight = "straight", curve = "curve", elbow = "elbow" } interface FlowEdgeHandleRef extends FlowHandle { node: FlowNode; type?: FlowEdgeHandleType; } interface FlowEdgeDragInfo { offsetX: number; offsetY: number; handleType: FlowEdgeHandleType; } interface FlowEdgeHandle { nodeId: string; position: Direction; handleId?: string; marker?: FlowEdgeMarkerType; } declare function isFlowEdgeElement(value: FlowElement): value is FlowEdge; declare const hasLabelIcon: (value: FlowEdge) => string | undefined; declare const hasLabelText: (value: FlowEdge) => slate.BaseElement | undefined; declare const hasLabel: (value: FlowEdge) => slate.BaseElement | undefined; interface FlowEdge extends FlowElement { target: FlowEdgeHandle; source?: FlowEdgeHandle; shape?: FlowEdgeShape; } declare const FlowEdge: { isFlowEdgeElement: typeof isFlowEdgeElement; hasLabelIcon: (value: FlowEdge) => string | undefined; hasLabelText: (value: FlowEdge) => slate.BaseElement | undefined; hasLabel: (value: FlowEdge) => slate.BaseElement | undefined; }; declare enum EdgeStableState { 'active' = "active", 'highlight' = "highlight", '' = "" } type EdgeState = EdgeStableState | 'hovering'; interface EdgeData$1 { state: EdgeState; } declare class EdgeGenerator extends Generator { static key: string; constructor(board: PlaitBoard); canDraw(element: FlowEdge, data: EdgeData$1): boolean; draw(element: FlowEdge, data: EdgeData$1): SVGGElement; } declare class EdgeElementRef extends PlaitCommonElementRef { private pathPoints; private state; buildPathPoints(board: PlaitBoard & PlaitBoard, element: FlowEdge): void; getPoints(): XYPosition[]; setState(state: EdgeStableState): void; getState(): EdgeStableState; } interface LabelIconItem { name: string; } interface PlaitFlowLabelIconBoard { renderLabelIcon: (container: Element | DocumentFragment, props: LabelIconProps) => RenderComponentRef; } declare const withLabelIcon: (board: T) => T & PlaitFlowLabelIconBoard; interface LabelIconProps { board: PlaitBoard; iconItem: LabelIconItem; element: FlowElement; fontSize: number; } interface EdgeData { state: EdgeState; className?: string; } declare class EdgeLabelGenerator extends Generator { textManage: TextManage; static key: string; labelIconRef: { ref: RenderComponentRef; labelIconG: SVGGElement; } | null; labelTextG: SVGGElement | null; constructor(board: PlaitBoard, textManage: TextManage); canDraw(element: FlowEdge, data: EdgeData): boolean; draw(element: FlowEdge, data: EdgeData): SVGGElement; drawLabelIcon(element: FlowEdge): { ref: RenderComponentRef; labelIconG: SVGGElement; } | null; updateLabelIcon(element: FlowEdge): void; drawLabelText(element: FlowEdge): SVGGElement | null; updateLabelText(element: FlowEdge): void; destroy(): void; } interface BoundedElements { source?: FlowNode; target?: FlowNode; } declare class FlowEdgeComponent extends CommonElementFlavour, PlaitBoard, EdgeElementRef> implements OnContextChanged { edgeGenerator: EdgeGenerator; edgeLabelGenerator: EdgeLabelGenerator; boundedElements: BoundedElements; constructor(); initializeGenerator(): void; initialize(): void; onContextChanged(value: PlaitPluginElementContext, previous: PlaitPluginElementContext): void; getBoundedElements(): BoundedElements; destroy(): void; } declare const withFlow: PlaitPlugin; declare const withFlowEdgeDnd: PlaitPlugin; declare enum FlowPluginKey { 'flowOptions' = "flowOptions" } interface FlowPluginOptions { edgeLabelOptions: EdgeLabelOptions; } interface EdgeLabelOptions { height?: number; maxWidth?: number; } declare const DEFAULT_STYLES: Options; declare const PRIMARY_COLOR = "#6698FF"; declare const HOVER_COLOR = "#aaaaaa"; declare const HIT_THRESHOLD = 10; declare const EDGE_LABEL_PADDING = 10; declare const EDGE_LABEL_FONTSIZE = 12; declare const EDGE_LABEL_ICON_PADDING = 2; declare const DEFAULT_EDGE_STYLES: Options; declare const DEFAULT_EDGE_ACTIVE_STYLES: Options; declare const DEFAULT_PLACEHOLDER_EDGE_STYLES: Options; declare const DEFAULT_EDGE_HOVER_STYLES: Options; declare const DEFAULT_POSITIONS: Direction[]; declare const HANDLE_DIAMETER = 8; declare const HANDLE_BUFFER = 6; declare const DEFAULT_HANDLE_STYLES: Options; declare const OUTLINE_BUFFER = 4; declare const DEFAULT_NODE_STYLES: Options; declare const DEFAULT_NODE_ACTIVE_STYLES: Options; declare function createFlowEdge(board: PlaitBoard, data: T, edge: FlowEdge, path?: Path): void; declare const addCreateEdgeInfo: (board: PlaitBoard, edge: FlowEdge) => void; declare const deleteCreateEdgeInfo: (board: PlaitBoard) => void; declare const getCreateEdgeInfo: (board: PlaitBoard) => FlowEdge | undefined; declare const FLOW_CREATE_EDGE_INFO: WeakMap; declare const isEdgeDragging: (board: PlaitBoard) => boolean; declare const addEdgeDraggingInfo: (edge: FlowEdge, data: FlowEdgeDragInfo) => void; declare const deleteEdgeDraggingInfo: (edge: FlowEdge) => void; declare const getEdgeDraggingInfo: (edge: FlowEdge) => FlowEdgeDragInfo | undefined; declare const FLOW_EDGE_DRAGGING_INFO: WeakMap; interface GetPointsParams { sourceRectangle: RectangleClient; sourceDirection: Direction; sourcePoint: Point; targetRectangle: RectangleClient; targetDirection: Direction; targetPoint: Point; } declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY }: { sourceX: number; sourceY: number; targetX: number; targetY: number; }): [number, number, number, number]; declare function getShapePoints(shape: FlowEdgeShape | undefined, params: GetPointsParams): Point[]; declare const buildEdgePathPoints: (board: PlaitBoard, edge: FlowEdge) => { x: number; y: number; }[]; declare const getEdgePoints: (board: PlaitBoard, edge: FlowEdge) => _plait_core.XYPosition[]; declare const getEdgeStyle: (edge: FlowEdge, state?: EdgeState) => FlowElementStyles; declare const getEdgesByNodeId: (board: PlaitBoard, nodeId: string) => FlowEdge<_plait_flow.FlowBaseData>[]; declare function getElbowPoints({ sourceRectangle, sourcePoint, sourceDirection, targetRectangle, targetPoint, targetDirection, offset }: { sourceRectangle: RectangleClient; sourceDirection: Direction; sourcePoint: Point; targetRectangle: RectangleClient; targetDirection: Direction; targetPoint: Point; offset?: number; }): Point[]; declare function getCurvePoints({ sourceDirection, sourcePoint, targetDirection, targetPoint }: { sourceDirection: Direction; sourcePoint: Point; targetDirection: Direction; targetPoint: Point; }): Point[]; declare function getStraightPoints({ sourcePoint, targetPoint }: { sourcePoint: Point; targetPoint: Point; }): Point[]; declare function isHitEdge(board: PlaitBoard, edge: FlowEdge, point: Point): boolean; declare function isHitEdgeText(board: PlaitBoard, edge: FlowEdge, point: Point): boolean; declare function getEdgeTextXYPosition(board: PlaitBoard, edge: FlowEdge, width: number, height: number): XYPosition; declare function getLabelTextRectangle(board: PlaitBoard, edge: FlowEdge): RectangleClient; declare function getLabelIconFontSize(): number; declare function getLabelIconRectangle(textRect: RectangleClient): RectangleClient; declare function getLabelRect(textRect: RectangleClient, element: FlowEdge): RectangleClient; declare const EdgeLabelSpace: { getLabelTextRectangle: typeof getLabelTextRectangle; getLabelIconFontSize: typeof getLabelIconFontSize; getLabelIconRectangle: typeof getLabelIconRectangle; getLabelRect: typeof getLabelRect; }; declare function getHitEdge(board: PlaitBoard, point: Point): FlowEdge | null; declare const addPlaceholderEdgeInfo: (board: PlaitBoard, placeholder: SVGElement) => void; declare const deletePlaceholderEdgeInfo: (board: PlaitBoard) => void; declare const isPlaceholderEdgeInfo: (board: PlaitBoard) => SVGElement | undefined; declare const FLOW_PLACEHOLDER_EDGE_INFO: WeakMap; declare const updateRelatedEdgeHighlight: (board: PlaitBoard, nodeId: string, highlight: boolean) => void; declare const renderEdge: (board: PlaitBoard, edge: FlowEdge, state?: EdgeState, labelClassName?: string) => void; declare const renderRelatedEdges: (board: PlaitBoard, nodeId: string, state?: EdgeState) => void; declare const renderEdgeOnDragging: (board: PlaitBoard, edge: FlowEdge) => void; declare const getEdgeLayer: (board: PlaitBoard, edge: FlowEdge, state: EdgeState) => SVGGElement; declare const getOverlapEdges: (board: PlaitBoard, edge: FlowEdge) => FlowEdge[]; declare const getDefaultHandles: () => FlowHandle[]; declare function getHandleXYPosition(position: Direction, nodeRect: RectangleClient, handle?: FlowHandle | null): XYPosition; declare const getEdgeHandles: (board: PlaitBoard, edge: FlowEdge) => FlowEdgeHandleRef[]; declare function isHitEdgeHandle(board: PlaitBoard, edge: FlowEdge, point: Point): boolean; declare function getHitHandleTypeByEdge(board: PlaitBoard, point: Point, edge: FlowEdge): FlowEdgeHandleType | null; interface HitNodeHandle extends FlowEdgeHandleRef { handlePoint: Point; } declare function getHitNodeHandle(board: PlaitBoard, point: Point): HitNodeHandle | null; declare function getHitHandleByNode(node: FlowNode, point: Point): HitNodeHandle | null; declare function isHitNode(board: PlaitBoard, node: FlowNode, point: [Point, Point]): boolean; declare function getFlowNodeById(board: PlaitBoard, id: string): FlowNode; declare function getFakeFlowNodeById(board: PlaitBoard, id: string, offsetX?: number, offsetY?: number): FlowNode; declare function getFlowElementsByType(board: PlaitBoard, type: FlowElementType): FlowElement<_plait_flow.FlowBaseData>[]; declare function drawAllNodesHandle(board: PlaitBoard): FlowNode<_plait_flow.FlowBaseData>[]; declare function destroyAllNodesHandle(board: PlaitBoard, flowNodeElements: FlowNode[]): void; declare function getHitNode(board: PlaitBoard, point: Point): FlowNode | null; declare const drawEdgeRoute: (board: PlaitBoard, edge: FlowEdge, state: EdgeState) => SVGGElement; declare const drawEdgeLabelShape: (board: PlaitBoard, edge: FlowEdge, textBackgroundRect: RectangleClient, state: EdgeState) => SVGGElement; declare const drawEdgeMarkers: (board: PlaitBoard, edge: FlowEdge, state: EdgeState) => SVGGElement[]; declare function drawNodeHandles(board: PlaitBoard, node: FlowNode): SVGGElement[]; declare function drawEdgeHandles(board: PlaitBoard, edge: FlowEdge): SVGGElement[]; declare function drawNode(board: PlaitBoard, node: FlowNode, outline?: boolean): SVGGElement; declare function drawNodeActiveMask(board: PlaitBoard, node: FlowNode): SVGGElement; declare abstract class FlowEdgeLabelIconBaseComponent { fontSize: number; iconItem: LabelIconItem; board: PlaitBoard; element: FlowElement; abstract nativeElement(): HTMLElement; initialize(): void; } export { DEFAULT_EDGE_ACTIVE_STYLES, DEFAULT_EDGE_HOVER_STYLES, DEFAULT_EDGE_STYLES, DEFAULT_HANDLE_STYLES, DEFAULT_NODE_ACTIVE_STYLES, DEFAULT_NODE_STYLES, DEFAULT_PLACEHOLDER_EDGE_STYLES, DEFAULT_POSITIONS, DEFAULT_STYLES, EDGE_LABEL_FONTSIZE, EDGE_LABEL_ICON_PADDING, EDGE_LABEL_PADDING, EdgeGenerator, EdgeLabelSpace, EdgeStableState, FLOW_CREATE_EDGE_INFO, FLOW_EDGE_DRAGGING_INFO, FLOW_PLACEHOLDER_EDGE_INFO, FlowEdge, FlowEdgeComponent, FlowEdgeLabelIconBaseComponent, FlowEdgeShape, FlowElement, FlowElementType, FlowNode, FlowNodeComponent, FlowPluginKey, HANDLE_BUFFER, HANDLE_DIAMETER, HIT_THRESHOLD, HOVER_COLOR, NodeActiveGenerator, NodeGenerator, NodeState, OUTLINE_BUFFER, PRIMARY_COLOR, addCreateEdgeInfo, addEdgeDraggingInfo, addPlaceholderEdgeInfo, buildEdgePathPoints, createFlowEdge, deleteCreateEdgeInfo, deleteEdgeDraggingInfo, deletePlaceholderEdgeInfo, destroyAllNodesHandle, drawAllNodesHandle, drawEdgeHandles, drawEdgeLabelShape, drawEdgeMarkers, drawEdgeRoute, drawNode, drawNodeActiveMask, drawNodeHandles, getCreateEdgeInfo, getCurvePoints, getDefaultHandles, getEdgeCenter, getEdgeDraggingInfo, getEdgeHandles, getEdgeLayer, getEdgePoints, getEdgeStyle, getEdgeTextXYPosition, getEdgesByNodeId, getElbowPoints, getFakeFlowNodeById, getFlowElementsByType, getFlowNodeById, getHandleXYPosition, getHitEdge, getHitHandleByNode, getHitHandleTypeByEdge, getHitNode, getHitNodeHandle, getOverlapEdges, getShapePoints, getStraightPoints, hasLabel, hasLabelIcon, hasLabelText, isEdgeDragging, isFlowEdgeElement, isFlowElement, isFlowNodeElement, isHitEdge, isHitEdgeHandle, isHitEdgeText, isHitNode, isPlaceholderEdgeInfo, renderEdge, renderEdgeOnDragging, renderRelatedEdges, updateRelatedEdgeHighlight, withFlow, withFlowEdgeDnd, withLabelIcon }; export type { EdgeData$1 as EdgeData, EdgeLabelOptions, EdgeState, FlowBaseData, FlowEdgeDragInfo, FlowEdgeHandle, FlowEdgeHandleRef, FlowEdgeHandleType, FlowEdgeMarkerType, FlowElementStyles, FlowHandle, FlowNodeHandle, FlowPluginOptions, HitNodeHandle, LabelIconItem, LabelIconProps, NodeActiveData, PlaitFlowLabelIconBoard };