Skip to content
D
Documentation

FlowBox

reference
1 min readUpdated

Import it from @grafloria/engine.

FLOW LAYOUT — the tidy layout a step-by-step flow (a workflow, a chatbot, an automation) wants, and which a general layered layout does not give it.

Two things a layered layout gets wrong for a flow:

  • It reads node→node edges and ignores PORTS, so a step's true branch can land below its false branch and a Switch's outputs come out in any order. Here every edge carries order — its source port's rank down that step's side (the caller measures it) — and children are laid out in that order.
  • It re-lays the whole graph. placeFlowNodes places only the NEW nodes, beside their parent in their port's slot, and leaves everything else where the user put it.

Pure geometry: boxes in, positions out. Nothing here touches a model.

flowLayout (a whole-flow tidy) is a tidy tree over the flow's spanning tree (each node under the first step that reaches it, children in port order), with the main axis set by the longest path — so a merge sits to the right of every branch that feeds it — and the cross axis by the tree: every child keeps its own band, so nothing overlaps. Cycles are fine (back edges are ignored for placement). Fixed boxes (notes, groups, anything the caller pins) are kept clear: a flow block that would run over one moves past it.

ts
interface FlowBox

Properties

NameTypeDefaultDescription
idstring
widthnumber
heightnumber
x?numberCurrent position (top-left), when it has one.
y?number

Was this page helpful?