Documentation
¶
Index ¶
- Constants
- func CenterView(width, height int, content string) string
- func ContinueTableWidth() int
- func CursorStyle() lipgloss.Style
- func DebugStyle() lipgloss.Style
- func DimItemStyle() lipgloss.Style
- func ErrorNoticeStyle() lipgloss.Style
- func FooterHint() lipgloss.Style
- func FormatStatus(s store.GameStatus) string
- func GeneratingFrame() lipgloss.Style
- func HeavyPanel(content string) string
- func InitCategoryList(items []list.Item, title string) list.Model
- func InitContinueTable(s *store.Store, height int) (table.Model, []store.GameRecord)
- func InitList(items []list.Item, title string) list.Model
- func InitThemeList(items []list.Item, width, height int) list.Model
- func InitWeeklyTable(rows []table.Row, height int) table.Model
- func ListHeight(l list.Model) int
- func LogoStyle() lipgloss.Style
- func MainMenuFrame() lipgloss.Style
- func MenuAccent() lipgloss.Style
- func NormalItemStyle() lipgloss.Style
- func Panel(title, content, footer string) string
- func PanelFrame() lipgloss.Style
- func PanelTitle() lipgloss.Style
- func RenderStatsBanner(b stats.ProfileBanner, width int) string
- func RenderStatsCard(c stats.Card, titleColor color.Color) string
- func RenderStatsCardGrid(cards []stats.Card, width int) string
- func SelectedItemStyle() lipgloss.Style
- func TablePagination(t table.Model) string
- func UpdateThemeListStyles(l *list.Model)
- func WeeklyTableWidth() int
- type MainMenu
- type MenuItem
Constants ¶
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
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
CursorStyle returns the style for the active cursor indicator in menus.
func DebugStyle ¶
DebugStyle returns the style for the debug overlay border.
func DimItemStyle ¶ added in v1.5.0
DimItemStyle returns the style for descriptions and secondary text.
func ErrorNoticeStyle ¶ added in v1.9.0
ErrorNoticeStyle returns the style for user-visible error notices.
func FooterHint ¶ added in v1.5.0
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
GeneratingFrame returns the frame style for the generating spinner box.
func HeavyPanel ¶ added in v1.5.0
HeavyPanel wraps content in a double-border frame, used for the main menu.
func InitCategoryList ¶ added in v1.6.0
InitCategoryList creates the category picker list with per-item hover bar colors sourced from the active theme color set.
func InitContinueTable ¶
InitContinueTable loads saved games from the store and builds the table widget. Returns the table, the loaded games, and the column definitions.
func InitList ¶
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
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
InitWeeklyTable builds the weekly browser table from pre-rendered rows.
func ListHeight ¶ added in v1.4.0
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 MainMenuFrame ¶ added in v1.5.0
MainMenuFrame returns the frame for the main menu.
func MenuAccent ¶
MenuAccent returns the primary accent color from the active theme.
func NormalItemStyle ¶ added in v1.5.0
NormalItemStyle returns the style for non-selected menu item titles.
func Panel ¶ added in v1.5.0
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
PanelFrame returns the rounded-border frame for sub-menus.
func PanelTitle ¶ added in v1.5.0
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 RenderStatsCardGrid ¶ added in v1.8.0
func SelectedItemStyle ¶ added in v1.5.0
SelectedItemStyle returns the style for the highlighted menu item title.
func TablePagination ¶ added in v1.5.0
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
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 ¶ added in v1.5.0
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
NewMainMenu creates a main menu with an ASCII art logo and the given items.
func (*MainMenu) CursorDown ¶ added in v1.5.0
func (m *MainMenu) CursorDown()
CursorDown moves the selection cursor down, wrapping around.
func (*MainMenu) CursorUp ¶ added in v1.5.0
func (m *MainMenu) CursorUp()
CursorUp moves the selection cursor up, wrapping around.
func (MainMenu) RenderItems ¶ added in v1.5.0
RenderItems returns the styled item list shared by View and ViewAsPanel.
func (MainMenu) SelectedAction ¶ added in v1.9.0
func (MainMenu) View ¶ added in v1.5.0
View renders the main menu as a framed panel with logo and items.
func (MainMenu) ViewAsPanel ¶ added in v1.5.0
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 ¶
MenuItem is a simple list.Item implementation for menu entries.