ui

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ui contains View functions and Lipgloss styles for the TUI. Pure: Model -> string. Bubble Tea's runtime calls these on every frame; keep them allocation-light.

Index

Constants

This section is empty.

Variables

View Source
var (
	StyleSidebarFrame = lipgloss.NewStyle().
						Border(lipgloss.NormalBorder(), false, true, false, false).
						Padding(0, 1).
						Width(28)

	StyleSidebarRowFocused = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
	StyleSidebarRowNormal  = lipgloss.NewStyle()
	StyleSidebarRowFailed  = lipgloss.NewStyle().Foreground(lipgloss.Color("9"))
	StyleSidebarRowRunning = lipgloss.NewStyle().Foreground(lipgloss.Color("10"))

	StyleHeader    = lipgloss.NewStyle().Bold(true).Padding(0, 1)
	StyleStatusBar = lipgloss.NewStyle().Faint(true).Padding(0, 1)
	StyleErrBanner = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true).Padding(0, 1)
	StyleRunHeader = lipgloss.NewStyle().Bold(true)
	StyleRunFooter = lipgloss.NewStyle().Faint(true)
	// StyleRunCursor is applied to the header of the run currently
	// selected by RunCursor when FocusArea == FocusMainPane.
	StyleRunCursor  = lipgloss.NewStyle().Bold(true).Reverse(true)
	StylePromptArea = lipgloss.NewStyle().Padding(0, 1).Width(60)
	StyleModalFrame = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).Padding(1, 2)
)

Functions

func EndSessionModalView

func EndSessionModalView(s *app.EndSessionModalState) string

func HelpModalView

func HelpModalView() string

func MainPaneView

func MainPaneView(m app.Model, width, height int) string

MainPaneView renders the focused session's run timeline plus the prompt input.

height bounds how many lines are visible at once. When the rendered content exceeds height, the slice shown is anchored to the BOTTOM (so the latest run is always in view by default), shifted upward by m.MainScrollFromBottom so the user can review older history with PgUp/PgDn. height <= 0 disables clipping (useful for tests that don't care about layout).

func NewSessionModalView

func NewSessionModalView(m app.Model) string

NewSessionModalView renders the new-session modal. It takes the whole Model (rather than just the modal state) so it can show the target namespace at the top — sessions created here land in m.Namespace, so making that visible BEFORE submission avoids surprise admission rejections.

func PaletteView

func PaletteView(p app.PaletteState, width int) string

PaletteView renders the command palette overlay. Returns the empty string when the palette is closed so the caller can layer it unconditionally.

func SidebarView

func SidebarView(m app.Model) string

SidebarView renders the sidebar from the given model. Returns the styled string suitable for placement at the left of a JoinHorizontal.

The "[+ new session]" row is the last entry in visibleNames (the app.NewSessionSentinel value). Rendering it inside the loop — rather than as a separately-appended static row — lets it pick up selection styling when the user arrows down onto it.

func TitleBarView

func TitleBarView(m app.Model, width int) string

TitleBarView renders the one-line title bar at the top of the TUI: the binary name on the left and the active namespace on the right. The width parameter controls how far apart left and right are pushed; when width is non-positive a sensible default is used.

func View

func View(m app.Model, width, height int) string

View renders the full TUI: title bar / sidebar | main pane / footer status bar, with an optional modal overlay.

The main pane is bounded to (height - title - footer) lines so a long run history can't push the sidebar or footer off the visible terminal. Scroll within that bounded view with PgUp/PgDn/Home/End (handled globally in the reducer).

Types

This section is empty.

Jump to

Keyboard shortcuts

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