Documentation
¶
Index ¶
- Constants
- Variables
- func NewLinearFocusHandler() linearFocusHandler
- type ChildComponent
- func (m ChildComponent) GetBorderStyle() lipgloss.Style
- func (m ChildComponent) GetFocusBorderStyle() lipgloss.Style
- func (m ChildComponent) GetMaximumHeight() int
- func (m ChildComponent) GetMaximumWidth() int
- func (m ChildComponent) GetMinimumHeight() int
- func (m ChildComponent) GetMinimumWidth() int
- func (m ChildComponent) GetModel() tea.Model
- func (m ChildComponent) GetPriority() int
- func (m ChildComponent) IsFocusable() bool
- func (m *ChildComponent) SetBorderStyle(style lipgloss.Style) *ChildComponent
- func (m *ChildComponent) SetFocusBorderStyle(style lipgloss.Style) *ChildComponent
- func (m *ChildComponent) SetFocusable(focusable bool) *ChildComponent
- func (m *ChildComponent) SetMaximumHeight(height int) *ChildComponent
- func (m *ChildComponent) SetMaximumWidth(width int) *ChildComponent
- func (m *ChildComponent) SetMinimumHeight(height int) *ChildComponent
- func (m *ChildComponent) SetMinimumWidth(width int) *ChildComponent
- func (m *ChildComponent) SetModel(model tea.Model) *ChildComponent
- func (m *ChildComponent) SetPriority(priority int) *ChildComponent
- func (m *ChildComponent) Update(message tea.Msg) (tea.Model, tea.Cmd)
- type Container
- type FocusHandler
- type LinearContainerModel
- func (m LinearContainerModel) GetChild(idx int) *ChildComponent
- func (m LinearContainerModel) GetChildStyle(child *ChildComponent) lipgloss.Style
- func (m LinearContainerModel) GetChildStyleByIndex(childIdx int) lipgloss.Style
- func (m LinearContainerModel) GetChildren() []*ChildComponent
- func (m LinearContainerModel) GetFocusHandler() FocusHandler
- func (m LinearContainerModel) GetSizeAlongMainAxis(msg tea.WindowSizeMsg) int
- func (m LinearContainerModel) Init() tea.Cmd
- func (m LinearContainerModel) IsHorizontal() bool
- func (m LinearContainerModel) IsVertical() bool
- func (m *LinearContainerModel) SetDirection(direction int) *LinearContainerModel
- func (m *LinearContainerModel) SetFocusHandler(handler FocusHandler)
- func (m LinearContainerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m LinearContainerModel) View() (s string)
Constants ¶
View Source
const ( HORIZONTAL int = iota VERTICAL STACK )
View Source
const ( FOCUS_FORWARD = "tab" FOCUS_BACKWARD = "shift+tab" )
Variables ¶
View Source
var BORDER_STYLE = lipgloss.NewStyle().BorderStyle( lipgloss.RoundedBorder(), ).BorderForeground(lipgloss.Color("#AAAAAA"))
View Source
var FOCUSED_BORDER_STYLE = lipgloss.NewStyle().BorderStyle( lipgloss.RoundedBorder(), ).BorderForeground(lipgloss.Color("69"))
View Source
var NO_BORDER_STYLE = lipgloss.NewStyle().BorderStyle( lipgloss.Border{ Top: "", Bottom: "", Left: "", Right: "", TopLeft: "", TopRight: "", BottomLeft: "", BottomRight: "", MiddleLeft: "", MiddleRight: "", Middle: "", MiddleTop: "", MiddleBottom: "", }, )
Functions ¶
func NewLinearFocusHandler ¶
func NewLinearFocusHandler() linearFocusHandler
Types ¶
type ChildComponent ¶
type ChildComponent struct {
// contains filtered or unexported fields
}
func ChildComponentFromModel ¶
func ChildComponentFromModel(model tea.Model) *ChildComponent
func GetFocusableComponents ¶
func GetFocusableComponents(components []*ChildComponent) (output []*ChildComponent)
Returns a slice of the components' (including their child components, if they have any) that are capable of receiving focus
func (ChildComponent) GetBorderStyle ¶
func (m ChildComponent) GetBorderStyle() lipgloss.Style
func (ChildComponent) GetFocusBorderStyle ¶
func (m ChildComponent) GetFocusBorderStyle() lipgloss.Style
func (ChildComponent) GetMaximumHeight ¶
func (m ChildComponent) GetMaximumHeight() int
func (ChildComponent) GetMaximumWidth ¶
func (m ChildComponent) GetMaximumWidth() int
func (ChildComponent) GetMinimumHeight ¶
func (m ChildComponent) GetMinimumHeight() int
func (ChildComponent) GetMinimumWidth ¶
func (m ChildComponent) GetMinimumWidth() int
func (ChildComponent) GetModel ¶
func (m ChildComponent) GetModel() tea.Model
func (ChildComponent) GetPriority ¶
func (m ChildComponent) GetPriority() int
func (ChildComponent) IsFocusable ¶
func (m ChildComponent) IsFocusable() bool
func (*ChildComponent) SetBorderStyle ¶
func (m *ChildComponent) SetBorderStyle(style lipgloss.Style) *ChildComponent
func (*ChildComponent) SetFocusBorderStyle ¶
func (m *ChildComponent) SetFocusBorderStyle(style lipgloss.Style) *ChildComponent
func (*ChildComponent) SetFocusable ¶
func (m *ChildComponent) SetFocusable(focusable bool) *ChildComponent
func (*ChildComponent) SetMaximumHeight ¶
func (m *ChildComponent) SetMaximumHeight(height int) *ChildComponent
func (*ChildComponent) SetMaximumWidth ¶
func (m *ChildComponent) SetMaximumWidth(width int) *ChildComponent
func (*ChildComponent) SetMinimumHeight ¶
func (m *ChildComponent) SetMinimumHeight(height int) *ChildComponent
func (*ChildComponent) SetMinimumWidth ¶
func (m *ChildComponent) SetMinimumWidth(width int) *ChildComponent
func (*ChildComponent) SetModel ¶
func (m *ChildComponent) SetModel(model tea.Model) *ChildComponent
func (*ChildComponent) SetPriority ¶
func (m *ChildComponent) SetPriority(priority int) *ChildComponent
type Container ¶
type Container interface {
GetChildren() []*ChildComponent
}
type FocusHandler ¶
type FocusHandler interface { /* Checks if a given string represents a key combination that the focus handler uses to change focus */ IsFocusKey(string) bool /* Updates which child component has focus based on the given key combination */ HandleFocusKey(string) FocusHandler /* Returns the component that currently has focus */ GetFocusedComponent() *ChildComponent /* Returns the focus handler with a given container as its subject. The subject being the UI element whose focus the focus manager is managing */ SetSubjectContainer(Container) FocusHandler /* Returns the focus handler with a given ChildComponent pointer as its currently focused component */ SetFocusedComponent(*ChildComponent) FocusHandler /* Returns the focus handler after having updated its focused child */ UpdateFocusedChild() FocusHandler }
FocusHandler keeps track of which child component has focus and determines how focus behaves
type LinearContainerModel ¶
type LinearContainerModel struct {
// contains filtered or unexported fields
}
func NewLinearContainer ¶
func NewLinearContainer() *LinearContainerModel
func NewLinearContainerFromComponents ¶
func NewLinearContainerFromComponents(components []*ChildComponent) *LinearContainerModel
func (LinearContainerModel) GetChild ¶
func (m LinearContainerModel) GetChild(idx int) *ChildComponent
func (LinearContainerModel) GetChildStyle ¶
func (m LinearContainerModel) GetChildStyle(child *ChildComponent) lipgloss.Style
Returns the current border style of the given child component
func (LinearContainerModel) GetChildStyleByIndex ¶
func (m LinearContainerModel) GetChildStyleByIndex(childIdx int) lipgloss.Style
func (LinearContainerModel) GetChildren ¶
func (m LinearContainerModel) GetChildren() []*ChildComponent
func (LinearContainerModel) GetFocusHandler ¶
func (m LinearContainerModel) GetFocusHandler() FocusHandler
func (LinearContainerModel) GetSizeAlongMainAxis ¶
func (m LinearContainerModel) GetSizeAlongMainAxis(msg tea.WindowSizeMsg) int
func (LinearContainerModel) Init ¶
func (m LinearContainerModel) Init() tea.Cmd
func (LinearContainerModel) IsHorizontal ¶
func (m LinearContainerModel) IsHorizontal() bool
func (LinearContainerModel) IsVertical ¶
func (m LinearContainerModel) IsVertical() bool
func (*LinearContainerModel) SetDirection ¶
func (m *LinearContainerModel) SetDirection(direction int) *LinearContainerModel
func (*LinearContainerModel) SetFocusHandler ¶
func (m *LinearContainerModel) SetFocusHandler(handler FocusHandler)
func (LinearContainerModel) View ¶
func (m LinearContainerModel) View() (s string)
Click to show internal directories.
Click to hide internal directories.