ui

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Status colors
	SuccessColor = lipgloss.Color("#00D787") // Bright green
	ErrorColor   = lipgloss.Color("#FF5F87") // Bright red
	WarningColor = lipgloss.Color("#FFD700") // Gold/yellow
	InfoColor    = lipgloss.Color("#5FAFD7") // Blue
	MutedColor   = lipgloss.Color("#6C6C6C") // Gray

	// Session type colors
	RegularColor   = lipgloss.Color("#FFFFFF") // White/default
	ForkColor      = lipgloss.Color("#00D7D7") // Cyan
	IncognitoColor = lipgloss.Color("#6C6C6C") // Dim gray
)

Color palette

View Source
var (
	BoldStyle   = lipgloss.NewStyle().Bold(true)
	DimStyle    = lipgloss.NewStyle().Foreground(MutedColor)
	ItalicStyle = lipgloss.NewStyle().Italic(true)

	// Status text styles
	SuccessStyle = lipgloss.NewStyle().Foreground(SuccessColor).Bold(true)
	ErrorStyle   = lipgloss.NewStyle().Foreground(ErrorColor).Bold(true)
	WarningStyle = lipgloss.NewStyle().Foreground(WarningColor).Bold(true)
	InfoStyle    = lipgloss.NewStyle().Foreground(InfoColor).Bold(true)
)

Base text styles

View Source
var (
	// Base box style with padding
	BoxStyle = lipgloss.NewStyle().
				Padding(0, 1).
				Border(lipgloss.RoundedBorder())

	// Session type box styles
	RegularBoxStyle = BoxStyle.
					BorderForeground(RegularColor)

	ForkBoxStyle = BoxStyle.
					BorderForeground(ForkColor)

	IncognitoBoxStyle = BoxStyle.
						BorderForeground(IncognitoColor)

	// Status box styles
	ErrorBoxStyle = BoxStyle.
					BorderForeground(ErrorColor).
					Padding(1, 2)

	WarningBoxStyle = BoxStyle.
					BorderForeground(WarningColor).
					Padding(1, 2)

	InfoBoxStyle = BoxStyle.
					BorderForeground(InfoColor).
					Padding(1, 2)
)

Box and border styles

Functions

func Error

func Error(msg string) string

Error renders an error message in a red bordered box

func ErrorWithDetails

func ErrorWithDetails(msg string, details []string) string

ErrorWithDetails renders an error message with optional detail lines

func Info

func Info(msg string) string

Info renders an info message with a blue info icon

func RunConfirm

func RunConfirm(model ConfirmModel) (bool, error)

RunConfirm runs the confirmation dialog and returns true if confirmed

func RunDashboard

func RunDashboard(model DashboardModel) (string, error)

RunDashboard runs the dashboard and returns the selected action

func RunPicker

func RunPicker(model PickerModel) (*session.Session, error)

RunPicker runs the session picker and returns the selected session

func RunTable

func RunTable(model TableModel) ([]string, error)

RunTable runs the table and returns the selected row data (or nil if cancelled)

func Success

func Success(msg string) string

Success renders a success message with a green checkmark

func Warning

func Warning(msg string) string

Warning renders a warning message with a yellow warning icon

Types

type ConfirmModel

type ConfirmModel struct {
	Title       string
	Message     string
	Details     []string
	Destructive bool
	Confirmed   bool
	Cancelled   bool
	Focused     int // 0 = Cancel (default), 1 = Confirm
}

ConfirmModel represents the confirmation dialog state

func NewConfirm

func NewConfirm(title, message string) ConfirmModel

NewConfirm creates a new confirmation dialog

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

Init initializes the model (required by bubbletea)

func (ConfirmModel) Update

func (m ConfirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles keyboard input

func (ConfirmModel) View

func (m ConfirmModel) View() string

View renders the confirmation dialog

func (ConfirmModel) WithDestructive

func (m ConfirmModel) WithDestructive() ConfirmModel

WithDestructive marks the action as destructive (red styling)

func (ConfirmModel) WithDetails

func (m ConfirmModel) WithDetails(details []string) ConfirmModel

WithDetails adds detail lines to the confirmation dialog

type DashboardModel

type DashboardModel struct {
	Sessions  []*session.Session
	Cursor    int
	Selected  string // Selected action ID
	Cancelled bool
	Width     int
	Height    int
	// contains filtered or unexported fields
}

DashboardModel represents the main dashboard state

func NewDashboard

func NewDashboard(sessions []*session.Session) DashboardModel

NewDashboard creates a new dashboard model

func (DashboardModel) Init

func (m DashboardModel) Init() tea.Cmd

Init initializes the model (required by bubbletea)

func (DashboardModel) Update

func (m DashboardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles keyboard input

func (DashboardModel) View

func (m DashboardModel) View() string

View renders the dashboard

type MenuItem struct {
	ID          string
	Label       string
	Description string
}

MenuItem represents a menu action

type PickerModel

type PickerModel struct {
	Sessions    []*session.Session
	Cursor      int
	Selected    *session.Session
	Cancelled   bool
	Title       string
	FilterText  string
	Filtering   bool
	ShowPreview bool // Show preview pane with session metadata
}

PickerModel represents the session picker state

func NewPicker

func NewPicker(sessions []*session.Session, title string) PickerModel

NewPicker creates a new session picker

func (PickerModel) Init

func (m PickerModel) Init() tea.Cmd

Init initializes the model (required by bubbletea)

func (PickerModel) Update

func (m PickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles keyboard input

func (PickerModel) View

func (m PickerModel) View() string

View renders the session picker

func (PickerModel) WithPreview

func (m PickerModel) WithPreview() PickerModel

WithPreview enables the preview pane

type TableModel

type TableModel struct {
	Headers       []string
	Rows          [][]string
	Cursor        int
	Selected      int      // -1 if cancelled
	SelectedRow   []string // actual selected row data
	Cancelled     bool
	SortColumn    int    // -1 for no sort, 0+ for column index
	SortAscending bool   // true for ascending, false for descending
	FilterText    string // current filter text
	Filtering     bool   // whether in filter mode
	// contains filtered or unexported fields
}

TableModel represents a table with headers, rows, and cursor navigation

func NewTable

func NewTable(headers []string, rows [][]string) TableModel

NewTable creates a new table model

func (TableModel) Init

func (m TableModel) Init() tea.Cmd

Init initializes the model (required by bubbletea)

func (TableModel) Update

func (m TableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles keyboard input

func (TableModel) View

func (m TableModel) View() string

View renders the table

func (TableModel) WithSorting

func (m TableModel) WithSorting() TableModel

WithSorting enables sorting on this table

Jump to

Keyboard shortcuts

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