ui

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorBase    lipgloss.Color
	ColorSurface lipgloss.Color
	ColorText    lipgloss.Color
	ColorSubtext lipgloss.Color
	ColorBlue    lipgloss.Color
	ColorPurple  lipgloss.Color
	ColorGreen   lipgloss.Color
	ColorRed     lipgloss.Color
	ColorYellow  lipgloss.Color
	ColorCyan    lipgloss.Color
	ColorOrange  lipgloss.Color
	ColorWhite   lipgloss.Color
)

Color palette — mutable, set by ApplyTheme.

View Source
var (
	StyleTitle        lipgloss.Style
	StyleActiveTab    lipgloss.Style
	StyleInactiveTab  lipgloss.Style
	StyleFilterPrompt lipgloss.Style
	StyleFilterText   lipgloss.Style
	StyleTableHeader  lipgloss.Style
	StyleSelected     lipgloss.Style
	StyleNormal       lipgloss.Style
	StyleDim          lipgloss.Style
	StyleAdded        lipgloss.Style
	StyleRemoved      lipgloss.Style
	StyleUpgrade      lipgloss.Style
	StyleStatusBar    lipgloss.Style
	StyleDetailKey    lipgloss.Style
	StyleDetailVal    lipgloss.Style
	StyleOverlay      lipgloss.Style
	StyleUpdateBanner lipgloss.Style
	StyleOverlayTitle lipgloss.Style
	StyleBadge        lipgloss.Style
)

Styles — rebuilt by ApplyTheme.

View Source
var Keys = KeyMap{
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
	Filter: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "search"),
	),
	Tab: key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "source"),
	),
	ShiftTab: key.NewBinding(
		key.WithKeys("shift+tab"),
		key.WithHelp("shift+tab", "prev source"),
	),
	Enter: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "detail"),
	),
	Back: key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "back"),
	),
	Snapshot: key.NewBinding(
		key.WithKeys("s"),
		key.WithHelp("s", "snap"),
	),
	Upgrade: key.NewBinding(
		key.WithKeys("u"),
		key.WithHelp("u", "upgrade"),
	),
	Remove: key.NewBinding(
		key.WithKeys("x"),
		key.WithHelp("x", "remove"),
	),
	Diff: key.NewBinding(
		key.WithKeys("d"),
		key.WithHelp("d", "diff"),
	),
	Export: key.NewBinding(
		key.WithKeys("e"),
		key.WithHelp("e", "export"),
	),
	Rescan: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "rescan"),
	),
	Edit: key.NewBinding(
		key.WithKeys("e"),
		key.WithHelp("e", "edit description"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "help"),
	),
	PkgHelp: key.NewBinding(
		key.WithKeys("h"),
		key.WithHelp("h", "help/usage"),
	),
	Deps: key.NewBinding(
		key.WithKeys("d"),
		key.WithHelp("d", "dependencies"),
	),
	SizeFilter: key.NewBinding(
		key.WithKeys("f"),
		key.WithHelp("f", "filter"),
	),
	MultiSelect: key.NewBinding(
		key.WithKeys("m"),
		key.WithHelp("m", "select"),
	),
	Install: key.NewBinding(
		key.WithKeys("i"),
		key.WithHelp("i", "search/install"),
	),
	Theme: key.NewBinding(
		key.WithKeys("t"),
		key.WithHelp("t", "theme"),
	),
	Space: key.NewBinding(
		key.WithKeys(" "),
		key.WithHelp("space", "toggle"),
	),
	PreRelease: key.NewBinding(
		key.WithKeys("p"),
		key.WithHelp("p", "pre-release"),
	),
	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	),
	PageUp: key.NewBinding(
		key.WithKeys("pgup"),
		key.WithHelp("pgup", "page up"),
	),
	PageDown: key.NewBinding(
		key.WithKeys("pgdown"),
		key.WithHelp("pgdn", "page down"),
	),
	HalfPageUp: key.NewBinding(
		key.WithKeys("ctrl+u"),
		key.WithHelp("ctrl+u", "½ page up"),
	),
	HalfPageDn: key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "½ page down"),
	),
	Home: key.NewBinding(
		key.WithKeys("home", "g"),
		key.WithHelp("home", "top"),
	),
	End: key.NewBinding(
		key.WithKeys("end", "G"),
		key.WithHelp("end", "bottom"),
	),
}
View Source
var ManagerColors map[model.Source]lipgloss.Color

ManagerColors maps each source to its badge color.

Functions

func ApplyTheme added in v0.3.3

func ApplyTheme(t config.Theme)

ApplyTheme sets all palette colors, styles, and manager colors from a theme.

func ModalFrame added in v0.3.29

func ModalFrame(opts ModalFrameOpts) string

ModalFrame produces a self-contained bordered rectangle. It owns all border drawing; do NOT wrap its output in StyleOverlay (or any other style that also draws a border — you would get doubling).

func Overlay added in v0.3.29

func Overlay(base, top string, width, height int) string

Overlay composites top over base: base is flat-dimmed, top is centered.

func RenderBadge

func RenderBadge(source model.Source) string

RenderBadge returns a styled pill for a package source (used in detail view).

func RenderBadgeInline

func RenderBadgeInline(source model.Source) string

RenderBadgeInline returns a colored source name without background (for inline use).

Types

type KeyMap

type KeyMap struct {
	Quit        key.Binding
	Filter      key.Binding
	Tab         key.Binding
	ShiftTab    key.Binding
	Enter       key.Binding
	Back        key.Binding
	Snapshot    key.Binding
	Upgrade     key.Binding
	Remove      key.Binding
	Diff        key.Binding
	Export      key.Binding
	Rescan      key.Binding
	Edit        key.Binding
	Help        key.Binding
	PkgHelp     key.Binding
	Deps        key.Binding
	SizeFilter  key.Binding
	MultiSelect key.Binding
	Install     key.Binding
	Theme       key.Binding
	Space       key.Binding
	PreRelease  key.Binding
	Up          key.Binding
	Down        key.Binding
	PageUp      key.Binding
	PageDown    key.Binding
	HalfPageUp  key.Binding
	HalfPageDn  key.Binding
	Home        key.Binding
	End         key.Binding
}

type ModalFrameOpts added in v0.3.29

type ModalFrameOpts struct {
	Title  string
	Body   string
	Footer string
	Width  int
}

ModalFrameOpts is the structural input for every modal. Pure string I/O.

type ModalType added in v0.3.29

type ModalType int

ModalType identifies which modal is currently open. ModalNone means no modal.

const (
	// ModalNone indicates no modal is currently open.
	ModalNone ModalType = iota
	// ModalHelp shows the keybindings reference.
	ModalHelp
	// ModalExport is the format-picker (Text / JSON) for exporting the package list.
	ModalExport
	// ModalDeps shows the dependency list of the currently-selected package.
	ModalDeps
	// ModalPkgHelp shows the output of `<pkg> --help` for the current package.
	ModalPkgHelp
	// ModalTheme is the theme picker with live preview.
	ModalTheme
	// ModalConfirmUpgrade confirms an upgrade action, optionally capturing sudo password.
	ModalConfirmUpgrade
	// ModalConfirmRemove confirms a remove action, optionally with deps selector + sudo password.
	ModalConfirmRemove
	// ModalConfirmBatch confirms a batch operation on multi-selected packages.
	ModalConfirmBatch
)

type Model

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

func NewModel

func NewModel(version string) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

Jump to

Keyboard shortcuts

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