terminal
block
A monospace character grid drawn as inline SVG: authored text primitives, inline ANSI, asciinema replay, plus stdlib TUI widgets.
terminal renders a monospace character grid as inline SVG, drawn with a bundled Nerd Font. The grid is populated three ways: authored text primitives, an inline ANSI-bearing text field, or replay of an asciinema recording. cols / rows size the grid; chrome toggles the window frame; title labels it.
Authored text
term_text is the one base primitive — styled text at a 1-based (row, col) carrying fg / bg and bold / italic / underline. Higher-level helpers (term_box, term_glyph, term_fill) lower to runs of term_text. Colours are strings: an ANSI name ("red"), a 256-palette index ("208"), or a hex ("#ff5fd2").
terminal {
cols = 46 rows = 7 title = "demo"
term_text "Colours" { row = 1 col = 2 bold = true underline = true }
term_text "red" { row = 2 col = 2 fg = "red" }
term_text "blue" { row = 2 col = 16 fg = "blue" }
term_box { row = 4 col = 2 width = 32 height = 3 border = :rounded fg = "cyan" title = "box" }
term_text "rounded border" { row = 5 col = 4 }
}
Inline ANSI and asciinema replay
Set text = "…" and the bundled avt virtual terminal evaluates it — ANSI sequences, cursor movement, and styling all apply (a bare \n is a newline). Set source = "rec.cast" for asciinema replay; frames replay at the recording's pace (override with speed) and stop at the end unless loop = true.
TUI widgets
Inside a terminal, stdlib TUI controls compose a small interface — each lowers to runs of term_text. They include tui_progress, tui_button, tui_spinner, tui_input, tui_dropdown, tui_checkbox, tui_radio, tui_panel (a bordered container, child positions relative to it), and tui_group (borderless). Declare a @block("name") type … extends TuiWidget with a lower returning list<TermFundamental> for a custom widget.
terminal {
cols = 44 rows = 8 title = "controls"
tui_progress "Upload" { row = 2 col = 2 value = 78 }
tui_progress "Sync" { row = 3 col = 2 value = 40 accent = "cyan" }
tui_button "Save" { row = 6 col = 2 accent = "green" }
tui_button "Discard" { row = 6 col = 11 accent = "red" }
}
Related
- diagram