Skip to content

React Flow adapter

Import these helpers from ego-graph/react-flow:

Export Purpose
DEFAULT_NODE_SIZE The { width: 180, height: 56 } fallback
measuredSize(node, fallback?) Reads measured dimensions, then width/height, then fallback
toLayoutGraph(nodes, edges, root, fallback?) Produces the minimal graph contract while preserving extra fields
applyPositions(nodes, positions) Copies computed top-left positions into nodes
retargetHandles(nodes, edges, mapper?, fallback?) Retargets each edge to the handles facing its counterpart
defaultHandleId(side, kind) Maps target sides to t/r/b/l, sources to st/sr/sb/sl

applyPositions preserves a node when no new position exists. retargetHandles likewise returns an unchanged edge by identity when its handle IDs are already correct.