shell

package
v0.266.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package shell renders the Crush-style playground frame: a left sidebar (gradient logo + context + nav + status footer), a main content pane, and a bottom status bar, composited flat on a lipgloss canvas with no painted panel backgrounds — structure comes from headers and rules. The one boxed exception is the centered modal dialog (with dim scrim and drop shadow); a bottom-right toast layers on top of everything. Styling is driven by the active theme via the style package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Focus

type Focus int

Focus identifies which region owns the highlight: the sidebar (tab selection) lights up its hatch bands + version; the main panel lights up its section header. Exactly one is focused at a time.

const (
	FocusSidebar Focus = iota
	FocusPanel
)
type NavItem struct {
	Label  string
	Icon   string
	Badge  string
	Active bool
}

NavItem is one sidebar navigation row.

type Shell

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

Shell holds the current size and the content of each region.

func New

func New() *Shell

New returns an empty shell.

func (*Shell) Collapsed

func (s *Shell) Collapsed() bool

Collapsed reports whether the sidebar is hidden at the current width.

func (*Shell) DialogSize

func (s *Shell) DialogSize() (int, int)

DialogSize returns the interior content budget of the modal dialog: renderDialog's width math (half the terminal, min 36, max width-4) minus its border+padding, and a height that leaves the dialog fully on-screen.

func (*Shell) InDialog

func (s *Shell) InDialog(x, y int) bool

InDialog reports whether screen cell (x, y) is inside the currently-open dialog box. It mirrors the centering used when the dialog layer is drawn.

func (*Shell) InSidebar

func (s *Shell) InSidebar(x int) bool

InSidebar reports whether screen column x falls in the sidebar (vs the panel).

func (*Shell) KeyHit

func (s *Shell) KeyHit(x, y int) string

KeyHit returns the footer key-hint text at screen cell (x, y), or "" if the click didn't land on a footer keycap.

func (*Shell) MainBodyOrigin

func (s *Shell) MainBodyOrigin() (int, int)

MainBodyOrigin returns the screen cell (x, y) of the top-left of the main pane's body — below the section header and its blank rule line — for mouse hit-testing. The main pane has a 1-col left padding and renders as "header\n\nbody", so the body starts at row 2.

func (*Shell) MainSize

func (s *Shell) MainSize() (int, int)

MainSize returns the drawable interior for main-pane content: the pane is flat (1-col margins, header + blank row) — no border rows or columns.

func (*Shell) NavHit

func (s *Shell) NavHit(x, y int) int

NavHit returns the nav index at screen cell (x, y), or -1 if the click didn't land on a nav item (sidebar collapsed, click in the panel, or off the list).

func (*Shell) SetBrand

func (s *Shell) SetBrand(tagline, version string)

SetBrand sets the sidebar's tagline (left) and version (right), rendered dim inside the wordmark's hatch band area.

func (*Shell) SetDialog

func (s *Shell) SetDialog(title, body string, accent ...color.Color)

SetDialog sets (or clears, when both title and body are empty) the centered modal dialog.

func (*Shell) SetDrift

func (s *Shell) SetDrift(p float64)

SetDrift sets the ambient gradient phase for the wordmark and active pill.

func (*Shell) SetEntrance

func (s *Shell) SetEntrance(frac float64, ghost bool)

SetEntrance drives the launch animation: frac slides the sidebar in from the left (1 = fully off-screen, 0 = settled) and ghost dims the main pane. frac 0 with ghost false is the steady state.

func (*Shell) SetFocus

func (s *Shell) SetFocus(f Focus)

SetFocus sets which region carries the focus highlight (sidebar or panel).

func (*Shell) SetMain

func (s *Shell) SetMain(title, body string)

SetMain sets the main pane title and body.

func (*Shell) SetSidebar

func (s *Shell) SetSidebar(context []string, nav []NavItem, footer string)

SetSidebar sets the sidebar content. The logo is rendered by the shell itself (sized to the sidebar width).

func (*Shell) SetSize

func (s *Shell) SetSize(w, h int)

SetSize records the available terminal size.

func (*Shell) SetStatus

func (s *Shell) SetStatus(st Status)

SetStatus sets the bottom status bar's segments.

func (*Shell) SetToast

func (s *Shell) SetToast(view string)

SetToast sets (or clears, when empty) the bottom-right toast slot.

func (*Shell) View

func (s *Shell) View() string

View composes the full frame on a canvas: a flat sidebar/main/status base with no painted surface backgrounds, an optional dimmed scrim + shadowed dialog centered on top, and a bottom-right toast layered above everything.

type Status

type Status struct {
	Profile string   // filled identity chip, shown first (empty = none)
	Mode    string   // filled keyword chip, e.g. "CHECK" (empty = none)
	Store   string   // raised chip (empty = none)
	Model   string   // raised chip (empty = none)
	Spinner string   // prepended to Left when non-empty
	Left    string   // free status text
	Keys    []string // right-aligned keycaps
}

Status describes the segmented bottom bar.

Jump to

Keyboard shortcuts

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