components

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBorderColor = colors.NeonPink
	SecondaryBorder    = colors.DarkGray
	AccentBorder       = colors.NeonCyan
)

Default colors for convenience (re-exported from colors package)

Functions

func CalculateHeight

func CalculateHeight(count int, width int, availableHeight int) int

CalculateHeight returns the number of lines needed to render the chunks Takes available height to support dynamic sizing

func RenderBtopBox

func RenderBtopBox(leftTitle, rightTitle string, content string, width, height int, borderColor color.Color) string

RenderBtopBox creates a btop-style box with title embedded in the top border. Supports left and right titles (e.g., search on left, pane name on right). Accepts pre-styled title strings. Example: ╭─ 🔍 Search... ─────────── Downloads ─╮

func RenderNumberedTabBar

func RenderNumberedTabBar(tabs []Tab, activeIndex int, activeStyle, inactiveStyle lipgloss.Style) string

RenderNumberedTabBar renders tabs with number prefixes like "[1] General" Each tab is wrapped in a rounded border box

func RenderTabBar

func RenderTabBar(tabs []Tab, activeIndex int, activeStyle, inactiveStyle lipgloss.Style) string

RenderTabBar renders a horizontal tab bar with the given tabs Each tab is wrapped in a rounded border box for consistent styling activeIndex specifies which tab is currently active (0-indexed)

Types

type AddDownloadModal

type AddDownloadModal struct {
	Title           string
	Inputs          []textinput.Model
	Labels          []string
	FocusedInput    int
	ShowURL         bool
	URL             string
	BrowseHintIndex int
	Help            help.Model
	HelpKeys        help.KeyMap
	BorderColor     color.Color
	Width           int
	Height          int
}

AddDownloadModal renders input-driven download forms (add download / extension prompt).

func (AddDownloadModal) RenderWithBtopBox

func (m AddDownloadModal) RenderWithBtopBox(
	renderBox func(leftTitle, rightTitle, content string, width, height int, borderColor color.Color) string,
	titleStyle lipgloss.Style,
) string

RenderWithBtopBox renders the modal with btop-style border.

func (AddDownloadModal) View

func (m AddDownloadModal) View() string

View renders the inner content (without border box).

type BoxRenderer

type BoxRenderer func(leftTitle, rightTitle, content string, width, height int, borderColor color.Color) string

BoxRenderer is the function signature for rendering btop-style boxes

type ChunkMapModel

type ChunkMapModel struct {
	Bitmap          []byte
	BitmapWidth     int // Total number of chunks in bitmap
	Width           int // UI render width (columns * 2)
	Height          int // Available height in rows (0 = auto)
	Paused          bool
	TotalSize       int64
	ActualChunkSize int64
	ChunkProgress   []int64
}

ChunkMapModel visualizes download chunks as a grid using a bitmap

func NewChunkMapModel

func NewChunkMapModel(bitmap []byte, bitmapWidth int, width, height int, paused bool, totalSize int64, actualChunkSize int64, chunkProgress []int64) ChunkMapModel

NewChunkMapModel creates a new chunk map visualization

func (ChunkMapModel) View

func (m ChunkMapModel) View() string

View renders the chunk grid

type ConfirmationModal

type ConfirmationModal struct {
	Title       string
	Message     string
	Detail      string      // Optional additional detail line (e.g., filename, URL)
	Keys        help.KeyMap // Key bindings to show in help
	Help        help.Model  // Help model for rendering keys
	BorderColor color.Color // Border color for the box
	Width       int
	Height      int
}

ConfirmationModal renders a styled confirmation dialog box

func (ConfirmationModal) Centered

func (m ConfirmationModal) Centered(width, height int) string

Centered returns the modal centered in the given dimensions (for standalone use) Help text is pushed to the last line

func (ConfirmationModal) RenderWithBtopBox

func (m ConfirmationModal) RenderWithBtopBox(
	renderBox func(leftTitle, rightTitle, content string, width, height int, borderColor color.Color) string,
	titleStyle lipgloss.Style,
) string

RenderWithBtopBox renders the modal using the btop-style box with title in border Help text is pushed to the last line of the modal

type DownloadStatus

type DownloadStatus int

DownloadStatus represents the state of a download

const (
	StatusQueued DownloadStatus = iota
	StatusDownloading
	StatusPaused
	StatusComplete
	StatusError
)

func DetermineStatus

func DetermineStatus(done bool, paused bool, hasError bool, speed float64, downloaded int64) DownloadStatus

DetermineStatus determines the DownloadStatus based on download state This centralizes the status determination logic that was duplicated in view.go and list.go

func (DownloadStatus) Color

func (s DownloadStatus) Color() color.Color

Color returns the status color

func (DownloadStatus) Icon

func (s DownloadStatus) Icon() string

Icon returns the status icon

func (DownloadStatus) Label

func (s DownloadStatus) Label() string

Label returns the status label

func (DownloadStatus) Render

func (s DownloadStatus) Render() string

Render returns the styled icon + label combination

func (DownloadStatus) RenderIcon

func (s DownloadStatus) RenderIcon() string

RenderIcon returns just the styled icon

func (DownloadStatus) RenderWithSpinner

func (s DownloadStatus) RenderWithSpinner(spinnerView string) string

RenderWithSpinner returns the styled icon + label combination, conditionally substituting a dynamic spinner for the Queued state

type FilePickerModal

type FilePickerModal struct {
	Title       string
	Picker      filepicker.Model
	Help        help.Model
	HelpKeys    help.KeyMap
	BorderColor color.Color
	Width       int
	Height      int
}

FilePickerModal represents a styled file picker modal

func NewFilePickerModal

func NewFilePickerModal(title string, picker filepicker.Model, helpModel help.Model, helpKeys help.KeyMap, borderColor color.Color) FilePickerModal

NewFilePickerModal creates a file picker modal with default styling

func (FilePickerModal) RenderWithBtopBox

func (m FilePickerModal) RenderWithBtopBox(
	renderBox func(leftTitle, rightTitle, content string, width, height int, borderColor color.Color) string,
	titleStyle lipgloss.Style,
) string

RenderWithBtopBox renders the modal using the btop-style box

func (FilePickerModal) View

func (m FilePickerModal) View() string

View returns the inner content of the file picker (without the box)

type HelpModal added in v0.8.0

type HelpModal struct {
	Title       string
	HelpKeys    help.KeyMap // Must implement FullHelp() [][]key.Binding
	Help        help.Model  // Help model for rendering
	BorderColor color.Color
	Width       int
	Height      int
}

HelpModal renders a styled help overlay showing all keyboard shortcuts

func (HelpModal) RenderWithBtopBox added in v0.8.0

func (m HelpModal) RenderWithBtopBox(
	renderBox func(leftTitle, rightTitle, content string, width, height int, borderColor color.Color) string,
	titleStyle lipgloss.Style,
) string

RenderWithBtopBox renders the help modal using a btop-style box with title in border

type NoKeys

type NoKeys struct{}

NoKeys satisfies help.KeyMap for informational modals with no interactive bindings.

func (NoKeys) FullHelp

func (NoKeys) FullHelp() [][]key.Binding

func (NoKeys) ShortHelp

func (NoKeys) ShortHelp() []key.Binding

type Tab

type Tab struct {
	Label string
	Count int // If >= 0, displays as "Label (Count)"; if < 0, displays just "Label"
}

Tab represents a single tab item

Jump to

Keyboard shortcuts

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