tui

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SearchPageSize = 10

SearchPageSize mirrors the CLI picker's displayPageSize (cmd/lmm/install.go).

Variables

This section is empty.

Functions

This section is empty.

Types

type DataProvider

type DataProvider interface {
	// Overview returns the dashboard summary and installed-mod rows from a
	// single underlying fetch.
	Overview(ctx context.Context) (Summary, []ModItem, error)
	Profiles(ctx context.Context) ([]ProfileItem, error)
	// Sources lists the game's configured source IDs, sorted; index 0 is the
	// default (mirrors the CLI's resolveSource).
	Sources() []string
	Search(ctx context.Context, source, query string, page int) (SearchPage, error)
}

DataProvider is the narrow, read-only boundary between the TUI and app data. Implementations must be safe to call from a Bubble Tea command goroutine.

func NewCoreProvider

func NewCoreProvider(svc *core.Service, game *domain.Game, profileName string) DataProvider

NewCoreProvider returns a DataProvider backed by the real app service for one game/profile pair.

func NewPrototypeProvider

func NewPrototypeProvider() DataProvider

NewPrototypeProvider returns the side-effect-free demo DataProvider used by --prototype mode and tests.

type KeyMap

type KeyMap struct {
	Quit          key.Binding
	Help          key.Binding
	NextScreen    key.Binding
	PrevScreen    key.Binding
	Up            key.Binding
	Down          key.Binding
	Search        key.Binding
	SearchScreen  key.Binding
	Dashboard     key.Binding
	InstalledMods key.Binding
	Profiles      key.Binding
	Select        key.Binding
	Submit        key.Binding
	Blur          key.Binding
	NextPage      key.Binding
	PrevPage      key.Binding
	CycleSource   key.Binding
}

KeyMap documents the TUI keyboard contract.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the shared key bindings shown in help and used by tests.

type Layout

type Layout string

Layout describes the major panel arrangement for a theme.

const (
	LayoutPartySheet         Layout = "party-sheet"
	LayoutMonochromeTerminal Layout = "monochrome-terminal"
	LayoutCommander          Layout = "commander"
	LayoutCrtStack           Layout = "crt-stack"
)

type ModItem

type ModItem struct {
	Name            string
	Author          string
	Version         string
	Source          string
	Status          string
	Summary         string
	Downloads       int64
	Endorsements    int64
	HasEndorsements bool
}

ModItem is one renderable mod row.

type Model

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

Model is the root Bubble Tea model for the lmm TUI.

func NewModel

func NewModel(options Options) (Model, error)

NewModel creates the TUI model backed by the given DataProvider.

func NewPrototypeModel

func NewPrototypeModel(options Options) (Model, error)

NewPrototypeModel creates a side-effect-free TUI model backed by fake data.

func (Model) CurrentScreen

func (m Model) CurrentScreen() Screen

CurrentScreen exposes the selected screen for tests.

func (Model) HelpVisible

func (m Model) HelpVisible() bool

HelpVisible exposes help overlay state for tests.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Layout

func (m Model) Layout() Layout

Layout exposes the active layout for tests and future visual selection UI.

func (Model) SelectedIndex

func (m Model) SelectedIndex(screen Screen) int

SelectedIndex exposes the selected row for tests.

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Options

type Options struct {
	Theme    string
	Provider DataProvider
	// Ctx seeds Model.ctx; see that field for why the context is stored
	// rather than threaded as a parameter.
	Ctx context.Context
}

Options configures the TUI app.

type ProfileItem

type ProfileItem struct {
	Name     string
	Active   bool
	ModCount int
}

ProfileItem is one renderable profile row.

type Screen

type Screen int

Screen identifies a top-level TUI view.

const (
	ScreenDashboard Screen = iota
	ScreenInstalledMods
	ScreenSearch
	ScreenProfiles
)

func (Screen) String

func (s Screen) String() string

String returns a human-readable screen name.

type SearchPage added in v1.5.0

type SearchPage struct {
	Results    []ModItem
	Query      string
	Source     string
	Page       int // 0-based
	PageSize   int
	TotalCount int // 0 if the source doesn't report totals
}

SearchPage is one page of search results for one source/query.

type Summary

type Summary struct {
	GameName    string
	ProfileName string
	Installed   int
	Enabled     int
	Updates     int // -1 = unknown (no update check has run)
	Conflicts   int // -1 = unknown
}

Summary is the dashboard header data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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