ui

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const MinTableRows = 5

MinTableRows is the minimum number of rows a table should display. If the terminal is too short, hide the header or status bar before shrinking the table below this threshold.

Variables

View Source
var (
	IconS3     = ServiceIcon{Nerd: "\U000f01bc", Fallback: "◇"} // nf-md-bucket
	IconEC2    = ServiceIcon{Nerd: "\U000f01c4", Fallback: "◈"} // nf-md-server
	IconCloud  = ServiceIcon{Nerd: "\U000f015f", Fallback: "☁"} // nf-md-cloud
	IconShield = ServiceIcon{Nerd: "\U000f0498", Fallback: "🛡"} // nf-md-shield
	IconSQS    = ServiceIcon{Nerd: "\U000f01ee", Fallback: "≡"} // nf-md-message_text

	// State indicators
	IconRunning = ServiceIcon{Nerd: "\U000f012c", Fallback: "●"} // nf-md-check_circle
	IconStopped = ServiceIcon{Nerd: "\U000f0156", Fallback: "○"} // nf-md-close_circle
	IconPending = ServiceIcon{Nerd: "\U000f0e4e", Fallback: "◌"} // nf-md-clock
)

Service icons

View Source
var (
	ErrorStyle   = lipgloss.NewStyle().Foreground(ActiveTheme.Error)
	WarningStyle = lipgloss.NewStyle().Foreground(ActiveTheme.Warning)
	SuccessStyle = lipgloss.NewStyle().Foreground(ActiveTheme.Success)
)
View Source
var ActiveTheme = DefaultTheme

ActiveTheme is the currently active theme. Set at startup.

View Source
var Catppuccin = Theme{
	Name:         "Catppuccin Mocha",
	Primary:      lipgloss.Color("#cba6f7"),
	Secondary:    lipgloss.Color("#585b70"),
	Accent:       lipgloss.Color("#a6e3a1"),
	Error:        lipgloss.Color("#f38ba8"),
	Warning:      lipgloss.Color("#f9e2af"),
	Success:      lipgloss.Color("#a6e3a1"),
	Info:         lipgloss.Color("#89b4fa"),
	Base:         lipgloss.Color("#1e1e2e"),
	Surface:      lipgloss.Color("#313244"),
	Overlay:      lipgloss.Color("#45475a"),
	Muted:        lipgloss.Color("#6c7086"),
	Text:         lipgloss.Color("#cdd6f4"),
	SubText:      lipgloss.Color("#a6adc8"),
	BrightText:   lipgloss.Color("#ffffff"),
	GradientFrom: lipgloss.Color("#cba6f7"),
	GradientTo:   lipgloss.Color("#89b4fa"),
	ChromaStyle:  "catppuccin-mocha",
	StateRunning: lipgloss.Color("#a6e3a1"),
	StateStopped: lipgloss.Color("#f38ba8"),
	StatePending: lipgloss.Color("#f9e2af"),
}
View Source
var DefaultTheme = Catppuccin

DefaultTheme is the default theme.

View Source
var Dracula = Theme{
	Name:         "Dracula",
	Primary:      lipgloss.Color("#bd93f9"),
	Secondary:    lipgloss.Color("#6272a4"),
	Accent:       lipgloss.Color("#50fa7b"),
	Error:        lipgloss.Color("#ff5555"),
	Warning:      lipgloss.Color("#f1fa8c"),
	Success:      lipgloss.Color("#50fa7b"),
	Info:         lipgloss.Color("#8be9fd"),
	Base:         lipgloss.Color("#282a36"),
	Surface:      lipgloss.Color("#44475a"),
	Overlay:      lipgloss.Color("#6272a4"),
	Muted:        lipgloss.Color("#6272a4"),
	Text:         lipgloss.Color("#f8f8f2"),
	SubText:      lipgloss.Color("#bfbfbf"),
	BrightText:   lipgloss.Color("#ffffff"),
	GradientFrom: lipgloss.Color("#bd93f9"),
	GradientTo:   lipgloss.Color("#ff79c6"),
	ChromaStyle:  "dracula",
	StateRunning: lipgloss.Color("#50fa7b"),
	StateStopped: lipgloss.Color("#ff5555"),
	StatePending: lipgloss.Color("#f1fa8c"),
}
View Source
var Nord = Theme{
	Name:         "Nord",
	Primary:      lipgloss.Color("#88c0d0"),
	Secondary:    lipgloss.Color("#4c566a"),
	Accent:       lipgloss.Color("#a3be8c"),
	Error:        lipgloss.Color("#bf616a"),
	Warning:      lipgloss.Color("#ebcb8b"),
	Success:      lipgloss.Color("#a3be8c"),
	Info:         lipgloss.Color("#81a1c1"),
	Base:         lipgloss.Color("#2e3440"),
	Surface:      lipgloss.Color("#3b4252"),
	Overlay:      lipgloss.Color("#434c5e"),
	Muted:        lipgloss.Color("#4c566a"),
	Text:         lipgloss.Color("#eceff4"),
	SubText:      lipgloss.Color("#d8dee9"),
	BrightText:   lipgloss.Color("#ffffff"),
	GradientFrom: lipgloss.Color("#88c0d0"),
	GradientTo:   lipgloss.Color("#5e81ac"),
	ChromaStyle:  "nord",
	StateRunning: lipgloss.Color("#a3be8c"),
	StateStopped: lipgloss.Color("#bf616a"),
	StatePending: lipgloss.Color("#ebcb8b"),
}
View Source
var ReadOnly = true

ReadOnly controls whether mutating operations are blocked. Always starts true; toggled at runtime via the mode picker.

S is the global computed styles instance. Initialized from ActiveTheme.

View Source
var ThemeOrder = []string{"catppuccin", "dracula", "nord", "tokyonight"}

ThemeOrder defines the cycle order for theme switching.

View Source
var Themes = map[string]Theme{
	"catppuccin": Catppuccin,
	"dracula":    Dracula,
	"nord":       Nord,
	"tokyonight": TokyoNight,
}

Themes maps theme names to themes.

View Source
var TokyoNight = Theme{
	Name:         "Tokyo Night",
	Primary:      lipgloss.Color("#7aa2f7"),
	Secondary:    lipgloss.Color("#565f89"),
	Accent:       lipgloss.Color("#9ece6a"),
	Error:        lipgloss.Color("#f7768e"),
	Warning:      lipgloss.Color("#e0af68"),
	Success:      lipgloss.Color("#9ece6a"),
	Info:         lipgloss.Color("#7aa2f7"),
	Base:         lipgloss.Color("#1a1b26"),
	Surface:      lipgloss.Color("#24283b"),
	Overlay:      lipgloss.Color("#414868"),
	Muted:        lipgloss.Color("#565f89"),
	Text:         lipgloss.Color("#c0caf5"),
	SubText:      lipgloss.Color("#a9b1d6"),
	BrightText:   lipgloss.Color("#ffffff"),
	GradientFrom: lipgloss.Color("#7aa2f7"),
	GradientTo:   lipgloss.Color("#bb9af7"),
	ChromaStyle:  "tokyonight-night",
	StateRunning: lipgloss.Color("#9ece6a"),
	StateStopped: lipgloss.Color("#f7768e"),
	StatePending: lipgloss.Color("#e0af68"),
}
View Source
var UseNerdFonts = true

UseNerdFonts controls whether Nerd Font icons are used. Set to true if the user's terminal has a Nerd Font patched font.

Functions

func ApplyModeAll added in v0.2.0

func ApplyModeAll(bindings []HintBinding)

ApplyModeAll applies mode logic to a slice of HintBindings.

func ColumnsFit added in v0.2.0

func ColumnsFit(cols []table.Column, width int) bool

ColumnsFit reports whether the given columns fit within the available width, accounting for the bubbles table's default cell padding (1 char each side).

func CycleTheme

func CycleTheme() string

CycleTheme advances to the next theme and rebuilds styles. Returns the new theme name.

func GradientText

func GradientText(text string, colors []color.Color) string

GradientText renders text with a horizontal gradient using the theme's gradient colors.

func HuhTheme added in v0.4.0

func HuhTheme() huh.ThemeFunc

HuhTheme returns a huh theme derived from the active LazyCloud theme.

func RebuildStyles

func RebuildStyles()

RebuildStyles rebuilds the global styles from the active theme.

func RenderGradientLine added in v0.2.0

func RenderGradientLine(width int) string

RenderGradientLine creates a thin horizontal gradient line.

func RenderHeader

func RenderHeader(data HeaderData) string

RenderHeader renders the top bar with gradient branding and profile/region badges.

func RenderStatusBar

func RenderStatusBar(data StatusBarData) string

RenderStatusBar renders the bottom bar with contextual keybindings. Hints that don't fit the available width are progressively dropped from the right (lowest priority), since currentKeyHints() orders view-specific hints first and global hints last.

func SortKeyBytes

func SortKeyBytes(size int64) string

SortKeyBytes returns a zero-padded string suitable for numeric byte sorting.

func StateColor

func StateColor(state string) string

StateColor returns a styled state string with the appropriate color and icon.

Types

type AppKeyMap added in v0.2.0

type AppKeyMap struct {
	Quit          HintBinding
	ThemePicker   HintBinding
	ProfilePicker HintBinding
	RegionPicker  HintBinding
	ModePicker    HintBinding
	EventLog      HintBinding
	CommandBar    HintBinding
	Help          HintBinding
	TabToggle     HintBinding
	PanelClose    HintBinding
	PanelEditor   HintBinding
	PanelGrow     HintBinding
	PanelShrink   HintBinding
	PanelReset    HintBinding
	CrossNavBack  HintBinding
}

AppKeyMap holds all app-level keybindings (global, navigation, panel).

func DefaultAppKeyMap added in v0.2.0

func DefaultAppKeyMap() AppKeyMap

DefaultAppKeyMap returns the default app-level keybindings.

type CommandBar added in v0.2.0

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

CommandBar is a vim/k9s-style text input at the bottom of the screen with autocomplete suggestions and command history.

func NewCommandBar added in v0.2.0

func NewCommandBar() CommandBar

NewCommandBar creates a hidden command bar.

func (*CommandBar) AddHistory added in v0.2.0

func (c *CommandBar) AddHistory(cmd string)

AddHistory adds a command to history, deduplicating.

func (*CommandBar) Hide added in v0.2.0

func (c *CommandBar) Hide()

Hide dismisses the command bar.

func (*CommandBar) Show added in v0.2.0

func (c *CommandBar) Show(commands []CommandEntry, width int)

Show activates the command bar with the given commands.

func (CommandBar) Update added in v0.2.0

func (c CommandBar) Update(msg tea.Msg) (CommandBar, tea.Cmd)

Update handles input when the command bar is visible.

func (CommandBar) ViewInput added in v0.2.0

func (c CommandBar) ViewInput(width int) string

ViewInput renders the command input line (replaces the status bar).

func (CommandBar) ViewSuggestions added in v0.2.0

func (c CommandBar) ViewSuggestions() string

ViewSuggestions renders the suggestion dropdown. Returns "" if no suggestions.

func (CommandBar) Visible added in v0.2.0

func (c CommandBar) Visible() bool

Visible returns whether the command bar is currently shown.

type CommandBarResultMsg added in v0.2.0

type CommandBarResultMsg struct {
	Value     string // the command text entered
	Cancelled bool   // true if dismissed without executing
}

CommandBarResultMsg is emitted when the user executes or cancels the command bar.

type CommandEntry added in v0.2.0

type CommandEntry struct {
	Name        string
	Aliases     []string
	Description string
}

CommandEntry is a single command available in the command bar.

type Confirm

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

Confirm is a confirmation dialog. In normal mode, the user must type "confirm" and press enter. In quick mode, a single y/n keypress suffices.

func NewConfirm

func NewConfirm() Confirm

NewConfirm creates a hidden confirmation dialog.

func (*Confirm) Hide

func (c *Confirm) Hide()

Hide dismisses the dialog.

func (*Confirm) Show

func (c *Confirm) Show(message, action string)

Show displays the type-to-confirm dialog with the given message and action ID.

func (*Confirm) ShowQuick added in v0.4.0

func (c *Confirm) ShowQuick(message, action string)

ShowQuick displays a y/n confirmation dialog for non-destructive actions.

func (Confirm) Update

func (c Confirm) Update(msg tea.Msg) (Confirm, tea.Cmd)

Update handles text input and confirmation logic.

func (Confirm) View

func (c Confirm) View() string

View renders the confirmation dialog box.

func (Confirm) Visible

func (c Confirm) Visible() bool

Visible returns whether the dialog is showing.

type ConfirmResultMsg

type ConfirmResultMsg struct {
	Confirmed bool
	Action    string
}

ConfirmResultMsg is emitted when the user responds to a confirmation dialog.

type ContentFormat

type ContentFormat string

ContentFormat identifies the content type.

const (
	FormatJSON     ContentFormat = "json"
	FormatYAML     ContentFormat = "yaml"
	FormatMarkdown ContentFormat = "markdown"
	FormatHCL      ContentFormat = "hcl"
	FormatShell    ContentFormat = "bash"
	FormatGo       ContentFormat = "go"
	FormatPython   ContentFormat = "python"
	FormatText     ContentFormat = "text"
	FormatAuto     ContentFormat = "auto"
)
type ContentLink struct {
	ViewID string
	Params map[string]string
}

ContentView displays syntax-highlighted, scrollable content with a cursor, visual line selection, and yank-to-clipboard. ContentLink maps a line to a navigation target for cross-resource navigation.

type ContentLinkActivatedMsg added in v0.2.0

type ContentLinkActivatedMsg struct {
	ViewID string
	Params map[string]string
}

ContentLinkActivatedMsg is emitted when the user presses Enter on a linked line.

type ContentView

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

func NewContentView

func NewContentView(title, content string, format ContentFormat) ContentView

NewContentView creates a content viewer with the given title, content, and format.

func (*ContentView) CancelVisual

func (cv *ContentView) CancelVisual()

CancelVisual exits visual mode without yanking.

func (ContentView) HasLinkAtCursor added in v0.2.0

func (cv ContentView) HasLinkAtCursor() bool

HasLinkAtCursor reports whether the current cursor line has a navigation link.

func (ContentView) InVisualMode

func (cv ContentView) InVisualMode() bool

InVisualMode returns whether visual line selection is active.

func (ContentView) OpenInEditorCmd

func (cv ContentView) OpenInEditorCmd() tea.Cmd

OpenInEditorCmd returns a tea.Cmd that opens the content in $EDITOR.

func (ContentView) Raw

func (cv ContentView) Raw() string

Raw returns the original unhighlighted content.

func (*ContentView) SetContent

func (cv *ContentView) SetContent(title, content string, format ContentFormat)

SetContent replaces the content.

func (*ContentView) SetEmbedded added in v0.2.0

func (cv *ContentView) SetEmbedded(v bool)

SetEmbedded marks this ContentView as embedded inside a TabbedPanel, hiding the footer (which duplicates the app-level status bar hints).

func (cv *ContentView) SetLinks(links map[int]ContentLink)

SetLinks sets navigable line links. Lines with links show a visual indicator and emit NavigateMsg when Enter is pressed on them.

func (*ContentView) SetSize

func (cv *ContentView) SetSize(w, h int)

SetSize sets the viewer dimensions.

func (*ContentView) ToggleLineNumbers

func (cv *ContentView) ToggleLineNumbers()

ToggleLineNumbers toggles line number display.

func (*ContentView) ToggleWrap added in v0.2.0

func (cv *ContentView) ToggleWrap()

ToggleWrap toggles word wrapping. When off, the viewport enables horizontal scrolling via h/l keys and ANSI-aware line clipping.

func (ContentView) Update

func (cv ContentView) Update(msg tea.Msg) (ContentView, tea.Cmd)

Update handles cursor movement, visual selection, yank, and viewport scrolling.

func (ContentView) View

func (cv ContentView) View() string

View renders the content viewer.

type ContentViewKeyMap added in v0.2.0

type ContentViewKeyMap struct {
	CursorDown   key.Binding
	CursorUp     key.Binding
	GotoTop      key.Binding
	GotoBottom   key.Binding
	HalfPageDown key.Binding
	HalfPageUp   key.Binding
	VisualToggle key.Binding
	Yank         key.Binding
	Enter        key.Binding
	LineNumbers  key.Binding
	WrapToggle   key.Binding
	ScrollLeft   key.Binding
	ScrollRight  key.Binding
}

ContentViewKeyMap holds keybindings for the content viewer (panel).

func DefaultContentViewKeyMap added in v0.2.0

func DefaultContentViewKeyMap() ContentViewKeyMap

DefaultContentViewKeyMap returns the default content viewer keybindings.

type Detail

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

Detail renders a scrollable key-value detail pane.

func NewDetail

func NewDetail(title string, fields []DetailField) Detail

NewDetail creates a Detail pane with the given title and fields.

func (*Detail) SetFields

func (d *Detail) SetFields(fields []DetailField)

SetFields updates the displayed fields.

func (*Detail) SetSize

func (d *Detail) SetSize(w, h int)

SetSize sets the detail pane dimensions.

func (Detail) Update

func (d Detail) Update(msg tea.Msg) (Detail, tea.Cmd)

Update handles viewport scrolling messages.

func (Detail) View

func (d Detail) View() string

View renders the detail pane.

type DetailField

type DetailField struct {
	Key   string
	Value string
}

DetailField represents a key-value pair in a detail pane.

type EditorFinishedMsg

type EditorFinishedMsg struct {
	Err error
}

EditorFinishedMsg is sent when the external editor exits.

type Filter

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

Filter provides an inline search input activated by a keybinding.

func NewFilter

func NewFilter() Filter

NewFilter creates an inactive filter with the default "/" prompt.

func NewFilterWithPrompt added in v0.2.0

func NewFilterWithPrompt(prompt, placeholder string) Filter

NewFilterWithPrompt creates an inactive filter with a custom prompt and placeholder.

func (*Filter) Activate

func (f *Filter) Activate()

Activate shows and focuses the filter input.

func (Filter) Active

func (f Filter) Active() bool

Active returns whether the filter is currently shown.

func (*Filter) Deactivate

func (f *Filter) Deactivate()

Deactivate hides the filter and clears its value.

func (*Filter) DeactivateKeepValue

func (f *Filter) DeactivateKeepValue()

DeactivateKeepValue hides the filter but keeps the text applied.

func (*Filter) SetValue added in v0.2.0

func (f *Filter) SetValue(v string)

SetValue sets the filter text.

func (*Filter) SetWidth

func (f *Filter) SetWidth(w int)

SetWidth sets the filter input width.

func (Filter) Update

func (f Filter) Update(msg tea.Msg) (Filter, tea.Cmd)

Update handles input messages when the filter is active.

func (Filter) Value

func (f Filter) Value() string

Value returns the current filter text.

func (*Filter) View

func (f *Filter) View() string

View renders the filter input. Returns "" when inactive.

type FilterChangedMsg

type FilterChangedMsg struct {
	Text string
}

FilterChangedMsg is emitted when the filter text changes.

type FormView added in v0.4.0

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

FormView wraps a huh.Form as a nav.View, providing a reusable multi-field form that integrates with the app's message routing and theme system.

func NewFormView added in v0.4.0

func NewFormView(req msg.RequestFormMsg) *FormView

NewFormView creates a FormView from a RequestFormMsg.

func (*FormView) Footer added in v0.4.0

func (f *FormView) Footer() string

func (*FormView) ID added in v0.4.0

func (f *FormView) ID() string

func (*FormView) Init added in v0.4.0

func (f *FormView) Init() tea.Cmd

func (*FormView) KeyMap added in v0.4.0

func (f *FormView) KeyMap() []HintBinding

func (*FormView) Title added in v0.4.0

func (f *FormView) Title() string

func (*FormView) Update added in v0.4.0

func (f *FormView) Update(m tea.Msg) (tea.Model, tea.Cmd)

func (*FormView) View added in v0.4.0

func (f *FormView) View() tea.View

type HeaderData

type HeaderData struct {
	Profile           string
	Region            string
	Mode              string // "RO" or "RW"
	Breadcrumbs       []string
	CrossNavBackLabel string // non-empty: show right-aligned back indicator with this label
	Width             int
}

HeaderData holds the values needed to render the header bar.

type HelpOverlay added in v0.2.0

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

HelpOverlay is a scrollable, filterable overlay that displays keybindings grouped by category.

func NewHelpOverlay added in v0.2.0

func NewHelpOverlay() HelpOverlay

NewHelpOverlay creates a hidden help overlay.

func (*HelpOverlay) Hide added in v0.2.0

func (h *HelpOverlay) Hide()

Hide dismisses the help overlay.

func (*HelpOverlay) Show added in v0.2.0

func (h *HelpOverlay) Show(hints []HintBinding, width, height int)

Show opens the help overlay with the given hints.

func (HelpOverlay) Update added in v0.2.0

func (h HelpOverlay) Update(msg tea.Msg) (HelpOverlay, tea.Cmd)

Update handles input when the help overlay is visible.

func (HelpOverlay) View added in v0.2.0

func (h HelpOverlay) View() string

View renders the help overlay as a bordered popup.

func (HelpOverlay) Visible added in v0.2.0

func (h HelpOverlay) Visible() bool

Visible returns whether the help overlay is currently shown.

type HintBinding added in v0.2.0

type HintBinding struct {
	key.Binding
	Mode     HintMode // ModeAny, ModeReadOnly, ModeReadWrite
	Category string   // for help overlay grouping; empty = "Current View"
}

HintBinding wraps key.Binding with metadata for the help overlay and status bar. It carries HintMode (ReadOnly/ReadWrite filtering) and Category (help overlay grouping) that key.Binding alone does not provide.

func NewHintBinding added in v0.2.0

func NewHintBinding(keys []string, helpKey, helpDesc string) HintBinding

NewHintBinding creates a HintBinding with ModeAny and no category.

func (*HintBinding) ApplyMode added in v0.2.0

func (h *HintBinding) ApplyMode()

ApplyMode enables or disables this binding based on the current ReadOnly state. ModeReadWrite bindings are disabled when ReadOnly is true; ModeReadOnly bindings are disabled when ReadOnly is false.

func (HintBinding) WithCategory added in v0.2.0

func (h HintBinding) WithCategory(cat string) HintBinding

WithCategory returns a copy with the given category.

func (HintBinding) WithMode added in v0.2.0

func (h HintBinding) WithMode(m HintMode) HintBinding

WithMode returns a copy with the given HintMode.

type HintMode added in v0.2.0

type HintMode int

HintMode controls when a keybinding hint is shown based on ReadOnly state.

const (
	ModeAny       HintMode = iota // shown in both ReadOnly and ReadWrite (default zero value)
	ModeReadOnly                  // shown only in ReadOnly mode
	ModeReadWrite                 // shown only in ReadWrite mode
)

type Picker

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

Picker is a popup selection dialog with j/k navigation and fuzzy search.

func NewPicker

func NewPicker() Picker

NewPicker creates a hidden picker.

func (*Picker) Hide

func (p *Picker) Hide()

Hide dismisses the picker.

func (*Picker) Show

func (p *Picker) Show(id, title string, options []PickerOption, initialIdx int)

Show displays the picker with the given options. The cursor starts on initialIdx.

func (Picker) Update

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

Update handles navigation, search, and selection input.

func (Picker) View

func (p Picker) View() string

View renders the picker as a bordered popup.

func (Picker) Visible

func (p Picker) Visible() bool

Visible returns whether the picker is currently shown.

type PickerOption

type PickerOption struct {
	Label string
	Value string
}

PickerOption is a single selectable item in the picker.

type PickerResultMsg

type PickerResultMsg struct {
	ID       string // picker identifier
	Selected int    // -1 if cancelled
	Value    string // selected option value, empty if cancelled
}

PickerResultMsg is emitted when the user selects an option or cancels.

type ServiceIcon

type ServiceIcon struct {
	Nerd     string // Nerd Font glyph
	Fallback string // plain Unicode fallback
}

ServiceIcon holds a Nerd Font icon and a Unicode fallback.

func (ServiceIcon) Icon

func (i ServiceIcon) Icon() string

Icon returns the Nerd Font icon if enabled, otherwise the fallback.

type SortDirection

type SortDirection int

SortDirection controls table column sort order.

const (
	SortAsc SortDirection = iota
	SortDesc
)

type Spinner

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

Spinner wraps a bubbles spinner with show/hide and a label.

func NewSpinner

func NewSpinner(label string) Spinner

NewSpinner creates a Spinner with the given label.

func (*Spinner) Hide

func (s *Spinner) Hide()

Hide makes the spinner invisible.

func (*Spinner) Show

func (s *Spinner) Show(label string)

Show makes the spinner visible with a new label.

func (Spinner) Tick

func (s Spinner) Tick() tea.Cmd

Tick returns the spinner's tick command for use in Init().

func (Spinner) Update

func (s Spinner) Update(msg tea.Msg) (Spinner, tea.Cmd)

Update handles spinner tick messages.

func (Spinner) View

func (s Spinner) View() string

View renders the spinner with its label. Returns "" when not visible.

func (Spinner) Visible

func (s Spinner) Visible() bool

Visible returns whether the spinner is currently shown.

type StatusBarData

type StatusBarData struct {
	Keys  []HintBinding
	Error string
	Width int
}

StatusBarData holds the values needed to render the status bar.

type Styles

type Styles struct {
	// Header
	HeaderStyle    lipgloss.Style
	HeaderAccent   lipgloss.Style
	Breadcrumb     lipgloss.Style
	BreadcrumbSep  lipgloss.Style
	HeaderGradient []color.Color

	// Status bar
	StatusBar     lipgloss.Style
	StatusKey     lipgloss.Style
	StatusDesc    lipgloss.Style
	StatusBarBase lipgloss.Style

	// Table
	TableHeader   lipgloss.Style
	TableSelected lipgloss.Style
	TableCell     lipgloss.Style

	// Detail
	DetailKey   lipgloss.Style
	DetailValue lipgloss.Style

	// Messages
	Error   lipgloss.Style
	Warning lipgloss.Style
	Success lipgloss.Style
	Info    lipgloss.Style

	// Filter
	FilterPrompt lipgloss.Style
	FilterBar    lipgloss.Style

	// Content border
	ContentBorder lipgloss.Style

	// Tabs
	TabActive   lipgloss.Style
	TabInactive lipgloss.Style

	// Content view
	FormatBadge   lipgloss.Style
	LineNumber    lipgloss.Style
	LinkIndicator lipgloss.Style
	PositionInfo  lipgloss.Style
	ModeIndicator lipgloss.Style

	// Dialogs
	DialogBorder      lipgloss.Style
	DialogErrorBorder lipgloss.Style

	// Picker / suggestions
	PickerOption         lipgloss.Style
	PickerOptionSelected lipgloss.Style
	SuggestionName       lipgloss.Style
	SuggestionDesc       lipgloss.Style
	SuggestionSelected   lipgloss.Style

	// Help overlay
	HelpGroupHeader lipgloss.Style
	HelpKeyColumn   lipgloss.Style
	ReadWriteBadge  lipgloss.Style

	// Command bar
	CommandCursor lipgloss.Style

	// General
	Muted lipgloss.Style
	Title lipgloss.Style
}

Styles holds all computed lipgloss styles derived from the active theme.

func NewStyles

func NewStyles(t Theme) Styles

NewStyles builds all styles from the given theme.

type TabInput added in v0.2.0

type TabInput struct {
	Title   string
	Content string
	Format  string
	Links   map[int]ContentLink // optional: navigable lines
}

TabInput describes the data for one tab, passed to NewTabbedPanel.

type TabbedPanel added in v0.2.0

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

TabbedPanel displays multiple content tabs with a tab bar and lazy viewer creation.

func NewTabbedPanel added in v0.2.0

func NewTabbedPanel(title string, tabs []TabInput) TabbedPanel

NewTabbedPanel creates a tabbed panel. The first tab's viewer is created eagerly.

func (TabbedPanel) ActiveTab added in v0.2.0

func (tp TabbedPanel) ActiveTab() int

ActiveTab returns the 0-indexed active tab.

func (TabbedPanel) OpenInEditorCmd added in v0.2.0

func (tp TabbedPanel) OpenInEditorCmd() tea.Cmd

OpenInEditorCmd delegates to the active tab's viewer.

func (*TabbedPanel) SetSize added in v0.2.0

func (tp *TabbedPanel) SetSize(w, h int)

SetSize sets the panel dimensions and resizes the active viewer.

func (TabbedPanel) TabCount added in v0.2.0

func (tp TabbedPanel) TabCount() int

TabCount returns the number of tabs.

func (TabbedPanel) TabData added in v0.3.0

func (tp TabbedPanel) TabData() []TabInput

TabData returns the stored tab entries for saving/restoring panel state.

func (TabbedPanel) Update added in v0.2.0

func (tp TabbedPanel) Update(msg tea.Msg) (TabbedPanel, tea.Cmd)

Update handles input. Number keys 1-9 switch tabs; all else forwarded to active viewer.

func (TabbedPanel) View added in v0.2.0

func (tp TabbedPanel) View() string

View renders the tab bar and active viewer content.

type Table

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

Table wraps bubbles/table with sort, filter, and multi-select support.

func NewTable

func NewTable(columns []table.Column, rows []table.Row) Table

NewTable creates a Table with the given columns and rows.

func (*Table) ClearSort

func (t *Table) ClearSort()

ClearSort removes any active sort, restoring the original row order.

func (Table) Columns added in v0.2.0

func (t Table) Columns() []table.Column

Columns returns the current column definitions.

func (*Table) DeselectAll

func (t *Table) DeselectAll()

DeselectAll clears all selections.

func (*Table) Filter

func (t *Table) Filter(text string)

Filter applies a text filter across all columns.

func (Table) FilteredIndices

func (t Table) FilteredIndices() []int

FilteredIndices returns the allRows indices of all currently visible (filtered) rows.

func (Table) IsSelected

func (t Table) IsSelected(allRowIdx int) bool

IsSelected returns whether the given allRows index is selected.

func (Table) RowCount

func (t Table) RowCount() (int, int)

RowCount returns (filtered count, total count).

func (*Table) SelectAll

func (t *Table) SelectAll()

SelectAll selects all currently visible (filtered) rows.

func (Table) SelectedAllRowIndex

func (t Table) SelectedAllRowIndex() int

SelectedAllRowIndex returns the allRows index for the current cursor position. Returns -1 if no valid mapping exists.

func (Table) SelectedIndex

func (t Table) SelectedIndex() int

SelectedIndex returns the cursor position in the filtered view.

func (Table) SelectedIndices

func (t Table) SelectedIndices() []int

SelectedIndices returns the allRows indices of all selected rows.

func (Table) SelectedRow

func (t Table) SelectedRow() table.Row

SelectedRow returns the currently highlighted row.

func (Table) SelectionCount

func (t Table) SelectionCount() int

SelectionCount returns the number of selected rows.

func (*Table) SetColumns added in v0.2.0

func (t *Table) SetColumns(columns []table.Column)

SetColumns swaps the column set without recreating the table. Clears rows and resets sort state since column indices may have changed. Selections are preserved — callers repopulate rows with the same data.

func (*Table) SetCursor added in v0.2.1

func (t *Table) SetCursor(n int)

SetCursor sets the cursor to the given row index.

func (*Table) SetRows

func (t *Table) SetRows(rows []table.Row)

SetRows replaces the table data and reapplies sort/filter. Selections are preserved for indices that remain valid.

func (*Table) SetRowsWithSortKeys

func (t *Table) SetRowsWithSortKeys(rows []table.Row, sortKeys []table.Row)

SetRowsWithSortKeys replaces the table data with parallel sort keys. Sort keys must be the same length as rows; each sort key row provides string values that sort correctly for each column. Selections are preserved for indices that remain valid.

func (*Table) SetSize

func (t *Table) SetSize(w, h int)

SetSize sets the table dimensions.

func (*Table) Sort

func (t *Table) Sort(col int)

Sort sorts the table by the given column index.

func (Table) SortColumnNames

func (t Table) SortColumnNames() ([]string, int)

SortColumnNames returns the base column titles and the currently sorted column index.

func (*Table) SortNext

func (t *Table) SortNext()

SortNext advances to the next sort column (ascending), or clears sort after the last column.

func (*Table) SortReverse

func (t *Table) SortReverse()

SortReverse reverses the current sort direction. No-op if no column is sorted.

func (*Table) ToggleSelect

func (t *Table) ToggleSelect()

ToggleSelect toggles selection on the current row and re-renders markers.

func (*Table) ToggleSelectAll

func (t *Table) ToggleSelectAll()

ToggleSelectAll selects all if none are selected, otherwise deselects all.

func (Table) Update

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

Update handles table navigation messages.

func (Table) View

func (t Table) View() string

View renders the table.

type Theme

type Theme struct {
	Name string

	// Core palette
	Primary   color.Color
	Secondary color.Color
	Accent    color.Color
	Error     color.Color
	Warning   color.Color
	Success   color.Color
	Info      color.Color

	// Surfaces
	Base       color.Color // main background-ish tone
	Surface    color.Color // elevated surface (panels)
	Overlay    color.Color // overlays, dialogs
	Muted      color.Color // subtle text
	Text       color.Color // primary text
	SubText    color.Color // secondary text
	BrightText color.Color // emphasized text

	// Gradient stops for header
	GradientFrom color.Color
	GradientTo   color.Color

	// Syntax highlighting
	ChromaStyle string // Chroma library style name (e.g., "catppuccin-mocha", "dracula")

	// State colors
	StateRunning color.Color
	StateStopped color.Color
	StatePending color.Color
}

Theme holds all colors for the application. Themes adapt to dark/light terminals.

type Toast

type Toast struct {
	Text      string
	Level     ToastLevel
	CreatedAt time.Time
	Duration  time.Duration
	ID        int
}

Toast is a single timed notification.

type ToastDismissMsg

type ToastDismissMsg struct {
	ID int
}

ToastDismissMsg is sent when a toast's duration expires.

type ToastLevel

type ToastLevel int

ToastLevel controls the color of a toast notification.

const (
	ToastInfo ToastLevel = iota
	ToastSuccess
	ToastError
)

type ToastManager

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

ToastManager manages a queue of auto-dismissing notifications.

func NewToastManager

func NewToastManager() ToastManager

NewToastManager creates a toast manager with a default max of 3 visible toasts.

func (*ToastManager) Add

func (tm *ToastManager) Add(text string, level ToastLevel, duration time.Duration) (int, tea.Cmd)

Add creates a new toast and returns its ID and a dismiss command.

func (*ToastManager) Cleanup

func (tm *ToastManager) Cleanup()

Cleanup removes toasts that have exceeded their duration. This is a fallback for cases where the dismiss command may not fire (e.g., when toasts originate from view closures routed through the message loop). Call from Update periodically.

func (*ToastManager) Dismiss

func (tm *ToastManager) Dismiss(id int)

Dismiss removes a toast by ID.

func (ToastManager) HasActive

func (tm ToastManager) HasActive() bool

HasActive returns whether any non-expired toasts exist.

func (ToastManager) View

func (tm ToastManager) View(width int) string

View renders the toast stack as a bordered block. Skips expired toasts that haven't been cleaned up yet.

type WidthTier added in v0.2.0

type WidthTier int

WidthTier represents a terminal width category for responsive layout.

const (
	TierNarrow WidthTier = iota // < 80 cols: table only, no detail panel
	TierMedium                  // 80-119 cols: full table, no detail panel
	TierWide                    // >= 120 cols: table + side detail panel
)

func GetWidthTier added in v0.2.0

func GetWidthTier(width int) WidthTier

GetWidthTier returns the layout tier for a given terminal width.

type YankedMsg

type YankedMsg struct {
	Lines int
}

YankedMsg is sent when content is copied to the clipboard.

Jump to

Keyboard shortcuts

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