import { Edge, Node } from '@xyflow/react'; import { FlowDirection } from '../tokens'; /** * Pure dagre auto-layout for the Flow Builder canvas. * * Mirrors CJO's `getDagreLayout` (`builder/dagreLayout.ts`) — same measured-size-first * behaviour and the same dagre-center → React-Flow-top-left coordinate conversion — * but consumes this package's own `00`-owned tokens instead of CJO's local literals * (`NODE_WIDTH = 240`, `nodesep: 64`, `ranksep: 96`), and runs on the maintained * `@dagrejs/dagre` fork rather than the unmaintained `dagre` CJO depends on. * * Deliberately a pure function, not canvas-internal behaviour: it never mutates * `nodes` and the canvas never calls it implicitly. A consumer calls it explicitly * (e.g. from an "Auto Layout" button, or a layout-direction toggle) and applies the * returned positions to its own controlled `nodes` state — this keeps `` * a purely controlled component with no layout side effects of its own. * * @param nodes - Current nodes. Each node's real rendered size * (`node.measured?.width`/`height`) is preferred; falls back to * `FLOW_NODE_WIDTH`/`FLOW_NODE_MIN_HEIGHT` for anything not yet measured * (first paint, off-screen, freshly added). * @param edges - Current edges. An edge whose `source`/`target` is not present in * `nodes` is skipped rather than thrown on. * @param direction - Dagre `rankdir`. @default 'LR' * @returns A map of node id → top-left `{ x, y }` position, ready to spread onto * each node (`{ ...node, position: positions[node.id] }`). Nodes dagre could not * place (e.g. it failed internally) are simply absent from the map — callers * should fall back to the node's existing position for any id not present. */ export declare function getFlowLayout(nodes: Node[], edges: Edge[], direction?: FlowDirection): Record;