Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(format string, args ...any)
- func Error(format string, args ...any)
- func LineStyle(highlighted bool) (lipgloss.Style, string)
- func PrintHeader()
- func RenderBanner(width, height int) string
- func RenderHeader(info *HeaderInfo, width int, height int) string
- func RenderNameWithGradient() string
- func Status(verb string, format string, args ...any)
- type Cursor
- type FooterKey
- type HeaderInfo
- type Screen
- type TickMsg
- type Window
- func (w *Window) ClearError()
- func (w *Window) Err() error
- func (w *Window) Flash() string
- func (w *Window) Height() int
- func (w *Window) Init() tea.Cmd
- func (w *Window) IntervalElapsed(interval time.Duration) bool
- func (w *Window) SetError(err error)
- func (w *Window) SetFlash(msg string)
- func (w *Window) SetHeader(info *HeaderInfo)
- func (w *Window) TickFrame() int
- func (w *Window) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (w *Window) View() tea.View
- func (w *Window) VpHeight() int
- func (w *Window) Width() int
Constants ¶
const CompactHeaderThreshold = 15
CompactHeaderThreshold is the terminal height below which the header collapses to a single line.
const TickInterval = 250 * time.Millisecond
TickInterval is the base tick rate for the TUI event loop.
Variables ¶
var ( ColorCyan = lipgloss.Color("#00d4ff") ColorPurple = lipgloss.Color("#8b5cf6") ColorOrange = lipgloss.Color("#f97316") ColorField = lipgloss.Color("#0099cc") ColorError = ColorPurple // lipgloss.Color("#ef4444") - this one is too similar to the orange ColorHighlight = lipgloss.Color("#1e2d3d") )
Theme colors
Functions ¶
func LineStyle ¶
LineStyle returns a base lipgloss style and cursor marker for a list row. When highlighted is true, the base style includes a highlight background and the marker is a colored arrow; otherwise the marker is two spaces.
func PrintHeader ¶
func PrintHeader()
PrintHeader prints a branding header (wordmark + tagline) to stdout. It detects terminal size and uses the compact layout on short terminals.
func RenderBanner ¶
RenderBanner produces a branding-only header string (wordmark + tagline, no session info). It uses the compact layout when height < CompactHeaderThreshold.
func RenderHeader ¶
func RenderHeader(info *HeaderInfo, width int, height int) string
RenderHeader produces the styled monitor header with wordmark, tagline, session info, and diagonal line field.
func RenderNameWithGradient ¶ added in v0.2.0
func RenderNameWithGradient() string
Types ¶
type Cursor ¶
type Cursor struct {
Pos int // highlighted item index
Offset int // scroll offset (first visible item)
VpHeight int // visible rows
ItemCount int // total items
}
Cursor provides scrollable list navigation. Screens that need a navigable list embed this struct and call HandleKey in their Update method.
func (*Cursor) EnsureVisible ¶
func (c *Cursor) EnsureVisible()
EnsureVisible adjusts Offset so Pos is within the visible window.
func (*Cursor) FooterKeys ¶
FooterKeys returns the standard navigation keybinding hints.
type FooterKey ¶
type FooterKey struct {
}
FooterKey describes a single keybinding hint shown in the footer.
type HeaderInfo ¶
func (HeaderInfo) ProjectDirWithHome ¶
func (info HeaderInfo) ProjectDirWithHome() string
ProjectDirWithHome replaces the home directory path in the project dir with "$HOME" to shorten the value.
type Screen ¶
type Screen interface {
// Update handles input and custom messages. Returning a different Screen
// switches the active screen. The Window pointer provides access to shared
// state (dimensions, flash, error).
Update(msg tea.Msg, w *Window) (Screen, tea.Cmd)
// View renders the content area between header and footer.
View(w *Window) string
// side of the footer. These are prepended before the base keys.
FooterKeys(w *Window) []FooterKey
// (e.g. tailing animation, progress). Return "" for no indicator.
FooterStatus(w *Window) string
}
Screen is implemented by each TUI screen (monitor, session selector, etc.).
type TickMsg ¶
type TickMsg struct{}
TickMsg is sent on every tick interval. Screens receive it after Window increments the frame counter and expires flash messages.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is the top-level tea.Model. It owns the shared frame (header, footer, sizing, tick, flash/error) and delegates content to the active Screen.
func NewWindow ¶
func NewWindow(header *HeaderInfo, screen Screen) *Window
func (*Window) ClearError ¶
func (w *Window) ClearError()
func (*Window) IntervalElapsed ¶
IntervalElapsed returns true if the given interval has elapsed since the last tick.
func (*Window) SetHeader ¶
func (w *Window) SetHeader(info *HeaderInfo)