tui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package tui provides filter and debounce utilities for the TUI model.

Package tui defines message types for the TUI model.

Package tui implements the core TUI model and logic for the toolkit application. It provides the Model struct and related helpers for managing state, events, and rendering using Bubble Tea and Charmbracelet components.

Package tui contains reducer and event logic for the Model. This file contains methods for state transitions, event handling, and UI updates.

Package tui contains the Model struct and constructor for the toolkit TUI. This file defines the main state container and its initialization logic.

Package tui implements the update/reduce logic for the Model.

Package tui implements the view and rendering logic for the Model.

Package tui — toast banner notifications.

A toast is a transient one-line message rendered over any view mode. It auto-dismisses after toastTTL via tea.Tick. The id guards against stale expiry messages clearing a newer toast.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebounceFilter

func DebounceFilter(m *Model) tea.Cmd

DebounceFilter triggers a debounced filter update for the model's text input. Emits filterApplyMsg with a gen so only the most recent tick applies.

Types

type Model

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

Model represents the main TUI model for the toolkit application. It manages state, events, and rendering for the Bubble Tea UI.

func NewModel

func NewModel(opts ...ModelOption) (*Model, error)

NewModel creates a new Model for the toolkit TUI, applying the given options.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init implements the tea.Model interface and initializes the model.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements the tea.Model interface and updates the Model state in response to a message.

func (*Model) View

func (m *Model) View() string

View renders the current state of the model as a string.

When a toast is up we append it under the active view's body rather than budget a row for it in updateLayout. The terminal scrolls one row to accommodate, briefly clipping the table's bottom border — acceptable for an 8s transient banner, and far simpler than running layout twice per toast-set/dismiss.

type ModelOption

type ModelOption func(*Model)

ModelOption defines a functional option for configuring Model.

func WithCategory

func WithCategory(category domain.Category) ModelOption

WithCategory sets the category field for the Model.

func WithContext

func WithContext(ctx context.Context) ModelOption

WithContext sets the context.Context for the Model.

func WithEnvironment

func WithEnvironment(env models.Environment) ModelOption

WithEnvironment sets the environment field.

func WithFilter

func WithFilter(filter string) ModelOption

WithFilter sets a starting filter before Init().

func WithKubeConfig

func WithKubeConfig(kubeConfig string) ModelOption

WithKubeConfig sets the kubeConfig field.

func WithLoader

func WithLoader(l loader.Composite) ModelOption

WithLoader sets the Loader implementation for the Model. The provided value must satisfy loader.Composite (see internal/infra/loader/interfaces.go for the canonical list of embedded loader interfaces).

func WithLogger

func WithLogger(logger logging.Logger) ModelOption

WithLogger sets the logger for the Model.

func WithRepoPath

func WithRepoPath(repoPath string) ModelOption

WithRepoPath sets the repoPath field.

func WithTable

func WithTable(tbl *table.Model) ModelOption

WithTable sets the table.Model.

func WithVersion

func WithVersion(v string) ModelOption

WithVersion sets the version of the Model.

type Styles added in v0.2.0

type Styles struct {
	Base         lipgloss.Style
	StatusNugget lipgloss.Style
	StatusBar    lipgloss.Style
	Context      lipgloss.Style
	Stats        lipgloss.Style
	StatusText   lipgloss.Style
	InfoKey      lipgloss.Style
	InfoValue    lipgloss.Style

	// Help view styles
	HelpBorder lipgloss.Style
	HelpHeader lipgloss.Style
	HelpKey    lipgloss.Style
	HelpDesc   lipgloss.Style
}

Styles groups immutable lipgloss styles used by the TUI. Keeping these centralized avoids per-Model recomputation and makes tests simpler.

func DefaultStyles added in v0.2.0

func DefaultStyles() Styles

DefaultStyles returns the shared immutable style set for the TUI.

Directories

Path Synopsis
Package actions provides side-effectful operations for the TUI Model.
Package actions provides side-effectful operations for the TUI Model.
Package common provides shared types and utilities for the TUI components.
Package common provides shared types and utilities for the TUI components.
Package keys provides key binding definitions and utilities for the TUI.
Package keys provides key binding definitions and utilities for the TUI.
Package view provides utilities for rendering and centering text in the TUI.
Package view provides utilities for rendering and centering text in the TUI.

Jump to

Keyboard shortcuts

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