import { AddChange, AddEdgeOptions, Align, Align as Align$1, AriaLabelConfig, AriaLabelConfig as AriaLabelConfig$1, BezierPathOptions, BezierPathOptions as BezierPathOptions$1, Box, ColorMode, ColorMode as ColorMode$1, Connection, Connection as Connection$1, ConnectionInProgress, ConnectionLineType, ConnectionLineType as ConnectionLineType$1, ConnectionLookup, ConnectionMode, ConnectionMode as ConnectionMode$1, ConnectionState, ConnectionState as ConnectionState$1, ControlLinePosition, ControlLinePosition as ControlLinePosition$1, ControlPosition, ControlPosition as ControlPosition$1, CoordinateExtent, CoordinateExtent as CoordinateExtent$1, DefaultEdgeOptionsBase, DimensionChange, Dimensions, DistributivePick, EdgeBase, EdgeChange, EdgeChange as EdgeChange$1, EdgeChangeset, EdgeChangeset as EdgeChangeset$1, EdgeLookup, EdgeMarker, EdgeMarkerType, EdgePosition, EdgeToolbarBaseProps, FinalConnectionState, FinalConnectionState as FinalConnectionState$1, FitBounds, FitBounds as FitBounds$1, FitBoundsOptions, FitViewOptionsBase, FitViewParamsBase, GetBezierPathParams, GetSmoothStepPathParams, GetStraightPathParams, GetViewport, GetZoom, HandleBounds, HandleBounds as HandleBounds$1, HandleProps as HandleProps$1, HandleType, HandleType as HandleType$1, InternalNodeBase, InternalNodeUpdate, KeyCode, KeyCode as KeyCode$1, MarkerType, NoConnection, NodeBase, NodeChange, NodeChange as NodeChange$1, NodeChangeset, NodeChangeset as NodeChangeset$1, NodeConnection, NodeConnection as NodeConnection$1, NodeHandle, NodeLookup, NodeOrigin, NodeOrigin as NodeOrigin$1, NodeProps as NodeProps$1, OnBeforeDeleteBase, OnConnect, OnConnect as OnConnect$1, OnConnectEnd, OnConnectEnd as OnConnectEnd$1, OnConnectStart, OnConnectStart as OnConnectStart$1, OnConnectStartParams, OnError, OnError as OnError$1, OnMove, OnMove as OnMove$1, OnMoveEnd, OnMoveEnd as OnMoveEnd$1, OnMoveStart, OnMoveStart as OnMoveStart$1, OnReconnect, OnReconnect as OnReconnect$1, OnResize, OnResize as OnResize$1, OnResizeEnd, OnResizeEnd as OnResizeEnd$1, OnResizeStart, OnResizeStart as OnResizeStart$1, OnSelectionDrag, OnSelectionDrag as OnSelectionDrag$1, OnViewportChange, PanBy, PanOnScrollMode, PanOnScrollMode as PanOnScrollMode$1, PanZoomInstance, PanelPosition, PanelPosition as PanelPosition$1, ParentLookup, Position, Position as Position$1, PositionChange, ReconnectEdgeOptions, Rect, Rect as Rect$1, RemoveChange, ReplaceChange, ResizeControlDirection, ResizeControlVariant, ResizeControlVariant as ResizeControlVariant$1, ResizeDragEvent, ResizeParams, ResizeParamsWithDirection, SelectionChange, SelectionMode, SelectionMode as SelectionMode$1, SelectionRect, SelectionRect as SelectionRect$1, SetCenter, SetCenter as SetCenter$1, SetCenterOptions, SetViewport, SetViewport as SetViewport$1, ShouldResize, ShouldResize as ShouldResize$1, SmoothStepPathOptions, SmoothStepPathOptions as SmoothStepPathOptions$1, SnapGrid, SnapGrid as SnapGrid$1, StepPathOptions, Transform, Transform as Transform$1, UpdateConnection, UpdateNodeInternals, UpdateNodePositions, UseNodeConnectionsParams, UseNodeConnectionsParams as UseNodeConnectionsParams$1, Viewport, Viewport as Viewport$1, ViewportHelperFunctionOptions, XYPosition, XYPosition as XYPosition$1, XYZPosition, ZIndexMode, ZIndexMode as ZIndexMode$1, ZoomInOut, ZoomTo, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, withResolvers } from "@xyflow/system"; import { AriaRole, ButtonHTMLAttributes, CSSProperties, ComponentType, DOMAttributes, Dispatch, HTMLAttributes, MouseEvent as MouseEvent$1, ReactNode, ReactPortal, SVGAttributes, SetStateAction, WheelEvent } from "react"; import { StoreApi } from "zustand"; /** * This type can be used to type the `onNodesChange` function with a custom node type. * * @public * * @example * * ```ts * const onNodesChange: OnNodesChange = useCallback((changes) => { * setNodes((nodes) => changes.applyTo(nodes)); * },[]); * ``` */ export type OnNodesChange = (changes: NodeChangeset$1) => void; /** * This type can be used to type the `onEdgesChange` function with a custom edge type. * * @public * * @example * * ```ts * const onEdgesChange: OnEdgesChange = useCallback((changes) => { * setEdges((edges) => changes.applyTo(edges)); * },[]); * ``` */ export type OnEdgesChange = (changes: EdgeChangeset$1) => void; export type OnNodesDelete = (nodes: NodeType[]) => void; export type OnEdgesDelete = (edges: EdgeType[]) => void; /** * This type can be used to type the `onDelete` function with a custom node and edge type. * * @public */ export type OnDelete = (params: { nodes: NodeType[]; edges: EdgeType[]; }) => void; export type NodeTypes = Record>; export type EdgeTypes = Record>; export type UnselectNodesAndEdgesParams = { nodes?: NodeType[]; edges?: EdgeType[]; }; export type OnSelectionChangeParams = { nodes: NodeType[]; edges: EdgeType[]; }; export type OnSelectionChangeFunc = (params: OnSelectionChangeParams) => void; /** * @inline */ export type FitViewParams = FitViewParamsBase; /** * When calling [`fitView`](/api-reference/types/react-flow-instance#fitview) these options * can be used to customize the behaviour. For example, the `duration` option can be used to * transform the viewport smoothly over a given amount of time. * * @public * @inline */ export type FitViewOptions = FitViewOptionsBase; /** * @inline */ export type FitView = (fitViewOptions?: FitViewOptions) => Promise; /** * @inline */ export type OnInit = (reactFlowInstance: ReactFlowInstance) => void; /** * @inline */ export type ViewportHelperFunctions = { /** * Zooms viewport in by 1.2. * * @param options.duration - optional duration. If set, a transition will be applied */ zoomIn: ZoomInOut; /** * Zooms viewport out by 1 / 1.2. * * @param options.duration - optional duration. If set, a transition will be applied */ zoomOut: ZoomInOut; /** * Zoom the viewport to a given zoom level. Passing in a `duration` will animate the viewport to * the new zoom level. * * @param zoomLevel - the zoom level to set * @param options.duration - optional duration. If set, a transition will be applied */ zoomTo: ZoomTo; /** * Get the current zoom level of the viewport. * * @returns current zoom as a number */ getZoom: GetZoom; /** * Sets the current viewport. * * @param viewport - the viewport to set * @param options.duration - optional duration. If set, a transition will be applied * @param options.ease - optional ease function. */ setViewport: SetViewport$1; /** * Returns the current viewport. * * @returns Viewport */ getViewport: GetViewport; /** * Center the viewport on a given position. Passing in a `duration` will animate the viewport to * the new position. * * @param x - x position * @param y - y position * @param options.zoom - optional zoom * @param options.duration - optional duration. If set, a transition will be applied * @param options.ease - optional ease function. */ setCenter: SetCenter$1; /** * A low-level utility function to fit the viewport to a given rectangle. By passing in a * `duration`, the viewport will animate from its current position to the new position. The * `padding` option can be used to add space around the bounds. * * @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to * @param options.padding - optional padding * @param options.duration - optional duration. If set, a transition will be applied * @param options.ease - optional ease function. */ fitBounds: FitBounds$1; /** * With this function you can translate a screen pixel position to a flow position. It is useful * for implementing drag and drop from a sidebar for example. * * @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY * @param options.snapToGrid - if true, the converted position will be snapped to the grid * @returns position as { x: number, y: number } * * @example * const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY }) */ screenToFlowPosition: (clientPosition: XYPosition$1, options?: { snapToGrid?: boolean; snapGrid?: SnapGrid$1; }) => XYPosition$1; /** * Translate a position inside the flow's canvas to a screen pixel position. * * @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY * @returns position as { x: number, y: number } * * @example * const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y }) */ flowToScreenPosition: (flowPosition: XYPosition$1) => XYPosition$1; }; export type OnBeforeDelete = OnBeforeDeleteBase; /** * This type can be used to type the `isValidConnection` function. * If the function returns `true`, the connection is valid and can be created. */ export type IsValidConnection = (edge: EdgeType | Connection$1) => boolean; /** * React Flow is independent and entirely funded by its users. * If you hide the attribution, please support our work by subscribing to React Flow Pro: https://reactflow.dev/remove-attribution * */ export type ProOptions = { account?: string; /** If you hide the attribution, please support our work with a subscription. */ hideAttribution: boolean; }; /** * The `Node` type represents everything React Flow needs to know about a given node. * Whenever you want to update a certain attribute of a node, you need to create a new * node object. * * @public */ export type Node = Record, NodeType extends string | undefined = string | undefined> = NodeBase & { style?: CSSProperties; className?: string; focusable?: boolean; /** * The ARIA role attribute for the node element, used for accessibility. * @default "group" */ ariaRole?: AriaRole; /** * General escape hatch for adding custom attributes to the node's DOM element. */ domAttributes?: Omit, 'id' | 'style' | 'className' | 'draggable' | 'role' | 'aria-label' | 'defaultValue' | 'dangerouslySetInnerHTML' | keyof DOMAttributes>; }; /** * The `InternalNode` type is identical to the base [`Node`](/api-references/types/node) * type but is extended with some additional properties used internally. * Some functions and callbacks that return nodes may return an `InternalNode`. * * @public */ export type InternalNode = InternalNodeBase; export type NodeMouseHandler = (event: MouseEvent$1, node: NodeType) => void; export type SelectionDragHandler = (event: MouseEvent$1, nodes: NodeType[]) => void; export type OnNodeDrag = (event: MouseEvent | TouchEvent, node: NodeType, nodes: NodeType[]) => void; export type NodeWrapperProps = { id: string; nodesConnectable: boolean; elementsSelectable: boolean; nodesDraggable: boolean; nodesFocusable: boolean; onClick?: NodeMouseHandler; onDoubleClick?: NodeMouseHandler; onMouseEnter?: NodeMouseHandler; onMouseMove?: NodeMouseHandler; onMouseLeave?: NodeMouseHandler; onContextMenu?: NodeMouseHandler; resizeObserver: ResizeObserver | null; noDragClassName: string; noPanClassName: string; rfId: string; disableKeyboardA11y: boolean; nodeTypes?: NodeTypes; nodeExtent?: CoordinateExtent$1; onError?: OnError$1; }; /** * The `BuiltInNode` type represents the built-in node types that are available in React Flow. * You can use this type to extend your custom node type if you still want to use the built-in ones. * * @public * @example * ```ts * type CustomNode = Node<{ value: number }, 'custom'>; * type MyAppNode = CustomNode | BuiltInNode; * ``` */ export type BuiltInNode = Node<{ label: string; }, 'input' | 'output' | 'default' | undefined> | Node, 'group'>; /** * When you implement a [custom node](/learn/customization/custom-nodes) it is * wrapped in a component that enables basic functionality like selection and * dragging. Your custom node receives `NodeProps` as props. * * @public * @example * ```tsx *import { useState } from 'react'; *import { NodeProps, Node } from '@xyflow/react'; * *export type CounterNode = Node<{ initialCount?: number }, 'counter'>; * *export default function CounterNode(props: NodeProps) { * const [count, setCount] = useState(props.data?.initialCount ?? 0); * * return ( *
*

Count: {count}

* *
* ); *} *``` */ export type NodeProps = NodeProps$1; /** * @inline */ export type EdgeLabelOptions = { /** * The label or custom element to render along the edge. This is commonly a text label or some * custom controls. */ label?: ReactNode; /** * Custom styles to apply to the label. */ labelStyle?: CSSProperties; labelShowBg?: boolean; labelBgStyle?: CSSProperties; labelBgPadding?: [number, number]; labelBgBorderRadius?: number; }; /** * An `Edge` is the complete description with everything React Flow needs * to know in order to render it. * @public */ export type Edge = Record, EdgeType extends string | undefined = string | undefined> = EdgeBase & EdgeLabelOptions & { style?: CSSProperties; className?: string; /** * Determines whether the edge can be updated by dragging the source or target to a new node. * This property will override the default set by the `edgesReconnectable` prop on the * `` component. */ reconnectable?: boolean | HandleType$1; focusable?: boolean; /** * The ARIA role attribute for the edge, used for accessibility. * @default "group" */ ariaRole?: AriaRole; /** * General escape hatch for adding custom attributes to the edge's DOM element. */ domAttributes?: Omit, 'id' | 'style' | 'className' | 'role' | 'aria-label' | 'dangerouslySetInnerHTML'>; }; type SmoothStepEdge$1 = Record> = Edge & { pathOptions?: SmoothStepPathOptions$1; }; type BezierEdge$1 = Record> = Edge & { pathOptions?: BezierPathOptions$1; }; type StepEdge$1 = Record> = Edge & { pathOptions?: StepPathOptions; }; type StraightEdge$1 = Record> = Edge; type InferPathOptions = E extends { pathOptions?: infer P; } ? P : any; export type BuiltInEdge = SmoothStepEdge$1 | BezierEdge$1 | StepEdge$1 | StraightEdge$1; export type EdgeMouseHandler = (event: MouseEvent$1, edge: EdgeType) => void; export type EdgeWrapperProps = { id: string; edgesFocusable: boolean; edgesReconnectable: boolean; elementsSelectable: boolean; noPanClassName: string; onClick?: EdgeMouseHandler; onDoubleClick?: EdgeMouseHandler; onReconnect?: OnReconnect$1; onContextMenu?: EdgeMouseHandler; onMouseEnter?: EdgeMouseHandler; onMouseMove?: EdgeMouseHandler; onMouseLeave?: EdgeMouseHandler; reconnectRadius?: number; onReconnectStart?: (event: MouseEvent$1, edge: EdgeType, handleType: HandleType$1) => void; onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType$1, connectionState: FinalConnectionState$1) => void; rfId?: string; edgeTypes?: EdgeTypes; onError?: OnError$1; disableKeyboardA11y?: boolean; connectionMode: ConnectionMode$1; elevateEdgesOnSelect: boolean; zIndexMode: ZIndexMode$1; defaultEdgeOptions?: DefaultEdgeOptions; }; /** * Many properties on an [`Edge`](/api-reference/types/edge) are optional. When a new edge is created, * the properties that are not provided will be filled in with the default values * passed to the `defaultEdgeOptions` prop of the [``](/api-reference/react-flow#defaultedgeoptions) component. */ export type DefaultEdgeOptions = DefaultEdgeOptionsBase; export type EdgeTextProps = Omit, 'x' | 'y'> & EdgeLabelOptions & { /** The x position where the label should be rendered. */ x: number; /** The y position where the label should be rendered. */ y: number; }; /** * When you implement a custom edge it is wrapped in a component that enables some * basic functionality. The `EdgeProps` type is the props that are passed to this. * @public * @expand */ export type EdgeProps = Pick & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: InferPathOptions; interactionWidth?: number; }; /** * BaseEdge component props * @public * @expand */ export type BaseEdgeProps = Omit, 'd' | 'path' | 'markerStart' | 'markerEnd'> & EdgeLabelOptions & { /** * The width of the invisible area around the edge that the user can interact with. This is * useful for making the edge easier to click or hover over. * @default 20 */ interactionWidth?: number; /** The x position of edge label */ labelX?: number; /** The y position of edge label */ labelY?: number; /** * The SVG path string that defines the edge. This should look something like * `'M 0 0 L 100 100'` for a simple line. The utility functions like `getSimpleBezierEdge` can * be used to generate this string for you. */ path: string; /** * The id of the SVG marker to use at the start of the edge. This should be defined in a * `` element in a separate SVG document or element. Use the format "url(#markerId)" where markerId is the id of your marker definition. */ markerStart?: string; /** * The id of the SVG marker to use at the end of the edge. This should be defined in a `` * element in a separate SVG document or element. Use the format "url(#markerId)" where markerId is the id of your marker definition. */ markerEnd?: string; }; /** * Helper type for edge components that get exported by the library * @public * @expand */ export type EdgeComponentProps = EdgePosition & EdgeLabelOptions & { id?: EdgeProps['id']; markerStart?: EdgeProps['markerStart']; markerEnd?: EdgeProps['markerEnd']; interactionWidth?: EdgeProps['interactionWidth']; style?: EdgeProps['style']; sourceHandleId?: EdgeProps['sourceHandleId']; targetHandleId?: EdgeProps['targetHandleId']; }; export type EdgeComponentWithPathOptions = EdgeComponentProps & { pathOptions?: PathOptions; }; /** * BezierEdge component props * @public * @expand */ export type BezierEdgeProps = EdgeComponentWithPathOptions; /** * SmoothStepEdge component props * @public * @expand */ export type SmoothStepEdgeProps = EdgeComponentWithPathOptions; /** * StepEdge component props * @public * @expand */ export type StepEdgeProps = EdgeComponentWithPathOptions; /** * StraightEdge component props * @public * @expand */ export type StraightEdgeProps = Omit; /** * SimpleBezier component props * @public * @expand */ export type SimpleBezierEdgeProps = EdgeComponentProps; /** * If you want to render a custom component for connection lines, you can set the * `connectionLineComponent` prop on the [``](/api-reference/react-flow#connection-connectionLineComponent) * component. The `ConnectionLineComponentProps` are passed to your custom component. * * @public */ export type ConnectionLineComponentProps = { connectionLineStyle?: CSSProperties; connectionLineType: ConnectionLineType$1; /** The node the connection line originates from. */ fromNode: InternalNode; /** The handle on the `fromNode` that the connection line originates from. */ fromHandle: HandleBounds$1; fromX: number; fromY: number; toX: number; toY: number; fromPosition: Position$1; toPosition: Position$1; /** * If there is an `isValidConnection` callback, this prop will be set to `"valid"` or `"invalid"` * based on the return value of that callback. Otherwise, it will be `null`. */ connectionStatus: 'valid' | 'invalid' | null; toNode: InternalNode | null; toHandle: HandleBounds$1 | null; pointer: XYPosition$1; }; export type ConnectionLineComponent = ComponentType>; /** * ReactFlow component props. * @public */ export interface ReactFlowProps extends Omit, 'onError'> { /** * An array of nodes to render in a controlled flow. * @default [] * @example * const nodes = [ * { * id: 'node-1', * type: 'input', * data: { label: 'Node 1' }, * position: { x: 250, y: 50 } * } * ]; */ nodes?: NodeType[]; /** * An array of edges to render in a controlled flow. * @default [] * @example * const edges = [ * { * id: 'edge-1-2', * source: 'node-1', * target: 'node-2', * } * ]; */ edges?: EdgeType[]; /** The initial nodes to render in an uncontrolled flow. */ defaultNodes?: NodeType[]; /** The initial edges to render in an uncontrolled flow. */ defaultEdges?: EdgeType[]; /** * Defaults to be applied to all new edges that are added to the flow. * Properties on a new edge will override these defaults if they exist. * @example * const defaultEdgeOptions = { * type: 'customEdgeType', * animated: true * } */ defaultEdgeOptions?: DefaultEdgeOptions; /** This event handler is called when a user clicks on a node. */ onNodeClick?: NodeMouseHandler; /** This event handler is called when a user double-clicks on a node. */ onNodeDoubleClick?: NodeMouseHandler; /** This event handler is called when mouse of a user enters a node. */ onNodeMouseEnter?: NodeMouseHandler; /** This event handler is called when mouse of a user moves over a node. */ onNodeMouseMove?: NodeMouseHandler; /** This event handler is called when mouse of a user leaves a node. */ onNodeMouseLeave?: NodeMouseHandler; /** This event handler is called when a user right-clicks on a node. */ onNodeContextMenu?: NodeMouseHandler; /** This event handler is called when a user starts to drag a node. */ onNodeDragStart?: OnNodeDrag; /** This event handler is called when a user drags a node. */ onNodeDrag?: OnNodeDrag; /** This event handler is called when a user stops dragging a node. */ onNodeDragStop?: OnNodeDrag; /** This event handler is called when a user clicks on an edge. */ onEdgeClick?: (event: MouseEvent$1, edge: EdgeType) => void; /** This event handler is called when a user right-clicks on an edge. */ onEdgeContextMenu?: EdgeMouseHandler; /** This event handler is called when mouse of a user enters an edge. */ onEdgeMouseEnter?: EdgeMouseHandler; /** This event handler is called when mouse of a user moves over an edge. */ onEdgeMouseMove?: EdgeMouseHandler; /** This event handler is called when mouse of a user leaves an edge. */ onEdgeMouseLeave?: EdgeMouseHandler; /** This event handler is called when a user double-clicks on an edge. */ onEdgeDoubleClick?: EdgeMouseHandler; /** * This handler is called when the source or target of a reconnectable edge is dragged from the * current node. It will fire even if the edge's source or target do not end up changing. * You can use the `reconnectEdge` utility to convert the connection to a new edge. */ onReconnect?: OnReconnect$1; /** * This event fires when the user begins dragging the source or target of an editable edge. */ onReconnectStart?: (event: MouseEvent$1, edge: EdgeType, handleType: HandleType$1) => void; /** * This event fires when the user releases the source or target of an editable edge. It is called * even if an edge update does not occur. */ onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType$1, connectionState: FinalConnectionState$1) => void; /** * Use this event handler to add interactivity to a controlled flow. * It is called on node drag, select, and move. * @example // Use NodesState hook to create edges and get onNodesChange handler * import ReactFlow, { useNodesState } from '@xyflow/react'; * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); * * return () * @example // Use helper function to update node * import ReactFlow, { applyNodeChanges } from '@xyflow/react'; * * const onNodeChange = useCallback( * (changes) => setNode((nds) => applyNodeChanges(changes, nds)), * [], * ); * * return () */ onNodesChange?: OnNodesChange; /** * Use this event handler to add interactivity to a controlled flow. It is called on edge select * and remove. * @example // Use EdgesState hook to create edges and get onEdgesChange handler * import ReactFlow, { useEdgesState } from '@xyflow/react'; * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); * * return () * @example // Use helper function to update edge * import ReactFlow, { applyEdgeChanges } from '@xyflow/react'; * * const onEdgesChange = useCallback( * (changes) => setEdges((eds) => applyEdgeChanges(changes, eds)), * [], * ); * * return () */ onEdgesChange?: OnEdgesChange; /** This event handler gets called when a node is deleted. */ onNodesDelete?: OnNodesDelete; /** This event handler gets called when an edge is deleted. */ onEdgesDelete?: OnEdgesDelete; /** This event handler gets called when a node or edge is deleted. */ onDelete?: OnDelete; /** This event handler gets called when a user starts to drag a selection box. */ onSelectionDragStart?: SelectionDragHandler; /** This event handler gets called when a user drags a selection box. */ onSelectionDrag?: SelectionDragHandler; /** This event handler gets called when a user stops dragging a selection box. */ onSelectionDragStop?: SelectionDragHandler; onSelectionStart?: (event: MouseEvent$1) => void; onSelectionEnd?: (event: MouseEvent$1) => void; /** * This event handler is called when a user right-clicks on a node selection. */ onSelectionContextMenu?: (event: MouseEvent$1, nodes: NodeType[]) => void; /** * When a connection line is completed and two nodes are connected by the user, this event fires with the new connection. * You can use the `addEdge` utility to convert the connection to a complete edge. * @example // Use helper function to update edges onConnect * import ReactFlow, { addEdge } from '@xyflow/react'; * * const onConnect = useCallback( * (params) => setEdges((eds) => addEdge(params, eds)), * [], * ); * * return () */ onConnect?: OnConnect$1; /** This event handler gets called when a user starts to drag a connection line. */ onConnectStart?: OnConnectStart$1; /** * This callback will fire regardless of whether a valid connection could be made or not. You can * use the second `connectionState` parameter to have different behavior when a connection was * unsuccessful. */ onConnectEnd?: OnConnectEnd$1; onClickConnectStart?: OnConnectStart$1; onClickConnectEnd?: OnConnectEnd$1; /** * The `onInit` callback is called when the viewport is initialized. At this point you can use the * instance to call methods like `fitView` or `zoomTo`. */ onInit?: OnInit; /** This event handler is called while the user is either panning or zooming the viewport. */ onMove?: OnMove$1; /** This event handler is called when the user begins to pan or zoom the viewport. */ onMoveStart?: OnMoveStart$1; /** * This event handler is called when panning or zooming viewport movement stops. * If the movement is not user-initiated, the event parameter will be `null`. */ onMoveEnd?: OnMoveEnd$1; /** This event handler gets called when a user changes group of selected elements in the flow. */ onSelectionChange?: OnSelectionChangeFunc; /** This event handler gets called when user scroll inside the pane. */ onPaneScroll?: (event?: WheelEvent) => void; /** This event handler gets called when user clicks inside the pane. */ onPaneClick?: (event: MouseEvent$1) => void; /** This event handler gets called when user right clicks inside the pane. */ onPaneContextMenu?: (event: MouseEvent$1 | MouseEvent) => void; /** This event handler gets called when mouse enters the pane. */ onPaneMouseEnter?: (event: MouseEvent$1) => void; /** This event handler gets called when mouse moves over the pane. */ onPaneMouseMove?: (event: MouseEvent$1) => void; /** This event handler gets called when mouse leaves the pane. */ onPaneMouseLeave?: (event: MouseEvent$1) => void; /** * Distance in pixels the pointer has to move before dragging the pane starts panning or a selection. * If the pointer moves less, the gesture is treated as a click: `onPaneClick` (or `onPaneContextMenu` * when panning with the right mouse button) is called and the viewport does not move. * This applies to every mouse button that is enabled via `panOnDrag` and to `selectionOnDrag`. * @default 1 */ paneDragThreshold?: number; /** * This handler is called before nodes or edges are deleted, allowing the deletion to be aborted * by returning `false` or modified by returning updated nodes and edges. */ onBeforeDelete?: OnBeforeDelete; /** * Custom node types to be available in a flow. * React Flow matches a node's type to a component in the `nodeTypes` object. * @default { * input: InputNode, * default: DefaultNode, * output: OutputNode, * group: GroupNode * } * @example * import CustomNode from './CustomNode'; * * const nodeTypes = { nameOfNodeType: CustomNode }; */ nodeTypes?: NodeTypes; /** * Custom edge types to be available in a flow. * React Flow matches an edge's type to a component in the `edgeTypes` object. * @default { * default: BezierEdge, * straight: StraightEdge, * step: StepEdge, * smoothstep: SmoothStepEdge, * simplebezier: SimpleBezier * } * @example * import CustomEdge from './CustomEdge'; * * const edgeTypes = { nameOfEdgeType: CustomEdge }; */ edgeTypes?: EdgeTypes; /** * The type of edge path to use for connection lines. * Although created edges can be of any type, React Flow needs to know what type of path to render for the connection line before the edge is created! * @default ConnectionLineType.Bezier */ connectionLineType?: ConnectionLineType$1; /** Styles to be applied to the connection line. */ connectionLineStyle?: CSSProperties; /** React Component to be used as a connection line. */ connectionLineComponent?: ConnectionLineComponent; /** Styles to be applied to the container of the connection line. */ connectionLineContainerStyle?: CSSProperties; /** * A loose connection mode will allow you to connect handles with differing types, including * source-to-source connections. However, it does not support target-to-target connections. Strict * mode allows only connections between source handles and target handles. * @default 'strict' */ connectionMode?: ConnectionMode$1; /** * If set, pressing the key or chord will delete any selected nodes and edges. Passing an array * represents multiple keys that can be pressed. * For example, `["Delete", "Backspace"]` will delete selected elements when either key is pressed. * @default 'Backspace' */ deleteKeyCode?: KeyCode$1 | null; /** * If set, holding this key will let you click and drag to draw a selection box around multiple * nodes and edges. Passing an array represents multiple keys that can be pressed. * * For example, `["Shift", "Meta"]` will allow you to draw a selection box when either key is * pressed. * @default 'Shift' */ selectionKeyCode?: KeyCode$1 | null; /** * Select multiple elements with a selection box, without pressing down `selectionKey`. * Has no effect when the left mouse button pans the viewport (`panOnDrag` is `true` or includes `0`). * @default false */ selectionOnDrag?: boolean; /** * When set to `"partial"`, when the user creates a selection box by click and dragging nodes that * are only partially in the box are still selected. * @default 'full' */ selectionMode?: SelectionMode$1; /** * If a key is set, you can pan the viewport while that key is held down even if `panOnScroll` * is set to `false`. * * By setting this prop to `null` you can disable this functionality. * @default 'Space' */ panActivationKeyCode?: KeyCode$1 | null; /** * Pressing down this key you can select multiple elements by clicking. * @default "Meta" for macOS, "Control" for other systems */ multiSelectionKeyCode?: KeyCode$1 | null; /** * If a key is set, you can zoom the viewport while that key is held down even if `panOnScroll` * is set to `false`. * * By setting this prop to `null` you can disable this functionality. * @default "Meta" for macOS, "Control" for other systems * */ zoomActivationKeyCode?: KeyCode$1 | null; /** When enabled, nodes will snap to the grid when dragged. */ snapToGrid?: boolean; /** * If `snapToGrid` is enabled, this prop configures the grid that nodes will snap to. * @example [20, 20] */ snapGrid?: SnapGrid$1; /** * You can enable this optimisation to instruct React Flow to only render nodes and edges that would be visible in the viewport. * * This might improve performance when you have a large number of nodes and edges but also adds an overhead. * @default false */ onlyRenderVisibleElements?: boolean; /** * Controls whether all nodes should be draggable or not. Individual nodes can override this * setting by setting their `draggable` prop. If you want to use the mouse handlers on * non-draggable nodes, you need to add the `"nopan"` class to those nodes. * @default true */ nodesDraggable?: boolean; /** * When `true`, the viewport will pan when a node is focused. * @default true */ autoPanOnNodeFocus?: boolean; /** * Controls whether all nodes should be connectable or not. Individual nodes can override this * setting by setting their `connectable` prop. * @default true */ nodesConnectable?: boolean; /** * When `true`, focus between nodes can be cycled with the `Tab` key and selected with the `Enter` * key. This option can be overridden by individual nodes by setting their `focusable` prop. * @default true */ nodesFocusable?: boolean; /** * The origin of the node to use when placing it in the flow or looking up its `x` and `y` * position. An origin of `[0, 0]` means that a node's top left corner will be placed at the `x` * and `y` position. * @default [0, 0] * @example * [0, 0] // default, top left * [0.5, 0.5] // center * [1, 1] // bottom right */ nodeOrigin?: NodeOrigin$1; /** * When `true`, focus between edges can be cycled with the `Tab` key and selected with the `Enter` * key. This option can be overridden by individual edges by setting their `focusable` prop. * @default true */ edgesFocusable?: boolean; /** * Whether edges can be updated once they are created. When both this prop is `true` and an * `onReconnect` handler is provided, the user can drag an existing edge to a new source or * target. Individual edges can override this value with their reconnectable property. * @default true */ edgesReconnectable?: boolean; /** * When `true`, elements (nodes and edges) can be selected by clicking on them. This option can be * overridden by individual elements by setting their `selectable` prop. * @default true */ elementsSelectable?: boolean; /** * If `true`, nodes get selected on drag. * @default true */ selectNodesOnDrag?: boolean; /** * Enabling this prop allows users to pan the viewport by clicking and dragging. * You can also set this prop to an array of numbers to limit which mouse buttons can activate panning. * Mouse button arrays do not disable touch panning; set this prop to `false` to disable all drag panning. * @default true * @example [0, 2] // allows panning with the left and right mouse buttons * [0, 1, 2, 3, 4] // allows panning with all mouse buttons */ panOnDrag?: boolean | number[]; /** * Minimum zoom level. * @default 0.5 */ minZoom?: number; /** * Maximum zoom level. * @default 2 */ maxZoom?: number; /** * When you pass a `viewport` prop, it's controlled, and you also need to pass `onViewportChange` * to handle internal changes. */ viewport?: Viewport$1; /** * Sets the initial position and zoom of the viewport. If a default viewport is provided but * `fitView` is enabled, the default viewport will be ignored. * @default { x: 0, y: 0, zoom: 1 } * @example * const initialViewport = { * zoom: 0.5, * position: { x: 0, y: 0 } * }; */ defaultViewport?: Viewport$1; /** * Used when working with a controlled viewport for updating the user viewport state. */ onViewportChange?: (viewport: Viewport$1) => void; /** * By default, the viewport extends infinitely. You can use this prop to set a boundary. * The first pair of coordinates is the top left boundary and the second pair is the bottom right. * @default [[-∞, -∞], [+∞, +∞]] * @example [[-1000, -10000], [1000, 1000]] */ translateExtent?: CoordinateExtent$1; /** * Disabling this prop will allow the user to scroll the page even when their pointer is over the flow. * @default true */ preventScrolling?: boolean; /** * By default, nodes can be placed on an infinite flow. You can use this prop to set a boundary. * The first pair of coordinates is the top left boundary and the second pair is the bottom right. * @example [[-1000, -10000], [1000, 1000]] */ nodeExtent?: CoordinateExtent$1; /** * Color of edge markers. * You can pass `null` to use the CSS variable `--xy-edge-stroke` for the marker color. * @default '#b1b1b7' */ defaultMarkerColor?: string | null; /** * Controls if the viewport should zoom by scrolling inside the container. * @default true */ zoomOnScroll?: boolean; /** * Controls if the viewport should zoom by pinching on a touch screen. * @default true */ zoomOnPinch?: boolean; /** * Controls if the viewport should pan by scrolling inside the container. * Can be limited to a specific direction with `panOnScrollMode`. * @default false */ panOnScroll?: boolean; /** * Controls how fast viewport should be panned on scroll. * Use together with `panOnScroll` prop. * @default 0.5 */ panOnScrollSpeed?: number; /** * This prop is used to limit the direction of panning when `panOnScroll` is enabled. * The `"free"` option allows panning in any direction. * @default "free" * @example "horizontal" | "vertical" */ panOnScrollMode?: PanOnScrollMode$1; /** * Controls if the viewport should zoom by double-clicking somewhere on the flow. * @default true */ zoomOnDoubleClick?: boolean; /** * The radius around an edge connection that can trigger an edge reconnection. * @default 10 */ reconnectRadius?: number; /** * If a node is draggable, clicking and dragging that node will move it around the canvas. Adding * the `"nodrag"` class prevents this behavior and this prop allows you to change the name of that * class. * @default "nodrag" */ noDragClassName?: string; /** * Typically, scrolling the mouse wheel when the mouse is over the canvas will zoom the viewport. * Adding the `"nowheel"` class to an element in the canvas will prevent this behavior and this prop * allows you to change the name of that class. * @default "nowheel" */ noWheelClassName?: string; /** * If an element in the canvas does not stop mouse events from propagating, clicking and dragging * that element will pan the viewport. Adding the `"nopan"` class prevents this behavior and this * prop allows you to change the name of that class. * @default "nopan" */ noPanClassName?: string; /** When `true`, the flow will be zoomed and panned to fit all the nodes initially provided. */ fitView?: boolean; /** * When you typically call `fitView` on a `ReactFlowInstance`, you can provide an object of * options to customize its behavior. This prop lets you do the same for the initial `fitView` * call. * @default { padding: '5%' } * @example * const fitViewOptions = { * padding: '5%', * includeHiddenNodes: false, * minZoom: 0.1, * maxZoom: 1, * duration: 200, * nodes: [{id: 'node-1'}, {id: 'node-2'}], // nodes to fit * }; */ fitViewOptions?: FitViewOptions; /** * The `connectOnClick` option lets you click or tap on a source handle to start a connection * and then click on a target handle to complete the connection. * * If you set this option to `false`, users will need to drag the connection line to the target * handle to create a connection. * @default true */ connectOnClick?: boolean; /** * By default, React Flow will render a small attribution in the bottom right corner of the flow. * * You can use this prop to change its position in case you want to place something else there. * @default 'bottom-right' * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' */ attributionPosition?: PanelPosition$1; /** * By default, we render a small attribution in the corner of your flows that links back to the project. * * Please only remove the attribution if you have a React Flow subscription. * More information in the {@link https://reactflow.dev/remove-attribution | removing attribution guide}. */ proOptions?: ProOptions; /** * Enabling this option will raise the z-index of nodes when they are selected. * @default true */ elevateNodesOnSelect?: boolean; /** * Enabling this option will raise the z-index of edges when they are selected. * This also ensures that, when multiple reconnectable edges share a handle, * the selected edge's repoint anchor is the one that receives the drag. * @default true */ elevateEdgesOnSelect?: boolean; /** * You can use this prop to disable keyboard accessibility features such as selecting nodes or * moving selected nodes with the arrow keys. * @default false */ disableKeyboardA11y?: boolean; /** * When `true`, the viewport will pan automatically when the cursor moves to the edge of the * viewport while dragging a node. * @default true */ autoPanOnNodeDrag?: boolean; /** * When `true`, the viewport will pan automatically when the cursor moves to the edge of the * viewport while creating a connection. * @default true */ autoPanOnConnect?: boolean; /** * When `true`, the viewport will pan automatically when the cursor moves to the edge of the * viewport while creating a selection box. * @default true */ autoPanOnSelection?: boolean; /** * The speed at which the viewport pans while dragging a node or a selection box. * @default 15 */ autoPanSpeed?: number; /** * The radius around a handle where you drop a connection line to create a new edge. * @default 20 */ connectionRadius?: number; /** * Occasionally something may happen that causes React Flow to throw an error. * * Instead of exploding your application, we log a message to the console and then call this event handler. * You might use it for additional logging or to show a message to the user. */ onError?: OnError$1; /** * This callback can be used to validate a new connection * * If you return `false`, the edge will not be added to your flow. * If you have custom connection logic its preferred to use this callback over the * `isValidConnection` prop on the handle component for performance reasons. */ isValidConnection?: IsValidConnection; /** * With a threshold greater than zero you can delay node drag events. * If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired. * 1 is the default value, so that clicks don't trigger drag events. * @default 1 */ nodeDragThreshold?: number; /** * The threshold in pixels that the mouse must move before a connection line starts to drag. * This is useful to prevent accidental connections when clicking on a handle. * @default 1 */ connectionDragThreshold?: number; /** Sets a fixed width for the flow. */ width?: number; /** Sets a fixed height for the flow. */ height?: number; /** * Forces a color scheme on the flow container via class name, overriding the system default. * Page-level theming is typically done by setting `data-theme` on ``. */ forceColorMode?: ColorMode$1; /** * If set `true`, some debug information will be logged to the console like which events are fired. * @default false */ debug?: boolean; /** * Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults. * Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings. */ ariaLabelConfig?: Partial; /** * Used to define how z-indexing is calculated for nodes and edges. * 'auto' is for selections and sub flows, 'basic' for selections only, and 'manual' for no auto z-indexing. * * @default 'basic' */ zIndexMode?: ZIndexMode$1; } type Listener = () => void; type HandleArgs = { nodeId: string; id?: string | null; type: HandleType$1; }; declare class PubSub { private nodeListeners; private edgeListeners; private handleListeners; subscribeToNode(id: string, onStoreChange: Listener): () => void; subscribeToNodes(ids: readonly string[] | ReadonlySet, onStoreChange: Listener): () => void; publishNodes(ids: Set): void; subscribeToEdge(id: string, onStoreChange: Listener): () => void; subscribeToEdges(ids: readonly string[] | ReadonlySet, onStoreChange: Listener): () => void; publishEdges(ids: Set): void; subscribeToConnectionForHandle(handle: HandleArgs, onStoreChange: Listener): () => void; publishConnectionClickStart(): void; publishConnection(previous: ConnectionState$1, connection: ConnectionState$1): void; reset(): void; private subscribe; private notify; private notifyAll; } export type ReactFlowStore = { pubSub: PubSub; rfId: string; onNodesChange: OnNodesChange | null; onEdgesChange: OnEdgesChange | null; hasDefaultNodes: boolean; hasDefaultEdges: boolean; domNode: HTMLDivElement | null; noPanClassName: string; panZoom: PanZoomInstance | null; minZoom: number; maxZoom: number; translateExtent: CoordinateExtent$1; nodeExtent: CoordinateExtent$1; nodeOrigin: NodeOrigin$1; nodeDragThreshold: number; connectionDragThreshold: number; nodesSelectionActive: boolean; userSelectionActive: boolean; connectionMode: ConnectionMode$1; snapToGrid: boolean; snapGrid: SnapGrid$1; nodesDraggable: boolean; autoPanOnNodeFocus: boolean; nodesConnectable: boolean; nodesFocusable: boolean; edgesFocusable: boolean; edgesReconnectable: boolean; elementsSelectable: boolean; elevateNodesOnSelect: boolean; elevateEdgesOnSelect: boolean; selectNodesOnDrag: boolean; multiSelectionActive: boolean; onNodeDragStart: OnNodeDrag | undefined; onNodeDrag: OnNodeDrag | undefined; onNodeDragStop: OnNodeDrag | undefined; onSelectionDragStart: OnSelectionDrag$1 | undefined; onSelectionDrag: OnSelectionDrag$1 | undefined; onSelectionDragStop: OnSelectionDrag$1 | undefined; onMoveStart: OnMoveStart$1 | undefined; onMove: OnMove$1 | undefined; onMoveEnd: OnMoveEnd$1 | undefined; onConnect: OnConnect$1 | undefined; onConnectStart: OnConnectStart$1 | undefined; onConnectEnd: OnConnectEnd$1 | undefined; onClickConnectStart: OnConnectStart$1 | undefined; onClickConnectEnd: OnConnectEnd$1 | undefined; connectOnClick: boolean; defaultEdgeOptions: DefaultEdgeOptions | undefined; fitViewQueued: boolean; fitViewOptions: FitViewOptions | undefined; fitViewResolver: ReturnType> | null; onNodesDelete: OnNodesDelete | undefined; onEdgesDelete: OnEdgesDelete | undefined; onDelete: OnDelete | undefined; onError: OnError$1 | undefined; onViewportChangeStart: OnViewportChange | undefined; onViewportChange: OnViewportChange | undefined; onViewportChangeEnd: OnViewportChange | undefined; onBeforeDelete: OnBeforeDelete | undefined; onSelectionChangeHandlers: OnSelectionChangeFunc[]; ariaLiveMessage: string; autoPanOnConnect: boolean; autoPanOnNodeDrag: boolean; autoPanSpeed: number; connectionRadius: number; isValidConnection: IsValidConnection | undefined; debug: boolean; ariaLabelConfig: AriaLabelConfig$1; zIndexMode: ZIndexMode$1; onNodesChangeMiddlewareMap: Map[]) => NodeChange$1[]>; onEdgesChangeMiddlewareMap: Map[]) => EdgeChange$1[]>; }; export type ReactFlowActions = { setNodes: (nodes: NodeType[]) => void; setEdges: (edges: EdgeType[]) => void; setDefaultNodesAndEdges: (nodes?: NodeType[], edges?: EdgeType[]) => void; updateNodeInternals: (updates: Map, params?: { triggerFitView: boolean; }) => void; updateNodePositions: UpdateNodePositions; resetSelectedElements: () => void; unselectNodesAndEdges: (params?: UnselectNodesAndEdgesParams) => void; addSelectedNodes: (nodeIds: string[]) => void; addSelectedEdges: (edgeIds: string[]) => void; setMinZoom: (minZoom: number) => void; setMaxZoom: (maxZoom: number) => void; setTranslateExtent: (translateExtent: CoordinateExtent$1) => void; setNodeExtent: (nodeExtent: CoordinateExtent$1) => void; cancelConnection: () => void; updateConnection: UpdateConnection>; updateConnectionClickStart: (connectionClickStartHandle: ConnectionStore['connectionClickStartHandle']) => void; reset: () => void; emitNodeChanges: (changes: NodeChange$1[]) => void; emitEdgeChanges: (changes: EdgeChange$1[]) => void; panBy: PanBy; setCenter: SetCenter$1; }; export type ReactFlowState = ReactFlowStore & ReactFlowActions; export type ViewportStore = { paneDragging: boolean; transform: Transform$1; width: number; height: number; }; export type ConnectionStore = { connection: ConnectionState$1>; connectionClickStartHandle: (Pick & Required>) | null; }; export type NodesStore = { nodes: NodeType[]; nodeLookup: NodeLookup>; parentLookup: ParentLookup>; nodesInitialized: boolean; }; export type EdgesStore = { edges: EdgeType[]; edgeLookup: EdgeLookup; connectionLookup: ConnectionLookup; }; export type SelectionStore = { userSelectionRect: SelectionRect$1 | null; }; export type ReactFlowStoreApi = { optionsStore: StoreApi>; viewportStore: StoreApi; connectionStore: StoreApi>; nodesStore: StoreApi>; edgesStore: StoreApi>; selectionStore: StoreApi; }; export type ReactFlowJsonObject = { nodes: NodeType[]; edges: EdgeType[]; viewport: Viewport$1; }; export type DeleteElementsOptions = { nodes?: (Node | { id: Node['id']; })[]; edges?: (Edge | { id: Edge['id']; })[]; }; /** * @inline */ export type GeneralHelpers = { /** * Returns nodes. * * @returns nodes array */ getNodes: () => NodeType[]; /** * Set your nodes array to something else by either overwriting it with a new array or by passing * in a function to update the existing array. If using a function, it is important to make sure a * new array is returned instead of mutating the existing array. Calling this function will * trigger the `onNodesChange` handler in a controlled flow. * * @param payload - the nodes to set or a function that receives the current nodes and returns the new nodes */ setNodes: (payload: NodeType[] | ((nodes: NodeType[]) => NodeType[])) => void; /** * Add one or many nodes to your existing nodes array. Calling this function will trigger the * `onNodesChange` handler in a controlled flow. * * @param payload - the nodes to add */ addNodes: (payload: NodeType[] | NodeType) => void; /** * Returns a node by id. * * @param id - the node id * @returns the node or undefined if no node was found */ getNode: (id: string) => NodeType | undefined; /** * Returns an internal node by id. * * @param id - the node id * @returns the internal node or undefined if no node was found */ getInternalNode: (id: string) => InternalNode | undefined; /** * Returns edges. * * @returns edges array */ getEdges: () => EdgeType[]; /** * Set your edges array to something else by either overwriting it with a new array or by passing * in a function to update the existing array. If using a function, it is important to make sure a * new array is returned instead of mutating the existing array. Calling this function will * trigger the `onEdgesChange` handler in a controlled flow. * * @param payload - the edges to set or a function that receives the current edges and returns the new edges */ setEdges: (payload: EdgeType[] | ((edges: EdgeType[]) => EdgeType[])) => void; /** * Add one or many edges to your existing edges array. Calling this function will trigger the * `onEdgesChange` handler in a controlled flow. * * @param payload - the edges to add */ addEdges: (payload: EdgeType[] | EdgeType) => void; /** * Returns an edge by id. * * @param id - the edge id * @returns the edge or undefined if no edge was found */ getEdge: (id: string) => EdgeType | undefined; /** * Returns the nodes, edges and the viewport as a JSON object. * * @returns the nodes, edges and the viewport as a JSON object */ toObject: () => ReactFlowJsonObject; /** * Deletes nodes and edges. * * @param params.nodes - optional nodes array to delete * @param params.edges - optional edges array to delete * * @returns a promise that resolves with the deleted nodes and edges */ deleteElements: (params: DeleteElementsOptions) => Promise<{ deletedNodes: Node[]; deletedEdges: Edge[]; }>; /** * Find all the nodes currently intersecting with a given node or rectangle. The `partially` * parameter can be set to `true` to include nodes that are only partially intersecting. * * @param node - the node or rect to check for intersections * @param partially - true by default, if set to false, only nodes that are fully intersecting will be returned * @param nodes - optional nodes array to check for intersections * * @returns an array of intersecting nodes */ getIntersectingNodes: (node: NodeType | { id: Node['id']; } | Rect$1, partially?: boolean, nodes?: NodeType[]) => NodeType[]; /** * Determine if a given node or rectangle is intersecting with another rectangle. The `partially` * parameter can be set to true return `true` even if the node is only partially intersecting. * * @param node - the node or rect to check for intersections * @param area - the rect to check for intersections * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react * * @returns true if the node or rect intersects with the given area */ isNodeIntersecting: (node: NodeType | { id: Node['id']; } | Rect$1, area: Rect$1, partially?: boolean) => boolean; /** * Updates a node. * * @param id - id of the node to update * @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update * @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged * * @example * updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } })); */ updateNode: (id: string, nodeUpdate: Partial | ((node: NodeType) => Partial), options?: { replace: boolean; }) => void; /** * Updates the data attribute of a node. * * @param id - id of the node to update * @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update * @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged * * @example * updateNodeData('node-1', { label: 'A new label' }); */ updateNodeData: (id: string, dataUpdate: Partial | ((node: NodeType) => Partial), options?: { replace: boolean; }) => void; /** * Changes the parent of a node. * * @param nodeId - id of the node to change the parent of * @param parentId - id of the new parent */ changeParent: (nodeId: string, parentId: string | null) => void; /** * Updates an edge. * * @param id - id of the edge to update * @param edgeUpdate - the edge update as an object or a function that receives the current edge and returns the edge update * @param options.replace - if true, the edge is replaced with the edge update, otherwise the changes get merged * * @example * updateEdge('edge-1', (edge) => ({ label: 'A new label' })); */ updateEdge: (id: string, edgeUpdate: Partial | ((edge: EdgeType) => Partial), options?: { replace: boolean; }) => void; /** * Updates the data attribute of a edge. * * @param id - id of the edge to update * @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update * @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged * * @example * updateEdgeData('edge-1', { label: 'A new label' }); */ updateEdgeData: (id: string, dataUpdate: Partial | ((edge: EdgeType) => Partial), options?: { replace: boolean; }) => void; /** * Returns the bounds of the given nodes or node ids. * * @param nodes - the nodes or node ids to calculate the bounds for * * @returns the bounds of the given nodes */ getNodesBounds: (nodes: (NodeType | InternalNode | string)[]) => Rect$1; /** * Gets all connections to a node. Can be filtered by handle type and id. * @param type - handle type 'source' or 'target' * @param handleId - the handle id (this is only needed if you have multiple handles of the same type, meaning you have to provide a unique id for each handle) * @param nodeId - the node id the handle belongs to * @returns an array with handle connections */ getNodeConnections: ({ type, handleId, nodeId }: { type?: HandleType$1; nodeId: string; handleId?: string | null; }) => NodeConnection$1[]; /** * Fits the view based on the passed params. By default it fits the view to all nodes. * * @param options.padding - optional padding * @param options.nodes - optional nodes to fit the view to * @param options.minZoom - optional minZoom * @param options.maxZoom - optional maxZoom * @param options.duration - optional duration. If set, a transition will be applied * @param options.includeHiddenNodes - optional includeHiddenNodes */ fitView: FitView; }; /** * The `ReactFlowInstance` provides a collection of methods to query and manipulate * the internal state of your flow. You can get an instance by using the * [`useReactFlow`](/api-reference/hooks/use-react-flow) hook or attaching a listener * to the [`onInit`](/api-reference/react-flow#event-oninit) event. * * @public */ export type ReactFlowInstance = GeneralHelpers & ViewportHelperFunctions & { /** * React Flow needs to mount the viewport to the DOM and initialize its zoom and pan behavior. * This property tells you when viewport is initialized. */ viewportInitialized: boolean; }; /** * The `` component is the heart of your React Flow application. * It renders your nodes and edges and handles user interaction * * @public * * @example * ```tsx *import { ReactFlow } from '@xyflow/react' * *export default function Flow() { * return (); *} *``` */ declare const _default: (props: ReactFlowProps & import("react").RefAttributes) => import("react").JSX.Element; /** * @expand */ type HandleProps = HandleProps$1 & Omit, 'id'> & { /** Callback called when connection is made */ onConnect?: OnConnect$1; }; /** * The `` component is used in your [custom nodes](/learn/customization/custom-nodes) * to define connection points. * *@public * *@example * *```jsx *import { Handle, Position } from '@xyflow/react'; * *export function CustomNode({ data }) { * return ( * <> *
* {data.label} *
* * * * * ); *}; *``` */ export declare const Handle: import("react").MemoExoticComponent<(props: HandleProps$1 & Omit, "id"> & { /** Callback called when connection is made */ onConnect?: OnConnect$1; } & import("react").RefAttributes) => import("react").JSX.Element>; declare function EdgeTextComponent({ x, y, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, children, className, ...rest }: EdgeTextProps): import("react").JSX.Element | null; declare namespace EdgeTextComponent { var displayName: string; } /** * You can use the `` component as a helper component to display text * within your custom edges. * * @public * * @example * ```jsx * import { EdgeText } from '@xyflow/react'; * * export function CustomEdgeLabel({ label }) { * return ( * * ); * } *``` */ export declare const EdgeText: import("react").MemoExoticComponent; /** * Component that can be used inside a custom edge to render a straight line. * * @public * @example * * ```tsx * import { StraightEdge } from '@xyflow/react'; * * function CustomEdge({ sourceX, sourceY, targetX, targetY }) { * return ( * * ); * } * ``` */ declare const StraightEdge: import("react").MemoExoticComponent<{ ({ id, sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth }: StraightEdgeProps): import("react").JSX.Element; displayName: string; }>; /** * Component that can be used inside a custom edge to render a step edge. * * @public * @example * * ```tsx * import { StepEdge } from '@xyflow/react'; * * function CustomEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition }) { * return ( * * ); * } * ``` */ declare const StepEdge: import("react").MemoExoticComponent<{ ({ id, ...props }: StepEdgeProps): import("react").JSX.Element; displayName: string; }>; /** * Component that can be used inside a custom edge to render a bezier curve. * * @public * @example * * ```tsx * import { BezierEdge } from '@xyflow/react'; * * function CustomEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition }) { * return ( * * ); * } * ``` */ declare const BezierEdge: import("react").MemoExoticComponent<{ ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, pathOptions, interactionWidth }: BezierEdgeProps): import("react").JSX.Element; displayName: string; }>; interface GetSimpleBezierPathParams { sourceX: number; sourceY: number; /** @default Position.Bottom */ sourcePosition?: Position$1; targetX: number; targetY: number; /** @default Position.Top */ targetPosition?: Position$1; } /** * The `getSimpleBezierPath` util returns everything you need to render a simple * bezier edge between two nodes. * @public * @returns * - `path`: the path to use in an SVG `` element. * - `labelX`: the `x` position you can use to render a label for this edge. * - `labelY`: the `y` position you can use to render a label for this edge. * - `offsetX`: the absolute difference between the source `x` position and the `x` position of the * middle of this path. * - `offsetY`: the absolute difference between the source `y` position and the `y` position of the * middle of this path. */ export declare function getSimpleBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition }: GetSimpleBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number]; declare const SimpleBezierEdge: import("react").MemoExoticComponent<{ ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth }: SimpleBezierEdgeProps): import("react").JSX.Element; displayName: string; }>; /** * Component that can be used inside a custom edge to render a smooth step edge. * * @public * @example * * ```tsx * import { SmoothStepEdge } from '@xyflow/react'; * * function CustomEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition }) { * return ( * * ); * } * ``` */ declare const SmoothStepEdge: import("react").MemoExoticComponent<{ ({ id, sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, sourcePosition, targetPosition, markerEnd, markerStart, pathOptions, interactionWidth }: SmoothStepEdgeProps): import("react").JSX.Element; displayName: string; }>; /** * The `` component gets used internally for all the edges. It can be * used inside a custom edge and handles the invisible helper edge and the edge label * for you. * * @public * @example * ```jsx *import { BaseEdge } from '@xyflow/react'; * *export function CustomEdge({ sourceX, sourceY, targetX, targetY, ...props }) { * const [edgePath] = getStraightPath({ * sourceX, * sourceY, * targetX, * targetY, * }); * * return ; *} *``` * * @remarks If you want to use an edge marker with the [``](/api-reference/components/base-edge) component, * you can pass the `markerStart` or `markerEnd` props passed to your custom edge * through to the [``](/api-reference/components/base-edge) component. * You can see all the props passed to a custom edge by looking at the [`EdgeProps`](/api-reference/types/edge-props) type. */ export declare function BaseEdge({ path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, interactionWidth, ...props }: BaseEdgeProps): import("react").JSX.Element; type ReactFlowProviderProps = { /** These nodes are used to initialize the flow. They are not dynamic. */ initialNodes?: Node[]; /** These edges are used to initialize the flow. They are not dynamic. */ initialEdges?: Edge[]; /** These nodes are used to initialize the flow. They are not dynamic. */ defaultNodes?: Node[]; /** These edges are used to initialize the flow. They are not dynamic. */ defaultEdges?: Edge[]; /** The initial width is necessary to be able to use fitView on the server */ initialWidth?: number; /** The initial height is necessary to be able to use fitView on the server */ initialHeight?: number; /** When `true`, the flow will be zoomed and panned to fit all the nodes initially provided. */ fitView?: boolean; /** * You can provide an object of options to customize the initial fitView behavior. */ initialFitViewOptions?: FitViewOptions; /** Initial minimum zoom level */ initialMinZoom?: number; /** Initial maximum zoom level */ initialMaxZoom?: number; /** * The origin of the node to use when placing it in the flow or looking up its `x` and `y` * position. An origin of `[0, 0]` means that a node's top left corner will be placed at the `x` * and `y` position. * @default [0, 0] * @example * [0, 0] // default, top left * [0.5, 0.5] // center * [1, 1] // bottom right */ nodeOrigin?: NodeOrigin$1; /** * By default, nodes can be placed on an infinite flow. You can use this prop to set a boundary. * * The first pair of coordinates is the top left boundary and the second pair is the bottom right. * @example [[-1000, -10000], [1000, 1000]] */ nodeExtent?: CoordinateExtent$1; children: ReactNode; zIndexMode?: ZIndexMode$1; }; /** * The `` component is a [context provider](https://react.dev/learn/passing-data-deeply-with-context#) * that makes it possible to access a flow's internal state outside of the * [``](/api-reference/react-flow) component. Many of the hooks we * provide rely on this component to work. * @public * * @example * ```tsx *import { ReactFlow, ReactFlowProvider, useNodes } from '@xyflow/react' * *export default function Flow() { * return ( * * * * * ); *} * *function Sidebar() { * // This hook will only work if the component it's used in is a child of a * // . * const nodes = useNodes() * * return ; *} *``` * * @remarks If you're using a router and want your flow's state to persist across routes, * it's vital that you place the `` component _outside_ of * your router. If you have multiple flows on the same page you will need to use a separate * `` for each flow. */ export declare function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, initialMinZoom: minZoom, initialMaxZoom: maxZoom, initialFitViewOptions: fitViewOptions, fitView, nodeOrigin, nodeExtent, zIndexMode, children }: ReactFlowProviderProps): import("react").JSX.Element; /** * @expand */ type PanelProps = HTMLAttributes & { /** * The position of the panel. * @default "top-left" */ position?: PanelPosition$1; }; /** * The `` component helps you position content above the viewport. * It is used internally by the [``](/api-reference/components/minimap) * and [``](/api-reference/components/controls) components. * * @public * * @example * ```jsx *import { ReactFlow, Background, Panel } from '@xyflow/react'; * *export default function Flow() { * return ( * * top-left * top-center * top-right * bottom-left * bottom-center * bottom-right * * ); *} *``` */ export declare const Panel: import("react").ForwardRefExoticComponent & { /** * The position of the panel. * @default "top-left" */ position?: PanelPosition$1; } & import("react").RefAttributes>; type EdgeLabelRendererProps = { children: ReactNode; }; /** * Edges are SVG-based. If you want to render more complex labels you can use the * `` component to access a div based renderer. This component * is a portal that renders the label in a `
` that is positioned on top of * the edges. You can see an example usage of the component in the * [edge label renderer example](/examples/edges/edge-label-renderer). * @public * * @example * ```jsx * import React from 'react'; * import { getBezierPath, EdgeLabelRenderer, BaseEdge } from '@xyflow/react'; * * export function CustomEdge({ id, data, ...props }) { * const [edgePath, labelX, labelY] = getBezierPath(props); * * return ( * <> * * *
* {data.label} *
*
* * ); * }; * ``` * * @remarks The `` has no pointer events by default. If you want to * add mouse interactions you need to set the style `pointerEvents: all` and add * the `nopan` class on the label or the element you want to interact with. */ export declare function EdgeLabelRenderer({ children }: EdgeLabelRendererProps): ReactPortal | null; /** * The `` component can be used to add components to the same viewport * of the flow where nodes and edges are rendered. This is useful when you want to render * your own components that are adhere to the same coordinate system as the nodes & edges * and are also affected by zooming and panning * @public * @example * * ```jsx *import React from 'react'; *import { ViewportPortal } from '@xyflow/react'; * *export default function () { * return ( * *
* This div is positioned at [100, 100] on the flow. *
*
* ); *} *``` */ export declare function ViewportPortal({ children }: { children: ReactNode; }): ReactPortal | null; /** * This hook returns a ReactFlowInstance that can be used to update nodes and edges, manipulate the viewport, or query the current state of the flow. * * @public * @example * ```jsx *import { useCallback, useState } from 'react'; *import { useReactFlow } from '@xyflow/react'; * *export function NodeCounter() { * const reactFlow = useReactFlow(); * const [count, setCount] = useState(0); * const countNodes = useCallback(() => { * setCount(reactFlow.getNodes().length); * // you need to pass it as a dependency if you are using it with useEffect or useCallback * // because at the first render, it's not initialized yet and some functions might not work. * }, [reactFlow]); * * return ( *
* *

There are {count} nodes in the flow.

*
* ); *} *``` */ export declare function useReactFlow(): ReactFlowInstance; /** * When you programmatically add or remove handles to a node or update a node's * handle position, you need to let React Flow know about it using this hook. This * will update the internal dimensions of the node and properly reposition handles * on the canvas if necessary. * * @public * @returns Use this function to tell React Flow to update the internal state of one or more nodes * that you have changed programmatically. * * @example * ```jsx *import { useCallback, useState } from 'react'; *import { Handle, useUpdateNodeInternals } from '@xyflow/react'; * *export default function RandomHandleNode({ id }) { * const updateNodeInternals = useUpdateNodeInternals(); * const [handleCount, setHandleCount] = useState(0); * const randomizeHandleCount = useCallback(() => { * setHandleCount(Math.floor(Math.random() * 10)); * updateNodeInternals(id); * }, [id, updateNodeInternals]); * * return ( * <> * {Array.from({ length: handleCount }).map((_, index) => ( * * ))} * *
* *

There are {handleCount} handles on this node.

*
* * ); *} *``` * @remarks This hook can only be used in a component that is a child of a *{@link ReactFlowProvider} or a {@link ReactFlow} component. */ export declare function useUpdateNodeInternals(): UpdateNodeInternals; /** * The `useViewport` hook is a convenient way to read the current state of the * {@link Viewport} in a component. Components that use this hook * will re-render **whenever the viewport changes**. * * @public * @returns The current viewport. * * @example * *```jsx *import { useViewport } from '@xyflow/react'; * *export default function ViewportDisplay() { * const { x, y, zoom } = useViewport(); * * return ( *
*

* The viewport is currently at ({x}, {y}) and zoomed to {zoom}. *

*
* ); *} *``` * * @remarks This hook can only be used in a component that is a child of a *{@link ReactFlowProvider} or a {@link ReactFlow} component. */ export declare function useViewport(): Viewport$1; type UseKeyPressOptions = { /** * Listen to key presses on a specific element. * @default document */ target?: Window | Document | HTMLElement | ShadowRoot | null; /** * You can use this flag to prevent triggering the key press hook when an input field is focused. * @default true */ actInsideInputWithModifier?: boolean; preventDefault?: boolean; }; /** * This hook lets you listen for specific key codes and tells you whether they are * currently pressed or not. * * @public * @param options - Options * * @example * ```tsx *import { useKeyPress } from '@xyflow/react'; * *export default function () { * const spacePressed = useKeyPress('Space'); * const cmdAndSPressed = useKeyPress(['Meta+s', 'Strg+s']); * * return ( *
* {spacePressed &&

Space pressed!

} * {cmdAndSPressed &&

Cmd + S pressed!

} *
* ); *} *``` */ export declare function useKeyPress( /** * The key code (string or array of strings) specifies which key(s) should trigger * an action. * * A **string** can represent: * - A **single key**, e.g. `'a'` * - A **key combination**, using `'+'` to separate keys, e.g. `'a+d'` * * An **array of strings** represents **multiple possible key inputs**. For example, `['a', 'd+s']` * means the user can press either the single key `'a'` or the combination of `'d'` and `'s'`. * @default null */ keyCode?: KeyCode$1 | null, options?: UseKeyPressOptions): boolean; /** * This hook makes it easy to prototype a controlled flow where you manage the * state of nodes and edges outside the `ReactFlowInstance`. You can think of it * like React's `useState` hook with an additional helper callback. * * @public * @returns * - `nodes`: The current array of nodes. You might pass this directly to the `nodes` prop of your * `` component, or you may want to manipulate it first to perform some layouting, * for example. * - `setNodes`: A function that you can use to update the nodes. You can pass it a new array of * nodes or a callback that receives the current array of nodes and returns a new array of nodes. * This is the same as the second element of the tuple returned by React's `useState` hook. * - `onNodesChange`: A handy callback that can take an array of `NodeChanges` and update the nodes * state accordingly. You'll typically pass this directly to the `onNodesChange` prop of your * `` component. * @example * *```tsx *import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react'; * *const initialNodes = []; *const initialEdges = []; * *export default function () { * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); * * return ( * * ); *} *``` * * @remarks This hook was created to make prototyping easier and our documentation * examples clearer. Although it is OK to use this hook in production, in * practice you may want to use a more sophisticated state management solution * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead. * */ export declare function useNodesState(initialNodes: NodeType[]): [nodes: NodeType[], setNodes: Dispatch>, onNodesChange: OnNodesChange]; /** * This hook makes it easy to prototype a controlled flow where you manage the * state of nodes and edges outside the `ReactFlowInstance`. You can think of it * like React's `useState` hook with an additional helper callback. * * @public * @returns * - `edges`: The current array of edges. You might pass this directly to the `edges` prop of your * `` component, or you may want to manipulate it first to perform some layouting, * for example. * * - `setEdges`: A function that you can use to update the edges. You can pass it a new array of * edges or a callback that receives the current array of edges and returns a new array of edges. * This is the same as the second element of the tuple returned by React's `useState` hook. * * - `onEdgesChange`: A handy callback that can take an array of `EdgeChanges` and update the edges * state accordingly. You'll typically pass this directly to the `onEdgesChange` prop of your * `` component. * @example * *```tsx *import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react'; * *const initialNodes = []; *const initialEdges = []; * *export default function () { * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); * * return ( * * ); *} *``` * * @remarks This hook was created to make prototyping easier and our documentation * examples clearer. Although it is OK to use this hook in production, in * practice you may want to use a more sophisticated state management solution * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead. * */ export declare function useEdgesState(initialEdges: EdgeType[]): [edges: EdgeType[], setEdges: Dispatch>, onEdgesChange: OnEdgesChange]; /** Wraps a selector to reuse its previous result when it is shallowly equal. */ export declare function useShallow(selector: (state: S) => U): (state: S) => U; /** * This hook subscribes to the shared settings and actions of the React Flow * component. Use `useViewportStore`, `useConnectionStore`, `useNodesStore`, * `useEdgesStore`, or `useSelectionStore` for their respective state. These hooks * use [Zustand](https://github.com/pmndrs/zustand) for subscriptions. * * @public * @param selector - An optional selector function that returns a slice of the flow's internal state. * Extracting or transforming just the state you need is a good practice to avoid unnecessary * re-renders. * For shallow comparisons, use `useShallow` from `@xyflow/react` by wrapping your selector: * `useOptionsStore(useShallow(selector))`. * Omit the selector to subscribe to the entire store. * @returns The selected state slice, or the entire store when no selector is provided. * * @example * ```ts * const nodesDraggable = useOptionsStore((state) => state.nodesDraggable); * ``` * * @remarks This hook should only be used if there is no other way to access the internal * state. For many of the common use cases, there are dedicated hooks available * such as {@link useReactFlow}, {@link useViewport}, etc. */ declare function useOptionsStore(): ReactFlowState; declare function useOptionsStore(selector: (state: ReactFlowState) => StateSlice): StateSlice; /** * In some cases, you might need to access the stores directly. This hook returns the store APIs which can be used on demand to access state or dispatch actions. * * @returns The options, viewport, connection, nodes, edges, and selection store APIs. * @example * ```ts * const { nodesStore } = useReactFlowStoreApi(); * const nodes = nodesStore.getState().nodes; * ``` * * @remarks This hook should only be used if there is no other way to access the internal * state. For many of the common use cases, there are dedicated hooks available * such as {@link useReactFlow}, {@link useViewport}, etc. */ declare function useReactFlowStoreApi(): ReactFlowStoreApi; export declare function useViewportStore(): ViewportStore; export declare function useViewportStore(selector: (state: ViewportStore) => StateSlice): StateSlice; export declare function useConnectionStore(): ConnectionStore; export declare function useConnectionStore(selector: (state: ConnectionStore) => StateSlice): StateSlice; export declare function useNodesStore(): NodesStore; export declare function useNodesStore(selector: (state: NodesStore) => StateSlice): StateSlice; export declare function useEdgesStore(): EdgesStore; export declare function useEdgesStore(selector: (state: EdgesStore) => StateSlice): StateSlice; export declare function useSelectionStore(): SelectionStore; export declare function useSelectionStore(selector: (state: SelectionStore) => StateSlice): StateSlice; export declare function useEqualSelector(selector: (state: S) => U, isEqual: (a: U, b: U) => boolean): (state: S) => U; type UseOnViewportChangeOptions = { /** Gets called when the viewport starts changing. */ onStart?: OnViewportChange; /** Gets called when the viewport changes. */ onChange?: OnViewportChange; /** Gets called when the viewport stops changing. */ onEnd?: OnViewportChange; }; /** * The `useOnViewportChange` hook lets you listen for changes to the viewport such * as panning and zooming. You can provide a callback for each phase of a viewport * change: `onStart`, `onChange`, and `onEnd`. * * @public * @example * ```jsx *import { useCallback } from 'react'; *import { useOnViewportChange } from '@xyflow/react'; * *function ViewportChangeLogger() { * useOnViewportChange({ * onStart: (viewport: Viewport) => console.log('start', viewport), * onChange: (viewport: Viewport) => console.log('change', viewport), * onEnd: (viewport: Viewport) => console.log('end', viewport), * }); * * return null; *} *``` */ export declare function useOnViewportChange({ onStart, onChange, onEnd }: UseOnViewportChangeOptions): void; type UseOnSelectionChangeOptions = { /** The handler to register. */ onChange: OnSelectionChangeFunc; }; /** * This hook lets you listen for changes to both node and edge selection. As the *name implies, the callback you provide will be called whenever the selection of *_either_ nodes or edges changes. * * @public * @example * ```jsx *import { useState } from 'react'; *import { ReactFlow, useOnSelectionChange } from '@xyflow/react'; * *function SelectionDisplay() { * const [selectedNodes, setSelectedNodes] = useState([]); * const [selectedEdges, setSelectedEdges] = useState([]); * * // the passed handler has to be memoized, otherwise the hook will not work correctly * const onChange = useCallback(({ nodes, edges }) => { * setSelectedNodes(nodes.map((node) => node.id)); * setSelectedEdges(edges.map((edge) => edge.id)); * }, []); * * useOnSelectionChange({ * onChange, * }); * * return ( *
*

Selected nodes: {selectedNodes.join(', ')}

*

Selected edges: {selectedEdges.join(', ')}

*
* ); *} *``` * * @remarks You need to memoize the passed `onChange` handler, otherwise the hook will not work correctly. */ export declare function useOnSelectionChange({ onChange }: UseOnSelectionChangeOptions): void; type UseNodesInitializedOptions = { /** @default false */ includeHiddenNodes?: boolean; }; /** * This hook tells you whether all the nodes in a flow have been measured and given *a width and height. When you add a node to the flow, this hook will return *`false` and then `true` again once the node has been measured. * * @public * @returns Whether or not the nodes have been initialized by the `` component and * given a width and height. * * @example * ```jsx *import { useReactFlow, useNodesInitialized } from '@xyflow/react'; *import { useEffect, useState } from 'react'; * *const options = { * includeHiddenNodes: false, *}; * *export default function useLayout() { * const { getNodes } = useReactFlow(); * const nodesInitialized = useNodesInitialized(options); * const [layoutedNodes, setLayoutedNodes] = useState(getNodes()); * * useEffect(() => { * if (nodesInitialized) { * setLayoutedNodes(yourLayoutingFunction(getNodes())); * } * }, [nodesInitialized]); * * return layoutedNodes; *} *``` */ export declare function useNodesInitialized(options?: UseNodesInitializedOptions): boolean; /** * This hook returns an array of connections on a specific node, handle type ('source', 'target') or handle ID. * * @public * @returns An array with connections. * * @example * ```jsx *import { useNodeConnections } from '@xyflow/react'; * *export default function () { * const connections = useNodeConnections({ * handleType: 'target', * handleId: 'my-handle', * }); * * return ( *
There are currently {connections.length} incoming connections!
* ); *} *``` */ export declare function useNodeConnections({ id, handleType, handleId, onConnect, onDisconnect }?: UseNodeConnectionsParams$1): NodeConnection$1[]; /** * This hook lets you subscribe to changes of a specific nodes `data` object. * * @public * @returns An object (or array of object) with `id`, `type`, `data` representing each node. * * @example *```jsx *import { useNodesData } from '@xyflow/react'; * *export default function() { * const nodeData = useNodesData('nodeId-1'); * const nodesData = useNodesData(['nodeId-1', 'nodeId-2']); * * return null; *} *``` */ export declare function useNodesData( /** The id of the node to get the data from. */ nodeId: string): DistributivePick | null; export declare function useNodesData( /** The ids of the nodes to get the data from. */ nodeIds: string[]): DistributivePick[]; /** * The `useConnection` hook returns the current connection when there is an active * connection interaction. If no connection interaction is active, it returns null * for every property. A typical use case for this hook is to colorize handles * based on a certain condition (e.g. if the connection is valid or not). * * @public * @param connectionSelector - An optional selector function used to extract a slice of the * `ConnectionState` data. Using a selector can prevent component re-renders where data you don't * otherwise care about might change. If a selector is not provided, the entire `ConnectionState` * object is returned unchanged. * @example * * ```tsx *import { useConnection } from '@xyflow/react'; * *function App() { * const connection = useConnection(); * * return ( *
{connection ? `Someone is trying to make a connection from ${connection.fromNode} to this one.` : 'There are currently no incoming connections!'} * *
* ); * } * ``` * * @returns ConnectionState */ export declare function useConnection>>(connectionSelector?: (connection: ConnectionState$1>) => SelectorReturn): SelectorReturn; /** * You can use this hook to get the id of the node it is used inside. It is useful * if you need the node's id deeper in the render tree but don't want to manually * drill down the id as a prop. * * @public * @returns The id for a node in the flow. * * @example *```jsx *import { useNodeId } from '@xyflow/react'; * *export default function CustomNode() { * return ( *
* This node has an id of * *
* ); *} * *function NodeIdDisplay() { * const nodeId = useNodeId(); * * return {nodeId}; *} *``` */ export declare const useNodeId: () => string | null; /** * This hook returns an array of the current nodes. Components that use this hook * will re-render **whenever any node changes**, including when a node is selected * or moved. * * @public * @returns An array of all nodes currently in the flow. * * @example * ```jsx *import { useNodes } from '@xyflow/react'; * *export default function() { * const nodes = useNodes(); * * return
There are currently {nodes.length} nodes!
; *} *``` */ export declare function useNodes(): NodeType[]; /** * This hook returns the node with the given id. Components that use this hook * will re-render **whenever the node changes**. * * @public * @param id - The id of the node to return. * @returns The node with the given id. * * @example * ```tsx *import { useNode } from '@xyflow/react'; * *export default function () { * const node = useNode('1'); * * return
Node: {node?.data.label}
; *} *``` */ export declare function useNode(id: string): NodeType | undefined; /** * This hook returns the internal representation of a specific node. * Components that use this hook will re-render **whenever the node changes**, * including when a node is selected or moved. * * @public * @param id - The ID of a node you want to observe. * @returns The `InternalNode` object for the node with the given ID. * * @example * ```tsx *import { useInternalNode } from '@xyflow/react'; * *export default function () { * const internalNode = useInternalNode('node-1'); * const absolutePosition = internalNode.internals.positionAbsolute; * * return ( *
* The absolute position of the node is at: *

x: {absolutePosition.x}

*

y: {absolutePosition.y}

*
* ); *} *``` */ export declare function useInternalNode(id: string): InternalNode | undefined; /** * This hook returns set of specific internal nodes and subscribes * only to those nodes. Missing IDs are omitted and duplicate IDs are ignored. * Reordering the IDs preserves the previous set and result order. * * @public * @param ids - An array of node IDs to observe. An empty array returns no nodes. * @returns The matching internal nodes. */ export declare function useInternalNodes(ids: readonly string[]): InternalNode[]; /** * This hook returns an array of the current edges. Components that use this hook * will re-render **whenever any edge changes**. * * @public * @returns An array of all edges currently in the flow. * * @example * ```tsx *import { useEdges } from '@xyflow/react'; * *export default function () { * const edges = useEdges(); * * return
There are currently {edges.length} edges!
; *} *``` */ export declare function useEdges(): EdgeType[]; /** * This hook returns the edge with the given id. Components that use this hook * will re-render **whenever the edge changes**. * * @public * @param id - The id of the edge to return. * @returns The edge with the given id. * * @example * ```tsx *import { useEdge } from '@xyflow/react'; * *export default function () { * const edge = useEdge('1'); * * return
Edge: {edge?.data.label}
; *} *``` */ export declare function useEdge(id: string): EdgeType | undefined; /** * Registers a middleware function to transform node changes. * * @public * @param fn - Middleware function. Should be memoized with useCallback to avoid re-registration. */ export declare function experimental_useOnNodesChangeMiddleware(fn: (changes: NodeChange$1[]) => NodeChange$1[]): void; /** * Registers a middleware function to transform edge changes. * * @public * @param fn - Middleware function. Should be memoized with useCallback to avoid re-registration. */ export declare function experimental_useOnEdgesChangeMiddleware(fn: (changes: EdgeChange$1[]) => EdgeChange$1[]): void; /** * Test whether an object is usable as an [`Node`](/api-reference/types/node). * In TypeScript this is a type guard that will narrow the type of whatever you pass in to * [`Node`](/api-reference/types/node) if it returns `true`. * * @public * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true * @param element - The element to test. * @returns Tests whether the provided value can be used as a `Node`. If you're using TypeScript, * this function acts as a type guard and will narrow the type of the value to `Node` if it returns * `true`. * * @example * ```js *import { isNode } from '@xyflow/react'; * *if (isNode(node)) { * // ... *} *``` */ export declare const isNode: (element: unknown) => element is NodeType; /** * Test whether an object is usable as an [`Edge`](/api-reference/types/edge). * In TypeScript this is a type guard that will narrow the type of whatever you pass in to * [`Edge`](/api-reference/types/edge) if it returns `true`. * * @public * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true * @param element - The element to test * @returns Tests whether the provided value can be used as an `Edge`. If you're using TypeScript, * this function acts as a type guard and will narrow the type of the value to `Edge` if it returns * `true`. * * @example * ```js *import { isEdge } from '@xyflow/react'; * *if (isEdge(edge)) { * // ... *} *``` */ export declare const isEdge: (element: unknown) => element is EdgeType; /** * The three variants are exported as an enum for convenience. You can either import * the enum and use it like `BackgroundVariant.Lines` or you can use the raw string * value directly. * @public */ export declare enum BackgroundVariant { Lines = "lines", Dots = "dots", Cross = "cross" } /** * @expand */ type BackgroundProps = { /** When multiple backgrounds are present on the page, each one should have a unique id. */ id?: string; /** Color of the pattern. */ color?: string; /** Color of the background. */ bgColor?: string; /** Class applied to the container. */ className?: string; /** Class applied to the pattern. */ patternClassName?: string; /** * The gap between patterns. Passing in a tuple allows you to control the x and y gap * independently. * @default 20 */ gap?: number | [number, number]; /** * The radius of each dot or the size of each rectangle if `BackgroundVariant.Dots` or * `BackgroundVariant.Cross` is used. This defaults to 1 or 6 respectively, or ignored if * `BackgroundVariant.Lines` is used. */ size?: number; /** * Offset of the pattern. * @default 0 */ offset?: number | [number, number]; /** * The stroke thickness used when drawing the pattern. * @default 1 */ lineWidth?: number; /** * Variant of the pattern. * @default BackgroundVariant.Dots * @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross * 'lines', 'dots', 'cross' */ variant?: BackgroundVariant; /** Style applied to the container. */ style?: CSSProperties; }; declare function BackgroundComponent({ id, variant, gap, size, lineWidth, offset, color, bgColor, style, className, patternClassName }: BackgroundProps): import("react").JSX.Element; declare namespace BackgroundComponent { var displayName: string; } /** * The `` component makes it convenient to render different types of backgrounds common in node-based UIs. It comes with three variants: lines, dots and cross. * * @example * * A simple example of how to use the Background component. * * ```tsx * import { useState } from 'react'; * import { ReactFlow, Background, BackgroundVariant } from '@xyflow/react'; * * export default function Flow() { * return ( * * * * ); * } * ``` * * @example * * In this example you can see how to combine multiple backgrounds * * ```tsx * import { ReactFlow, Background, BackgroundVariant } from '@xyflow/react'; * import '@xyflow/react/style.css'; * * export default function Flow() { * return ( * * * * * ); * } * ``` * * @remarks * * When combining multiple components it’s important to give each of them a unique id prop! * */ export declare const Background: import("react").MemoExoticComponent; /** * @expand */ type ControlProps = { /** * Whether or not to show the zoom in and zoom out buttons. These buttons will adjust the viewport * zoom by a fixed amount each press. * @default true */ showZoom?: boolean; /** * Whether or not to show the fit view button. By default, this button will adjust the viewport so * that all nodes are visible at once. * @default true */ showFitView?: boolean; /** * Show button for toggling interactivity * @default true */ showInteractive?: boolean; /** * Customise the options for the fit view button. These are the same options you would pass to the * fitView function. */ fitViewOptions?: FitViewOptions; /** Called in addition the default zoom behavior when the zoom in button is clicked. */ onZoomIn?: () => void; /** Called in addition the default zoom behavior when the zoom out button is clicked. */ onZoomOut?: () => void; /** * Called when the fit view button is clicked. When this is not provided, the viewport will be * adjusted so that all nodes are visible. */ onFitView?: () => void; /** Called when the interactive (lock) button is clicked. */ onInteractiveChange?: (interactiveStatus: boolean) => void; /** * Position of the controls on the pane * @default PanelPosition.BottomLeft * @example PanelPosition.TopLeft, PanelPosition.TopRight, * PanelPosition.BottomLeft, PanelPosition.BottomRight */ position?: PanelPosition$1; children?: ReactNode; /** Style applied to container */ style?: React.CSSProperties; /** Class name applied to container */ className?: string; /** * @default 'React Flow controls' */ 'aria-label'?: string; /** * @default 'vertical' */ orientation?: 'horizontal' | 'vertical'; }; /** * @expand */ type ControlButtonProps = ButtonHTMLAttributes; declare function ControlsComponent({ style, showZoom, showFitView, showInteractive, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position, orientation, 'aria-label': ariaLabel }: ControlProps): import("react").JSX.Element; declare namespace ControlsComponent { var displayName: string; } /** * The `` component renders a small panel that contains convenient * buttons to zoom in, zoom out, fit the view, and lock the viewport. * * @public * @example *```tsx *import { ReactFlow, Controls } from '@xyflow/react' * *export default function Flow() { * return ( * * * * ) *} *``` * * @remarks To extend or customise the controls, you can use the [``](/api-reference/components/control-button) component * */ export declare const Controls: import("react").MemoExoticComponent; /** * You can add buttons to the control panel by using the `` component * and pass it as a child to the [``](/api-reference/components/controls) component. * * @public * @example *```jsx *import { MagicWand } from '@radix-ui/react-icons' *import { ReactFlow, Controls, ControlButton } from '@xyflow/react' * *export default function Flow() { * return ( * * * alert('Something magical just happened. ✨')}> * * * * * ) *} *``` */ export declare function ControlButton({ children, className, ...rest }: ControlButtonProps): import("react").JSX.Element; type GetMiniMapNodeAttribute = (node: NodeType) => string | undefined; /** * @expand */ type MiniMapProps = Omit, 'onClick'> & { /** * Color of nodes on minimap. * @default "#e2e2e2" */ nodeColor?: string | GetMiniMapNodeAttribute; /** * Stroke color of nodes on minimap. * @default "transparent" */ nodeStrokeColor?: string | GetMiniMapNodeAttribute; /** * Class name applied to nodes on minimap. * @default "" */ nodeClassName?: string | GetMiniMapNodeAttribute; /** * Border radius of nodes on minimap. * @default 5 */ nodeBorderRadius?: number; /** * Stroke width of nodes on minimap. * @default 2 */ nodeStrokeWidth?: number; /** * A custom component to render the nodes in the minimap. This component must render an SVG * element! */ nodeComponent?: ComponentType; /** Background color of minimap. */ bgColor?: string; /** * The color of the mask that covers the portion of the minimap not currently visible in the * viewport. * @default "rgba(240, 240, 240, 0.6)" */ maskColor?: string; /** * Stroke color of mask representing viewport. * @default transparent */ maskStrokeColor?: string; /** * Stroke width of mask representing viewport. * @default 1 */ maskStrokeWidth?: number; /** * Position of minimap on pane. * @default PanelPosition.BottomRight * @example PanelPosition.TopLeft, PanelPosition.TopRight, * PanelPosition.BottomLeft, PanelPosition.BottomRight */ position?: PanelPosition$1; /** Callback called when minimap is clicked. */ onClick?: (event: MouseEvent$1, position: XYPosition$1) => void; /** Callback called when node on minimap is clicked. */ onNodeClick?: (event: MouseEvent$1, node: NodeType) => void; /** * Determines whether you can pan the viewport by dragging inside the minimap. * @default false */ pannable?: boolean; /** * Determines whether you can zoom the viewport by scrolling inside the minimap. * @default false */ zoomable?: boolean; /** * There is no text inside the minimap for a screen reader to use as an accessible name, so it's * important we provide one to make the minimap accessible. The default is sufficient, but you may * want to replace it with something more relevant to your app or product. * @default "Mini Map" */ ariaLabel?: string | null; /** Invert direction when panning the minimap viewport. */ inversePan?: boolean; /** * Step size for zooming in/out on minimap. * @default 10 */ zoomStep?: number; /** * Offset the viewport on the minimap, acts like a padding. * @default 5 */ offsetScale?: number; }; type MiniMapNodes = Pick, 'nodeColor' | 'nodeStrokeColor' | 'nodeClassName' | 'nodeBorderRadius' | 'nodeStrokeWidth' | 'nodeComponent'> & { onClick?: (event: MouseEvent$1, nodeId: string) => void; }; /** * The props that are passed to the MiniMapNode component * * @public * @expand */ type MiniMapNodeProps = { id: string; x: number; y: number; width: number; height: number; borderRadius: number; className?: string; color?: string; shapeRendering: string; strokeColor?: string; strokeWidth?: number; style?: CSSProperties; selected: boolean; onClick?: (event: MouseEvent$1, id: string) => void; }; declare function MiniMapComponent({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, offsetScale }: MiniMapProps): import("react").JSX.Element; declare namespace MiniMapComponent { var displayName: string; } /** * The `` component can be used to render an overview of your flow. It * renders each node as an SVG element and visualizes where the current viewport is * in relation to the rest of the flow. * * @public * @example * * ```jsx *import { ReactFlow, MiniMap } from '@xyflow/react'; * *export default function Flow() { * return ( * * * * ); *} *``` */ export declare const MiniMap: typeof MiniMapComponent; declare function MiniMapNodeComponent({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, selected, onClick }: MiniMapNodeProps): import("react").JSX.Element; export declare const MiniMapNode: import("react").MemoExoticComponent; /** * @expand */ type NodeResizerProps = { /** * Id of the node it is resizing. * @remarks optional if used inside custom node */ nodeId?: string; /** Color of the resize handle. */ color?: string; /** Class name applied to handle. */ handleClassName?: string; /** Style applied to handle. */ handleStyle?: CSSProperties; /** Class name applied to line. */ lineClassName?: string; /** Style applied to line. */ lineStyle?: CSSProperties; /** * Are the controls visible. * @default true */ isVisible?: boolean; /** * Minimum width of node. * @default 10 */ minWidth?: number; /** * Minimum height of node. * @default 10 */ minHeight?: number; /** * Maximum width of node. * @default Number.MAX_VALUE */ maxWidth?: number; /** * Maximum height of node. * @default Number.MAX_VALUE */ maxHeight?: number; /** * Keep aspect ratio when resizing. * @default false */ keepAspectRatio?: boolean; /** * Scale the controls with the zoom level. * @default true */ autoScale?: boolean; /** Callback to determine if node should resize. */ shouldResize?: ShouldResize$1; /** Callback called when resizing starts. */ onResizeStart?: OnResizeStart$1; /** Callback called when resizing. */ onResize?: OnResize$1; /** Callback called when resizing ends. */ onResizeEnd?: OnResizeEnd$1; }; /** * @expand */ type ResizeControlProps = Pick & { /** * Position of the control. * @example ControlPosition.TopLeft, ControlPosition.TopRight, * ControlPosition.BottomLeft, ControlPosition.BottomRight */ position?: ControlPosition$1; /** * Variant of the control. * @default "handle" * @example ResizeControlVariant.Handle, ResizeControlVariant.Line */ variant?: ResizeControlVariant$1; /** * The direction the user can resize the node. * If not provided, the user can resize in any direction. */ resizeDirection?: ResizeControlDirection; className?: string; style?: CSSProperties; children?: ReactNode; }; /** * @expand */ type ResizeControlLineProps = Omit & { position?: ControlLinePosition$1; }; /** * The `` component can be used to add a resize functionality to your * nodes. It renders draggable controls around the node to resize in all directions. * @public * * @example *```jsx *import { memo } from 'react'; *import { Handle, Position, NodeResizer } from '@xyflow/react'; * *function ResizableNode({ data }) { * return ( * <> * * *
{data.label}
* * * ); *}; * *export default memo(ResizableNode); *``` */ export declare function NodeResizer({ nodeId, isVisible, handleClassName, handleStyle, lineClassName, lineStyle, color, minWidth, minHeight, maxWidth, maxHeight, keepAspectRatio, autoScale, shouldResize, onResizeStart, onResize, onResizeEnd }: NodeResizerProps): import("react").JSX.Element | null; declare function ResizeControl({ nodeId, position, variant, className, style, children, color, minWidth, minHeight, maxWidth, maxHeight, keepAspectRatio, resizeDirection, autoScale, shouldResize, onResizeStart, onResize, onResizeEnd }: ResizeControlProps): import("react").JSX.Element; /** * To create your own resizing UI, you can use the `NodeResizeControl` component where you can pass children (such as icons). * @public * */ export declare const NodeResizeControl: import("react").MemoExoticComponent; /** * @expand */ type NodeToolbarProps = HTMLAttributes & { /** * By passing in an array of node id's you can render a single tooltip for a group or collection * of nodes. */ nodeId?: string | string[]; /** If `true`, node toolbar is visible even if node is not selected. */ isVisible?: boolean; /** * Position of the toolbar relative to the node. * @default Position.Top * @example Position.TopLeft, Position.TopRight, Position.BottomLeft, Position.BottomRight */ position?: Position$1; /** * The space between the node and the toolbar, measured in pixels. * @default 10 */ offset?: number; /** * Align the toolbar relative to the node. * @default "center" * @example Align.Start, Align.Center, Align.End */ align?: Align$1; }; /** * This component can render a toolbar or tooltip to one side of a custom node. This * toolbar doesn't scale with the viewport so that the content is always visible. * * @public * @example * ```jsx *import { memo } from 'react'; *import { Handle, Position, NodeToolbar } from '@xyflow/react'; * *function CustomNode({ data }) { * return ( * <> * * * * * * *
* {data.label} *
* * * * * ); *}; * *export default memo(CustomNode); *``` * @remarks By default, the toolbar is only visible when a node is selected. If multiple * nodes are selected it will not be visible to prevent overlapping toolbars or * clutter. You can override this behavior by setting the `isVisible` prop to `true`. */ export declare function NodeToolbar({ nodeId, children, className, style, isVisible, position, offset, align, ...rest }: NodeToolbarProps): import("react").JSX.Element | null; /** * @inline */ type EdgeToolbarProps = EdgeToolbarBaseProps & HTMLAttributes & { /** * An edge toolbar must be attached to an edge. */ edgeId: string; children?: ReactNode; }; /** * This component can render a toolbar or tooltip to one side of a custom edge. This * toolbar doesn't scale with the viewport so that the content stays the same size. * * @public * @example * ```jsx * import { EdgeToolbar, BaseEdge, getBezierPath, type EdgeProps } from "@xyflow/react"; * * export function CustomEdge({ id, data, ...props }: EdgeProps) { * const [edgePath, centerX, centerY] = getBezierPath(props); * * return ( * <> * * * * * * ); * } * ``` */ export declare function EdgeToolbar({ edgeId, isVisible, ...rest }: EdgeToolbarProps): import("react").JSX.Element | null; export declare function addEdge(edgeParams: EdgeType | Connection$1, edges: EdgeType[], options?: AddEdgeOptions): EdgeType[]; export declare function reconnectEdge(oldEdge: EdgeType, newConnection: Connection$1, edges: EdgeType[], options?: ReconnectEdgeOptions): EdgeType[]; export { type AddChange, type Align, type AriaLabelConfig, type BackgroundProps, BezierEdge, type BezierPathOptions, type Box, type ColorMode, type Connection, type ConnectionInProgress, ConnectionLineType, ConnectionMode, type ConnectionState, type ControlButtonProps, type ControlLinePosition, type ControlPosition, type ControlProps, type CoordinateExtent, type DimensionChange, type Dimensions, type EdgeChange, EdgeChangeset, type EdgeLabelRendererProps, type EdgeMarker, type EdgeMarkerType, type EdgeToolbarProps, type FinalConnectionState, type FitBounds, type FitBoundsOptions, type GetBezierPathParams, type GetMiniMapNodeAttribute, type GetSmoothStepPathParams, type GetStraightPathParams, type HandleBounds, type HandleProps, type HandleType, type KeyCode, MarkerType, type MiniMapNodeProps, type MiniMapNodes, type MiniMapProps, type NoConnection, type NodeChange, NodeChangeset, type NodeConnection, type NodeHandle, type NodeOrigin, type NodeResizerProps, type NodeToolbarProps, type OnConnect, type OnConnectEnd, type OnConnectStart, type OnConnectStartParams, type OnError, type OnMove, type OnMoveEnd, type OnMoveStart, type OnReconnect, type OnResize, type OnResizeEnd, type OnResizeStart, type OnSelectionDrag, PanOnScrollMode, type PanelPosition, type PanelProps, Position, type PositionChange, _default as ReactFlow, type Rect, type RemoveChange, type ReplaceChange, type ResizeControlLineProps, type ResizeControlProps, ResizeControlVariant, type ResizeDragEvent, type ResizeParams, type ResizeParamsWithDirection, type SelectionChange, SelectionMode, type SelectionRect, type SetCenter, type SetCenterOptions, type SetViewport, type ShouldResize, SimpleBezierEdge, SmoothStepEdge, type SmoothStepPathOptions, type SnapGrid, StepEdge, StraightEdge, type Transform, type UseNodeConnectionsParams, type UseNodesInitializedOptions, type UseOnSelectionChangeOptions, type UseOnViewportChangeOptions, type Viewport, type ViewportHelperFunctionOptions, type XYPosition, type XYZPosition, type ZIndexMode, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, useOptionsStore, useReactFlowStoreApi }; //# sourceMappingURL=index.d.ts.map