geomancy-layout
Geometry and matrix manipulation
| Stackage Nightly 2026-12-03: | 0.2.0 |
| Latest on Hackage: | 0.2.0 |
geomancy-layout-0.2.0@sha256:2c93020b02584143e05c8a22b24a9c1b77167f09abb7b061da5947d11b2b937c,2045Module documentation for 0.2.0
geomancy-layout
Layout primitives using geomancy vectors.
Geomancy.Layout- box cutting and stacking.Geomancy.Layout.Box- size/position and top/right/bottom/left boxes and manipulation.Geomancy.Layout.Alignment- distribute size leftovers proportionally.Geomancy.Layout.View- SwiftUI-like containers.
Changes
0.2.0
Layout follows SwiftUI more closely. Where SwiftUI is silent, it picks the least surprising option.
Stacks
HStack and VStack got spacing and align. hstack and vstack take both. hstack_ and vstack_ keep the old look.
Stacks share space more fairly. They hold back room for the children still waiting, never offer a child less than its minimum, and give parent-sized children what the others leave. Their cross axis spans their widest child. Their size never goes negative or drifts from where the children end up.
Negative spacing overlaps children, as in SwiftUI.
Spacers
A spacer expands only along its stack’s axis, as in SwiftUI. Outside a row or column it still fills both ways. A row with a spacer no longer swallows its column’s height.
Clearance
A view can ask to keep space from its stack neighbours on each edge, through the new clearance field of ViewSize. A stack puts the larger of its spacing and its children’s requests between them. Neighbouring requests collapse instead of adding up. Containers pass on the requests of their outer children. Padding counts toward them.
Frames and aspect ratio
FlexibleFrame follows SwiftUI’s flexible frame. Its constraints moved to a new FrameBounds record, where a missing bound means “no constraint” rather than “take the parent’s size”. between, widthWithin, heightWithin, fillWidth, fillHeight and filling build bounds. A frame that fills now measures as flexible instead of parent-sized.
AspectRatio letterboxes its content. It offers the child the largest box with its ratio that the child can grow into. It reports the smallest box with that ratio around the child’s answer. A ratio without a positive, finite quotient does nothing.
Padding adds its insets to both ends of its measured range.
Layers
Overlay and ZStack got an align field. They place each layer at the size it reports, as in SwiftUI. The new Background works like Overlay but paints its secondary behind the primary.
Traversal runs back to front, in paint order. Backgrounds come before their primary and overlays after it. ZStack layers keep their order. Painting in foldMap order is now correct.
Grid
New Grid container, like SwiftUI’s. Columns are as wide as their widest cell and rows as tall as their tallest. Cells that would stretch forever fill their slot without widening it. A column or row made only of them takes what is left.
span_ lets a cell span columns and rows, like an HTML table cell. Cells fill row by row around earlier spans. A spanning cell gets its room before open tracks take the rest. It grows the covered tracks that can still grow first.
Upgrading
Code that builds HStack, VStack, ZStack, Overlay or ViewSize directly needs the new fields. FlexibleFrame takes FrameBounds. A parent_ pin becomes filling. A range_ frame becomes between, which takes the offered size instead of hugging its child.
0.1.1
- Added
Geomancy.Layout.View- an experimental SwiftUI-like propose-report-place protocol.
0.1
Initial import.
Extracted from keid-core.