component.go

 1package common
 2
 3import (
 4	"github.com/charmbracelet/bubbles/v2/help"
 5	tea "github.com/charmbracelet/bubbletea/v2"
 6)
 7
 8// Component represents a Bubble Tea model that implements a SetSize function.
 9type Component interface {
10	tea.Model
11	tea.ViewModel
12	help.KeyMap
13	SetSize(width, height int)
14}
15
16// TabComponenet represents a model that is mounted to a tab.
17// TODO: find a better name.
18type TabComponent interface {
19	Component
20
21	// StatusBarValue returns the status bar value component.
22	StatusBarValue() string
23
24	// StatusBarInfo returns the status bar info component.
25	StatusBarInfo() string
26
27	// SpinnerID returns the ID of the spinner.
28	SpinnerID() int
29
30	// TabName returns the name of the tab.
31	TabName() string
32
33	// Path returns the hierarchical path of the tab.
34	Path() string
35}