LiveFlow.Layout (LiveFlow v0.4.0)

Copy Markdown View Source

Helpers for preparing flow data for client-side auto-layout (ELK).

Summary

Functions

Prepares serializable layout data from the current flow state.

Prepares serializable layout data for the client-side tree layout algorithm.

Functions

prepare_layout_data(flow, opts \\ %{})

@spec prepare_layout_data(LiveFlow.State.t(), map()) :: map()

Prepares serializable layout data from the current flow state.

Returns a map with nodes (list of id/width/height maps) and edges (list of id/source/target maps) suitable for sending to the client-side ELK layout engine via push_event.

prepare_tree_layout_data(flow, opts \\ %{})

@spec prepare_tree_layout_data(LiveFlow.State.t(), map()) :: map()

Prepares serializable layout data for the client-side tree layout algorithm.

Similar to prepare_layout_data/2 but outputs options compatible with the pure JS tree layout engine (direction: TB/LR, nodeSpacing, levelSpacing).