ui

package
v1.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxTableRows = 20

MaxTableRows is the maximum number of rows visible in the continue table.

Variables

This section is empty.

Functions

func CenterView added in v1.4.0

func CenterView(width, height int, content string) string

CenterView wraps content in centered placement within the available area.

func ContinueTableWidth added in v1.9.0

func ContinueTableWidth() int

ContinueTableWidth is the natural width of the saved-games table.

func CursorStyle added in v1.5.0

func CursorStyle() lipgloss.Style

CursorStyle returns the style for the active cursor indicator in menus.

func DebugStyle

func DebugStyle() lipgloss.Style

DebugStyle returns the style for the debug overlay border.

func DimItemStyle added in v1.5.0

func DimItemStyle() lipgloss.Style

DimItemStyle returns the style for descriptions and secondary text.

func ErrorNoticeStyle added in v1.9.0

func ErrorNoticeStyle() lipgloss.Style

ErrorNoticeStyle returns the style for user-visible error notices.

func FooterHint added in v1.5.0

func FooterHint() lipgloss.Style

FooterHint returns the style for navigation hint text.

func FormatStatus

func FormatStatus(s store.GameStatus) string

FormatStatus converts a GameStatus enum to a human-readable display string.

func GeneratingFrame added in v1.5.0

func GeneratingFrame() lipgloss.Style

GeneratingFrame returns the frame style for the generating spinner box.

func HeavyPanel added in v1.5.0

func HeavyPanel(content string) string

HeavyPanel wraps content in a double-border frame, used for the main menu.

func InitCategoryList added in v1.6.0

func InitCategoryList(items []list.Item, title string) list.Model

InitCategoryList creates the category picker list with per-item hover bar colors sourced from the active theme color set.

func InitContinueTable

func InitContinueTable(s *store.Store, height int) (table.Model, []store.GameRecord)

InitContinueTable loads saved games from the store and builds the table widget. Returns the table, the loaded games, and the column definitions.

func InitList

func InitList(items []list.Item, title string) list.Model

InitList creates a styled list widget with the active theme's colors. The list title is hidden because lists are rendered inside Panel frames that provide their own styled title.

func InitThemeList added in v1.5.0

func InitThemeList(items []list.Item, width, height int) list.Model

InitThemeList creates a styled list widget for the theme picker with a fixed-width delegate so the list column doesn't shift as the cursor moves across names of different lengths.

func InitWeeklyTable added in v1.8.0

func InitWeeklyTable(rows []table.Row, height int) table.Model

InitWeeklyTable builds the weekly browser table from pre-rendered rows.

func ListHeight added in v1.4.0

func ListHeight(l list.Model) int

ListHeight returns the minimum height needed to display all items in a single page, avoiding pagination. The bubbles list component has a circular dependency between pagination visibility and PerPage calculation that causes rendering glitches when pages change, so we size the list to prevent pagination entirely when the terminal is tall enough.

func LogoStyle added in v1.5.0

func LogoStyle() lipgloss.Style

LogoStyle returns the style for the ASCII art brand logo.

func MainMenuFrame() lipgloss.Style

MainMenuFrame returns the frame for the main menu.

func MenuAccent() lipgloss.Style

MenuAccent returns the primary accent color from the active theme.

func NormalItemStyle added in v1.5.0

func NormalItemStyle() lipgloss.Style

NormalItemStyle returns the style for non-selected menu item titles.

func Panel added in v1.5.0

func Panel(title, content, footer string) string

Panel wraps content in a bordered frame with a styled title and footer hint. It uses RoundedBorder by default, suitable for sub-menus and secondary views.

func PanelFrame added in v1.5.0

func PanelFrame() lipgloss.Style

PanelFrame returns the rounded-border frame for sub-menus.

func PanelTitle added in v1.5.0

func PanelTitle() lipgloss.Style

PanelTitle returns the style for panel title text.

func RenderStatsBanner added in v1.8.0

func RenderStatsBanner(b stats.ProfileBanner, width int) string

func RenderStatsCard added in v1.8.0

func RenderStatsCard(c stats.Card, titleColor color.Color) string

func RenderStatsCardGrid added in v1.8.0

func RenderStatsCardGrid(cards []stats.Card, width int) string

func SelectedItemStyle added in v1.5.0

func SelectedItemStyle() lipgloss.Style

SelectedItemStyle returns the style for the highlighted menu item title.

func TablePagination added in v1.5.0

func TablePagination(t table.Model) string

TablePagination returns a pagination string like "1-20 of 45" for the continue table, or an empty string if all rows fit on one page.

func UpdateThemeListStyles added in v1.5.0

func UpdateThemeListStyles(l *list.Model)

UpdateThemeListStyles refreshes the delegate colors on an existing theme list so that live-preview theme changes are reflected immediately.

func WeeklyTableWidth added in v1.9.0

func WeeklyTableWidth() int

WeeklyTableWidth is the natural width of the weekly browser table.

Types

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

MainMenu is a custom main menu component with an ASCII art logo and styled item list. It replaces the generic list.Model for the root menu to give the application a game-themed identity.

func NewMainMenu added in v1.5.0

func NewMainMenu(items []MenuItem) MainMenu

NewMainMenu creates a main menu with an ASCII art logo and the given items.

func (m *MainMenu) CursorDown()

CursorDown moves the selection cursor down, wrapping around.

func (m *MainMenu) CursorUp()

CursorUp moves the selection cursor up, wrapping around.

func (m MainMenu) RenderItems() string

RenderItems returns the styled item list shared by View and ViewAsPanel.

func (m MainMenu) Selected() MenuItem
func (m MainMenu) SelectedAction() string
func (m MainMenu) View() string

View renders the main menu as a framed panel with logo and items.

func (m MainMenu) ViewAsPanel(title string) string

ViewAsPanel renders the menu items inside a rounded-border Panel, suitable for submenus that should look visually distinct from the root main menu.

type MenuItem struct {
	ItemTitle string
	Desc      string
	Action    string
}

MenuItem is a simple list.Item implementation for menu entries.

func (i MenuItem) ActionID() string
func (i MenuItem) Description() string
func (i MenuItem) FilterValue() string
func (i MenuItem) Title() string

Jump to

Keyboard shortcuts

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