Documentation
¶
Overview ¶
Package block defines the shared interface for all visual blocks in the message list viewport.
Index ¶
Constants ¶
const BorderWidth = 1
BorderWidth is the width of the left border on blocks. The messagelist applies a left border; blocks handle their own internal padding.
const PaddingX = 2
PaddingX is the horizontal padding inside each block.
const PaddingY = 1
PaddingY is the vertical padding inside elevated blocks (text, tools, user).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block interface {
// View renders the block at the width set by SetWidth.
View() string
// Height returns the number of lines this block renders.
Height() int
// Update handles messages.
Update(tea.Msg) tea.Cmd
// SetWidth sets the available width for rendering.
SetWidth(int)
// SetFocused sets whether this block is the focused block in the viewport.
SetFocused(bool)
// Focused returns whether this block is currently focused.
Focused() bool
// Kind returns the block type.
Kind() Kind
}
Block is the interface for all visual atoms in the message list. Each block is an independently focusable, renderable unit. Width is set via SetWidth before View is called.
type Toggleable ¶
type Toggleable interface {
Toggle(y int)
}
Toggleable is an optional interface for blocks that can be toggled (e.g. expand/collapse thinking blocks, show/hide tool body). y is the click position relative to the block's top edge. Blocks should only toggle when the click is on the header line.