Skip to main content

Module flex

Module flex 

Source
Expand description

Constrained flex layout engine supporting single-line and multi-line wrapping.

Provides:

  • Single-line flex layout (FlexDirection::Row, Column, RowReverse, ColumnReverse).
  • Multi-line flex wrapping (FlexWrap::Wrap, FlexWrap::WrapReverse, FIX-WRP-001, FIX-WRP-002, FIX-WRP-003).
  • Line formation with strict fractional breakpoint handling (FIX-WRP-005).
  • Cross-axis line distribution (AlignContent::Start, End, Center, Stretch, SpaceBetween, SpaceAround, SpaceEvenly, FIX-WRP-004).
  • Reverse cross-line stacking under FlexWrap::WrapReverse (FIX-WRP-003).
  • Flex basis determination (explicit flex_basis, main-axis size, or auto content size).
  • Iterative constrained grow with max-size clamp freezing (FIX-FLX-003).
  • Iterative constrained shrink with min-size floor freezing and zero-shrink items (FIX-FLX-004, FIX-FLX-005).
  • Gaps along main and cross axes (gap.width, gap.height, FIX-FLX-001, FIX-FLX-002).
  • Reverse flow positioning (RowReverse, ColumnReverse, FIX-FLX-006, FIX-FLX-007).
  • Content justification (Start, End, Center, SpaceBetween, SpaceAround, SpaceEvenly, FIX-FLX-008, FIX-FLX-009).
  • Cross-axis alignment (Start, End, Center, Stretch, Baseline) and per-item align_self override (FIX-FLX-010, FIX-FLX-011).
  • Asymmetric padding insets and margin offsets (FIX-FLX-012).
  • Parent-local coordinate placement with strict numerical invariants.

Structs§

FlexItem
A single flex item being resolved within a flex container.

Functions§

compute_flex
Computes flex layout for a container and its in-flow children, automatically handling single-line or multi-line wrapping according to container_style.flex_wrap.
compute_multi_line_flex
Computes multi-line flex layout (FlexWrap::Wrap or FlexWrap::WrapReverse).
compute_single_line_flex
Computes single-line flex layout for a container and its in-flow children.
to_align_self
Converts container AlignItems to equivalent item AlignSelf.