Documentation
¶
Overview ¶
Package styles provides reusable lipgloss-based TUI components.
Package styles provides reusable lipgloss-based TUI components.
Index ¶
- Constants
- func DefaultDarkPalette() config.ColorPalette
- func HistoryTableColumns() []table.Column
- func NewDefaultSpinner(theme *Theme) spinner.Model
- func NewHistoryList(theme *Theme, items []HistoryItem, width, height int) list.Model
- func NewSearchInput(theme *Theme) textinput.Model
- func NewStyledHelp(theme *Theme) help.Model
- func NewStyledInput(theme *Theme, placeholder string) textinput.Model
- func NewStyledSpinner(theme *Theme, spinnerType SpinnerType) spinner.Model
- func NewStyledTable(theme *Theme, columns []table.Column, rows []table.Row, width, height int) table.Model
- func NewURLInput(theme *Theme) textinput.Model
- func RelativeTime(tm time.Time) string
- func StatsTableColumns() []table.Column
- func TimeCategoryLabel(cat TimeCategory) string
- type AboutRenderer
- type CleanupKeyMap
- type CleanupModel
- type CleanupRange
- type CleanupRangeInfo
- type CleanupResultMsg
- type ConfirmKeyMap
- type ConfirmModel
- type ConfirmResult
- type ConfirmResultMsg
- type DmenuKeyMap
- type DoctorMediaReport
- type DoctorRenderer
- type DoctorReport
- type DoctorRuntimeCheck
- type DoctorRuntimeReport
- type DomainStatsRow
- type HistoryDelegate
- type HistoryItem
- type HistoryKeyMap
- type KeyMap
- type LoadingModel
- type PurgeItem
- type PurgeKeyMap
- type PurgeModel
- func (m PurgeModel) Done() bool
- func (m PurgeModel) Init() tea.Cmd
- func (m PurgeModel) SelectedCount() int
- func (m PurgeModel) SelectedSessionIDs() []entity.SessionID
- func (m PurgeModel) SelectedSize() int64
- func (m PurgeModel) SelectedTypes() []entity.PurgeTargetType
- func (m PurgeModel) SessionsEnabled() bool
- func (m *PurgeModel) ToggleAllSessions()
- func (m PurgeModel) Update(msg tea.Msg) (PurgeModel, tea.Cmd)
- func (m PurgeModel) View() string
- type SimpleDelegate
- type SimpleItem
- type SpinnerType
- type TabsModel
- type Theme
- func (t *Theme) AccentBadge(text string) string
- func (t *Theme) DomainBadge(domain string) string
- func (t *Theme) InputBox(input string, focused bool) string
- func (t *Theme) MutedBadge(text string) string
- func (t *Theme) Renderer() *lipgloss.Renderer
- func (t *Theme) StatusBadge(text string, fg, bg lipgloss.Color) string
- func (t *Theme) TimeBadge(tm time.Time) string
- func (t *Theme) VisitBadge(count int) string
- type TimeCategory
Constants ¶
const ( IconGlobe = "\uf0ac" // browser/web IconVersion = "\uf02b" // tag IconGitBranch = "\ue725" // git branch IconCalendar = "\uf073" // calendar IconCode = "\uf121" // code IconGithub = "\uf09b" // github IconHeart = "\uf004" // heart IconGo = "\ue627" // go gopher IconArrow = "\uf061" // arrow right // Doctor / diagnostics IconDoctor = "\uf0f1" // stethoscope IconCheck = "\uf00c" // check IconX = "\uf00d" // x IconWarning = "\uf071" // warning IconInfo = "\uf05a" // info IconWrench = "\uf0ad" // wrench IconPackage = "\uf187" // archive/package IconVideo = "\uf03d" // video camera // Purge / filesystem IconTrash = "\uf1f8" // trash IconFolder = "\uf07b" // folder IconConfig = "\ue615" // config IconDatabase = "\uf1c0" // database IconFilter = "\uf0b0" // filter IconDesktop = "\uf108" // desktop IconImage = "\uf1c5" // image file IconCache = "\uf49e" // cache IconLogs = "\uf0f6" // file-text // Checkboxes IconCheckboxEmpty = "\uf096" // unchecked IconCheckboxChecked = "\uf046" // checked // UI IconCursor = "\uf054" // chevron-right // Sessions / browser IconSession = "\uf2d2" // window IconSessionStack = "\uf24d" // clone/stack IconTab = "\uf0ce" // table IconPane = "\uf0db" // columns IconTree = "\uf1bb" // tree IconClock = "\uf017" // clock IconPlay = "\uf04b" // play (running) IconStop = "\uf04d" // stop (exited) IconRestore = "\uf0e2" // rotate-left (restore) IconExpand = "\uf065" // expand IconCollapse = "\uf066" // compress )
Nerd Font icons (requires a Nerd Font to display correctly)
Variables ¶
This section is empty.
Functions ¶
func DefaultDarkPalette ¶
func DefaultDarkPalette() config.ColorPalette
DefaultDarkPalette returns hardcoded dark theme colors.
func HistoryTableColumns ¶
HistoryTableColumns returns columns for history list table.
func NewDefaultSpinner ¶
NewDefaultSpinner creates the default themed spinner.
func NewHistoryList ¶
func NewHistoryList(theme *Theme, items []HistoryItem, width, height int) list.Model
NewHistoryList creates a themed list for history items.
func NewSearchInput ¶
NewSearchInput creates a search-specific input.
func NewStyledHelp ¶
NewStyledHelp creates a themed help model.
func NewStyledInput ¶
NewStyledInput creates a themed text input.
func NewStyledSpinner ¶
func NewStyledSpinner(theme *Theme, spinnerType SpinnerType) spinner.Model
NewStyledSpinner creates a themed spinner.
func NewStyledTable ¶
func NewStyledTable(theme *Theme, columns []table.Column, rows []table.Row, width, height int) table.Model
NewStyledTable creates a themed table model.
func NewURLInput ¶
NewURLInput creates a URL input field.
func RelativeTime ¶
RelativeTime formats a time as a human-readable relative string.
func StatsTableColumns ¶
StatsTableColumns returns columns for domain stats table.
func TimeCategoryLabel ¶
func TimeCategoryLabel(cat TimeCategory) string
TimeCategoryLabel returns the display label for a time category.
Types ¶
type AboutRenderer ¶
type AboutRenderer struct {
// contains filtered or unexported fields
}
AboutRenderer renders build info in fastfetch style.
func NewAboutRenderer ¶
func NewAboutRenderer(theme *Theme) *AboutRenderer
NewAboutRenderer creates a new about renderer with the given theme.
type CleanupKeyMap ¶
type CleanupKeyMap struct {
Up key.Binding
Down key.Binding
Confirm key.Binding
Cancel key.Binding
}
CleanupKeyMap defines keybindings for cleanup modal.
func DefaultCleanupKeyMap ¶
func DefaultCleanupKeyMap() CleanupKeyMap
DefaultCleanupKeyMap returns default keybindings.
type CleanupModel ¶
type CleanupModel struct {
Ranges []CleanupRangeInfo
Selected int
Confirmed bool
Canceled bool
// contains filtered or unexported fields
}
CleanupModel is a cleanup range selection modal.
func NewCleanup ¶
func NewCleanup(theme *Theme) CleanupModel
NewCleanup creates a new cleanup modal.
func (CleanupModel) Done ¶
func (m CleanupModel) Done() bool
Done returns true if the modal is complete.
func (CleanupModel) SelectedRange ¶
func (m CleanupModel) SelectedRange() CleanupRange
SelectedRange returns the selected cleanup range.
func (CleanupModel) Update ¶
func (m CleanupModel) Update(msg tea.Msg) (CleanupModel, tea.Cmd)
Update implements tea.Model.
type CleanupRange ¶
type CleanupRange int
CleanupRange represents a time range for history cleanup.
const ( CleanupRangeLastHour CleanupRange = iota CleanupRangeLast24Hours CleanupRangeLast7Days CleanupRangeLast30Days CleanupRangeAll )
func (CleanupRange) CutoffTime ¶
func (r CleanupRange) CutoffTime() time.Time
CutoffTime returns the cutoff time for this range.
type CleanupRangeInfo ¶
type CleanupRangeInfo struct {
Range CleanupRange
Label string
Description string
}
CleanupRangeInfo holds display info for a cleanup range.
func AllCleanupRanges ¶
func AllCleanupRanges() []CleanupRangeInfo
AllCleanupRanges returns all available cleanup ranges.
type CleanupResultMsg ¶
type CleanupResultMsg struct {
Confirmed bool
Range CleanupRange
}
CleanupResultMsg is sent when cleanup modal completes.
type ConfirmKeyMap ¶
type ConfirmKeyMap struct {
Yes key.Binding
No key.Binding
Left key.Binding
Right key.Binding
Confirm key.Binding
Cancel key.Binding
}
ConfirmKeyMap defines keybindings for the confirm dialog.
func DefaultConfirmKeyMap ¶
func DefaultConfirmKeyMap() ConfirmKeyMap
DefaultConfirmKeyMap returns the default keybindings.
type ConfirmModel ¶
type ConfirmModel struct {
Message string
Yes bool // Current selection
Confirmed bool // User pressed enter
Canceled bool // User pressed escape
// contains filtered or unexported fields
}
ConfirmModel is a yes/no confirmation dialog.
func NewConfirm ¶
func NewConfirm(theme *Theme, message string) ConfirmModel
NewConfirm creates a new confirmation dialog.
func (ConfirmModel) Done ¶
func (m ConfirmModel) Done() bool
Done returns true if the dialog is complete.
func (ConfirmModel) Result ¶
func (m ConfirmModel) Result() bool
Result returns true if user confirmed "Yes".
func (ConfirmModel) Update ¶
func (m ConfirmModel) Update(msg tea.Msg) (ConfirmModel, tea.Cmd)
Update implements tea.Model.
type ConfirmResult ¶
ConfirmResult wraps the confirm dialog result for parent models.
type ConfirmResultMsg ¶
type ConfirmResultMsg ConfirmResult
ConfirmResultMsg is sent when the confirm dialog completes.
type DmenuKeyMap ¶
type DmenuKeyMap struct {
}
DmenuKeyMap defines keybindings for dmenu browser.
func DefaultDmenuKeyMap ¶
func DefaultDmenuKeyMap() DmenuKeyMap
DefaultDmenuKeyMap returns the default dmenu keybindings.
func (DmenuKeyMap) FullHelp ¶
func (k DmenuKeyMap) FullHelp() [][]key.Binding
FullHelp returns keybindings for expanded help.
func (DmenuKeyMap) ShortHelp ¶
func (k DmenuKeyMap) ShortHelp() []key.Binding
ShortHelp returns keybindings to show in compact help.
type DoctorMediaReport ¶
type DoctorMediaReport struct {
GStreamerAvailable bool
HWAccelAvailable bool
AV1HWAvailable bool
HasVAPlugin bool
HasVAAPIPlugin bool
HasNVCodecPlugin bool
AV1Decoders []string
H264Decoders []string
H265Decoders []string
VP9Decoders []string
VAAPIAvailable bool
VAAPIDriver string
VAAPIVersion string
Warnings []string
}
type DoctorRenderer ¶
type DoctorRenderer struct {
// contains filtered or unexported fields
}
func NewDoctorRenderer ¶
func NewDoctorRenderer(theme *Theme) *DoctorRenderer
func (*DoctorRenderer) Render ¶
func (r *DoctorRenderer) Render(report DoctorReport) string
type DoctorReport ¶
type DoctorReport struct {
OverallOK bool
Runtime DoctorRuntimeReport
Media *DoctorMediaReport
}
type DoctorRuntimeCheck ¶
type DoctorRuntimeReport ¶
type DoctorRuntimeReport struct {
Prefix string
OK bool
Checks []DoctorRuntimeCheck
}
type DomainStatsRow ¶
DomainStatsRow converts domain stats to table row.
func (DomainStatsRow) ToRow ¶
func (d DomainStatsRow) ToRow() table.Row
ToRow converts to table.Row.
type HistoryDelegate ¶
HistoryDelegate renders history items with theme styling.
func NewHistoryDelegate ¶
func NewHistoryDelegate(theme *Theme) HistoryDelegate
NewHistoryDelegate creates a themed history list delegate.
func (HistoryDelegate) Height ¶
func (d HistoryDelegate) Height() int
Height returns the height of each item.
func (HistoryDelegate) Spacing ¶
func (d HistoryDelegate) Spacing() int
Spacing returns the spacing between items.
type HistoryItem ¶
type HistoryItem struct {
ID int64
URL string
Title string
Domain string
VisitCount int
LastVisited time.Time
}
HistoryItem represents a history entry for the list.
func (HistoryItem) DescriptionValue ¶
func (i HistoryItem) DescriptionValue() string
Description implements list.DefaultItem.
func (HistoryItem) FilterValue ¶
func (i HistoryItem) FilterValue() string
FilterValue implements list.Item.
func (HistoryItem) TitleValue ¶
func (i HistoryItem) TitleValue() string
Title implements list.DefaultItem.
type HistoryKeyMap ¶
type HistoryKeyMap struct {
Up key.Binding
Down key.Binding
Tab1 key.Binding
Tab2 key.Binding
Tab3 key.Binding
Tab4 key.Binding
NextTab key.Binding
PrevTab key.Binding
Search key.Binding
Open key.Binding
Delete key.Binding
DeleteDomain key.Binding
Cleanup key.Binding
Filter key.Binding
Help key.Binding
Quit key.Binding
}
HistoryKeyMap defines keybindings for history browser.
func DefaultHistoryKeyMap ¶
func DefaultHistoryKeyMap() HistoryKeyMap
DefaultHistoryKeyMap returns the default history keybindings.
func (HistoryKeyMap) FullHelp ¶
func (k HistoryKeyMap) FullHelp() [][]key.Binding
FullHelp returns keybindings for expanded help.
func (HistoryKeyMap) ShortHelp ¶
func (k HistoryKeyMap) ShortHelp() []key.Binding
ShortHelp returns keybindings to show in compact help.
type LoadingModel ¶
type LoadingModel struct {
Spinner spinner.Model
Message string
// contains filtered or unexported fields
}
LoadingModel wraps a spinner with a message.
func NewLoading ¶
func NewLoading(theme *Theme, message string) LoadingModel
NewLoading creates a loading indicator with message.
type PurgeItem ¶
type PurgeItem struct {
entity.PurgeTarget
Selected bool
}
PurgeItem wraps entity.PurgeTarget with selection state for the UI.
type PurgeKeyMap ¶
type PurgeKeyMap struct {
Up key.Binding
Down key.Binding
Toggle key.Binding
ToggleAll key.Binding
Confirm key.Binding
Cancel key.Binding
}
PurgeKeyMap defines keybindings for purge modal.
func DefaultPurgeKeyMap ¶
func DefaultPurgeKeyMap() PurgeKeyMap
DefaultPurgeKeyMap returns default keybindings.
type PurgeModel ¶
type PurgeModel struct {
Items []PurgeItem
Sessions []entity.SessionPurgeItem
SessionsSize int64 // Total size of all session snapshots
Cursor int // Flat cursor index across all rows
Confirmed bool
Canceled bool
// contains filtered or unexported fields
}
PurgeModel is the multi-select purge modal with simplified sessions support. Sessions are handled as a single "purge all" option instead of individual selection.
func NewPurge ¶
func NewPurge(theme *Theme, targets []entity.PurgeTarget) PurgeModel
NewPurge creates a new purge modal with the given targets.
func NewPurgeWithSessions ¶ added in v0.21.0
func NewPurgeWithSessions(theme *Theme, targets []entity.PurgeTarget, sessions []entity.SessionPurgeItem, sessionsSize int64) PurgeModel
NewPurgeWithSessions creates a new purge modal with targets and sessions.
func (PurgeModel) Done ¶
func (m PurgeModel) Done() bool
Done returns true if the modal is complete.
func (PurgeModel) SelectedCount ¶
func (m PurgeModel) SelectedCount() int
SelectedCount returns the number of selected items (targets + sessions as 1 if selected).
func (PurgeModel) SelectedSessionIDs ¶ added in v0.21.0
func (m PurgeModel) SelectedSessionIDs() []entity.SessionID
SelectedSessionIDs returns the IDs of all sessions if sessions are selected. Returns nil if Data is selected (sessions are deleted with the database) or if sessions are not selected.
func (PurgeModel) SelectedSize ¶
func (m PurgeModel) SelectedSize() int64
SelectedSize returns the total size of selected items. When Data is selected, includes SessionsSize since DB will be removed.
func (PurgeModel) SelectedTypes ¶
func (m PurgeModel) SelectedTypes() []entity.PurgeTargetType
SelectedTypes returns the selected target types.
func (PurgeModel) SessionsEnabled ¶ added in v0.21.0
func (m PurgeModel) SessionsEnabled() bool
SessionsEnabled returns true if sessions can be selected. Sessions are disabled when Data is selected (database will be removed).
func (*PurgeModel) ToggleAllSessions ¶ added in v0.21.0
func (m *PurgeModel) ToggleAllSessions()
ToggleAllSessions toggles the selection state of all sessions.
func (PurgeModel) Update ¶
func (m PurgeModel) Update(msg tea.Msg) (PurgeModel, tea.Cmd)
Update implements tea.Model.
type SimpleDelegate ¶
type SimpleDelegate struct {
Theme *Theme
}
SimpleDelegate renders simple items.
func (SimpleDelegate) Height ¶
func (d SimpleDelegate) Height() int
Height returns the height of each item.
func (SimpleDelegate) Spacing ¶
func (d SimpleDelegate) Spacing() int
Spacing returns the spacing between items.
type SimpleItem ¶
SimpleItem is a basic list item with title and description.
func (SimpleItem) FilterValue ¶
func (i SimpleItem) FilterValue() string
FilterValue implements list.Item.
type SpinnerType ¶
type SpinnerType int
SpinnerType defines available spinner styles.
const ( SpinnerDots SpinnerType = iota SpinnerLine SpinnerMiniDot SpinnerJump SpinnerPulse SpinnerPoints SpinnerGlobe SpinnerMoon SpinnerMonkey )
type TabsModel ¶
TabsModel represents a horizontal tab bar.
func TimelineTabs ¶
TimelineTabs creates tabs for history timeline view.
func (TabsModel) ViewCompact ¶
ViewCompact renders a compact tab bar without separators.
func (TabsModel) ViewWithCounts ¶
ViewWithCounts renders tabs with item counts.
type Theme ¶
type Theme struct {
// Base colors (from config.ColorPalette)
Background lipgloss.Color
Surface lipgloss.Color
SurfaceVariant lipgloss.Color
Text lipgloss.Color
Muted lipgloss.Color
Accent lipgloss.Color
Border lipgloss.Color
// Additional semantic colors
Error lipgloss.Color
Warning lipgloss.Color
Success lipgloss.Color
// Pre-built styles
Title lipgloss.Style
Subtitle lipgloss.Style
Normal lipgloss.Style
Subtle lipgloss.Style
Highlight lipgloss.Style
ErrorStyle lipgloss.Style
WarningStyle lipgloss.Style
SuccessStyle lipgloss.Style
// Component styles
ActiveTab lipgloss.Style
InactiveTab lipgloss.Style
TabBar lipgloss.Style
ListItem lipgloss.Style
ListItemSelected lipgloss.Style
ListItemTitle lipgloss.Style
ListItemDesc lipgloss.Style
Badge lipgloss.Style
BadgeMuted lipgloss.Style
Input lipgloss.Style
InputFocused lipgloss.Style
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
Box lipgloss.Style
BoxHeader lipgloss.Style
}
Theme holds lipgloss colors and styles derived from config.
func NewThemeFromPalette ¶
func NewThemeFromPalette(p config.ColorPalette) *Theme
NewThemeFromPalette creates a Theme from a ColorPalette.
func (*Theme) AccentBadge ¶
AccentBadge renders a badge with accent color.
func (*Theme) DomainBadge ¶
DomainBadge renders a domain badge.
func (*Theme) MutedBadge ¶
MutedBadge renders a badge with muted colors.
func (*Theme) StatusBadge ¶
StatusBadge renders a status badge with custom colors.
func (*Theme) VisitBadge ¶
VisitBadge renders a visit count badge.
type TimeCategory ¶
type TimeCategory int
TimeCategory returns which timeline category a time belongs to.
const ( TimeCategoryToday TimeCategory = iota TimeCategoryYesterday TimeCategoryThisWeek TimeCategoryOlder )
func GetTimeCategory ¶
func GetTimeCategory(tm time.Time) TimeCategory
GetTimeCategory returns the category for a given time.