Documentation
¶
Overview ¶
Package tui implements the Bubble Tea terminal user interface for doomsday.
Index ¶
- func ViewName(v View) string
- type AppKeyMap
- type AppModel
- func (m AppModel) ActiveView() View
- func (m AppModel) Height() int
- func (m AppModel) Init() tea.Cmd
- func (m AppModel) Styles() Styles
- func (m *AppModel) SwitchView(v View)
- func (m AppModel) Theme() Theme
- func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m AppModel) View() string
- func (m AppModel) Width() int
- type AppOption
- func WithDissolveActiveFunc(fn func() bool) AppOption
- func WithModalActiveFunc(fn func() bool) AppOption
- func WithStatusMessageFunc(fn func() string) AppOption
- func WithTheme(theme Theme) AppOption
- func WithThemeMode(mode ThemeMode) AppOption
- func WithToolbarFunc(fn func() string) AppOption
- func WithViewInitFunc(fn func() tea.Cmd) AppOption
- func WithViewRenderFunc(fn func(View, int, int) string) AppOption
- func WithViewUpdateFunc(fn func(View, tea.Msg) tea.Cmd) AppOption
- type ColorPalette
- type DashboardKeyMap
- type NavigationKeyMap
- type SnapshotKeyMap
- type Styles
- type Theme
- type ThemeMode
- type View
- type ViewModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppKeyMap ¶
type AppKeyMap struct {
// Actions
Help key.Binding
Quit key.Binding
Back key.Binding
Enter key.Binding
Refresh key.Binding
}
AppKeyMap defines the global keybindings for the application shell.
func DefaultAppKeyMap ¶
func DefaultAppKeyMap() AppKeyMap
DefaultAppKeyMap returns the default application-level key bindings.
type AppModel ¶
type AppModel struct {
// contains filtered or unexported fields
}
AppModel is the root Bubble Tea model for the doomsday TUI.
func (AppModel) ActiveView ¶
ActiveView returns the currently active view.
func (*AppModel) SwitchView ¶
SwitchView changes the active view programmatically.
type AppOption ¶
type AppOption func(*AppModel)
AppOption is a functional option for configuring the App model.
func WithDissolveActiveFunc ¶
WithDissolveActiveFunc sets a function that returns true during dissolve animation.
func WithModalActiveFunc ¶
WithModalActiveFunc sets a function that returns true when a modal overlay is active. When active, global keybindings (quit, view switching) are suppressed.
func WithStatusMessageFunc ¶
WithStatusMessageFunc sets a function that returns a transient status message to display in the status bar.
func WithThemeMode ¶
WithThemeMode sets the theme mode for the app.
func WithToolbarFunc ¶
WithToolbarFunc sets the function that returns the context-sensitive toolbar.
func WithViewInitFunc ¶
WithViewInitFunc sets the function called during Init to initialize views.
func WithViewRenderFunc ¶
WithViewRenderFunc sets the function used to render view content.
type ColorPalette ¶
type ColorPalette struct {
// Primary brand colors
Primary lipgloss.Color
Secondary lipgloss.Color
Accent lipgloss.Color
// Status colors
StatusOK lipgloss.Color
StatusWarning lipgloss.Color
StatusError lipgloss.Color
// Text colors
TextPrimary lipgloss.Color
TextSecondary lipgloss.Color
TextMuted lipgloss.Color
TextInverse lipgloss.Color
// Surface colors
Surface lipgloss.Color
SurfaceAlt lipgloss.Color
SurfaceBright lipgloss.Color
Background lipgloss.Color
// Border colors
Border lipgloss.Color
BorderActive lipgloss.Color
BorderMuted lipgloss.Color
// Special purpose
Highlight lipgloss.Color
Selection lipgloss.Color
// Progress bar gradient
ProgressStart lipgloss.Color
ProgressEnd lipgloss.Color
}
ColorPalette holds all colors used throughout the TUI.
func DarkPalette ¶
func DarkPalette() ColorPalette
DarkPalette returns the dark theme color palette. Apocalyptic aesthetic: deep reds, ambers, muted greens on dark surfaces.
func LightPalette ¶
func LightPalette() ColorPalette
LightPalette returns the light theme color palette.
type DashboardKeyMap ¶
DashboardKeyMap defines keybindings for the dashboard/drill-down view.
func DefaultDashboardKeyMap ¶
func DefaultDashboardKeyMap() DashboardKeyMap
DefaultDashboardKeyMap returns default dashboard view bindings.
func (DashboardKeyMap) FullHelp ¶
func (k DashboardKeyMap) FullHelp() [][]key.Binding
FullHelp returns dashboard full help bindings.
func (DashboardKeyMap) ShortHelp ¶
func (k DashboardKeyMap) ShortHelp() []key.Binding
ShortHelp returns dashboard short help bindings.
type NavigationKeyMap ¶
type NavigationKeyMap struct {
}
NavigationKeyMap provides vim-style up/down navigation.
func DefaultNavigationKeyMap ¶
func DefaultNavigationKeyMap() NavigationKeyMap
DefaultNavigationKeyMap returns standard vim-style navigation bindings.
func (NavigationKeyMap) FullHelp ¶
func (k NavigationKeyMap) FullHelp() [][]key.Binding
FullHelp returns bindings for full help.
func (NavigationKeyMap) ShortHelp ¶
func (k NavigationKeyMap) ShortHelp() []key.Binding
ShortHelp returns bindings for short help.
type SnapshotKeyMap ¶
type SnapshotKeyMap struct {
Browse key.Binding
Restore key.Binding
Diff key.Binding
Filter key.Binding
}
SnapshotKeyMap defines keybindings for the snapshot browser view.
func DefaultSnapshotKeyMap ¶
func DefaultSnapshotKeyMap() SnapshotKeyMap
DefaultSnapshotKeyMap returns default snapshot view bindings.
func (SnapshotKeyMap) FullHelp ¶
func (k SnapshotKeyMap) FullHelp() [][]key.Binding
FullHelp returns snapshot full help bindings.
func (SnapshotKeyMap) ShortHelp ¶
func (k SnapshotKeyMap) ShortHelp() []key.Binding
ShortHelp returns snapshot short help bindings.
type Styles ¶
type Styles struct {
// Layout
App lipgloss.Style
TabBar lipgloss.Style
TabActive lipgloss.Style
TabItem lipgloss.Style
Content lipgloss.Style
StatusBar lipgloss.Style
// Typography
Title lipgloss.Style
Subtitle lipgloss.Style
Heading lipgloss.Style
Body lipgloss.Style
Muted lipgloss.Style
Bold lipgloss.Style
Code lipgloss.Style
Whimsy lipgloss.Style
// Status indicators
StatusOK lipgloss.Style
StatusWarning lipgloss.Style
StatusError lipgloss.Style
StatusBadge lipgloss.Style
// Cards and containers
Card lipgloss.Style
CardActive lipgloss.Style
CardHeader lipgloss.Style
Panel lipgloss.Style
PanelBorder lipgloss.Style
// Data display
Key lipgloss.Style
Value lipgloss.Style
Label lipgloss.Style
Number lipgloss.Style
Timestamp lipgloss.Style
Path lipgloss.Style
BlobID lipgloss.Style
// Interactive
Selected lipgloss.Style
Cursor lipgloss.Style
Highlight lipgloss.Style
// Table
TableHeader lipgloss.Style
TableCell lipgloss.Style
TableSelected lipgloss.Style
// Backup config items
ConfigName lipgloss.Style
ConfigOK lipgloss.Style
ConfigWarning lipgloss.Style
ConfigError lipgloss.Style
// Progress
ProgressLabel lipgloss.Style
ProgressValue lipgloss.Style
ProgressSpeed lipgloss.Style
ProgressETA lipgloss.Style
// Dividers
Divider lipgloss.Style
// Logo / brand
Logo lipgloss.Style
LogoAccent lipgloss.Style
// Help
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
HelpSep lipgloss.Style
}
Styles holds all lipgloss styles used throughout the TUI. Built from a Theme so they adapt to dark/light mode.
func (Styles) RenderDivider ¶
Divider returns a horizontal divider string of the given width.
func (Styles) StatusText ¶
StatusText returns styled text with status coloring.
type Theme ¶
type Theme struct {
Mode ThemeMode
Colors ColorPalette
IsDark bool
Name string
}
Theme holds the active color palette and metadata.
type ThemeMode ¶
type ThemeMode int
ThemeMode represents the terminal color scheme.
func ParseThemeMode ¶
ParseThemeMode converts a config string to a ThemeMode.