ui

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StyleError     lipgloss.Style
	StyleWarn      lipgloss.Style
	StyleInfo      lipgloss.Style
	StyleDebug     lipgloss.Style
	StyleFatal     lipgloss.Style
	StyleBorder    lipgloss.Style
	StyleStatusBar lipgloss.Style
	StyleQueryBar  lipgloss.Style
	StyleHighlight lipgloss.Style
	StyleDim       lipgloss.Style
	StyleTitle     lipgloss.Style
	StyleMatch     lipgloss.Style
	StyleHistBar   lipgloss.Style
	StyleHistError lipgloss.Style
	StyleHistLabel lipgloss.Style
)

Style variables (referenced by other UI files).

View Source
var DarkTheme = Theme{
	Red:     lipgloss.Color("#FF5555"),
	Orange:  lipgloss.Color("#FFB86C"),
	Cyan:    lipgloss.Color("#8BE9FD"),
	Gray:    lipgloss.Color("#6272A4"),
	Green:   lipgloss.Color("#50FA7B"),
	Purple:  lipgloss.Color("#BD93F9"),
	White:   lipgloss.Color("#F8F8F2"),
	Bg:      lipgloss.Color("#44475A"),
	DarkBg:  lipgloss.Color("#282A36"),
	MatchBg: lipgloss.Color("#F1FA8C"),
	MatchFg: lipgloss.Color("#282A36"),
}

DarkTheme is the default Dracula-inspired dark palette.

View Source
var LightTheme = Theme{
	Red:            lipgloss.Color("#D32F2F"),
	Orange:         lipgloss.Color("#E65100"),
	Cyan:           lipgloss.Color("#00838F"),
	Gray:           lipgloss.Color("#757575"),
	Green:          lipgloss.Color("#2E7D32"),
	Purple:         lipgloss.Color("#7B1FA2"),
	White:          lipgloss.Color("#212121"),
	Bg:             lipgloss.Color("#E0E0E0"),
	DarkBg:         lipgloss.Color("#FAFAFA"),
	MatchBg:        lipgloss.Color("#FFF176"),
	MatchFg:        lipgloss.Color("#212121"),
	FillBackground: true,
}

LightTheme is a light palette with dark text on light backgrounds.

View Source
var StyleBase lipgloss.Style

StyleBase is the base style — empty for dark theme, has background for light. Use StyleBase.Copy() when creating inline styles in rendering code.

Functions

func ApplyTheme added in v0.6.2

func ApplyTheme(t Theme)

ApplyTheme sets all package-level color and style variables from the given theme.

func LevelStyle

func LevelStyle(level string) lipgloss.Style

LevelStyle returns the appropriate style for a log level.

func RenderAppBackground added in v0.6.2

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

RenderAppBackground pads content to fill the viewport when the theme requires it. For dark theme, returns content unchanged.

Types

type Completer added in v0.6.0

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

Completer manages inline auto-completion state for the query bar.

func (*Completer) Current added in v0.6.0

func (c *Completer) Current() string

Current returns the full text of the current candidate, or "".

func (*Completer) GhostSuffix added in v0.6.0

func (c *Completer) GhostSuffix() string

GhostSuffix returns the dimmed text to append after the cursor.

func (*Completer) HasCandidates added in v0.6.0

func (c *Completer) HasCandidates() bool

HasCandidates returns true if there are active completions.

func (*Completer) Next added in v0.6.0

func (c *Completer) Next()

Next cycles to the next candidate.

func (*Completer) Reset added in v0.6.0

func (c *Completer) Reset()

Reset clears all completion state.

type DetailView

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

DetailView renders a full-screen overlay showing all fields of a record.

func NewDetailView

func NewDetailView() DetailView

NewDetailView creates a new detail view.

func (*DetailView) EnterPickMode added in v0.9.0

func (d *DetailView) EnterPickMode(items []trace.IDField)

EnterPickMode shows a selection list of trace ID fields.

func (*DetailView) ExitPickMode added in v0.9.0

func (d *DetailView) ExitPickMode()

ExitPickMode returns to normal detail view.

func (*DetailView) IsTreeMode added in v1.1.0

func (d *DetailView) IsTreeMode() bool

IsTreeMode returns true if the detail view is showing a JSON tree.

func (*DetailView) PickDown added in v0.9.0

func (d *DetailView) PickDown()

PickDown moves the pick cursor down.

func (*DetailView) PickSelected added in v0.9.0

func (d *DetailView) PickSelected() trace.IDField

PickSelected returns the currently selected trace ID field.

func (*DetailView) PickUp added in v0.9.0

func (d *DetailView) PickUp()

PickUp moves the pick cursor up.

func (*DetailView) SelectedDotPath added in v1.1.0

func (d *DetailView) SelectedDotPath() string

SelectedDotPath returns the dot path of the currently selected tree line.

func (*DetailView) SetHighlights added in v0.6.0

func (d *DetailView) SetHighlights(h []HighlightTerm)

SetHighlights sets the terms to highlight in the detail view.

func (*DetailView) SetRecord

func (d *DetailView) SetRecord(r *parser.Record)

SetRecord sets the record to display.

func (*DetailView) SetSize

func (d *DetailView) SetSize(w, h int)

SetSize updates the overlay dimensions.

func (*DetailView) TreeCollapse added in v1.1.0

func (d *DetailView) TreeCollapse()

TreeCollapse collapses the selected node or moves cursor to parent.

func (*DetailView) TreeDown added in v1.1.0

func (d *DetailView) TreeDown()

TreeDown moves the tree cursor down.

func (*DetailView) TreeExpand added in v1.1.0

func (d *DetailView) TreeExpand()

TreeExpand expands the selected node.

func (*DetailView) TreeToggle added in v1.1.0

func (d *DetailView) TreeToggle()

TreeToggle toggles expand/collapse on the selected node.

func (*DetailView) TreeUp added in v1.1.0

func (d *DetailView) TreeUp()

TreeUp moves the tree cursor up.

func (DetailView) View

func (d DetailView) View() string

View renders the detail overlay.

type Focus

type Focus int

Focus tracks which panel has focus.

const (
	FocusLogView Focus = iota
	FocusQueryBar
	FocusHistogram
)

type HighlightTerm added in v0.6.0

type HighlightTerm struct {
	Text    string         // plain text (case-insensitive match)
	Pattern *regexp.Regexp // compiled regex (for field~"pattern" queries)
	Field   string         // if non-empty, only highlight within this field
}

HighlightTerm represents a search term to highlight in log output.

func ExtractHighlightTerms added in v0.6.0

func ExtractHighlightTerms(node *query.Node) []HighlightTerm

ExtractHighlightTerms walks the query AST and collects terms for highlighting.

type Histogram

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

Histogram renders a vertical time-based bar chart.

func NewHistogram

func NewHistogram() Histogram

NewHistogram creates a new histogram.

func (*Histogram) ScrollDown

func (h *Histogram) ScrollDown()

ScrollDown moves the histogram cursor down.

func (*Histogram) ScrollUp

func (h *Histogram) ScrollUp()

ScrollUp moves the histogram cursor up.

func (*Histogram) SelectedBucket

func (h *Histogram) SelectedBucket() *index.HistogramBucket

SelectedBucket returns the currently focused bucket, or nil.

func (*Histogram) SetBuckets

func (h *Histogram) SetBuckets(buckets []index.HistogramBucket)

SetBuckets updates the histogram data.

func (*Histogram) SetFocused

func (h *Histogram) SetFocused(f bool)

SetFocused sets focus state.

func (*Histogram) SetSize

func (h *Histogram) SetSize(w, he int)

SetSize updates the histogram dimensions.

func (*Histogram) View

func (h *Histogram) View() string

View renders the histogram.

type KeyMap

type KeyMap struct {
	Up             key.Binding
	Down           key.Binding
	PageUp         key.Binding
	PageDown       key.Binding
	Home           key.Binding
	End            key.Binding
	Left           key.Binding
	Right          key.Binding
	Search         key.Binding
	Enter          key.Binding
	Escape         key.Binding
	Tab            key.Binding
	Quit           key.Binding
	Copy           key.Binding
	CopyPath       key.Binding
	Save           key.Binding
	Trace          key.Binding
	TraceClear     key.Binding
	Pattern        key.Binding
	BookmarkToggle key.Binding
	BookmarkNext   key.Binding
	BookmarkFilter key.Binding
}

KeyMap defines all keybindings.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings.

type LogView

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

LogView renders the scrollable log lines panel.

func NewLogView

func NewLogView() LogView

NewLogView creates a new log view.

func (*LogView) GoToEnd

func (lv *LogView) GoToEnd()

GoToEnd jumps to the last record.

func (*LogView) GoToStart

func (lv *LogView) GoToStart()

GoToStart jumps to the first record.

func (*LogView) ScrollDown

func (lv *LogView) ScrollDown(n int)

ScrollDown moves the cursor down.

func (*LogView) ScrollUp

func (lv *LogView) ScrollUp(n int)

ScrollUp moves the cursor up.

func (*LogView) SelectedRecordIndex

func (lv *LogView) SelectedRecordIndex() int

SelectedRecordIndex returns the index of the currently selected record, or -1 if nothing is selected.

func (*LogView) SetBookmarks added in v1.0.0

func (lv *LogView) SetBookmarks(bm map[int]bool)

SetBookmarks sets the bookmark map for gutter rendering.

func (*LogView) SetColumns added in v0.6.2

func (lv *LogView) SetColumns(cols []string)

SetColumns sets the column names for table rendering mode.

func (*LogView) SetHighlights added in v0.6.0

func (lv *LogView) SetHighlights(h []HighlightTerm)

SetHighlights sets the terms to highlight in log output.

func (*LogView) SetResults

func (lv *LogView) SetResults(records []parser.Record, results []int)

SetResults updates the filtered results.

func (*LogView) SetSize

func (lv *LogView) SetSize(w, h int)

SetSize updates the viewport dimensions.

func (*LogView) SetTraceOrigin added in v0.9.0

func (lv *LogView) SetTraceOrigin(idx int)

SetTraceOrigin sets the record index that originated a trace filter. Pass -1 to clear.

func (*LogView) View

func (lv *LogView) View() string

View renders the log view.

type Model

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

Model is the main bubbletea model.

func NewModel

func NewModel(idx *index.Index, filename, fileSize string) Model

NewModel creates a new app model.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (*Model) SetAliases added in v0.8.0

func (m *Model) SetAliases(reg *alias.Registry)

SetAliases sets the alias registry for query expansion and autocomplete.

func (*Model) SetColumns added in v0.6.2

func (m *Model) SetColumns(cols []string)

SetColumns sets the column names for column mode display.

func (*Model) SetFollowReader added in v0.2.0

func (m *Model) SetFollowReader(fr *input.FollowReader)

SetFollowReader enables follow mode for tailing a file.

func (*Model) SetHistory added in v0.6.2

func (m *Model) SetHistory(entries []string, path string)

SetHistory loads persistent history entries and sets the history file path.

func (*Model) SetTraceFields added in v0.9.0

func (m *Model) SetTraceFields(fields []string)

SetTraceFields sets the list of field names to use for trace ID detection.

func (*Model) SetViews added in v1.1.0

func (m *Model) SetViews(views []SavedView)

SetViews sets the saved views for quick switching with digit keys.

func (Model) Update

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

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type PatternView added in v1.0.0

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

PatternView renders the cluster list in pattern mode.

func NewPatternView added in v1.0.0

func NewPatternView() PatternView

NewPatternView creates a new pattern view.

func (*PatternView) GoToEnd added in v1.0.0

func (pv *PatternView) GoToEnd()

GoToEnd jumps to the last cluster.

func (*PatternView) GoToStart added in v1.0.0

func (pv *PatternView) GoToStart()

GoToStart jumps to the first cluster.

func (*PatternView) ScrollDown added in v1.0.0

func (pv *PatternView) ScrollDown(n int)

ScrollDown moves the cursor down.

func (*PatternView) ScrollUp added in v1.0.0

func (pv *PatternView) ScrollUp(n int)

ScrollUp moves the cursor up.

func (*PatternView) SelectedCluster added in v1.0.0

func (pv *PatternView) SelectedCluster() *pattern.Cluster

SelectedCluster returns the cluster under the cursor, or nil.

func (*PatternView) SetClusters added in v1.0.0

func (pv *PatternView) SetClusters(clusters []pattern.Cluster, total int)

SetClusters updates the cluster data.

func (*PatternView) SetSize added in v1.0.0

func (pv *PatternView) SetSize(w, h int)

SetSize updates the viewport dimensions.

func (*PatternView) View added in v1.0.0

func (pv *PatternView) View() string

View renders the pattern view.

type QueryBar

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

QueryBar wraps a text input for filter queries with history and auto-complete.

func NewQueryBar

func NewQueryBar() QueryBar

NewQueryBar creates a new query bar.

func (*QueryBar) AcceptCompletion added in v0.6.0

func (qb *QueryBar) AcceptCompletion() bool

AcceptCompletion applies the current completion candidate to the input. Returns true if a completion was applied.

func (*QueryBar) Blur

func (qb *QueryBar) Blur()

Blur removes focus from the query bar.

func (*QueryBar) CycleCompletion added in v0.6.0

func (qb *QueryBar) CycleCompletion()

CycleCompletion advances to the next completion candidate without accepting.

func (*QueryBar) Focus

func (qb *QueryBar) Focus()

Focus gives focus to the query bar.

func (*QueryBar) Focused

func (qb *QueryBar) Focused() bool

Focused returns whether the query bar has focus.

func (*QueryBar) History added in v0.6.2

func (qb *QueryBar) History() []string

History returns the current history entries.

func (*QueryBar) HistoryDown added in v0.3.0

func (qb *QueryBar) HistoryDown() bool

HistoryDown loads the next history entry. Returns true if handled.

func (*QueryBar) HistoryUp added in v0.3.0

func (qb *QueryBar) HistoryUp() bool

HistoryUp loads the previous history entry. Returns true if handled.

func (*QueryBar) PushHistory added in v0.3.0

func (qb *QueryBar) PushHistory(q string)

PushHistory adds a query to the history (deduplicates consecutive entries).

func (*QueryBar) SetAliases added in v0.8.0

func (qb *QueryBar) SetAliases(reg *alias.Registry)

SetAliases sets the alias registry for autocomplete.

func (*QueryBar) SetError

func (qb *QueryBar) SetError(msg string)

SetError sets the error message.

func (*QueryBar) SetHistory added in v0.6.2

func (qb *QueryBar) SetHistory(entries []string)

SetHistory replaces the internal history slice (used for loading persistent history).

func (*QueryBar) SetValue

func (qb *QueryBar) SetValue(v string)

SetValue sets the query text.

func (*QueryBar) SetWidth

func (qb *QueryBar) SetWidth(w int)

SetWidth updates the query bar width.

func (*QueryBar) TextInput

func (qb *QueryBar) TextInput() *textinput.Model

TextInput returns the underlying textinput model for update handling.

func (*QueryBar) UpdateCompletions added in v0.6.0

func (qb *QueryBar) UpdateCompletions(idx *index.Index)

UpdateCompletions recomputes completion candidates based on the current input.

func (*QueryBar) Value

func (qb *QueryBar) Value() string

Value returns the current query text.

func (*QueryBar) View

func (qb *QueryBar) View() string

View renders the query bar.

type SavedView added in v1.1.0

type SavedView struct {
	Name    string
	Query   string
	Columns []string
}

SavedView represents a named saved view from config.

type StatusBar

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

StatusBar renders the bottom status line.

func NewStatusBar

func NewStatusBar() StatusBar

NewStatusBar creates a new status bar.

func (*StatusBar) SetSize

func (sb *StatusBar) SetSize(w int)

SetSize updates the status bar width.

func (*StatusBar) Update

func (sb *StatusBar) Update(matches, total int, qt time.Duration, filename, fileSize string)

Update refreshes status bar data.

func (*StatusBar) View

func (sb *StatusBar) View() string

View renders the status bar.

type Theme added in v0.6.2

type Theme struct {
	Red            lipgloss.Color
	Orange         lipgloss.Color
	Cyan           lipgloss.Color
	Gray           lipgloss.Color
	Green          lipgloss.Color
	Purple         lipgloss.Color
	White          lipgloss.Color
	Bg             lipgloss.Color
	DarkBg         lipgloss.Color
	MatchBg        lipgloss.Color
	MatchFg        lipgloss.Color
	FillBackground bool // if true, paint the viewport with DarkBg
}

Theme holds all colors used throughout the UI.

func DetectTheme added in v0.6.2

func DetectTheme() Theme

DetectTheme returns LightTheme or DarkTheme based on the terminal background.

Jump to

Keyboard shortcuts

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