Documentation
¶
Overview ¶
Package bubblon enables a model-stack architecture for Bubble Tea apps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilModel = errors.New("model cannot be nil")
ErrNilModel is returned when attempting to initialize a Controller with a nil model.
Functions ¶
func Close ¶
Close is a command instructing bubblon to close the current model. A notification to the parent model is sent on closure.
func Cmd ¶
Cmd is a helper function that wraps a tea.Msg as a tea.Cmd. Should be used only for static messages.
Types ¶
type Closed ¶
type Closed struct{}
Closed is a message sent to the parent model indicating that the top model has been closed. The message is not sent if the model is replaced.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a stack-based navigation model for Bubble Tea apps. It manages a stack of tea.Model instances, where only the top model receives updates and renders.
func New ¶
func New(model tea.Model) (Controller, error)
New creates a new Controller initialized with the given model. Returns an error if the model is nil.
func (Controller) Init ¶
func (c Controller) Init() tea.Cmd
Init initializes the initial model, if one exists.
func (Controller) Update ¶
Update handles incoming messages to update the state and delegate messages to the top model.
func (Controller) View ¶
func (c Controller) View() string
View renders the view of the top model on the stack. Returns an empty string if there is no model.