Every layout engine you've found is welded to a renderer. You need the math without the framework.
panes is a spatial layout engine that computes rectangles without rendering them.
Describe panels in rows, columns, and presets. panes solves the geometry via Taffy's flexbox engine and hands back a map of PanelId → Rect. No framework. No widget system. No opinions about pixels.
Proof
use ;
let resolved = master_stack
.master_ratio
.gap
.resolve?;
for in resolved.iter
// PanelId(0): Rect { x: 0.0, y: 0.0, w: 47.5, h: 24.0 }
// PanelId(1): Rect { x: 48.5, y: 0.0, w: 31.5, h: 11.5 }
// PanelId(2): Rect { x: 48.5, y: 12.5, w: 31.5, h: 11.5 }
Install
cargo add panes
Usage
Pick a preset, build custom, or mutate at runtime.
// Preset — 15 built-in strategies
master_stack.master_ratio.gap
// Builder — nest rows, columns, constraints
let mut b = new;
b.row?;
// Runtime — mutations, viewport, frame diffing
let mut rt = from;
rt.tree_mut.add_panel?;
let frame = rt.resolve?;
let diff = frame.diff;
Adapters convert rects to renderer-native types:
| Crate | Target | Rect type |
|---|---|---|
panes-ratatui |
ratatui | ratatui::layout::Rect (u16, edge-rounded) |
panes-egui |
egui | egui::Rect (f32) |
panes-css |
Browser | CSS declarations (browser solves layout) |
panes-wasm |
Canvas/JS | WasmRect (f64) |
Documentation
See the User Guide for the full API: all 15 presets, the layout macro, TOML configuration, runtime mutations, frame diffing, animation, and render adapters.
License
MIT or Apache 2.0, at your option. See LICENSE-MIT and LICENSE-APACHE.