display

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IconSetSymbols - Unicode symbols.
	IconSetSymbols = IconSet{
		Running: "⏺",
		Success: "✓",
		Error:   "✗",
		Warning: "⚠",
		Info:    "ℹ",
		None:    "⏺",
	}
)

Functions

func NewFileCardRow

func NewFileCardRow(cards ...*FileCard) string

NewFileCardRow renders multiple cards inline with a one-space gap.

Types

type CodeBlock

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

CodeBlock displays source code with line numbers, syntax highlighting, and collapse/expand behavior.

func NewCodeBlock

func NewCodeBlock(opts ...CodeBlockOption) *CodeBlock

func (*CodeBlock) Blur

func (cb *CodeBlock) Blur()

func (*CodeBlock) Collapse

func (cb *CodeBlock) Collapse()

func (*CodeBlock) Expand

func (cb *CodeBlock) Expand()

func (*CodeBlock) Focus

func (cb *CodeBlock) Focus()

func (*CodeBlock) Focused

func (cb *CodeBlock) Focused() bool

func (*CodeBlock) GetSelectionManager

func (cb *CodeBlock) GetSelectionManager() *selection.SelectionManager

GetSelectionManager returns the selection manager for this code block.

func (*CodeBlock) Init

func (cb *CodeBlock) Init() tea.Cmd

func (*CodeBlock) IsExpanded

func (cb *CodeBlock) IsExpanded() bool

func (*CodeBlock) Toggle

func (cb *CodeBlock) Toggle()

func (*CodeBlock) Update

func (cb *CodeBlock) Update(msg tea.Msg) (tui.Component, tea.Cmd)

func (*CodeBlock) View

func (cb *CodeBlock) View() string

type CodeBlockOption

type CodeBlockOption func(*CodeBlock)

CodeBlockOption configures a CodeBlock.

func WithCode

func WithCode(code string) CodeBlockOption

func WithCodeBlockDesignTokens added in v2.11.0

func WithCodeBlockDesignTokens(dt *design.DesignTokens) CodeBlockOption

WithCodeBlockDesignTokens applies design system tokens to the code block.

func WithCodeBlockFilename added in v2.1.0

func WithCodeBlockFilename(filename string) CodeBlockOption

func WithCodeBlockLanguage added in v2.1.0

func WithCodeBlockLanguage(lang SyntaxLanguage) CodeBlockOption

func WithCodeBlockMouseSelection

func WithCodeBlockMouseSelection(enabled bool) CodeBlockOption

func WithCodeFilename

func WithCodeFilename(name string) CodeBlockOption

func WithCodeLines

func WithCodeLines(lines []string) CodeBlockOption

func WithCodeMaxLines

func WithCodeMaxLines(max int) CodeBlockOption

func WithCodeOperation

func WithCodeOperation(op string) CodeBlockOption

func WithCodeSummary

func WithCodeSummary(summary string) CodeBlockOption

func WithExpanded

func WithExpanded(expanded bool) CodeBlockOption

func WithLanguage

func WithLanguage(lang string) CodeBlockOption

func WithPreviewLines

func WithPreviewLines(n int) CodeBlockOption

func WithStartLine

func WithStartLine(line int) CodeBlockOption

type DiffBlock

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

DiffBlock displays code changes with +/- indicators.

func NewDiffBlock

func NewDiffBlock(opts ...DiffBlockOption) *DiffBlock

func NewDiffBlockFromStrings

func NewDiffBlockFromStrings(old, new string, opts ...DiffBlockOption) *DiffBlock

func (*DiffBlock) Blur

func (db *DiffBlock) Blur()

func (*DiffBlock) Collapse

func (db *DiffBlock) Collapse()

func (*DiffBlock) Expand

func (db *DiffBlock) Expand()

func (*DiffBlock) Focus

func (db *DiffBlock) Focus()

func (*DiffBlock) Focused

func (db *DiffBlock) Focused() bool

func (*DiffBlock) GetSelectionManager

func (db *DiffBlock) GetSelectionManager() *selection.SelectionManager

func (*DiffBlock) Init

func (db *DiffBlock) Init() tea.Cmd

func (*DiffBlock) IsExpanded

func (db *DiffBlock) IsExpanded() bool

func (*DiffBlock) Toggle

func (db *DiffBlock) Toggle()

func (*DiffBlock) Update

func (db *DiffBlock) Update(msg tea.Msg) (tui.Component, tea.Cmd)

func (*DiffBlock) View

func (db *DiffBlock) View() string

type DiffBlockOption

type DiffBlockOption func(*DiffBlock)

func WithDiffBlockDesignTokens added in v2.11.0

func WithDiffBlockDesignTokens(dt *design.DesignTokens) DiffBlockOption

WithDiffBlockDesignTokens applies design system tokens to the diff block.

func WithDiffBlockFilename added in v2.3.0

func WithDiffBlockFilename(name string) DiffBlockOption

func WithDiffBlockLanguage added in v2.3.0

func WithDiffBlockLanguage(lang SyntaxLanguage) DiffBlockOption

func WithDiffBlockMouseSelection

func WithDiffBlockMouseSelection(enabled bool) DiffBlockOption

func WithDiffContext

func WithDiffContext(n int) DiffBlockOption

func WithDiffExpanded

func WithDiffExpanded(expanded bool) DiffBlockOption

func WithDiffFilename

func WithDiffFilename(name string) DiffBlockOption

func WithDiffLines

func WithDiffLines(lines []DiffLine) DiffBlockOption

func WithDiffMaxLines

func WithDiffMaxLines(max int) DiffBlockOption

func WithDiffOperation

func WithDiffOperation(op string) DiffBlockOption

func WithDiffSummary

func WithDiffSummary(summary string) DiffBlockOption

type DiffLine

type DiffLine struct {
	Type    DiffType
	Content string
	LineNum int
}

DiffLine represents a single line in a diff.

type DiffType

type DiffType int

DiffType indicates the type of diff line.

const (
	DiffUnchanged DiffType = iota
	DiffAdded
	DiffRemoved
)

type ErrorFrame

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

ErrorFrame displays a bordered error box with a title and message body.

func NewErrorFrame

func NewErrorFrame(title, message string, opts ...ErrorFrameOption) *ErrorFrame

NewErrorFrame creates a new ErrorFrame component.

func (*ErrorFrame) Blur

func (e *ErrorFrame) Blur()

Blur marks the component as unfocused.

func (*ErrorFrame) Focus

func (e *ErrorFrame) Focus()

Focus marks the component as focused.

func (*ErrorFrame) Focused

func (e *ErrorFrame) Focused() bool

Focused returns whether the component is focused.

func (*ErrorFrame) Init

func (e *ErrorFrame) Init() tea.Cmd

Init initializes the error frame.

func (*ErrorFrame) SetMessage

func (e *ErrorFrame) SetMessage(s string)

SetMessage updates the frame message.

func (*ErrorFrame) SetTitle

func (e *ErrorFrame) SetTitle(s string)

SetTitle updates the frame title.

func (*ErrorFrame) Update

func (e *ErrorFrame) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*ErrorFrame) View

func (e *ErrorFrame) View() string

View renders the error frame.

type ErrorFrameOption

type ErrorFrameOption func(*ErrorFrame)

ErrorFrameOption configures an ErrorFrame.

func WithErrorFrameDesignTokens

func WithErrorFrameDesignTokens(tokens *design.DesignTokens) ErrorFrameOption

WithErrorFrameDesignTokens applies design tokens to the error frame.

func WithErrorFrameTheme

func WithErrorFrameTheme(theme string) ErrorFrameOption

WithErrorFrameTheme applies a named design-system theme.

func WithErrorFrameWidth

func WithErrorFrameWidth(width int) ErrorFrameOption

WithErrorFrameWidth sets a fixed content width for the error frame. If width is 0, the frame auto-sizes to content.

type FileCard

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

FileCard displays a compact filename badge with diff stats.

func NewFileCard

func NewFileCard(filename string, additions, deletions int, opts ...FileCardOption) *FileCard

NewFileCard creates a new file card.

func (*FileCard) Blur

func (c *FileCard) Blur()

Blur marks the component as unfocused.

func (*FileCard) Focus

func (c *FileCard) Focus()

Focus marks the component as focused.

func (*FileCard) Focused

func (c *FileCard) Focused() bool

Focused reports whether the component is focused.

func (*FileCard) Init

func (c *FileCard) Init() tea.Cmd

Init initializes the component.

func (*FileCard) SetAdditions

func (c *FileCard) SetAdditions(n int)

SetAdditions updates the added-line count.

func (*FileCard) SetDeletions

func (c *FileCard) SetDeletions(n int)

SetDeletions updates the removed-line count.

func (*FileCard) SetFilename

func (c *FileCard) SetFilename(s string)

SetFilename updates the filename.

func (*FileCard) Update

func (c *FileCard) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles Bubble Tea messages.

func (*FileCard) View

func (c *FileCard) View() string

View renders the file card.

type FileCardOption

type FileCardOption func(*FileCard)

FileCardOption configures a FileCard.

func WithFileCardDesignTokens

func WithFileCardDesignTokens(tokens *design.DesignTokens) FileCardOption

WithFileCardDesignTokens applies design-system tokens to a file card.

func WithFileCardTheme

func WithFileCardTheme(theme string) FileCardOption

WithFileCardTheme applies a named design-system theme.

type Highlighter added in v2.1.0

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

Highlighter is a simple regex-based syntax highlighter for terminal output.

func NewHighlighter added in v2.1.0

func NewHighlighter(lang SyntaxLanguage) *Highlighter

NewHighlighter creates a language-specific regex highlighter.

func (*Highlighter) HighlightLine added in v2.1.0

func (h *Highlighter) HighlightLine(line string) string

HighlightLine applies syntax highlighting to a single line.

func (*Highlighter) HighlightLines added in v2.1.0

func (h *Highlighter) HighlightLines(lines []string) []string

HighlightLines highlights multiple lines.

type IconSet

type IconSet struct {
	Running string
	Success string
	Error   string
	Warning string
	Info    string
	None    string
}

IconSet defines icons for different statuses.

type StatCard

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

StatCard displays a single metric with title, value, change indicator, and optional sparkline trend visualization.

func NewStatCard

func NewStatCard(opts ...StatCardOption) *StatCard

NewStatCard creates a new stat card with the given configuration options.

func (*StatCard) Blur

func (s *StatCard) Blur()

Blur is called when this component loses focus.

func (*StatCard) Deselect

func (s *StatCard) Deselect()

Deselect marks the card as not selected.

func (*StatCard) Focus

func (s *StatCard) Focus()

Focus is called when this component receives focus.

func (*StatCard) Focused

func (s *StatCard) Focused() bool

Focused returns whether this component is currently focused.

func (*StatCard) Init

func (s *StatCard) Init() tea.Cmd

Init initializes the stat card.

func (*StatCard) IsSelected

func (s *StatCard) IsSelected() bool

IsSelected returns whether this card is selected.

func (*StatCard) Select

func (s *StatCard) Select()

Select marks the card as selected (for drill-down).

func (*StatCard) Update

func (s *StatCard) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles Bubble Tea messages.

func (*StatCard) View

func (s *StatCard) View() string

View renders the stat card.

type StatCardOption

type StatCardOption func(*StatCard)

StatCardOption configures a StatCard.

func WithChange

func WithChange(change int, changePct float64) StatCardOption

WithChange sets the change value and percentage.

func WithColor

func WithColor(color string) StatCardOption

WithColor sets the accent color.

func WithSubtitle

func WithSubtitle(subtitle string) StatCardOption

WithSubtitle sets the subtitle/description.

func WithTitle

func WithTitle(title string) StatCardOption

WithTitle sets the card title.

func WithTrend

func WithTrend(trend []float64) StatCardOption

WithTrend sets the sparkline trend data.

func WithTrendColor

func WithTrendColor(color string) StatCardOption

WithTrendColor sets the trend line color.

func WithValue

func WithValue(value string) StatCardOption

WithValue sets the main value to display.

type SyntaxLanguage added in v2.1.0

type SyntaxLanguage string

SyntaxLanguage identifies the source language used for highlighting.

const (
	SyntaxLanguageGo         SyntaxLanguage = "Go"
	SyntaxLanguageJavaScript SyntaxLanguage = "JavaScript"
	SyntaxLanguageTypeScript SyntaxLanguage = "TypeScript"
	SyntaxLanguagePython     SyntaxLanguage = "Python"
	SyntaxLanguageRust       SyntaxLanguage = "Rust"
	SyntaxLanguageSQL        SyntaxLanguage = "SQL"
	SyntaxLanguageShell      SyntaxLanguage = "Shell"
	SyntaxLanguageJSON       SyntaxLanguage = "JSON"
	SyntaxLanguageYAML       SyntaxLanguage = "YAML"
	SyntaxLanguageMarkdown   SyntaxLanguage = "Markdown"
	SyntaxLanguagePlain      SyntaxLanguage = "Plain"
)

func DetectLanguage added in v2.1.0

func DetectLanguage(filename string) SyntaxLanguage

DetectLanguage detects language based on a filename extension.

type Toast

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

Toast displays stacked notifications with auto-dismiss behavior.

func NewToast

func NewToast(opts ...ToastOption) *Toast

NewToast creates a toast component.

func (*Toast) Blur

func (t *Toast) Blur()

Blur marks this component as unfocused.

func (*Toast) Count

func (t *Toast) Count() int

Count returns the number of active toasts.

func (*Toast) Dismiss

func (t *Toast) Dismiss(id string)

Dismiss dismisses a toast by ID.

func (*Toast) DismissAll

func (t *Toast) DismissAll()

DismissAll dismisses all toasts.

func (*Toast) Focus

func (t *Toast) Focus()

Focus marks this component as focused.

func (*Toast) Focused

func (t *Toast) Focused() bool

Focused returns whether this component is focused.

func (*Toast) Init

func (t *Toast) Init() tea.Cmd

Init initializes the toast component.

func (*Toast) Push

func (t *Toast) Push(message string, level ToastLevel) string

Push adds a toast with the default duration and returns its ID.

func (*Toast) PushWithDuration

func (t *Toast) PushWithDuration(message string, level ToastLevel, d time.Duration) string

PushWithDuration adds a toast with a custom duration and returns its ID.

func (*Toast) Update

func (t *Toast) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles toast messages.

func (*Toast) View

func (t *Toast) View() string

View renders stacked toasts (most recent first).

type ToastItem

type ToastItem struct {
	ID        string
	Message   string
	Level     ToastLevel
	CreatedAt time.Time
	Duration  time.Duration
	Dismissed bool
}

ToastItem represents a single toast notification item.

type ToastLevel

type ToastLevel int

ToastLevel is the severity level for a toast notification.

const (
	ToastInfo ToastLevel = iota
	ToastSuccess
	ToastWarning
	ToastError
)

type ToastOption

type ToastOption func(*Toast)

ToastOption configures a Toast.

func WithDefaultDuration

func WithDefaultDuration(d time.Duration) ToastOption

WithDefaultDuration sets the default auto-dismiss duration.

func WithMaxVisible

func WithMaxVisible(n int) ToastOption

WithMaxVisible sets how many toasts are rendered at once.

func WithToastDesignTokens

func WithToastDesignTokens(tokens *design.DesignTokens) ToastOption

WithToastDesignTokens applies design-system colors to toast rendering.

func WithToastIconSet

func WithToastIconSet(iconSet IconSet) ToastOption

WithToastIconSet sets the icon set used by toasts.

func WithToastTheme

func WithToastTheme(theme string) ToastOption

WithToastTheme applies a named design-system theme.

Jump to

Keyboard shortcuts

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