layout.go

 1package layout
 2
 3import (
 4	"github.com/charmbracelet/bubbles/v2/help"
 5	"github.com/charmbracelet/bubbles/v2/key"
 6	tea "github.com/charmbracelet/bubbletea/v2"
 7)
 8
 9type Focusable interface {
10	Focus() tea.Cmd
11	Blur() tea.Cmd
12	IsFocused() bool
13}
14
15type Sizeable interface {
16	SetSize(width, height int) tea.Cmd
17	GetSize() (int, int)
18}
19
20type Help interface {
21	Help() help.KeyMap
22}
23
24type Positionable interface {
25	SetPosition(x, y int) tea.Cmd
26}
27
28// KeyMapProvider defines an interface for types that can provide their key bindings as a slice
29type KeyMapProvider interface {
30	KeyBindings() []key.Binding
31}