Skip to content
D
Documentation

Layout — types

reference
2 min readUpdated

Types

Import these from @grafloria/engine.

Types

CompoundAlgorithm

Also has every member of String, listed on its own entry.

Any registered layout name, or the built-in grid.

ts
type CompoundAlgorithm = 'grid' | 'dagre' | 'elk' | (string & {});

ConstraintType

Also has every member of String, listed on its own entry.

Types of layout constraints that can be applied to nodes

ts
type ConstraintType = 'pin' | 'fix-x' | 'fix-y' | 'boundary';

EdgeBundlingStrategy

Also has every member of String, listed on its own entry.

Bundling strategy

ts
type EdgeBundlingStrategy = 'stub' | 'force-directed' | 'hierarchical' | 'none';

ELKAlgorithm

Also has every member of String, listed on its own entry.

ELK layout algorithms

ts
type ELKAlgorithm =
  | 'layered'
  | 'force'
  | 'stress'
  | 'mrtree'
  | 'radial'
  | 'disco';

ElkPortConstraint

Also has every member of String, listed on its own entry.

ts
type ElkPortConstraint = 'FREE' | 'FIXED_SIDE' | 'FIXED_ORDER' | 'FIXED_POS';

ElkPortSide

Also has every member of String, listed on its own entry.

ELK's compass vocabulary for a port side.

ts
type ElkPortSide = 'NORTH' | 'EAST' | 'SOUTH' | 'WEST';

FlowDirection

Also has every member of String, listed on its own entry.

ts
type FlowDirection = 'TB' | 'BT' | 'LR' | 'RL';

GraphLayoutFn

The contract a layout must satisfy to be packable: nodes + links in, positions out. Deliberately array-based (not DiagramModel-based) — a component is a SUBSET of a diagram, and there is no such thing as a sub-DiagramModel.

ts
type GraphLayoutFn = (
  nodes: NodeModel[],
  links: LinkModel[],
  options: UnifiedLayoutOptions
) => Promise<LayoutResult> | LayoutResult;

IncrementalLayoutStrategy

Also has every member of String, listed on its own entry.

Strategy for incremental layout

ts
type IncrementalLayoutStrategy =
  | 'pin-existing'
  | 'fix-anchors'
  | 'proximity-aware'
  | 'minimal-shift';

LayoutAlgorithmType

Also has every member of String, listed on its own entry.

Layout algorithm types

ts
type LayoutAlgorithmType = 'grid' | 'force-directed' | 'hierarchical' | 'hybrid';

LayoutEventType

Also has every member of String, listed on its own entry.

Layout event types

ts
type LayoutEventType =
  | 'layout:started'
  | 'layout:completed'
  | 'layout:failed'
  | 'layout:algorithm-changed'
  | 'layout:node-placed';

LayoutMode

Also has every member of String, listed on its own entry.

Layout mode for automatic vs manual positioning

ts
type LayoutMode = 'auto' | 'manual';

LayoutRequest

Also has every member of LayoutRequestRun, listed on its own entry.

ts
type LayoutRequest = LayoutRequestRun | LayoutRequestCancel;

LayoutResponse

Also has every member of LayoutProgressMessage, listed on its own entry.

ts
type LayoutResponse =
  | LayoutProgressMessage
  | LayoutResultMessage
  | LayoutErrorMessage;

LayoutStopReason

Also has every member of String, listed on its own entry.

Why a run stopped early. Absent when it ran to completion.

ts
type LayoutStopReason = 'cancelled' | 'timeout' | 'iteration-cap';

LayoutWireOptions

Also has every member of LayoutOptions, listed on its own entry.

Options as they cross the wire: the named ones, plus whatever adapter-specific knobs the caller supplied (iterations, repulsion, rankdir, …). Anything here must be structured-clone-safe — stripNonClonable enforces that at the seam rather than trusting callers to.

ts
type LayoutWireOptions = Partial<LayoutOptions> & Record<string, unknown>;

PortConstraintMode

Also has every member of String, listed on its own entry.

How much freedom does the layout engine have over this node's ports?

FREE — no declared ports: put the edge wherever it routes best. FIXED_SIDE — the author said which side; the engine may still reorder within that side to reduce crossings. FIXED_ORDER — side AND order are the author's. FIXED_POS — the exact coordinates are the author's.

'auto' (the default) resolves per node: FIXED_SIDE when the node declares ports, FREE when it does not. That is what makes port-awareness safe to leave ON — it constrains only the nodes whose author asked for it.

ts
type PortConstraintMode = 'auto' | 'free' | 'fixed-side' | 'fixed-order' | 'fixed-pos';

PortFlowDirection

Also has every member of String, listed on its own entry.

Port direction (input or output)

ts
type PortFlowDirection = 'input' | 'output' | 'bidirectional';

PortSide

Also has every member of String, listed on its own entry.

Port side relative to node

ts
type PortSide = 'left' | 'right' | 'top' | 'bottom';

Was this page helpful?

Layout — types — Grafloria