tui

package
v0.0.0-...-67450be Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorPrimary   = lipgloss.Color("#7D56F4")
	ColorSecondary = lipgloss.Color("#04B575")
	ColorMuted     = lipgloss.Color("#626262")
	ColorWarning   = lipgloss.Color("#FFCC00")
	ColorError     = lipgloss.Color("#FF4444")
	ColorHighlight = lipgloss.Color("#FF79C6")
	ColorWhite     = lipgloss.Color("#FFFFFF")
	ColorDim       = lipgloss.Color("#888888")
	ColorBgSelect  = lipgloss.Color("#3B3B5C")

	StyleHeader = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorPrimary).
				PaddingLeft(1)

	StyleTableHeader = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorPrimary)

	StyleTableRowSelected = lipgloss.NewStyle().
							Background(ColorBgSelect).
							Foreground(ColorWhite).
							Bold(true)

	StyleTableBase = lipgloss.NewStyle().
					Foreground(ColorWhite)

	StyleStatusBar = lipgloss.NewStyle().
					Foreground(ColorWhite).
					Background(lipgloss.Color("#333355")).
					PaddingLeft(1).
					PaddingRight(1)

	StyleHelp = lipgloss.NewStyle().
				Foreground(ColorMuted)

	StyleDetailBorder = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(ColorPrimary).
						Padding(1, 2)

	StyleDetailKey = lipgloss.NewStyle().
					Foreground(ColorSecondary).
					Bold(true).
					Width(24)

	StyleDetailValue = lipgloss.NewStyle().
						Foreground(ColorWhite)

	StyleDetailSection = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorHighlight).
						MarginTop(1)

	StyleTitle = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorPrimary).
				Background(lipgloss.Color("#1a1a2e")).
				PaddingLeft(1).
				PaddingRight(1)

	StyleSizeSmall  = lipgloss.NewStyle().Foreground(ColorSecondary)
	StyleSizeMedium = lipgloss.NewStyle().Foreground(ColorWarning)
	StyleSizeLarge  = lipgloss.NewStyle().Foreground(ColorError)

	StyleLinked   = lipgloss.NewStyle().Foreground(ColorSecondary)
	StyleUnlinked = lipgloss.NewStyle().Foreground(ColorDim)
)
View Source
var DefaultKeys = KeyMap{
	Up:        key.NewBinding(key.WithKeys("up", "k"), key.WithHelp("up/k", "up")),
	Down:      key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("dn/j", "down")),
	Enter:     key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "details")),
	Escape:    key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "back")),
	Quit:      key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")),
	Scan:      key.NewBinding(key.WithKeys("s"), key.WithHelp("s", "scan")),
	Refresh:   key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "refresh")),
	Search:    key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "filter")),
	Sort:      key.NewBinding(key.WithKeys("tab"), key.WithHelp("tab", "sort")),
	Help:      key.NewBinding(key.WithKeys("?"), key.WithHelp("?", "help")),
	LinkModel: key.NewBinding(key.WithKeys("l"), key.WithHelp("l", "link")),
	PageUp:    key.NewBinding(key.WithKeys("pgup", "ctrl+u"), key.WithHelp("pgup", "page up")),
	PageDown:  key.NewBinding(key.WithKeys("pgdown", "ctrl+d"), key.WithHelp("pgdn", "page down")),
	Tab:       key.NewBinding(key.WithKeys("tab"), key.WithHelp("tab", "next sort")),
	VRAMTable: key.NewBinding(key.WithKeys("v"), key.WithHelp("v", "vram table")),
}

DefaultKeys defines the default key bindings.

Functions

func RunTUI

func RunTUI(cfg *config.Config, repo *repository.Repository, models []model.ModelInfo, scanOpts scanner.ScanOptions) error

RunTUI launches the bubbletea program.

func SizeStyle

func SizeStyle(sizeBytes int64) lipgloss.Style

SizeStyle returns a color style based on file size in bytes.

Types

type App

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

App is the main bubbletea model.

func NewApp

func NewApp(cfg *config.Config, repo *repository.Repository, models []model.ModelInfo, scanOpts scanner.ScanOptions) *App

NewApp creates the main application.

func (*App) Init

func (a *App) Init() tea.Cmd

func (*App) Update

func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*App) View

func (a *App) View() string

type DetailModel

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

DetailModel displays detailed model information with scrolling.

func NewDetailModel

func NewDetailModel(m *model.ModelInfo, width, height int) DetailModel

NewDetailModel creates a detail view for a model.

func (*DetailModel) SetSize

func (d *DetailModel) SetSize(width, height int)

SetSize updates dimensions.

func (*DetailModel) Update

func (d *DetailModel) Update(msg tea.Msg) tea.Cmd

Update handles input for the detail view.

func (*DetailModel) View

func (d *DetailModel) View() string

View renders the detail view.

type KeyMap

type KeyMap struct {
	Up        key.Binding
	Down      key.Binding
	Enter     key.Binding
	Escape    key.Binding
	Quit      key.Binding
	Scan      key.Binding
	Refresh   key.Binding
	Search    key.Binding
	Sort      key.Binding
	Help      key.Binding
	LinkModel key.Binding
	PageUp    key.Binding
	PageDown  key.Binding
	Tab       key.Binding
	VRAMTable key.Binding
}

KeyMap defines all key bindings for the application.

type TableModel

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

TableModel wraps bubble-table with model data.

func NewTableModel

func NewTableModel(models []model.ModelInfo, width, height int) TableModel

NewTableModel creates a table with columns and initial data.

func (*TableModel) CycleSortColumn

func (t *TableModel) CycleSortColumn()

CycleSortColumn advances to the next sort column.

func (*TableModel) SelectedModel

func (t *TableModel) SelectedModel() *model.ModelInfo

SelectedModel returns the ModelInfo for the currently highlighted row.

func (*TableModel) SetModels

func (t *TableModel) SetModels(models []model.ModelInfo)

SetModels updates the table data.

func (*TableModel) SetSize

func (t *TableModel) SetSize(width, height int)

SetSize updates the table dimensions.

func (*TableModel) SortLabel

func (t *TableModel) SortLabel() string

SortLabel returns the current sort state string.

type ViewState

type ViewState int

ViewState tracks which view is currently active.

const (
	ViewTable ViewState = iota
	ViewDetail
	ViewHelp
)

Jump to

Keyboard shortcuts

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