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 ¶
- type Focus
- type NavItem
- type Shell
- func (s *Shell) Collapsed() bool
- func (s *Shell) DialogSize() (int, int)
- func (s *Shell) InDialog(x, y int) bool
- func (s *Shell) InSidebar(x int) bool
- func (s *Shell) KeyHit(x, y int) string
- func (s *Shell) MainBodyOrigin() (int, int)
- func (s *Shell) MainSize() (int, int)
- func (s *Shell) NavHit(x, y int) int
- func (s *Shell) SetBrand(tagline, version string)
- func (s *Shell) SetDialog(title, body string, accent ...color.Color)
- func (s *Shell) SetDrift(p float64)
- func (s *Shell) SetEntrance(frac float64, ghost bool)
- func (s *Shell) SetFocus(f Focus)
- func (s *Shell) SetMain(title, body string)
- func (s *Shell) SetSidebar(context []string, nav []NavItem, footer string)
- func (s *Shell) SetSize(w, h int)
- func (s *Shell) SetStatus(st Status)
- func (s *Shell) SetToast(view string)
- func (s *Shell) View() string
- type Status
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.
type NavItem ¶
type NavItem struct {
// Key is an accelerator advertised as a faint "[k]" prefix; "" renders
// none. In the collapsed one-line strip (navStrip) it is not shown at all
// unless the item has no Icon to show in its place, and the active item
// there always renders as an icon+label pill. Nothing constrains its
// length: the strip and the expanded rows both budget for a short chord, so
// a long Key ("ctrl+shift+q") eats the width the label needed and truncates
// the label instead of itself.
}
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 (*Shell) DialogSize ¶
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 ¶
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 ¶
InSidebar reports whether screen column x falls in the sidebar (vs the panel).
func (*Shell) KeyHit ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetBrand sets the sidebar's tagline (left) and version (right), rendered dim inside the wordmark's hatch band area.
func (*Shell) SetDialog ¶
SetDialog sets (or clears, when both title and body are empty) the centered modal dialog.
func (*Shell) SetEntrance ¶
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) SetSidebar ¶
SetSidebar sets the sidebar content. The logo is rendered by the shell itself (sized to the sidebar width).
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.