Documentation
¶
Overview ¶
Package tui is the dashboard shell: it owns layout, focus, global keys and the frame around each widget. It must not import a concrete widget package.
Index ¶
- Constants
- func Frame(t theme.Theme, title string, state FrameState, w, h int, content string) string
- func Layout(rows [][]string, w, h int) [][]Box
- func MoveDown(rows [][]string, name string) [][]string
- func MoveLeft(rows [][]string, name string) [][]string
- func MoveRight(rows [][]string, name string) [][]string
- func MoveUp(rows [][]string, name string) [][]string
- func SplitOut(rows [][]string, name string) [][]string
- type Box
- type FrameState
- type Model
Constants ¶
const ( FrameOverheadX = 4 FrameOverheadY = 2 )
FrameOverhead is the number of cells the frame consumes on each axis: a border and one column of padding on each side horizontally, and a border row top and bottom vertically.
Variables ¶
This section is empty.
Functions ¶
func Frame ¶
Frame draws a titled box of exactly w by h cells around content.
lipgloss has no border-title support, so the top border is assembled by hand. content is expected to already fit the inner area; anything longer is truncated ANSI-safely rather than allowed to break the layout.
func Layout ¶
Layout computes the outer box for every widget on a dashboard.
Rows split the available height; widgets within a row split that row's width. Remainders go to the earlier rows and earlier columns, so a 3-column layout in an 80-cell terminal gives 27/27/26 rather than losing two cells.
func MoveDown ¶
MoveDown moves a widget into the row below, creating one at the bottom when there is none.
Types ¶
type FrameState ¶
type FrameState int
FrameState selects how a widget's border is drawn.
const ( // FrameIdle is an unfocused widget. FrameIdle FrameState = iota // FrameFocused is the widget receiving keys. FrameFocused // FrameMoving is the widget being repositioned in layout mode. FrameMoving )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root bubbletea model.