Documentation
¶
Index ¶
- Constants
- func ContentLineCount(content string) int
- func Footer(width int, hints []HintPair) string
- func FooterHints(hints []HintPair) string
- func FormatPercent(percent float64) string
- func HRule(width int) string
- func KV(label, value string) string
- func KVBlock(pairs []KVPair) string
- func KVBold(label, value string) string
- func KVMuted(label, value string) string
- func ProgressBar(percent float64, width int) string
- func ProgressBarWithLabel(percent float64, width int, label string) string
- func Section(title string, width int) string
- func SectionWithKV(title string, width int, pairs []KVPair) string
- func Sparkline(data []float64, width int, color color.Color) string
- func StateTag(state string) string
- func StateTagWidth(state string) int
- func TitledPanel(title, content string, width int) string
- func TitledPanelHeight(title, content string, width, minLines int) string
- type Alignment
- type CancelMsg
- type ConfirmData
- type ConfirmDialog
- type ConfirmKind
- type ConfirmMsg
- type HintPair
- type KVPair
- type ResourceTable
- func (t *ResourceTable) ClearFilter()
- func (t *ResourceTable) CursorBottom()
- func (t *ResourceTable) CursorDown()
- func (t *ResourceTable) CursorTop()
- func (t *ResourceTable) CursorUp()
- func (t *ResourceTable) FilteredCount() int
- func (t *ResourceTable) SelectedIndex() int
- func (t *ResourceTable) SelectedRow() *TableRow
- func (t *ResourceTable) SetFilter(query string)
- func (t *ResourceTable) SetRows(rows []TableRow)
- func (t *ResourceTable) SetSize(w, h int)
- func (t *ResourceTable) Sort(col int, ascending bool)
- func (t ResourceTable) View() string
- func (t *ResourceTable) Width() int
- type ResourceTableConfig
- type TableColumn
- type TableRow
- type Toast
- type ToastExpiredMsg
- type ToastTone
Constants ¶
const ToastDuration = 2500 * time.Millisecond
ToastDuration is how long a toast notification is displayed before expiring.
Variables ¶
This section is empty.
Functions ¶
func ContentLineCount ¶
ContentLineCount counts the number of lines in a content string (for computing equal panel heights).
func FooterHints ¶
FooterHints renders a row of key-description pairs separated by two spaces.
key desc key desc key desc
func FormatPercent ¶
FormatPercent formats a percentage with color based on threshold. Values >= 66.7% are rendered in green; below that in yellow.
func KV ¶
KV renders a single key-value line: label in Slate500 (fixed width 16) and value in Slate200.
func ProgressBar ¶
ProgressBar renders a progress bar with the given percentage (0-1) using bubbles/progress. Filled blocks use theme.Slate200 and empty blocks use theme.Slate700.
func ProgressBarWithLabel ¶
ProgressBarWithLabel renders a progress bar with a text label centered inside it.
func Section ¶
Section renders a section heading (bold Slate100) followed by a red accent rule of the given width.
func SectionWithKV ¶
SectionWithKV renders a Section heading followed by a KVBlock.
func Sparkline ¶
Sparkline renders a mini bar chart from a slice of float64 values. Each value maps to one character column. The color parameter controls the foreground color of the bars. Width limits the number of data points shown (uses the rightmost values if data exceeds width).
func StateTag ¶
StateTag renders an inline state tag like │active│ with color-mapped borders. The Unicode box-drawing character │ is used as the border, not a lipgloss rounded border (which would produce a 3-line box).
func StateTagWidth ¶
StateTagWidth returns the display width of a state tag for column alignment. The width is the label length plus 2 for the border characters.
func TitledPanel ¶
TitledPanel renders content inside a bordered box with the title embedded in the top border line:
┌─ TITLE ──────────────────┐ │ content line 1 │ │ content line 2 │ └───────────────────────────┘
The width parameter is the outer width including border characters. Content lines are left-padded with 1 space and right-padded to fill.
func TitledPanelHeight ¶
TitledPanelHeight is like TitledPanel but enforces a minimum number of content lines (minLines). If the content has fewer lines, empty lines are appended so that all panels in a row can be the same height. Pass 0 for minLines to auto-size (no padding).
Types ¶
type ConfirmData ¶
type ConfirmData struct {
Title string
Body string
Danger bool // if true, red border instead of neutral
Fee string // e.g., "0.0142 AKT"
Account string // e.g., "akash1abc...def"
}
ConfirmData holds the content displayed inside the confirmation dialog.
type ConfirmDialog ¶
type ConfirmDialog struct {
// contains filtered or unexported fields
}
ConfirmDialog is a modal overlay for destructive actions.
func NewConfirmDialog ¶
func NewConfirmDialog(kind ConfirmKind, data ConfirmData) ConfirmDialog
NewConfirmDialog creates a confirmation dialog for the given kind and data.
func (ConfirmDialog) Active ¶
func (d ConfirmDialog) Active() bool
Active returns whether the dialog is currently visible.
func (*ConfirmDialog) Open ¶
func (d *ConfirmDialog) Open()
Open makes the dialog visible and resets focus state.
func (*ConfirmDialog) SetSize ¶
func (d *ConfirmDialog) SetSize(w, h int)
SetSize updates the available terminal dimensions for centering.
func (*ConfirmDialog) Update ¶
func (d *ConfirmDialog) Update(msg tea.Msg) tea.Cmd
Update handles key events while the dialog is active.
func (ConfirmDialog) View ¶
func (d ConfirmDialog) View() string
View renders the dialog as a centered overlay.
type ConfirmKind ¶
type ConfirmKind int
ConfirmKind identifies the type of destructive action being confirmed.
const ( ConfirmClose ConfirmKind = iota // close deployment ConfirmVote // governance vote ConfirmDelegate // delegate tokens ConfirmUnbond // unbond tokens ConfirmRedelegate // redelegate tokens )
type ConfirmMsg ¶
type ConfirmMsg struct {
Kind ConfirmKind
VoteOption string // "yes","no","abstain","veto" — only for vote variant
Amount string // for delegate/unbond variants
}
ConfirmMsg is sent when the user confirms the action.
type HintPair ¶
HintPair represents a single key-description pair in the footer. When Accent is true the key is rendered in AccentRed instead of the default Slate400.
type ResourceTable ¶
type ResourceTable struct {
// contains filtered or unexported fields
}
ResourceTable is a reusable table component for list views. It renders fixed-width columns using fmt.Sprintf("%-*s") to prevent row wrapping.
func NewResourceTable ¶
func NewResourceTable(cfg ResourceTableConfig) ResourceTable
NewResourceTable creates a new ResourceTable with the given configuration.
func (*ResourceTable) ClearFilter ¶
func (t *ResourceTable) ClearFilter()
ClearFilter removes the active filter.
func (*ResourceTable) CursorBottom ¶
func (t *ResourceTable) CursorBottom()
CursorBottom moves the cursor to the last row.
func (*ResourceTable) CursorDown ¶
func (t *ResourceTable) CursorDown()
CursorDown moves the cursor down one row.
func (*ResourceTable) CursorTop ¶
func (t *ResourceTable) CursorTop()
CursorTop moves the cursor to the first row.
func (*ResourceTable) CursorUp ¶
func (t *ResourceTable) CursorUp()
CursorUp moves the cursor up one row.
func (*ResourceTable) FilteredCount ¶
func (t *ResourceTable) FilteredCount() int
FilteredCount returns the number of visible (filtered) rows.
func (*ResourceTable) SelectedIndex ¶
func (t *ResourceTable) SelectedIndex() int
SelectedIndex returns the current cursor position.
func (*ResourceTable) SelectedRow ¶
func (t *ResourceTable) SelectedRow() *TableRow
SelectedRow returns the currently highlighted row, or nil if empty.
func (*ResourceTable) SetFilter ¶
func (t *ResourceTable) SetFilter(query string)
SetFilter sets a case-insensitive substring filter across all cells.
func (*ResourceTable) SetRows ¶
func (t *ResourceTable) SetRows(rows []TableRow)
SetRows replaces the table rows and rebuilds the filtered/sorted view.
func (*ResourceTable) SetSize ¶
func (t *ResourceTable) SetSize(w, h int)
SetSize updates the available width and height for rendering.
func (*ResourceTable) Sort ¶
func (t *ResourceTable) Sort(col int, ascending bool)
Sort sets the sort column and direction, then re-applies filtering and sorting.
func (ResourceTable) View ¶
func (t ResourceTable) View() string
View renders the table as a string.
func (*ResourceTable) Width ¶
func (t *ResourceTable) Width() int
Width returns the current table width.
type ResourceTableConfig ¶
type ResourceTableConfig struct {
Columns []TableColumn
EmptyText string // shown when no rows
}
ResourceTableConfig configures a ResourceTable.
type TableColumn ¶
type TableColumn struct {
Header string
Width int // character width (0 = fill remaining space)
Align Alignment // left or right alignment
RenderFunc func(value string) string // optional custom cell renderer (e.g., state tags)
}
TableColumn defines a single column in a ResourceTable.
type Toast ¶
Toast is a transient notification that auto-dismisses after toastDuration.
type ToastExpiredMsg ¶
type ToastExpiredMsg struct{}
ToastExpiredMsg is sent when a toast should be removed.