Raxol.UI.Layout.Engine (Raxol v0.3.0)
View SourceCore layout engine that translates the logical view structure into absolute positions.
This module is responsible for:
- Calculating element positions based on available space
- Resolving layout constraints
- Managing the layout pipeline
Summary
Functions
Applies layout to a view, calculating absolute positions for all elements.
Calculates the intrinsic dimensions (width, height) of an element.
Functions
Applies layout to a view, calculating absolute positions for all elements.
Parameters
view
- The view to calculate layout fordimensions
- Terminal dimensions%{width: w, height: h}
Returns
A list of positioned elements with absolute coordinates.
Calculates the intrinsic dimensions (width, height) of an element.
This function determines the natural size of an element before layout constraints are applied. For containers, it might recursively measure children.
Parameters
element
- The element map to measure.available_space
- Map providing context (e.g., max width).
- Defaults to an empty map.
Returns
A map representing the dimensions: %{width: integer(), height: integer()}
.