components

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package components provides reusable TUI widgets for revoco.

Package components contains reusable Bubble Tea UI widgets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilePicker

type FilePicker struct {
	Mode          PickerMode
	Selected      string   // Single selection (ModeDir/ModeFile)
	MultiSelected []string // Multiple selections (ModeMultiFile)
	Done          bool
	Err           error

	// AllowedExts filters selectable files in ModeFile/ModeMultiFile (e.g. []string{".zip"}).
	// Empty means all files are allowed.
	AllowedExts []string
	// contains filtered or unexported fields
}

FilePicker is a keyboard-driven file/directory picker.

In ModeDir the user navigates with Enter and confirms the current directory with Space. In ModeFile the user navigates into directories with Enter and selects a file with Enter. In ModeMultiFile, Space toggles selection and Enter confirms all selected files.

func NewFilePicker

func NewFilePicker(mode PickerMode) FilePicker

NewFilePicker creates a FilePicker starting in the user's home directory.

func (FilePicker) Init

func (p FilePicker) Init() tea.Cmd

Init returns the command that reads the initial directory.

func (*FilePicker) SetHeight

func (p *FilePicker) SetHeight(h int)

SetHeight sets the visible row count.

func (FilePicker) Update

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

Update processes messages.

func (FilePicker) View

func (p FilePicker) View() string

View renders the picker.

type LogLine

type LogLine struct {
	Text    string
	IsError bool
}

LogLine is a single entry in the log panel.

type LogPanel

type LogPanel struct {
	Width    int
	Height   int
	MaxLines int
	// contains filtered or unexported fields
}

LogPanel is a scrollable log view backed by bubbles/viewport with auto-follow when at the bottom.

func NewLogPanel

func NewLogPanel(width, height, maxLines int) LogPanel

NewLogPanel creates a LogPanel with the given dimensions and max line capacity.

func (*LogPanel) Append

func (l *LogPanel) Append(text string, isErr bool)

Append adds a line, evicting the oldest if over capacity, and refreshes content.

func (*LogPanel) Resize

func (l *LogPanel) Resize(width, height int)

Resize updates the viewport dimensions.

func (*LogPanel) Update

func (l *LogPanel) Update(msg tea.Msg) tea.Cmd

Update handles keyboard events for the viewport.

func (LogPanel) View

func (l LogPanel) View() string

View renders the log panel with a rounded border.

type PhaseBar

type PhaseBar struct {
	Label    string
	Done     int
	Total    int
	Width    int
	Active   bool
	Finished bool
	// contains filtered or unexported fields
}

PhaseBar renders a progress bar for a single pipeline phase using bubbles/progress.ViewAs for smooth animated fills.

func (*PhaseBar) Init

func (p *PhaseBar) Init() tea.Cmd

Init should be called once on the PhaseBar when it becomes active. Returns a tea.Cmd that drives the spinner animation.

func (*PhaseBar) UpdateSpinner

func (p *PhaseBar) UpdateSpinner(msg tea.Msg) tea.Cmd

UpdateSpinner advances the spinner state. Call from the parent Update on spinner.TickMsg.

func (PhaseBar) View

func (p PhaseBar) View() string

View renders the phase bar line.

type PickerMode

type PickerMode int

PickerMode controls what the filepicker allows the user to select.

const (
	// ModeDir allows directory selection. Enter navigates into directories,
	// Space confirms the current directory as the selection.
	ModeDir PickerMode = iota
	// ModeFile allows file selection. Enter navigates into directories or
	// selects the highlighted file.
	ModeFile
	// ModeMultiFile allows selecting multiple files. Space toggles selection,
	// Enter confirms all selections.
	ModeMultiFile
)

type Sparkline

type Sparkline struct {
	// Width is the number of columns the sparkline should fill.
	Width int
	// Label is displayed after the graph (e.g. "MB/s").
	Label string
	// contains filtered or unexported fields
}

Sparkline tracks a rolling window of float64 samples and renders an ASCII throughput graph using Unicode block characters.

func NewSparkline

func NewSparkline(width int, label string) Sparkline

NewSparkline creates a Sparkline with the given width and label.

func (*Sparkline) Push

func (s *Sparkline) Push(v float64)

Push adds a new sample, evicting the oldest if the buffer is full.

func (Sparkline) View

func (s Sparkline) View() string

View renders the sparkline as a single line: graph + current value + label.

Jump to

Keyboard shortcuts

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