components

package
v0.3.0-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package components hosts shared bubbletea components used by view modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StatusBar

func StatusBar(s StatusBarState) string

StatusBar renders the status bar as a styled string sized to s.Width. Pure function — no internal state.

Types

type Column

type Column struct {
	Title string
	Width int
}

Column is the squad-side type for a table column. View modules don't import bubbles/table directly so the underlying widget stays swappable.

type Command

type Command struct {
	Name        string
	Description string
}

type ConnState

type ConnState int

ConnState is the connection-state indicator shown in the status bar.

const (
	ConnUp ConnState = iota
	ConnReconnecting
	ConnDown
)

type Palette

type Palette struct {
	// contains filtered or unexported fields
}

func NewPalette

func NewPalette(commands []Command, historyPath string) Palette

func (Palette) Close

func (p Palette) Close() Palette

func (Palette) Cursor

func (p Palette) Cursor() int

func (Palette) HasHistory

func (p Palette) HasHistory(name string) bool

func (Palette) HistorySize

func (p Palette) HistorySize() int

func (Palette) IsActive

func (p Palette) IsActive() bool

func (Palette) Open

func (p Palette) Open() Palette

func (Palette) Update

func (p Palette) Update(msg tea.Msg) (Palette, tea.Cmd)

func (Palette) View

func (p Palette) View() string

func (Palette) VisibleMatches

func (p Palette) VisibleMatches() []Command

type PaletteSelectedMsg

type PaletteSelectedMsg struct {
	Command string
}

type ReasonModal

type ReasonModal struct {
	// contains filtered or unexported fields
}

func NewReasonModal

func NewReasonModal() ReasonModal

func (ReasonModal) Cancelled

func (m ReasonModal) Cancelled() bool

func (ReasonModal) Error

func (m ReasonModal) Error() string

func (ReasonModal) Init

func (m ReasonModal) Init() tea.Cmd

func (ReasonModal) Submitted

func (m ReasonModal) Submitted() bool

func (ReasonModal) Update

func (m ReasonModal) Update(msg tea.Msg) (ReasonModal, tea.Cmd)

func (ReasonModal) Value

func (m ReasonModal) Value() string

func (ReasonModal) View

func (m ReasonModal) View() string

type StatusBarState

type StatusBarState struct {
	Scope  string
	View   string
	Conn   ConnState
	Notify int
	Lag    int // milliseconds; 0 means "no lag"
	Hints  []string
	Width  int
}

StatusBarState carries the data the bar needs each render. View modules (specifically the root model) populate it before invoking StatusBar.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table wraps bubbles/table.Model with squad's theme and a substring filter. View modules embed it inside their own bubbletea Model.

func NewTable

func NewTable(cols []Column, rows [][]string) Table

NewTable constructs a Table from the given columns and rows.

func (Table) Cursor

func (t Table) Cursor() int

Cursor returns the index of the currently selected row in the visible (filtered) row set.

func (Table) SelectedRow

func (t Table) SelectedRow() []string

SelectedRow returns the cells of the currently selected row, or nil if there are no rows.

func (Table) SetFilter

func (t Table) SetFilter(q string) Table

SetFilter narrows the visible rows to those whose any cell contains the given substring (case-insensitive). Empty filter restores all.

func (Table) SetRows

func (t Table) SetRows(rows [][]string) Table

SetRows replaces the source row set, preserving the active filter. Cursor resets to 0.

func (Table) Update

func (t Table) Update(msg tea.Msg) (Table, tea.Cmd)

Update forwards key/window messages to the inner table, translating vim-style movement keys into directional KeyMsgs first.

func (Table) View

func (t Table) View() string

View renders the table.

func (Table) VisibleRows

func (t Table) VisibleRows() int

VisibleRows returns the count of currently displayed rows after filter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL