Documentation
¶
Overview ¶
Package deck is the bubbletea runtime for viewkit.
Invariant: tea lives ONLY in this package — viewkit core (glyph/theme/layout/panels/…) must not import bubbletea. Apps and plugins implement View and register via RegisterView; Model (alias Host) owns stack navigation + chrome.
Process-global singletons (install before Run):
- theme.Use / theme.Cur — active palette
- keys.Use / keys.Cur — active key scheme
- theme.Register / keys.Register / RegisterView — contribution registries
See INTERFACE.md for the Model + singleton contract.
Index ¶
- func ComponentIDs() []string
- func Confirm(title, message, yesLabel, noLabel string) (bool, error)
- func Prompt(spec PromptSpec) (vals map[string]any, ok bool, err error)
- func RegisterComponent(id string, ctor func() Component)
- func RegisterView(id string, ctor func() View)
- func Run(root View, opts ...Option) error
- func ViewIDs() []string
- type Chrome
- type Component
- type Content
- type ContentFunc
- type Editor
- func (e *Editor) Body(width, height int) string
- func (e *Editor) Confirming() bool
- func (e *Editor) Context() [][2]string
- func (e *Editor) Form() *forms.Form
- func (e *Editor) Hints() [][2]string
- func (e *Editor) Init() tea.Cmd
- func (e *Editor) Notice() []string
- func (e *Editor) OnResults() bool
- func (e *Editor) Remembered() map[string]any
- func (e *Editor) Running() bool
- func (e *Editor) Selected() (list.Item, bool)
- func (e *Editor) SelectedOf(key string) int
- func (e *Editor) SetStatus(msg string)
- func (e *Editor) Status() string
- func (e *Editor) SyncFields()
- func (e *Editor) Title() string
- func (e *Editor) Update(a *Model, msg tea.Msg) tea.Cmd
- func (e *Editor) Value(key string) string
- type EditorDoc
- type EditorKeys
- type EditorOutput
- type FormKeys
- type FormSpec
- type FormView
- func (v *FormView) Body(width, _ int) string
- func (v *FormView) Context() [][2]string
- func (v *FormView) Form() *forms.Form
- func (v *FormView) Hints() [][2]string
- func (v *FormView) Init() tea.Cmd
- func (v *FormView) Status(msg string)
- func (v *FormView) Title() string
- func (v *FormView) Update(a *Model, msg tea.Msg) tea.Cmd
- func (v *FormView) Values() map[string]any
- type HomeShell
- func (h *HomeShell) Body(width, height int) string
- func (h *HomeShell) Context() [][2]string
- func (h *HomeShell) FocusSide() bool
- func (h *HomeShell) Hints() [][2]string
- func (h *HomeShell) Init() tea.Cmd
- func (h *HomeShell) Reload() tea.Cmd
- func (h *HomeShell) Title() string
- func (h *HomeShell) Update(host *Model, msg tea.Msg) tea.Cmd
- type Host
- func (h *Host) Height() int
- func (h *Host) Init() tea.Cmd
- func (h *Host) Pop() tea.Cmd
- func (h *Host) Push(v View) tea.Cmd
- func (h *Host) RefreshStatus() tea.Cmd
- func (h *Host) SetStatus(info StatusInfo)
- func (h *Host) Top() View
- func (h *Host) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (h *Host) View() string
- func (h *Host) Width() int
- type ItemList
- func (r *ItemList) Body(width, height int) string
- func (r *ItemList) Context() [][2]string
- func (r *ItemList) Hints() [][2]string
- func (r *ItemList) Init() tea.Cmd
- func (r *ItemList) Reload() tea.Cmd
- func (r *ItemList) Selected() (list.Item, bool)
- func (r *ItemList) Title() string
- func (r *ItemList) Update(h *Model, msg tea.Msg) tea.Cmd
- type Job
- type KeyHook
- type Menu
- type MenuItem
- type Message
- type Model
- type MsgHook
- type Option
- func WithChrome(c Chrome) Option
- func WithInitCmd(cmd tea.Cmd) Option
- func WithKeyHook(fn KeyHook) Option
- func WithKeyMapQuit() Option
- func WithMsgHook(fn MsgHook) Option
- func WithQuitCheck(fn func(string) bool) Option
- func WithQuitHint(glyph string) Option
- func WithStatus(fn StatusFunc) Option
- func WithoutClock() Option
- type PromptSpec
- type ReloadMsg
- type Results
- type Scroll
- type ScrollContent
- type ServiceStatus
- type StatusFunc
- type StatusInfo
- type StatusLevel
- type Text
- type Toaster
- func (t *Toaster) Body(body string, width int) string
- func (t *Toaster) Prune()
- func (t *Toaster) Push(n notify.Notification) tea.Cmd
- func (t *Toaster) PushFor(n notify.Notification, ttl time.Duration) tea.Cmd
- func (t *Toaster) Queue() *notify.Queue
- func (t *Toaster) SetOverlayPos(pos layout.OverlayPos)
- func (t *Toaster) Tick() tea.Cmd
- func (t *Toaster) Update(msg tea.Msg) (cmd tea.Cmd, handled bool)
- type View
- type Work
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentIDs ¶
func ComponentIDs() []string
ComponentIDs returns registered component ids sorted.
func Prompt ¶ added in v0.1.9
func Prompt(spec PromptSpec) (vals map[string]any, ok bool, err error)
Prompt runs spec as a standalone tea program and returns the entered values. ok is false when the user cancelled.
func RegisterComponent ¶
RegisterComponent associates id with a component constructor.
func RegisterView ¶
RegisterView associates id with a view constructor.
Types ¶
type Chrome ¶
Chrome configures brand/header appearance. Apps inject product branding; viewkit/deck never hard-codes app names.
type Component ¶
Component is a reusable UI fragment registered by id. Components are not full Views — they paint a region when asked.
func LookupComponent ¶
LookupComponent returns a fresh Component for id.
type Content ¶
type Content interface {
// Render returns the painted body for the given width (may ignore width).
Render(width int) string
}
Content is domain-agnostic job/panel body text. Apps adapt their types (e.g. domain section trees) into Content before crossing into deck.
type ContentFunc ¶
ContentFunc adapts a function to Content.
func (ContentFunc) Render ¶
func (f ContentFunc) Render(width int) string
Render implements Content.
type Editor ¶ added in v0.1.6
type Editor struct {
// contains filtered or unexported fields
}
Editor is a two-pane View: an editable form above a scrollable result list. When the terminal is too short it collapses the results, then the form, to a one-line summary rather than overflowing.
func NewEditor ¶ added in v0.1.6
func NewEditor(doc EditorDoc, km EditorKeys, seed map[string]any) *Editor
NewEditor builds an Editor over doc. seed pre-fills the form and is carried across rebuilds when doc.Sync reports true.
func (*Editor) Confirming ¶ added in v0.1.6
Confirming reports whether the delete dialog is open.
func (*Editor) OnResults ¶ added in v0.1.6
OnResults reports whether focus is on the results pane rather than the form.
func (*Editor) Remembered ¶ added in v0.1.13
Remembered returns every value the Editor is carrying, including those of fields a later rebuild stopped rendering. Live form values win over remembered ones. A document whose field set shrinks reads this rather than Form().Values() when it must not silently discard what is still held.
func (*Editor) SelectedOf ¶ added in v0.1.6
SelectedOf returns the chosen option index of the select field under key, or -1 when no such field exists.
func (*Editor) Status ¶ added in v0.1.6
Status is the error line shown beneath the form, or "" when clear.
func (*Editor) SyncFields ¶ added in v0.1.6
func (e *Editor) SyncFields()
SyncFields rebuilds the form from the document, preserving entered values, when the document reports that its field set is value-dependent.
type EditorDoc ¶ added in v0.1.6
type EditorDoc interface {
// Kind names the document type for messages, e.g. "query".
Kind() string
// Title heads the form panel.
Title() string
// Context supplies the chrome context pairs.
Context() [][2]string
// SavedName is the persisted name, or "" when never saved. Delete and
// the delete hint are suppressed while it is empty.
SavedName() string
// Fields builds the form, seeded from previously entered values.
Fields(prev map[string]any) []forms.Field
// Sync reports whether editing a field should rebuild the whole form,
// for documents whose field set depends on earlier answers.
Sync() bool
// Summary is the one-line description shown when the form is collapsed.
Summary() string
// PreviewLines renders the document for the yaml-style preview panel.
PreviewLines() []string
// ValidateLines checks the document and returns display lines for the
// validation panel. A non-nil error means the document could not be
// built at all, and is surfaced as the status line instead.
ValidateLines() ([]string, error)
// Run executes the document. The returned loader runs off the UI
// goroutine, so it must not touch the doc.
Run() (label string, load func() Results, err error)
// Persist saves the document and returns a confirmation summary.
Persist() (summary string, err error)
// Remove deletes the saved document and returns a summary.
Remove() string
}
EditorDoc is the document an Editor edits. Implementations own all domain concerns — parsing, validation, persistence — and hand the Editor only strings, form fields and Results.
type EditorKeys ¶ added in v0.1.6
type EditorKeys struct {
// Map resolves keys while the form or results pane has focus.
Map *keys.Map
// Confirm resolves keys while the delete dialog is open.
Confirm *keys.Map
Run keys.Action
Save keys.Action
Validate keys.Action
Preview keys.Action
Delete keys.Action
Focus keys.Action
// Copy and Write drive EditorOutput. Leave them empty for documents that
// produce no text.
Copy keys.Action
Write keys.Action
}
EditorKeys binds an Editor's commands to a host application's key scheme. Actions are supplied by the caller because command vocabularies are app-specific; only Cancel and the navigation actions come from viewkit.
type EditorOutput ¶ added in v0.1.11
type EditorOutput interface {
// CopyOutput puts the last run's text on the clipboard.
CopyOutput() (summary string, err error)
// WriteOutput persists the last run's text and names where it landed.
WriteOutput() (summary string, err error)
}
EditorOutput is an optional EditorDoc extension for documents whose run produces text worth taking away — a rendered report, a generated file. An Editor offers Copy and Write only when its doc implements this and the host bound the matching keys, so documents without an output are unaffected.
type FormKeys ¶ added in v0.1.6
type FormKeys struct {
// Map resolves keys while the form has focus. A nil Map falls back to the
// active scheme's editor bindings (navigation, confirm, cancel, erase,
// paging), resolved fresh on every key so a later keys.Use still applies.
Map *keys.Map
// Save is the action that triggers OnSubmit. Leave it empty for a form
// with no save command (submit then only happens through OnKey).
Save keys.Action
}
FormKeys binds a FormView's commands to a host application's key scheme. Only cancel comes from viewkit's vocabulary (keys.Cancel, resolved through Map); the save action is supplied by the caller because command vocabularies are app-specific — an app may name it "app.save" and bind it to ctrl+s, or name it something else entirely. This mirrors EditorKeys.
type FormSpec ¶ added in v0.1.6
type FormSpec struct {
// Fields build the form, in display order.
Fields []forms.Field
// Keys binds cancel and save.
Keys FormKeys
// Title heads the breadcrumb trail. TitleFunc wins when both are set,
// for views whose title depends on state ("new role" vs "edit role").
Title string
// TitleFunc computes the title on every read.
TitleFunc func() string
// PanelTitle heads the rendered form panel. Defaults to the view title,
// which is what most forms want; set it when the panel wants a longer
// caption than the breadcrumb.
PanelTitle string
// Context supplies chrome context cues. ContextFunc wins when both are
// set; use it when the cues can change while the form is open.
Context [][2]string
// ContextFunc computes context cues on every read.
ContextFunc func() [][2]string
// Hints overrides the footer legend. When nil, the legend is derived from
// Keys: field movement, value change, and the save binding.
Hints [][2]string
// OnSubmit runs on the save action with the form's current values. It
// receives the Model so it can Pop back and Push a result view. A nil
// OnSubmit makes save a no-op.
OnSubmit func(a *Model, vals map[string]any) tea.Cmd
// OnKey sees every key before the form does. Return handled=true to
// suppress all default handling — including cancel, save and text entry —
// which is how a view adds its own commands (delete, preview) on top of
// the shared form behaviour.
OnKey func(a *Model, key tea.KeyMsg) (cmd tea.Cmd, handled bool)
// OnMsg sees every message before anything else, keys included. Views
// whose save runs as a tea.Cmd use it to catch the completion message and
// either Pop or Status the error.
OnMsg func(a *Model, msg tea.Msg) (cmd tea.Cmd, handled bool)
}
FormSpec configures a FormView. Every field beyond Fields is optional, and most views set only two or three of them; a struct keeps those call sites readable and lets the type grow a knob without breaking anyone, which a ten-argument constructor could not.
type FormView ¶ added in v0.1.6
type FormView struct {
// contains filtered or unexported fields
}
FormView is a single-panel form View: the boilerplate sibling of Menu, Message and Scroll. It owns the form, key routing (cancel pops, save calls back, everything else is navigation or text entry) and an error line under the panel. Domain concerns stay in the spec's callbacks.
func NewFormView ¶ added in v0.1.6
NewFormView builds a form View from spec.
func (*FormView) Body ¶ added in v0.1.6
Body renders the form panel, with the status line appended when set.
func (*FormView) Form ¶ added in v0.1.6
Form exposes the live form so hosts can read or seed entered values.
func (*FormView) Hints ¶ added in v0.1.6
Hints reports the footer legend: the spec's override, else one derived from the bound keys so the legend cannot advertise a binding the view ignores.
func (*FormView) Status ¶ added in v0.1.6
Status sets the error line shown beneath the form; "" clears it.
type HomeShell ¶
type HomeShell struct {
// BoxTitle is the menu TitledBox title. Empty (default) omits the title.
BoxTitle string
// SideLabel is shown above the side list when SideFetch is set.
SideLabel string
// SideLabelFn, when set, supplies the side label on every read instead of
// SideLabel — the shape a long-lived shell needs when the side pane's
// subject can change beneath it. Returning "" hides the side pane.
SideLabelFn func() string
// SideHint is the tab-target label when menu-focused (default "side").
SideHint string
// SideFetch loads opaque side content once (nil disables the side pane).
SideFetch func() any
// SideBind maps fetched data → rows using current width.
SideBind func(width int, fetched any) []list.Item
// SideLoading shown while SideFetch has not completed.
SideLoading string
// ReloadHint is the footer label for the reload key (default "reload").
ReloadHint string
// IsAction maps a key string to a keys.Action, fully replacing the active
// scheme map (keys.Cur); map PageUp/PageDown and FocusNext to keep paging
// and pane switching.
IsAction func(string) (keys.Action, bool)
// OnOpen overrides browser.Open when a side item Key is opened.
OnOpen func(url string) error
OnSelect func(h *Model, key string) tea.Cmd
// contains filtered or unexported fields
}
HomeShell is a dual-pane View: navigable menu + optional side Item list. SideFetch/SideBind keep domain types out of deck (caller maps → list.Item).
func NewHomeShell ¶
NewHomeShell builds a HomeShell. sideLabel empty + SideFetch nil → menu-only. BoxTitle defaults empty (no menu titled-box title); set after construction if desired.
func (*HomeShell) FocusSide ¶
FocusSide reports whether the side pane has keyboard focus (for tests/adapters).
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is the tea model: stack navigation + chrome. Prefer the Model alias in new code; Host remains for compatibility.
func (*Host) RefreshStatus ¶ added in v0.1.3
RefreshStatus reloads the status strip via the installed StatusFunc. Same path as the periodic refresh ticker; no-op when WithStatus was not set.
func (*Host) SetStatus ¶
func (h *Host) SetStatus(info StatusInfo)
SetStatus applies chrome status immediately (tests / non-async hosts).
type ItemList ¶
type ItemList struct {
// Fetch loads opaque content once (optional if Bind alone is enough).
Fetch func() any
// Bind turns fetched data into list rows. Called on each refresh after load.
Bind func(width int, fetched any) []list.Item
// ChromeReserve is subtracted from window height for title/status chrome.
ChromeReserve int
// IsCancel reports whether a key string should pop the view.
IsCancel func(string) bool
// IsAction maps a key string to a keys.Action, fully replacing the active
// scheme map (keys.Cur); map PageUp/PageDown too to keep paging.
IsAction func(string) (keys.Action, bool)
// OnOpen overrides browser.Open when an item Key is opened.
OnOpen func(url string) error
OnSelect func(h *Model, key string) tea.Cmd
// LoadingText shown before load completes.
LoadingText string
// ReloadHint is the footer label for the reload key (default "reload").
ReloadHint string
// contains filtered or unexported fields
}
ItemList is a lazy-loaded selectable list View. Fetch runs once on Init; Bind maps fetched data → rows using the current width so callers can width-wrap without importing domain types into deck.
func NewItemList ¶
func NewItemList(title string, ctx [][2]string, fetch func() any, bind func(width int, fetched any) []list.Item) *ItemList
NewItemList builds an ItemList with Fetch+Bind.
func (*ItemList) Reload ¶ added in v0.1.11
Reload drops fetched content and re-runs Fetch, showing LoadingText until the new data lands. No-op when there is nothing to fetch.
type Job ¶ added in v0.1.5
Job is one unit of work. Do must be safe for concurrent execution; return Content (never domain types).
type KeyHook ¶
KeyHook handles a key before the top view. Return handled=true to skip view Update (and optionally a Cmd such as Push).
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu is a simple navigable list View.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is a dismissible text View.
func NewMessage ¶
NewMessage builds a Message view.
type Model ¶
type Model = Host
Model is the stateful Bubble Tea program root for deck: navigable view stack, injectable chrome, and async status strip. It implements tea.Model (Init / Update / View).
Contract:
- One Model owns one tea.Program for a deck session.
- Views receive *Model in Update so they can Push/Pop and read size.
- Domain state lives in View implementations (or app kits), not in Model.
Host is a compatibility alias; prefer Model in new code and docs.
type MsgHook ¶ added in v0.1.4
MsgHook handles a non-key message before the top view. Return handled=true to skip view Update (e.g. debounced role-lifecycle settle).
type Option ¶
type Option func(*Model)
Option configures Model (Host alias).
func WithInitCmd ¶ added in v0.1.11
WithInitCmd adds a command to run when the program starts, alongside the root view's own Init. Use it to start a watcher that outlives navigation: a tick armed here and re-armed from a MsgHook keeps running whatever is on the stack, whereas one armed by a view stops as soon as that view is pushed over.
Repeated calls accumulate.
func WithKeyHook ¶
WithKeyHook installs a global key interceptor (e.g. app hotkeys).
func WithKeyMapQuit ¶
func WithKeyMapQuit() Option
WithKeyMapQuit installs a quit matcher from keys.Cur() Quit binding. This is also the default; the option remains for explicit call sites.
func WithMsgHook ¶ added in v0.1.4
WithMsgHook installs a global message interceptor (e.g. debounce settle).
func WithQuitCheck ¶
WithQuitCheck overrides quit key matcher. An opaque matcher cannot be rendered, so pair it with WithQuitHint to keep the footer legend truthful.
func WithQuitHint ¶ added in v0.1.5
WithQuitHint overrides the quit glyph in the footer legend. Defaults to the active scheme's Quit binding.
func WithStatus ¶
func WithStatus(fn StatusFunc) Option
WithStatus installs an async status loader for the footer strip.
func WithoutClock ¶ added in v0.1.13
func WithoutClock() Option
type PromptSpec ¶ added in v0.1.9
type PromptSpec struct {
// Title heads the rendered panel.
Title string
// Fields builds the form, seeded from previously entered values. It is
// called again after every Sync, exactly like EditorDoc.Fields.
Fields func(prev map[string]any) []forms.Field
// Sync reports whether the last edit changed a value the field set
// depends on, and so whether to rebuild. A nil Sync never rebuilds.
Sync func(vals map[string]any) bool
// Seed pre-fills the form.
Seed map[string]any
// Save is the action that submits. It defaults to keys.Confirm when left
// empty; hosts with a save binding of their own pass it here.
Save keys.Action
// Keys resolves keys. A nil Map falls back to the active scheme's editor
// bindings, like FormView.
Keys *keys.Map
}
PromptSpec configures a one-shot form prompt. It is the Editor's shape minus everything a command-line caller has no use for — no results pane, no preview, no persistence — so a CLI command can collect the same fields, with the same suggestions, without entering the deck.
type ReloadMsg ¶ added in v0.1.11
type ReloadMsg struct{}
ReloadMsg asks the active view to discard what it fetched and fetch again. Views that load lazily honour it; the rest ignore it, so it is safe to emit from a global key hook without knowing what is on top of the stack.
type Results ¶ added in v0.1.6
type Results interface {
// Items renders the result set as list rows sized to f.
Items(f layout.Frame) []list.Item
// Count reports how many underlying records the rows represent.
Count() int
}
Results is the lower pane of an Editor: whatever a run produced.
type Scroll ¶
type Scroll struct {
// ChromeReserve is subtracted from window height for title/status chrome.
ChromeReserve int
// IsCancel reports whether a key string should pop the view.
IsCancel func(string) bool
// ReloadHint is the footer label for the reload key (default "reload").
ReloadHint string
// contains filtered or unexported fields
}
Scroll is a lazy-loaded scrollable text view (bubbles viewport). Hosted only in the deck module so tea stays out of viewkit core.
type ScrollContent ¶
type ScrollContent struct {
// contains filtered or unexported fields
}
ScrollContent is a lazy-loaded scrollable text View.
func NewScrollContent ¶
func NewScrollContent(title string, ctx, hints [][2]string, load func() string) *ScrollContent
NewScrollContent builds a content view that loads asynchronously.
func (*ScrollContent) Body ¶
func (c *ScrollContent) Body(width, height int) string
func (*ScrollContent) Context ¶
func (c *ScrollContent) Context() [][2]string
func (*ScrollContent) Hints ¶
func (c *ScrollContent) Hints() [][2]string
func (*ScrollContent) Init ¶
func (c *ScrollContent) Init() tea.Cmd
func (*ScrollContent) Title ¶
func (c *ScrollContent) Title() string
type ServiceStatus ¶
type ServiceStatus struct {
Name string
Detail string
Level StatusLevel
Glyph string
Color lipgloss.TerminalColor
}
ServiceStatus is one right-strip status chip.
type StatusFunc ¶
type StatusFunc func(context.Context) StatusInfo
StatusFunc loads status asynchronously for the chrome strip.
type StatusInfo ¶
type StatusInfo struct {
Identity string
Services []ServiceStatus
}
StatusInfo is optional chrome identity + service chips.
type Toaster ¶ added in v0.1.6
type Toaster struct {
// contains filtered or unexported fields
}
Toaster owns a view's notification lifecycle: a TTL queue, the once-a-second prune tick, and the overlay that floats the current notification over a rendered body. Embed one in a View and forward Update / Body to it.
Expiry does not depend on the tick arriving. Body prunes against the clock before it reads the queue, so a tick lost while another view was on top (see toastPruneMsg) delays nothing the user can see; the tick exists to repaint on time, not to be the only thing that expires a toast.
func NewToaster ¶ added in v0.1.6
NewToaster builds a Toaster holding at most capacity notifications (0 for unbounded), each shown for ttl.
func (*Toaster) Body ¶ added in v0.1.6
Body overlays the current notification on an already-rendered body, sized for the same screen width the body was rendered at. It returns body unchanged when nothing is showing.
func (*Toaster) Prune ¶ added in v0.1.6
func (t *Toaster) Prune()
Prune expires everything past its TTL. Body does this already; call it directly before reading Queue in a view that renders notifications itself.
func (*Toaster) Push ¶ added in v0.1.6
func (t *Toaster) Push(n notify.Notification) tea.Cmd
Push shows n for the Toaster's default TTL and returns the command that keeps the prune loop running. Return it from the view's Update.
func (*Toaster) PushFor ¶ added in v0.1.6
PushFor shows n for ttl, overriding the Toaster's default.
func (*Toaster) Queue ¶ added in v0.1.6
Queue exposes the underlying queue for views that render notifications themselves (a panel of recent items, say) instead of as an overlay.
func (*Toaster) SetOverlayPos ¶ added in v0.1.6
func (t *Toaster) SetOverlayPos(pos layout.OverlayPos)
SetOverlayPos moves the toast card. It defaults to top centre.
func (*Toaster) Tick ¶ added in v0.1.6
Tick arms the prune loop and returns the command to run, or nil when a tick is already in flight or there is nothing left to expire. Views that push notifications through Push / PushFor never need to call it; a view that restores a Toaster it filled earlier (after a Pop back onto it) can.
type View ¶
type View interface {
Title() string
Init() tea.Cmd
Update(m *Model, msg tea.Msg) tea.Cmd
Body(width, height int) string
Hints() [][2]string
Context() [][2]string
}
View is a navigable screen hosted by Model. Apps implement domain views; the tea runtime lives only in this module (tea must not enter viewkit core).
func WithExtraHints ¶ added in v0.1.6
WithExtraHints wraps inner so the footer legend carries extra after the view's own hints. Every other method passes through untouched. inner is returned unchanged when extra is empty, so the wrapper never costs a level of indirection it does not earn.
func WithLiveContext ¶ added in v0.1.6
WithLiveContext wraps inner so its chrome context cues are recomputed on every render rather than captured when the view was built — the shape a long-lived view needs when the cue (active role, selection, count) can change beneath it. Every other method passes through untouched. inner is returned unchanged when fn is nil.