components

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package components is shared TUI components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageDisplay

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

ImageDisplay implements tea.ExecCommand to render an image in the terminal. bubbletea's tea.Exec temporarily releases the terminal (exits alt screen), lets us write graphics escape sequences, then restores the TUI on return.

func NewImageDisplay

func NewImageDisplay(path string) *ImageDisplay

NewImageDisplay creates a tea.ExecCommand that tries terminal graphics protocols (Kitty, iTerm2, Sixel) before falling back to the system opener.

func (*ImageDisplay) Run

func (d *ImageDisplay) Run() error

func (*ImageDisplay) SetStderr

func (d *ImageDisplay) SetStderr(io.Writer)

func (*ImageDisplay) SetStdin

func (d *ImageDisplay) SetStdin(r io.Reader)

func (*ImageDisplay) SetStdout

func (d *ImageDisplay) SetStdout(w io.Writer)

type MedianCutQuantizer

type MedianCutQuantizer struct {
	NumColor int
}

MedianCutQuantizer implements a simple median-cut color quantizer.

func (MedianCutQuantizer) Quantize

func (q MedianCutQuantizer) Quantize(dst *image.Paletted, r image.Rectangle, src image.Image, sp image.Point)

Quantize fills dst with a paletted version of src.

type Progress

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

Progress shows a spinner with operation name and elapsed time.

func NewProgress

func NewProgress() Progress

NewProgress creates a new progress spinner component.

func StartedProgress

func StartedProgress(operation string) Progress

StartedProgress creates a Progress that is already active with the given operation.

func (*Progress) Active

func (p *Progress) Active() bool

Active returns whether the spinner is currently running.

func (*Progress) InitialTick

func (p *Progress) InitialTick() tea.Cmd

InitialTick returns the spinner tick command without mutating state. Use this from value-receiver Init() methods after constructing with StartedProgress.

func (*Progress) Start

func (p *Progress) Start(operation string) tea.Cmd

Start begins the progress animation and returns the initial tick command.

func (*Progress) Stop

func (p *Progress) Stop()

Stop ends the progress animation.

func (*Progress) Update

func (p *Progress) Update(msg tea.Msg) tea.Cmd

Update handles spinner tick messages.

func (*Progress) View

func (p *Progress) View() string

View renders the spinner with operation name and elapsed time.

type ResultList

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

ResultList renders a scrollable list of task results.

func NewResultList

func NewResultList(width, height int) ResultList

NewResultList creates a new result list component.

func (*ResultList) AddResult

func (r *ResultList) AddResult(result tasks.Result)

AddResult appends a result and auto-scrolls to bottom.

func (*ResultList) Count

func (r *ResultList) Count() int

Count returns the number of results.

func (*ResultList) SetSize

func (r *ResultList) SetSize(width, height int)

SetSize updates the viewport dimensions.

func (*ResultList) Update

func (r *ResultList) Update(msg tea.Msg) tea.Cmd

Update handles viewport messages (scrolling).

func (*ResultList) View

func (r *ResultList) View() string

View renders the result list.

Jump to

Keyboard shortcuts

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