ui

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ui provides shared UI constants and utilities.

Index

Constants

View Source
const (
	// ScrollMargin is the number of items to keep visible above/below the cursor.
	ScrollMargin = 5

	// BorderHeight is the vertical space consumed by a standard panel border.
	BorderHeight = 2

	// HeaderHeight is the space for header + separator in panels.
	HeaderHeight = 2

	// PanelOverhead is the total vertical overhead (border + header + separator).
	// Used to calculate available list height: listHeight = panelHeight - PanelOverhead
	PanelOverhead = BorderHeight + HeaderHeight

	// ColumnWidthDivisor determines the width ratio between current and preview columns.
	// Current column gets 1/ColumnWidthDivisor of the width.
	ColumnWidthDivisor = 3

	// MinProgressBarWidth is the minimum width for a usable progress bar.
	MinProgressBarWidth = 5

	// MinExpandedWidth is the minimum width for expanded player bar mode.
	MinExpandedWidth = 40
)

Layout constants for consistent sizing across UI components.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base added in v0.1.11

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

Base provides common UI component functionality for focus and size management. Embed this in component models to get standard methods automatically.

Example:

type Model struct {
    ui.Base
    cursor cursor.Cursor
    items  []Item
}

func (Base) Height added in v0.1.11

func (b Base) Height() int

Height returns the component height.

func (Base) IsFocused added in v0.1.11

func (b Base) IsFocused() bool

IsFocused returns whether the component is focused.

func (Base) ListHeight added in v0.1.11

func (b Base) ListHeight(overhead int) int

ListHeight returns available height for list content after subtracting overhead.

func (*Base) SetFocused added in v0.1.11

func (b *Base) SetFocused(focused bool)

SetFocused sets whether the component is focused.

func (*Base) SetSize added in v0.1.11

func (b *Base) SetSize(width, height int)

SetSize sets the component dimensions.

func (Base) Size added in v0.1.11

func (b Base) Size() (width, height int)

Size returns the component dimensions.

func (Base) Width added in v0.1.11

func (b Base) Width() int

Width returns the component width.

Directories

Path Synopsis
Package action defines the interface for UI component actions.
Package action defines the interface for UI component actions.
Package albumart provides terminal-based album cover rendering using Kitty or Sixel graphics protocols.
Package albumart provides terminal-based album cover rendering using Kitty or Sixel graphics protocols.
Package confirm provides a yes/no confirmation popup component.
Package confirm provides a yes/no confirmation popup component.
Package cursor provides a reusable cursor component for scrollable lists.
Package cursor provides a reusable cursor component for scrollable lists.
Package downloads provides the Downloads view for monitoring slskd downloads.
Package downloads provides the Downloads view for monitoring slskd downloads.
Package export provides the export popup UI.
Package export provides the export popup UI.
internal/ui/headerbar/headerbar.go
internal/ui/headerbar/headerbar.go
Package helpbindings provides a scrollable popup for displaying keybindings.
Package helpbindings provides a scrollable popup for displaying keybindings.
Package jobbar displays long-running job progress at the bottom of the screen.
Package jobbar displays long-running job progress at the bottom of the screen.
Package lastfmauth provides a Last.fm account linking popup.
Package lastfmauth provides a Last.fm account linking popup.
Package layout provides pure functions for UI dimension calculations.
Package layout provides pure functions for UI dimension calculations.
Package librarybrowser provides a 3-column library browser (Artists, Albums, Tracks) with a contextual description panel.
Package librarybrowser provides a 3-column library browser (Artists, Albums, Tracks) with a contextual description panel.
Package librarysources provides a popup for managing library source paths.
Package librarysources provides a popup for managing library source paths.
Package list provides a generic scrollable list component.
Package list provides a generic scrollable list component.
Package lyrics provides a synchronized lyrics popup display.
Package lyrics provides a synchronized lyrics popup display.
Package render provides text rendering utilities for TUI components.
Package render provides text rendering utilities for TUI components.
Package scanreport provides a popup component for displaying library scan results.
Package scanreport provides a popup component for displaying library scan results.
Package similarartists provides a popup for discovering similar artists.
Package similarartists provides a popup for discovering similar artists.
Package statepopup provides a generic state machine framework for multi-phase popups.
Package statepopup provides a generic state machine framework for multi-phase popups.
Package testutil provides common testing utilities for UI components.
Package testutil provides common testing utilities for UI components.
Package textinput provides a simple text input popup component.
Package textinput provides a simple text input popup component.

Jump to

Keyboard shortcuts

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