bubbly

package module
v0.0.0-...-8a411f9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 18

README

Bubbly

A small collection of bubbletea TUI components and helpers.

Status

Consider this project to be in alpha. The API is not stable and may change at any time.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDispatcher

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

func NewEventDispatcher

func NewEventDispatcher() *EventDispatcher

func (*EventDispatcher) AddHandler

func (d *EventDispatcher) AddHandler(t partybus.EventType, fn EventHandlerFn)

func (*EventDispatcher) AddHandlers

func (d *EventDispatcher) AddHandlers(handlers map[partybus.EventType]EventHandlerFn)

func (EventDispatcher) Handle

func (d EventDispatcher) Handle(e partybus.Event) ([]tea.Model, tea.Cmd)

func (EventDispatcher) RespondsTo

func (d EventDispatcher) RespondsTo() []partybus.EventType

type EventHandler

type EventHandler interface {
	partybus.Responder
	// Handle optionally generates new models and commands in response to the given event. It might be that the event
	// has an effect on the system, but the model is managed by a sub-component, in which case no new model would be
	// returned but the Init() call on the managed model would return commands that should be executed in the context
	// of the application lifecycle.
	Handle(partybus.Event) ([]tea.Model, tea.Cmd)
}

type EventHandlerFn

type EventHandlerFn func(partybus.Event) ([]tea.Model, tea.Cmd)

type HandleWaiter

type HandleWaiter interface {
	Wait()
}

type HandlerCollection

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

func NewHandlerCollection

func NewHandlerCollection(handlers ...EventHandler) *HandlerCollection

func (*HandlerCollection) Append

func (h *HandlerCollection) Append(handlers ...EventHandler)

func (HandlerCollection) Handle

func (h HandlerCollection) Handle(event partybus.Event) ([]tea.Model, tea.Cmd)

func (HandlerCollection) OnMessage

func (h HandlerCollection) OnMessage(msg tea.Msg)

func (HandlerCollection) RespondsTo

func (h HandlerCollection) RespondsTo() []partybus.EventType

func (HandlerCollection) Wait

func (h HandlerCollection) Wait()

type MessageListener

type MessageListener interface {
	OnMessage(tea.Msg)
}

type PromptReader

type PromptReader interface {
	Response(ctx context.Context) (string, error)
}

type PromptWriter

type PromptWriter interface {
	IsSensitive() bool
	PromptMessage() string
	Respond(string) error
	Validate(string) error
}

type Prompter

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

func NewPrompter

func NewPrompter(message string, sensitive bool, validators ...func(string) error) *Prompter

func (Prompter) IsSensitive

func (p Prompter) IsSensitive() bool

func (Prompter) PromptMessage

func (p Prompter) PromptMessage() string

func (*Prompter) Respond

func (p *Prompter) Respond(value string) error

func (*Prompter) Response

func (p *Prompter) Response(ctx context.Context) (string, error)

func (*Prompter) Validate

func (p *Prompter) Validate(value string) error

type VisibleModel

type VisibleModel interface {
	IsVisible() bool
	tea.Model
}

Directories

Path Synopsis
bubbles

Jump to

Keyboard shortcuts

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