Documentation
¶
Index ¶
- Variables
- func CenteredLoading(frame, label string, width, height int) string
- func FormatBytesPerSec(v float64) string
- func FormatRate(v float64) string
- func ListenForProgress(ch <-chan ProgressMsg) tea.Cmd
- func NewProgressChannel(total int) chan ProgressMsg
- func RenderSparkline(data []float64, width int) string
- type ClearMsg
- type FetchProgressBar
- func (f FetchProgressBar) Current() int
- func (f FetchProgressBar) IsActive() bool
- func (f *FetchProgressBar) StartListening(ch <-chan ProgressMsg, total int) tea.Cmd
- func (f FetchProgressBar) Total() int
- func (f FetchProgressBar) Update(msg tea.Msg) (FetchProgressBar, tea.Cmd)
- func (f FetchProgressBar) View(width int) string
- type FuzzyMatch
- type FuzzyMatcher
- type JSONContentConfig
- type JSONContentView
- func (jcv *JSONContentView) LineDown(lines int)
- func (jcv *JSONContentView) LineUp(lines int)
- func (jcv *JSONContentView) SetContent(content string)
- func (jcv *JSONContentView) SetDisplayFormat(format string)
- func (jcv *JSONContentView) SetFocused(focused bool)
- func (jcv *JSONContentView) UpdateConfig(config JSONContentConfig)
- func (jcv *JSONContentView) View() string
- func (jcv *JSONContentView) Viewport() *viewport.Model
- type ProgressBarFrameMsg
- type ProgressMsg
- type ResourceSwitchMsg
- type SearchBarModel
- func (sb *SearchBarModel) Blur()
- func (sb *SearchBarModel) ClearError()
- func (sb *SearchBarModel) EnterResourceMode()
- func (sb *SearchBarModel) EnterSearchMode()
- func (sb *SearchBarModel) Focus() tea.Cmd
- func (sb SearchBarModel) Focused() bool
- func (sb *SearchBarModel) GetResourceSuggestions() []string
- func (sb SearchBarModel) Init() tea.Cmd
- func (sb SearchBarModel) IsResourceMode() bool
- func (sb *SearchBarModel) SetError(err string)
- func (sb *SearchBarModel) SetResultCount(count int)
- func (sb *SearchBarModel) SetSearchSuggestions(suggestions []string)
- func (sb *SearchBarModel) SetValue(value string)
- func (sb *SearchBarModel) SetWidth(width int)
- func (sb SearchBarModel) Update(msg tea.Msg) (SearchBarModel, tea.Cmd)
- func (sb SearchBarModel) Value() string
- func (sb SearchBarModel) View() string
- type SearchBarOption
- func WithOnClear(fn func() tea.Msg) SearchBarOption
- func WithOnResourceSwitch(fn func(resource string) tea.Msg) SearchBarOption
- func WithOnSearch(fn func(query string) tea.Msg) SearchBarOption
- func WithPlaceholder(placeholder string) SearchBarOption
- func WithSearchMode(mode SearchMode) SearchBarOption
- func WithSearchSuggestions(suggestions []string) SearchBarOption
- type SearchMode
- type SearchMsg
- type Sparkline
- type Spinner
Constants ¶
This section is empty.
Variables ¶
var ( Subtle = lipgloss.AdaptiveColor{Light: "#D9DCCF", Dark: "#383838"} Highlight = lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "#7D56F4"} Special = lipgloss.AdaptiveColor{Light: "#43BF6D", Dark: "#73F59F"} Info = lipgloss.AdaptiveColor{Light: "#4A90E2", Dark: "#4A90E2"} Warning = lipgloss.AdaptiveColor{Light: "#F5A623", Dark: "#F5A623"} )
Colors
var ( MainPanelStyle = lipgloss.NewStyle(). BorderStyle(RoundedBorder). BorderForeground(Subtle). Padding(1, 1) SidebarPanelStyle = lipgloss.NewStyle(). BorderStyle(RoundedBorder). BorderForeground(Subtle). Padding(1, 2) )
Content panel styles
var ( TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(lipgloss.Color("#1a1a1a")). Padding(0, 1) SubtitleStyle = lipgloss.NewStyle(). Foreground(Special). Bold(true). MarginBottom(1) InfoStyle = lipgloss.NewStyle(). Foreground(Subtle). Italic(true) )
Text styles
var ( StatusStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#FFFFFF")). Background(lipgloss.Color("#3c3c3c")). Padding(0, 1) DocStyle = lipgloss.NewStyle(). Margin(1, 2) )
Common styles
var ( TableStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("240")). Padding(0, 1) Width(30). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("240")). Padding(1, 2) SidebarTitleStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("205")). Bold(true). Align(lipgloss.Center) SidebarContentStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("250")). PaddingTop(1) SearchBarStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("240")). Padding(0, 1) )
Shared component styles
var ( Foreground(lipgloss.Color("#FFFFFF")). Background(Subtle). Padding(0, 1) )
Footer styles
var ( HeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(Highlight). Padding(0, 1). MarginBottom(1) )
Header styles
var (
HighlightColor = lipgloss.Color("205")
)
Custom colors
var (
LayoutStyle = lipgloss.NewStyle().
Padding(1, 2)
)
Main layout styles
var ( ResourceTypeStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#FFFFFF")). Background(Info). Bold(true). Padding(0, 1). MarginRight(1) )
Resource type indicator
var (
RoundedBorder = lipgloss.Border{
Top: "",
Bottom: "",
Left: "",
Right: "",
TopLeft: "",
TopRight: "",
BottomLeft: "",
BottomRight: "",
}
)
Border styles
Functions ¶
func CenteredLoading ¶
CenteredLoading renders a spinner frame and label centered in the given box. When width/height are unknown (<=0) it falls back to a simple left-aligned line.
func FormatBytesPerSec ¶
FormatBytesPerSec formats a bytes-per-second rate with IEC units. A negative value is unknown and renders as an en dash.
func FormatRate ¶
FormatRate formats a plain per-second rate (e.g. messages/s). Negative is unknown.
func ListenForProgress ¶
func ListenForProgress(ch <-chan ProgressMsg) tea.Cmd
ListenForProgress returns a Cmd that blocks until the next ProgressMsg arrives on ch, then delivers it to the Bubble Tea Update loop. Chain this inside your Update handler to receive a continuous stream.
func NewProgressChannel ¶
func NewProgressChannel(total int) chan ProgressMsg
NewProgressChannel creates a properly buffered channel for progress updates.
func RenderSparkline ¶
RenderSparkline renders a series of values as a unicode block sparkline. It keeps at most `width` (rightmost) samples. Negative values are treated as gaps ("unknown", api.RateUnknown) and rendered as spaces. A series with no known values renders as an empty string (callers show a placeholder).
Types ¶
type FetchProgressBar ¶
type FetchProgressBar struct {
// contains filtered or unexported fields
}
FetchProgressBar is a reusable, self-contained animated progress bar component for tracking counted fetch / load operations.
Typical usage:
// 1. Embed in your model:
type Model struct { bar components.FetchProgressBar }
// 2. Start when the operation begins:
ch := components.NewProgressChannel(total)
cmds = append(cmds, model.bar.StartListening(ch, total))
// 3. Forward messages in Update:
model.bar, cmd = model.bar.Update(msg)
// 4. Render in View:
if model.bar.IsActive() { content += model.bar.View(width) }
func NewFetchProgressBar ¶
func NewFetchProgressBar() FetchProgressBar
NewFetchProgressBar creates a FetchProgressBar with a default gradient style.
func (FetchProgressBar) Current ¶
func (f FetchProgressBar) Current() int
Current returns the number of items received so far.
func (FetchProgressBar) IsActive ¶
func (f FetchProgressBar) IsActive() bool
IsActive returns true while an operation is in progress.
func (*FetchProgressBar) StartListening ¶
func (f *FetchProgressBar) StartListening(ch <-chan ProgressMsg, total int) tea.Cmd
StartListening initialises the component for a new operation, stores the progress channel and returns the initial Cmds (reset animation + first listener). Call this once when the fetch begins.
func (FetchProgressBar) Total ¶
func (f FetchProgressBar) Total() int
Total returns the target item count.
func (FetchProgressBar) Update ¶
func (f FetchProgressBar) Update(msg tea.Msg) (FetchProgressBar, tea.Cmd)
Update handles ProgressMsg (progress updates and completion) and progress.FrameMsg (spring animation ticks). Pass all incoming messages to this method from your parent component's Update.
func (FetchProgressBar) View ¶
func (f FetchProgressBar) View(width int) string
View renders the progress bar at the given width. Returns an empty string when the component is not active and has never run.
type FuzzyMatch ¶
FuzzyMatch represents a fuzzy match result
type FuzzyMatcher ¶
type FuzzyMatcher struct {
// contains filtered or unexported fields
}
FuzzyMatcher provides fuzzy matching functionality
func NewFuzzyMatcher ¶
func NewFuzzyMatcher(caseSensitive bool) *FuzzyMatcher
NewFuzzyMatcher creates a new fuzzy matcher
func (*FuzzyMatcher) GetBestMatch ¶
func (fm *FuzzyMatcher) GetBestMatch(query string, candidates []string) string
GetBestMatch returns the best fuzzy match from candidates
func (*FuzzyMatcher) GetMatchedStrings ¶
func (fm *FuzzyMatcher) GetMatchedStrings(query string, candidates []string, maxResults int) []string
GetMatchedStrings returns just the matched strings (without scores)
func (*FuzzyMatcher) Match ¶
func (fm *FuzzyMatcher) Match(query string, candidates []string, maxResults int) []FuzzyMatch
Match performs fuzzy matching on a list of candidates
type JSONContentConfig ¶
type JSONContentConfig struct {
Width int
Height int
Title string
Content string
DisplayFormat string // "raw", "json", "pretty"
ShowLineNumbers bool
Focused bool
}
JSONContentConfig holds configuration for the JSON content viewer
type JSONContentView ¶
type JSONContentView struct {
// contains filtered or unexported fields
}
JSONContentView represents a reusable JSON content viewer component
func NewJSONContentView ¶
func NewJSONContentView(config JSONContentConfig) *JSONContentView
NewJSONContentView creates a new JSON content viewer component
func (*JSONContentView) LineDown ¶
func (jcv *JSONContentView) LineDown(lines int)
LineDown moves the viewport down by the given number of lines
func (*JSONContentView) LineUp ¶
func (jcv *JSONContentView) LineUp(lines int)
LineUp moves the viewport up by the given number of lines
func (*JSONContentView) SetContent ¶
func (jcv *JSONContentView) SetContent(content string)
SetContent updates the content displayed in the viewer
func (*JSONContentView) SetDisplayFormat ¶
func (jcv *JSONContentView) SetDisplayFormat(format string)
SetDisplayFormat updates the display format
func (*JSONContentView) SetFocused ¶
func (jcv *JSONContentView) SetFocused(focused bool)
SetFocused updates the focus state
func (*JSONContentView) UpdateConfig ¶
func (jcv *JSONContentView) UpdateConfig(config JSONContentConfig)
UpdateConfig updates the component configuration
func (*JSONContentView) View ¶
func (jcv *JSONContentView) View() string
View renders the JSON content viewer
func (*JSONContentView) Viewport ¶
func (jcv *JSONContentView) Viewport() *viewport.Model
Viewport returns the underlying viewport for direct manipulation
type ProgressBarFrameMsg ¶
ProgressBarFrameMsg is a re-export of the underlying animation frame message. Callers should forward this type to FetchProgressBar.Update so the spring animation keeps running. This avoids callers importing bubbles/progress directly.
type ProgressMsg ¶
ProgressMsg reports progress of a counted operation. When Done is true the operation has finished; the caller may deliver the final result payload through a separate channel/message.
type ResourceSwitchMsg ¶
type ResourceSwitchMsg struct {
Resource string
}
ResourceSwitchMsg is a message type for resource switching events
type SearchBarModel ¶
type SearchBarModel struct {
core.BaseComponent // Embed base component for common functionality
// contains filtered or unexported fields
}
SearchBarModel represents the search bar component
func NewSearchBar ¶
func NewSearchBar(options ...SearchBarOption) SearchBarModel
NewSearchBar creates a new search bar component
func (*SearchBarModel) Blur ¶
func (sb *SearchBarModel) Blur()
Blur removes focus from the search bar
func (*SearchBarModel) ClearError ¶
func (sb *SearchBarModel) ClearError()
ClearError clears the error message
func (*SearchBarModel) EnterResourceMode ¶
func (sb *SearchBarModel) EnterResourceMode()
EnterResourceMode enters resource switching mode
func (*SearchBarModel) EnterSearchMode ¶
func (sb *SearchBarModel) EnterSearchMode()
EnterSearchMode enters normal search mode
func (*SearchBarModel) Focus ¶
func (sb *SearchBarModel) Focus() tea.Cmd
Focus focuses the search bar
func (SearchBarModel) Focused ¶
func (sb SearchBarModel) Focused() bool
Focused returns whether the search bar is focused
func (*SearchBarModel) GetResourceSuggestions ¶
func (sb *SearchBarModel) GetResourceSuggestions() []string
GetResourceSuggestions returns all available resource suggestions
func (SearchBarModel) Init ¶
func (sb SearchBarModel) Init() tea.Cmd
Init initializes the search bar
func (SearchBarModel) IsResourceMode ¶
func (sb SearchBarModel) IsResourceMode() bool
IsResourceMode returns whether the search bar is in resource mode
func (*SearchBarModel) SetError ¶
func (sb *SearchBarModel) SetError(err string)
SetError sets an error message
func (*SearchBarModel) SetResultCount ¶
func (sb *SearchBarModel) SetResultCount(count int)
SetResultCount sets the result count
func (*SearchBarModel) SetSearchSuggestions ¶
func (sb *SearchBarModel) SetSearchSuggestions(suggestions []string)
SetSearchSuggestions updates the suggestions for search mode
func (*SearchBarModel) SetValue ¶
func (sb *SearchBarModel) SetValue(value string)
SetValue sets the value of the search bar
func (*SearchBarModel) SetWidth ¶
func (sb *SearchBarModel) SetWidth(width int)
SetWidth sets the width of the search bar
func (SearchBarModel) Update ¶
func (sb SearchBarModel) Update(msg tea.Msg) (SearchBarModel, tea.Cmd)
Update handles messages for the search bar
func (SearchBarModel) Value ¶
func (sb SearchBarModel) Value() string
Value returns the current value of the search bar
type SearchBarOption ¶
type SearchBarOption func(*SearchBarModel)
SearchBarOption is a function that configures a SearchBarModel
func WithOnClear ¶
func WithOnClear(fn func() tea.Msg) SearchBarOption
WithOnClear sets the callback function for clear
func WithOnResourceSwitch ¶
func WithOnResourceSwitch(fn func(resource string) tea.Msg) SearchBarOption
WithOnResourceSwitch sets the callback function for resource switching
func WithOnSearch ¶
func WithOnSearch(fn func(query string) tea.Msg) SearchBarOption
WithOnSearch sets the callback function for search
func WithPlaceholder ¶
func WithPlaceholder(placeholder string) SearchBarOption
WithPlaceholder sets the placeholder text
func WithSearchMode ¶
func WithSearchMode(mode SearchMode) SearchBarOption
WithSearchMode sets the search mode
func WithSearchSuggestions ¶
func WithSearchSuggestions(suggestions []string) SearchBarOption
WithSearchSuggestions sets the suggestions for search mode
type SearchMode ¶
type SearchMode int
SearchMode represents different search modes
const ( SimpleSearch SearchMode = iota AdvancedSearch RegexSearch ResourceSearch )
type SearchMsg ¶
type SearchMsg struct {
Query string
Mode SearchMode
}
SearchMsg is a message type for search events
type Sparkline ¶
type Sparkline struct {
core.BaseComponent
// contains filtered or unexported fields
}
Sparkline is a reusable component that renders a value series as a sparkline, optionally followed by a min/max/avg summary. Styling is injected from the role-based palette (no hex literals here).
func NewSparkline ¶
NewSparkline builds a Sparkline rendered in the given (role-based) style.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is a thin, reusable wrapper around bubbles/spinner that gives pages a single shared loading-indicator mechanism instead of each page hand-rolling its own spinner state. Use NewSpinner + Tick to start it, forward spinner.TickMsg to Update, and CenteredLoading (or Frame) to render.
func NewSpinner ¶
func NewSpinner() Spinner
NewSpinner returns a Spinner using the standard dot animation.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datatable provides a reusable table component wrapping github.com/charmbracelet/bubbles/table.
|
Package datatable provides a reusable table component wrapping github.com/charmbracelet/bubbles/table. |
|
Package form provides a reusable, typed form model for create/edit flows.
|
Package form provides a reusable, typed form model for create/edit flows. |
|
Package menu provides the filterable overlay list behind the two discovery surfaces the controls spec requires: the command palette (`:`) and the contextual actions menu (`a` / right-click).
|
Package menu provides the filterable overlay list behind the two discovery surfaces the controls spec requires: the command palette (`:`) and the contextual actions menu (`a` / right-click). |
|
Package tabstrip renders a tab bar whose tabs are click and hover targets.
|
Package tabstrip renders a tab bar whose tabs are click and hover targets. |