smelt.layout¶
Tier: Host - Available in every runtime, including headless mode.
Visibility: Public - Stable Lua API intended for user config and plugins.
Declarative, width-independent content layout primitives for transcript/tool display.
smelt.layout.cap¶
Types: smelt.layout.Node
Cap a child by rendered rows. opts.rows is numeric; opts.keep is head, tail, or head_tail; edge caps accept opts.marker = "above" | "below"; head_tail uses opts.head_rows and accepts opts.marker = "middle". opts.total_rows may provide the full source row count for clearer tail markers.
smelt.layout.code¶
Types: smelt.layout.Node
Syntax-highlighted code layout leaf. opts.lang supplies the language name.
smelt.layout.diff¶
Types: smelt.layout.Node
Inline-diff render directive. The worker renders the diff directly into the block buffer. opts.old, opts.new are the before/after strings; opts.path picks syntax via extension; opts.anchor (defaults to opts.old) is the diff-view anchor; opts.lang overrides path-based syntax; opts.full_file treats opts.old as the complete pre-edit file for stable previews after writes.
smelt.layout.elapsed¶
Types: smelt.layout.Node
Dynamic elapsed-time text leaf. Pass block.elapsed from a transcript renderer, or a call-id string with opts.status / opts.secs. Rust resolves current tool elapsed at render time when possible.
smelt.layout.empty¶
Types: smelt.layout.Node
Explicit zero-row layout node. Use this instead of returning nil when a renderer intentionally hides content.
smelt.layout.file_view¶
Types: smelt.layout.Node
Syntax-highlighted file-view render directive. Uses a single line-number column and no diff bg. opts.content is the source text; opts.path picks syntax via extension; opts.lang overrides path-based syntax.
smelt.layout.gutter¶
Types: smelt.layout.Node
Render child with an explicit non-selectable gutter prefix on each emitted row. opts.text defaults to two spaces. The prefix consumes display width before wrapping/measuring the child; opts.styled = true lets row-level styles include the prefix.
smelt.layout.hbox¶
Types: smelt.layout.Node
Lay items out horizontally. Each entry is either a layout userdata (defaults to fill weight 1) or { layout, cols=N } / { layout, weight=N } / { layout, fit=true } for a fixed, weighted, or renderer-defined intrinsic-width slot. fit=true uses unwrapped content width when available, capped by the parent; fixed and fit slots are allocated before fill slots.
smelt.layout.line¶
Types: smelt.layout.Node
Single styled line layout leaf. spans is a string or a one-dimensional span table; unlike runs, this does not wrap.
smelt.layout.markdown¶
Types: smelt.layout.Node
Markdown layout leaf. opts.dim dims all spans; opts.italic italicizes inline-mode spans; opts.inline = true preserves line-by-line inline markdown without block parsing.
smelt.layout.panel¶
Types: smelt.layout.Node
Render child inside a full-width background panel. opts.hl_group / opts.hl names the panel highlight group; opts.padding defaults to 1 cell/row.
smelt.layout.row_prefix¶
Types: smelt.layout.Node
Apply row chrome to child after the child has produced rows. opts.first is a styled line or string for row 1; opts.rest is used for every later row and defaults to opts.first. Prefix spans keep their own selectable flags: set selectable = false for pure chrome, leave it true for copyable labels. The widest prefix consumes display width before wrapping/measuring the child, so prefixed rows stay within the layout width. Put this outside layout.cap when cap markers should inherit the same row chrome.
smelt.layout.runs¶
Types: smelt.layout.Node
Styled inline text layout leaf. lines is a string or styled-lines table ({ { { text=..., syntax?, hl?, fg?, bg?, dim?, bold?, italic?, selectable?, title_suffix? }, ... }, ... }). opts.hl_group / opts.hl supplies a default theme group for spans without hl; opts.continuation_indent indents soft-wrapped continuation rows by display columns.
smelt.layout.separator¶
Types: smelt.layout.Node
Full-width horizontal separator. opts.label is centered in the row and accepts the same styled span shape as smelt.layout.line; generated line fill is chrome and is not searchable/selectable unless opts.selectable is true. opts.dim defaults to true.
smelt.layout.style¶
Types: smelt.layout.Node
Apply inherited style to a child layout. opts.hl_group / opts.hl names a theme group; opts.fg / opts.bg name theme colors; opts.dim, opts.bold, and opts.italic set text attributes. Child spans may override inherited fields.
smelt.layout.text¶
Types: smelt.layout.Node
Plain text layout leaf. opts.hl_group / opts.hl may name a theme group; without it, text renders dimmed. opts.ansi = true enables ANSI parsing. Wrapping is computed by the transcript at the current width.
smelt.layout.vbox¶
Types: smelt.layout.Node
Stack items vertically into a single block layout. Each item must be a layout userdata produced by a smelt.layout primitive.