smelt.ui.layout¶
Tier: UiHost — Requires a terminal UI; calling these from headless mode raises.
Composable layout-tree primitives (set/vbox/hbox/leaf) for the main TUI layout. smelt.ui.layout.set(fn) registers a composer invoked once per frame; the composer returns a tree built from these constructors describing how the transcript, prompt, statusline, and any plugin-added windows split the screen.
smelt.ui.layout.hbox¶
Horizontal container. items is an array of { child_layout, width = <constraint>, collapse_when_empty = bool? }. opts accepts border, title, gap, padding (uniform inner inset on all sides, inside any border).
smelt.ui.layout.leaf¶
Wrap a Win handle or paint id into a leaf node. opts accepts border, title, collapse_when_empty (force the slot to zero size when the wrapped window's buffer is empty), measure (a {w, h} table for a static natural size or a smelt.ui.layout.measure(...) handle for one the plugin can live-update).
smelt.ui.layout.measure¶
Construct a shareable natural-size handle for use with layout.leaf(opts.measure = ...). Initial size is (w, h) (default (0, 0)); update at any time via handle:set(w, h) to drive a live resize on the next frame. Read current size via handle:get().
smelt.ui.layout.set¶
Register the main layout composer. The callback receives a state table (term_w, term_h, prompt_input_rows) and returns a layout userdata built via smelt.ui.layout.{vbox,hbox,leaf}. Passing nil clears the composer and reverts to the engine's hardcoded layout. Only the most recent registration is active; later calls replace earlier ones.
smelt.ui.layout.vbox¶
Vertical container. items is an array of { child_layout, height = <constraint>, collapse_when_empty = bool? }. opts accepts border, title, gap (cells between children), padding (uniform inner inset on all sides, inside any border).