import { Rect as AvoidArea } from '@xyflow/react'; import { BezierEdgeProps } from '@xyflow/react'; import { ComponentType } from 'react'; import { ConnectionLineComponentProps } from '@xyflow/react'; import { CSSProperties } from 'react'; import { Edge } from '@xyflow/react'; import { EdgeLabelOptions } from '@xyflow/react'; import { EdgePosition } from '@xyflow/system'; import { EdgeProps } from '@xyflow/react'; import { EdgeTypes } from '@xyflow/react'; import { JSX } from 'react'; import { MemoExoticComponent } from 'react'; import { Node as Node_2 } from '@xyflow/react'; import { Position } from '@xyflow/react'; import { ReactNode } from 'react'; import { SimpleBezierEdgeProps } from '@xyflow/react'; import { SmoothStepEdgeProps } from '@xyflow/react'; import { StepEdgeProps } from '@xyflow/react'; import { StraightEdgeProps } from '@xyflow/react'; import { XYPosition } from '@xyflow/react'; export { AvoidArea } /** Blocks every cell in `[columnStart, columnEnd) × [rowStart, rowEnd)`, clamped to bounds. */ export declare const blockCellRange: (grid: FlatGrid, columnStart: number, rowStart: number, columnEnd: number, rowEnd: number) => void; export declare const cloneFlatGrid: (grid: FlatGrid) => FlatGrid; export declare type ConfigureSmartEdgeOptions = Partial; /** * A single waypoint of an editable smart edge. Stored (active) points live in * `edge.data.points`; inactive points are computed on the fly for adding new * waypoints and are not persisted. */ export declare type ControlPointData = XYPosition & { id: string; active?: boolean; }; export declare const createFlatGrid: (width: number, height: number) => FlatGrid; export declare function createSmartEdge(preset: SmartEdgePreset, options?: ConfigureSmartEdgeOptions): SmartEdgeComponent; /** * A `Position`-shaped string union. `Position`'s enum values are exactly * these strings, so working in plain strings here (and letting real * `Position` values widen into this type at call sites) avoids importing the * `@xyflow/react` runtime — this module must stay reachable from the routing * Web Worker. Exported so `createGrid.ts`'s `PointInfo` can reuse it. */ export declare type Direction = "top" | "bottom" | "left" | "right"; declare type Direction_2 = "top" | "bottom" | "left" | "right"; /** Options for `isDirectPathBlocked`. */ declare interface DirectPathOptions { nodePadding?: number; avoidAreas?: AvoidArea[]; excludeNodeIds?: string[]; } /** Values accepted by {@link GetSmartEdgeOptions.drawEdge}. */ export declare type DrawEdgeFunction = SVGDrawFunction | SVGSimpleBezierDrawFunction; /** * `sourceX`/`sourceY`/`targetX`/`targetY` come straight from React Flow's * `EdgeProps`. `sourcePosition`/`targetPosition` are widened from `EdgeProps`' * nominal `Position` enum to the plain `Direction` string union, so callers * that only have a synthetic handle side (no real `Position`, e.g. waypoint * routing's `sideFacing`) can supply one too. Every real `Position` value is * still assignable here, so this is non-breaking for existing callers. */ declare type EdgeParams = Pick & { sourcePosition: Direction; targetPosition: Direction; }; /** * Source/target points carry both their graph coordinates and the side of the * node they are attached to (top/bottom/left/right). */ export declare interface EndpointInfo extends XYPosition { position: Direction_2; } /** * Flat typed-array obstacle grid: the v5 replacement for the object-based * PathFinding.js grid. One byte per cell, indexed `y * width + x`, so building * and cloning are single allocations and pathfinding touches no heap objects. */ export declare interface FlatGrid { width: number; height: number; /** `1` = blocked, `0` = walkable; index = `y * width + x`. */ blocked: Uint8Array; } /** * The dynamic connection parameters for a floating edge: the source/target * intersection coordinates on each node's border, plus the side (position) of * the node those points sit on. */ export declare interface FloatingEdgeParams { sx: number; sy: number; tx: number; ty: number; sourcePos: Position; targetPos: Position; } /** * Returns the side of `node` (top/right/bottom/left) that `intersectionPoint` * sits on, used as the handle position fed into the pathfinding pipeline. */ export declare const getEdgePosition: (node: Node_2, intersectionPoint: XYPosition) => Position; /** * Computes the floating connection parameters between two nodes: the points * where the edge meets each node's border and the corresponding sides. Feed the * result into {@link getSmartEdge} to route a floating edge around obstacles. * * Both nodes are expected to carry absolute `position` coordinates (resolve any * subflow offsets with `getAbsoluteNodes` first) and `measured` dimensions. */ export declare const getFloatingEdgeParams: (sourceNode: Node_2, targetNode: Node_2) => FloatingEdgeParams; /** * Returns the point where the straight line between the centers of * `intersectionNode` and `otherNode` crosses the border of `intersectionNode`. * * Ported from React Flow's Floating Edges example * (https://reactflow.dev/examples/edges/floating-edges), adapted to this * library's `Node` shape (`measured` dimensions + absolute `position`). */ export declare const getNodeIntersection: (intersectionNode: Node_2, otherNode: Node_2) => XYPosition; export declare const getSmartEdge: = Record>({ options, nodes, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }: GetSmartEdgeParams) => GetSmartEdgeReturn | Error; export declare interface GetSmartEdgeOptions { gridRatio?: number; nodePadding?: number; drawEdge?: DrawEdgeFunction; generatePath?: PathFindingFunction; /** * Extra rectangular areas (in graph coordinates) the path should route * around, in addition to the nodes. Useful for keeping edges clear of edge * labels or any other arbitrary regions. Each area uses the same * `nodePadding` clearance as nodes. */ avoidAreas?: AvoidArea[]; } declare type GetSmartEdgeParams = Record> = EdgeParams & { options?: GetSmartEdgeOptions; nodes: Node_2[]; }; declare interface GetSmartEdgeReturn { svgPathString: string; edgeCenterX: number; edgeCenterY: number; /** * The sequence of graph-coordinate points that make up the routed path * (after endpoint alignment), excluding the source/target handle points. * Used by waypoint routing to stitch multiple segments into a single edge. */ points: number[][]; /** * Always `true` for a result produced by this synchronous routing pass. * The provider's `SmartEdgeRouteResult` uses `wasRouted: false` on its * `"clear"` variant (native path, no A*). Pending provider routes are * `null` from `useSmartEdgePath`, not a `wasRouted: false` placeholder. */ wasRouted: true; } /** * Routes a smart edge that passes through a set of user-defined waypoints. * * Each consecutive pair in `[source, ...waypoints, target]` is routed * independently with {@link getSmartEdge} (so every segment still avoids * nodes), then the resulting point lists are stitched together and drawn as a * single continuous SVG path. Free waypoint endpoints are given a synthetic * handle position derived from the travel direction. * * If an individual segment fails to route (for example a waypoint dropped * inside a node), that segment degrades to a straight line between its * endpoints instead of blanking the whole edge. */ export declare const getSmartEdgeWaypoints: = Record>(params: GetSmartEdgeWaypointsParams) => GetSmartEdgeReturn | Error; export declare type GetSmartEdgeWaypointsParams = Record> = GetSmartEdgeParams & { /** * Intermediate points (in graph coordinates) the edge must pass through, in * order from source to target. With no waypoints this behaves exactly like * {@link getSmartEdge}. */ waypoints: XYPosition[]; }; /** * Configuration for circuit-style "hops": small bridge arcs drawn where a * smart edge crosses another orthogonal smart edge rendered beneath it. */ export declare interface HopOptions { /** Radius of the bridge arc drawn at each crossing. Default `6`. */ radius?: number; /** * Corner rounding radius applied to the whole edge while hops are active. * `0` (default) keeps sharp step corners; a positive value gives a * smooth-step look. For smooth-step edges set this to match your border * radius (React Flow's default is `5`). */ borderRadius?: number; /** Axis-alignment / crossing tolerance in pixels. Default `0.5`. */ epsilon?: number; } /** * Public utility: does a straight line between `source` and `target` cross * any padded node (or `avoidAreas`)? Useful for skipping path-finding * entirely when a direct line is already clear. `excludeNodeIds` should * typically include the edge's own source/target node ids, since a handle * point normally sits inside its own node's padded box. */ export declare const isDirectPathBlocked: (source: XYPosition, target: XYPosition, nodes: Node_2[], options?: DirectPathOptions) => boolean; export declare const isInside: (grid: FlatGrid, column: number, row: number) => boolean; export declare const isWalkable: (grid: FlatGrid, column: number, row: number) => boolean; /** A padded, axis-aligned obstacle rectangle in graph coordinates. */ export declare interface ObstacleBox { id: string; xMin: number; yMin: number; xMax: number; yMax: number; } export declare const pathfindingAStarDiagonal: PathFindingFunction; export declare const pathfindingAStarNoDiagonal: PathFindingFunction; /** * Takes source and target {x, y} points, together with a flat grid * representation of the graph, and returns an array of number tuples [x, y], * representing the full path from source to target. */ export declare type PathFindingFunction = (grid: FlatGrid, start: XYPosition, end: XYPosition) => number[][]; export declare const pathfindingJumpPointNoDiagonal: PathFindingFunction; /** One edge registered with the scheduler: everything a routing batch needs, * plus its registration order (hop paint order, a later task). */ export declare interface RegisteredSmartEdge extends SmartEdgeBatchItem { order: number; } /** * Every option a `SmartEdgeProvider` resolves from its props: the scheduler's * routing-decision fields (inherited from `SchedulerOptions`, declared once in * `scheduler.ts`) plus the presentation fields the provider itself owns * (preset, corner radius, drag placeholder style). Extending rather than * redeclaring the shared fields keeps them in exactly one place while this * type still satisfies `SchedulerDeps["options"]` structurally, with no cast. */ export declare interface ResolvedProviderOptions extends ResolvedProviderOptions_2 { preset: SmartEdgePreset; /** Corner radius for the `smoothstep` preset. */ borderRadius?: number; /** Extra style merged onto a smart edge's native path while the route is * pending or an endpoint is being dragged. Drag uses a * `react-flow__edge animated` wrapper; pending uses a static dash. */ dragFallbackStyle: CSSProperties; } /** The scheduling/routing options a provider resolves from its props (a * later task). Declared locally so this module has no dependency on that * provider; any structurally compatible object works here. */ declare interface ResolvedProviderOptions_2 { routeOnlyWhenBlocked: boolean; routeWhileDragging: boolean; debounceMs: number; nodePadding: number; gridRatio: number; avoidAreas: AvoidArea[]; cacheSize: number; } /** * Routes many smart edges against a shared node set in one pass. This is the * pure core used both inside the Web Worker and as the main-thread fallback, * so it must not depend on the DOM or React. Nodes resolve to absolute * (subflow-aware) coordinates once for the whole batch; each edge then * excludes its own ancestor containers from the obstacle set, resolves its * preset to the matching `drawEdge`/`generatePath`, and routes through * `getSmartEdgeWaypoints` when it carries waypoints or plain `getSmartEdge` * otherwise. Edges that fail to route are omitted so the edge component keeps * rendering its fallback. */ export declare const routeSmartEdgeBatch: (nodes: Node_2[], edges: SmartEdgeBatchItem[]) => Record; /** Out-of-bounds writes are silently ignored, like the old `setWalkableAt`. */ export declare const setBlocked: (grid: FlatGrid, column: number, row: number, blocked: boolean) => void; export declare const SmartBezierEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare const SmartCheckpointEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; /** * The `edge.data` shape consumed by checkpoint smart edges: the ordered list * of fixed graph-coordinate points the edge is routed through. */ export declare interface SmartCheckpointEdgeData extends Record { checkpoints?: XYPosition[]; } /** * Routes an edge through the nearest `SmartEdgeProvider` and renders its path, * falling back to the preset's native edge whenever routing is unavailable * (no provider), pending, deferred (an endpoint is dragging and * `routeWhileDragging` is off), or the corridor is clear (unless hops are * enabled on a step/smooth-step edge, in which case the native skeleton is * still drawn so crossings can bridge). * * Requires a `SmartEdgeProvider` ancestor to route; without one it warns once * (in development) and renders the fallback edge. Custom `drawEdge` / * `generatePath` functions passed via `options` are ignored here — the * provider resolves those from `preset` — and remain available only through * the synchronous `getSmartEdge` API. */ export declare function SmartEdge({ preset, options, ...edgeProps }: Readonly>): JSX.Element; /** * One edge to route, with endpoints already resolved on the main thread and * everything else stripped to structured-clone-safe data (no functions), so * the whole batch can cross the `postMessage` boundary to the routing worker. */ export declare interface SmartEdgeBatchItem { id: string; source: string; target: string; sourceX: number; sourceY: number; targetX: number; targetY: number; sourcePosition: Position; targetPosition: Position; preset: SmartEdgePreset; options?: SmartEdgeBatchItemOptions; /** * Intermediate points (in graph coordinates) the edge must pass through, * in order from source to target. Routes through `getSmartEdgeWaypoints` * instead of plain `getSmartEdge` when present and non-empty. */ waypoints?: XYPosition[]; } /** * The subset of `GetSmartEdgeOptions` that can be sent to the routing Web * Worker. Function options (`drawEdge`/`generatePath`) are excluded because * functions cannot cross the `postMessage` boundary; the worker resolves * those from the edge's `preset` instead. */ declare interface SmartEdgeBatchItemOptions { gridRatio?: number; nodePadding?: number; avoidAreas?: AvoidArea[]; /** Corner radius for the `smoothstep` preset. */ borderRadius?: number; } declare type SmartEdgeComponent = EdgeTypes[string]; /** What `SmartEdgeProvider` exposes to descendants through React context. */ export declare interface SmartEdgeContextValue { store: SmartEdgeStore; /** An immutable snapshot of the resolved provider options. The provider * mutates its live options object in place (the scheduler closes over * that reference) and publishes a fresh snapshot on every applied change, * so the identity of this object tracks option value changes exactly. */ options: ResolvedProviderOptions; /** Registers one edge's routing geometry, assigning it the next * registration order. Returns an unregister function. */ registerEdge: (edge: Omit) => () => void; /** Every currently registered edge, in registration (paint) order — used * to place hop arcs where edges cross (a later task). */ getRegistrationsInOrder: () => RegisteredSmartEdge[]; /** The latest `nodes` prop, resolved to absolute (subflow-aware) * coordinates — used by floating edges (a later task). */ getNodesSnapshot: () => Node_2[]; } /** Aggregate counters for one completed flush, reported via `onMetrics`. */ export declare interface SmartEdgeMetrics { batchId: number; executedOn: "worker" | "main"; batchLatencyMs: number; /** Time spent running the batch on the main thread. `0` when the batch * ran on the worker, and `0` when the flush dispatched no edges. */ mainThreadBlockingMs: number; routed: number; cacheHits: number; clear: number; deferred: number; unchanged: number; } export declare type SmartEdgeOptions = GetSmartEdgeOptions & { fallback?: ComponentType>; /** * When enabled, the edge's source/target connection points are computed * dynamically from node geometry (the nearest border facing the other node) * instead of using the fixed handle positions, mirroring React Flow's * floating edges. See https://github.com/tisoap/react-flow-smart-edge/issues/13 */ floating?: boolean; /** * When enabled, the edge renders draggable control points (waypoints) that * the path is routed through, still avoiding nodes between each waypoint. * Waypoints are read from and persisted to `edge.data.points`; the consumer * owns persistence via React Flow's edge state. Click an inactive point to * add a waypoint, drag to move, right-click or press Delete to remove. * See https://github.com/tisoap/react-flow-smart-edge/issues/36 */ editable?: boolean; /** * When enabled, the edge is routed through fixed waypoints read from * `edge.data.checkpoints` without rendering draggable control points. Each * segment still uses pathfinding. Ignored when `editable` is also `true`. */ checkpoints?: boolean; /** * Color used to render the editable control points. Defaults to a blue. */ controlPointColor?: string; /** * Corner radius for the `smoothstep` preset. Serializable, so unlike a custom * `drawEdge` it survives the provider's routing pipeline to the worker. */ borderRadius?: number; /** * Circuit-style "hops": where this edge crosses another smart edge of the * same `type` rendered beneath it, draw a small bridge arc over the crossing * so intersecting wires read cleanly (like a schematic). Only the step and * smooth-step variants are orthogonal enough for this; it is ignored on * editable/checkpoint edges. Pass `true` for defaults or a {@link HopOptions} * object to tune the arc radius, corner rounding, and tolerance. * See https://github.com/tisoap/react-flow-smart-edge/issues/61 */ hops?: boolean | HopOptions; }; export declare type SmartEdgePreset = keyof typeof smartEdgePresets; export declare const smartEdgePresets: { readonly bezier: { readonly drawEdge: SVGDrawFunction; readonly generatePath: PathFindingFunction; readonly fallback: MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, pathOptions, interactionWidth, }: BezierEdgeProps) => JSX.Element>; }; readonly straight: { readonly drawEdge: SVGDrawFunction; readonly generatePath: PathFindingFunction; readonly fallback: MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth, }: StraightEdgeProps) => JSX.Element>; }; readonly step: { readonly drawEdge: SVGDrawFunction; readonly generatePath: PathFindingFunction; readonly fallback: MemoExoticComponent<({ id, ...props }: StepEdgeProps) => JSX.Element>; }; readonly smoothstep: { readonly drawEdge: SVGDrawFunction; readonly generatePath: PathFindingFunction; readonly fallback: MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, sourcePosition, targetPosition, markerEnd, markerStart, pathOptions, interactionWidth, }: SmoothStepEdgeProps) => JSX.Element>; }; readonly simplebezier: { readonly drawEdge: SVGSimpleBezierDrawFunction; readonly generatePath: PathFindingFunction; readonly fallback: MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth, }: SimpleBezierEdgeProps) => JSX.Element>; }; }; declare interface SmartEdgeProps extends EdgeProps { /** Which preset (`bezier`, `step`, …) resolves this edge's draw/pathfinding * on the routing side. Set for you by `createSmartEdge`. */ preset: SmartEdgePreset; options: SmartEdgeOptions; } /** * Owns one `SmartEdgeStore`, one `RoutingScheduler`, and one inline routing * Web Worker for its lifetime, exposing them to descendants through * `SmartEdgeRoutingContext`. Falls back to synchronous main-thread routing * whenever `Worker` is unavailable, its construction throws, or it reports a * runtime error — edges keep routing either way. The `nodes` prop drives both * the scheduler's obstacle/drag state and `getNodesSnapshot` (absolute, * subflow-resolved coordinates for floating edges). */ export declare function SmartEdgeProvider({ nodes, options, onMetrics, children, }: Readonly): JSX.Element; /** Provider-facing options: every field of `ResolvedProviderOptions` is * optional, defaulted by `resolveProviderOptions`. */ export declare type SmartEdgeProviderOptions = Partial; export declare interface SmartEdgeProviderProps { /** All flow nodes (controlled pattern). Used as routing obstacles and as * the source of drag/selection state. */ nodes: Node_2[]; options?: SmartEdgeProviderOptions; onMetrics?: (metrics: SmartEdgeMetrics) => void; children: ReactNode; } /** * One edge's routing outcome as tracked by the provider store. `"routed"` * carries a full `getSmartEdge` result; `"clear"` tells the edge component * to render its native (non-smart) path locally instead, e.g. while an * async route is still pending or after routing failed. */ export declare type SmartEdgeRouteResult = ({ kind: "routed"; wasRouted: true; } & GetSmartEdgeReturn) | { kind: "clear"; wasRouted: false; }; /** * Keyed external store for smart-edge routes plus graph-wide node * drag/selection state, shaped for `useSyncExternalStore`: every getter * returns a stable reference until the slice it reads actually changes, so * React can skip re-rendering subscribers whose data was untouched. */ declare interface SmartEdgeStore { /** Subscribes to changes for one edge's route. Returns an unsubscribe * function. */ subscribeEdge(edgeId: string, listener: () => void): () => void; /** The edge's current route, or `undefined` if none has been set (or it * was removed). Stable by reference until that edge's route changes. */ getRoute(edgeId: string): SmartEdgeRouteResult | undefined; /** Applies a batch of route updates, notifying only the listeners of ids * whose stored value reference actually changed. */ mergeRoutes(patch: Record): void; /** Deletes the stored route for each id and notifies its listeners (who * will then read `undefined` from `getRoute`). */ removeRoutes(edgeIds: string[]): void; /** Subscribes to every route change: any `mergeRoutes`/`removeRoutes` call * that actually changed at least one stored route. Coarser than * `subscribeEdge` (fires for any edge's change, not just one id) — used by * consumers that need to react to a neighbor's route without tracking * every neighbor individually (e.g. hop bridges). Returns an unsubscribe * function. */ subscribeAllRoutes(listener: () => void): () => void; /** A counter incremented once per actual route change (any id). Read * through `useSyncExternalStore` alongside `subscribeAllRoutes`: a bare * number is trivially stable-by-value, so snapshots never need a custom * equality check. */ getRoutesVersion(): number; /** Subscribes to changes in dragging/selected node state. Returns an * unsubscribe function. */ subscribeNodeState(listener: () => void): () => void; /** The current set of dragging node ids. Stable by reference until the * set's contents change. */ getDraggingNodeIds(): ReadonlySet; /** The current set of selected node ids. Stable by reference until the * set's contents change. */ getSelectedNodeIds(): ReadonlySet; /** Replaces the dragging/selected node sets, notifying node-state * listeners only if either set's contents actually changed. */ setNodeState(dragging: Set, selected: Set): void; } export declare const SmartEditableEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; /** * The `edge.data` shape consumed by editable smart edges: the ordered list of * active waypoints the edge is routed through. */ export declare interface SmartEditableEdgeData extends Record { points?: ControlPointData[]; } /** * A connection line component (for React Flow's `connectionLineComponent` prop) * that previews a smart, obstacle-avoiding floating edge while the user drags a * new connection. The source point is derived from the origin node's geometry * (floating), the target follows the cursor, and the line is routed with the * same pathfinding as {@link SmartFloatingEdge}. * * Falls back to a straight preview line when no valid smart path can be found. */ export declare function SmartFloatingConnectionLine({ fromNode, toX, toY, toPosition, connectionLineStyle, options, }: Readonly): JSX.Element; export declare type SmartFloatingConnectionLineProps = ConnectionLineComponentProps & { options?: GetSmartEdgeOptions; }; export declare const SmartFloatingEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare const SmartSimpleBezierEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare const SmartSmoothStepEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare const SmartStepEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare const SmartStraightEdge: ComponentType, string | undefined>, "id" | "type" | "data" | "selected" | "selectable" | "deletable" | "style" | "animated" | "source" | "target"> & EdgePosition & EdgeLabelOptions & { sourceHandleId?: string | null; targetHandleId?: string | null; markerStart?: string; markerEnd?: string; pathOptions?: any; interactionWidth?: number; } & { data: any; type: any; }>; export declare interface SmoothStepOptions { borderRadius?: number; } /** * Takes source and target `{x, y}` points, together with an array of number * tuples `[x, y]` representing the points along the path, and returns a string * to be used as the SVG path. */ export declare type SVGDrawFunction = (source: XYPosition, target: XYPosition, path: number[][]) => string; /** * Draws an SVG path using chained cubic bezier segments with handle-position * controls, mirroring React Flow's SimpleBezierEdge. */ export declare const svgDrawSimpleBezierLinePath: SVGSimpleBezierDrawFunction; /** * Draws a SVG path from a list of points, using rounded lines. */ export declare const svgDrawSmoothLinePath: SVGDrawFunction; /** * Returns a {@link SVGDrawFunction} that draws an orthogonal ("step") path with * rounded corners, mirroring React Flow's smooth step edge. The `borderRadius` * controls how much each corner is rounded (default `5`, matching React Flow); * it is clamped per-corner to half of the adjacent segment lengths so tight * grid corners never overshoot. * * Adapted from https://gist.github.com/holgergp/b95396f8e81abb17add1809c404b163c */ export declare const svgDrawSmoothStepLinePath: (options?: SmoothStepOptions) => SVGDrawFunction; /** * Draws a SVG path from a list of points, using straight lines. */ export declare const svgDrawStraightLinePath: SVGDrawFunction; /** * Like {@link SVGDrawFunction}, but requires handle positions on the endpoints * so cubic control points can mirror React Flow's `SimpleBezierEdge`. */ export declare type SVGSimpleBezierDrawFunction = (source: EndpointInfo, target: EndpointInfo, path: number[][]) => string; /** * Registers one edge's routing geometry with the nearest `SmartEdgeProvider` * and subscribes to that edge's routed path and drag state. * * Mechanics mirror the 4.x `useSmartEdgeRoute`: building the registration * object is cheap, so it happens on every render, but a JSON signature of * that object gates the registration effect, so `registerEdge` only runs * again when the edge's routable geometry actually changed — not on every * unrelated re-render. The latest registration is kept in a ref (written in * its own effect, never during render) so the signature-gated effect can * read the current value without needing the object itself — which is * a fresh reference every render — in its dependency array. * * Every hook runs unconditionally, provider or not: outside a * `SmartEdgeProvider` this resolves to inert subscriptions and * `{ route: null, isDragging: false, hasProvider: false }`, which is also * exactly what a server render (no context, no DOM) produces. */ export declare const useSmartEdgePath: (input: UseSmartEdgePathInput) => UseSmartEdgePathResult; /** Everything an edge component needs to hand `useSmartEdgePath` to register * its routing geometry and read back its route. Mirrors `SmartEdgeBatchItem` * (Task 10) minus `preset`, which is optional here and defaults to the * nearest `SmartEdgeProvider`'s configured preset. */ export declare interface UseSmartEdgePathInput { id: string; source: string; target: string; sourceX: number; sourceY: number; targetX: number; targetY: number; sourcePosition: Position; targetPosition: Position; /** Defaults to the nearest `SmartEdgeProvider`'s `options.preset`. */ preset?: SmartEdgePreset; /** Per-edge routing overrides (grid ratio, padding, avoid areas, corner * radius). */ options?: NonNullable; waypoints?: XYPosition[]; } export declare interface UseSmartEdgePathResult { /** `null` while the route is still pending (or when there is no * provider). */ route: SmartEdgeRouteResult | null; /** True when this edge's source or target node is being dragged. */ isDragging: boolean; /** False outside a `SmartEdgeProvider`; every other field is then inert. */ hasProvider: boolean; } export { XYPosition } export { }