Documentation
¶
Overview ¶
Package porticus is the pantheon suite's shared TUI façade: the chrome every tool presents in common — palette, styles, two-pane layout, title bars, the footer hint bar, and the help plaque. It is the colonnade the whole suite shares; only the accent colour, sigil and name vary per tool (see Theme).
porticus is presentation only: it has no dependency on the data spine (github.com/LinusNyman/pantheon) and no tool-specific types. Tools render their own rows (a todo, a contact, a habit) and hand the rendered strings to the layout helpers here. The canonical design rationale lives in the suite TUI design guide (aoapp_tui_design.md); this package is its executable form.
Index ¶
- Constants
- Variables
- func Center(s string, width int) string
- func PadTo(s string, width int) string
- func PaneWidths(total int) (left, right int)
- func SpacedCaps(s string) string
- func Truncate(s string, width int) string
- func WrapRows(prefix, body string, width int) []string
- type HelpGroup
- type Styles
- func (s Styles) Checkbox(done bool) string
- func (s Styles) HRule(width int) string
- func (s Styles) HelpPage(t Theme, groups []HelpGroup, width, height, scroll int) string
- func (s Styles) Hints(groups [][]string, width int) string
- func (s Styles) LeftHeader(t Theme, nodeName string, width int) string
- func (s Styles) Page(t Theme, label, body string, width, height, scroll int) string
- func (s Styles) RightHeader(label string, focused bool, width int) string
- func (s Styles) ScrollHint(above, below, width int) string
- func (s Styles) Stacked(width, height int, top, bottom func(w, h int) string) string
- func (s Styles) TwoPane(width, height int, left, right func(w, h int) string) string
- type Theme
Constants ¶
const ( ColCode = "#4fa6e0" // aegean blue: node codes ColName = "#f2ead0" // marble ivory: primary text, selection fg ColOwnCount = "#3fc79a" // verdigris bronze: own-item counts ColDim = "#9a917b" // weathered stone: dim text, hints, inactive ColDue = "#f5a623" // ochre: due dates, soft urgency ColRecur = "#bd6ad8" // Tyrian purple: recurrence specs ColOverdue = "#e8492c" // Pompeian red: errors, overdue ColCompleted = "#aac63f" // laurel green: done marks, success ColHeading = "#ee7f44" // terracotta: section headings ColDesc = "#d4c79e" // aged parchment: descriptions ColSelFocus = "#4a4231" // dark umber: focused selection bg ColSelBlur = "#332d20" // deep umber: blurred selection bg ColSelFg = "#f2ead0" // marble ivory: selection text ColDivider = "#4a4231" // umber: pane divider, rules, plaque border ColPaneOff = "#9a917b" // weathered stone: unfocused pane title ColToday = "#4fa6e0" // aegean blue: the "today" calendar day, distinct from the accent focus )
Shared base palette (suite standard §5). Fixed across every tool — do not vary these per tool. Only the accent (Theme.Accent) changes. Kept as exported constants so a tool can reach for a raw colour when a Style isn't enough.
const NarrowWidth = 80
NarrowWidth is the terminal width below which the two-pane layout stacks vertically instead (suite standard §2).
Variables ¶
var Tools = map[string]Theme{
"pantheon": {Name: "pantheon", Sigil: "✦", Accent: "#c8c0b0"},
"pensum": {Name: "pensum", Sigil: "✎", Accent: "#e06474"},
"tabella": {Name: "tabella", Sigil: "≡", Accent: "#4fa6e0"},
"decreta": {Name: "decreta", Sigil: "⚖", Accent: "#c45f9c"},
"speculum": {Name: "speculum", Sigil: "○", Accent: "#3fc79a"},
"studium": {Name: "studium", Sigil: "⊙", Accent: "#a78bfa"},
"atrium": {Name: "atrium", Sigil: "◈", Accent: "#ee7f44"},
"album": {Name: "album", Sigil: "❦", Accent: "#f5a623"},
"calendarium": {Name: "calendarium", Sigil: "⊕", Accent: "#5b7dc8"},
}
Tools is the canonical per-tool identity table (suite standard §4), kept in one place so a tool can pull its identity by name rather than hard-coding the hex and glyph. A tool may also construct its own Theme literal.
Functions ¶
func Center ¶
Center pads s with spaces on both sides to center it within width display cells, accounting for ANSI styling. A string already at least width wide is returned unchanged; any odd remainder favours the right side.
func PadTo ¶
PadTo right-pads s with spaces to width display cells, accounting for ANSI styling (it measures with lipgloss.Width). It never truncates: a string wider than width is returned unchanged.
func PaneWidths ¶
PaneWidths returns the left (tree/list) and right (working-area) pane widths for a given total terminal width, per the suite layout spec (§2): the left pane is width*2/5 clamped to [28,48]; the right takes the remainder after the 3-column divider, with a floor of 20.
func SpacedCaps ¶
SpacedCaps converts a string to uppercase with a space between every letter, e.g. "pensum" → "P E N S U M". Used for tool and pane titles (suite standard §3.1). Works on multi-byte runes (åäö) since it splits on runes.
func Truncate ¶
Truncate visually truncates an ANSI-styled string to width cells, appending an ellipsis when it overflows. width<=0 yields "".
func WrapRows ¶
WrapRows wraps a list row's styled body so the whole row fits within width, returning one string per visual row. The first row carries the prefix (index, checkbox, columns…); continuation rows are indented by the prefix width so the leading column reads blank and the body lines up as one paragraph. Shared by every tool's list panes so wrapping behaves identically everywhere.
Types ¶
type HelpGroup ¶
HelpGroup is one labelled section of the help page: a heading over key/action rows. Rows are {keys, action} pairs, e.g. {"j / k", "move down / up"}.
type Styles ¶
type Styles struct {
Accent string // raw accent hex (Theme.Accent), for ad-hoc styling
Title lipgloss.Style // bold accent — left pane title, footer hederas
Code lipgloss.Style
Name lipgloss.Style
Count lipgloss.Style
Dim lipgloss.Style
Done lipgloss.Style // dim + strikethrough
Due lipgloss.Style
Recur lipgloss.Style
Overdue lipgloss.Style
Completed lipgloss.Style
Heading lipgloss.Style // bold terracotta
Desc lipgloss.Style // parchment italic
Err lipgloss.Style // overdue colour — error text
OK lipgloss.Style // laurel green — status text
SelFocus lipgloss.Style // focused selection: umber bg, ivory fg, bold
SelBlur lipgloss.Style // blurred selection: deep umber bg, ivory fg
Divider lipgloss.Style // ║ divider and ══ / ── rules
PaneOn lipgloss.Style // bold accent — focused pane title
PaneOff lipgloss.Style // dim — unfocused pane title
HelpPlaque lipgloss.Style // double border in umber — the help tablet
Today lipgloss.Style // aegean blue — the "today" calendar day
}
Styles bundles every shared lipgloss style, built once per tool by NewStyles. The accent colour is the only per-tool input; every other style uses a fixed suite colour so look stays identical across tools. Field names mirror the suite standard §7 variable names so style code reads the same everywhere.
func NewStyles ¶
NewStyles builds the suite style set for one tool. accent is the tool's identity colour (Theme.Accent, suite standard §4); everything else is fixed.
func (Styles) Checkbox ¶
Checkbox is the list status glyph shared by every tool: a dim empty ☐, or a laurel-green ☑ when done. Both are one cell wide so columns stay aligned.
func (Styles) HRule ¶
HRule renders a full-width single-rule line of the given width in the divider colour (the stacked-layout separator, U+2500).
func (Styles) HelpPage ¶
HelpPage renders the suite help screen as a page of the app (suite standard §6): the unchanged tool title with "help" where the node name normally sits, over a carved-stone plaque (a double-ruled border echoing the ══ rule) holding the binding groups in one or two columns. scroll is the first body row to show; the page windows the groups to the available height and shows a scroll hint in the header. Returns a block exactly width×height so the footer stays pinned.
func (Styles) Hints ¶
Hints renders the footer hint bar from groups of "key:action" hints, wrapped to width so no hint is pushed off-screen (suite standard §6). Hints within a group are separated by " · " (dim); groups by " ❧ " (the accent hedera). A single "key:action" hint is never split across lines. width<=0 falls back to a sane default.
func (Styles) LeftHeader ¶
LeftHeader renders the left pane's two-line header: the identity title (sigil + spaced-caps tool name + ❧ + node name) over a full-width ══ double rule (suite standard §3.1, §3.3). nodeName may be "" for the root.
func (Styles) Page ¶
Page renders a scrollable read-only page through the standard chrome: the left header (sigil + spaced-caps tool name + ❧ + label) over the ══ rule, then body windowed to the remaining height and scrolled by scroll (the caller owns the offset, as with HelpPage), a scroll hint when it overflows, filled to exactly width×height so the footer stays pinned. Use it for any custom read-only screen — a markdown preview, a stats page; insights.InsightsPage is a thin wrapper over it.
func (Styles) RightHeader ¶
RightHeader renders the right pane's two-line header: a spaced-caps label in stone (no sigil) over a single ── rule. When the pane is focused the rule is drawn in the accent colour (suite standard §6).
func (Styles) ScrollHint ¶
ScrollHint renders a dim one-line indicator of how many rows are hidden above and/or below the visible window, e.g. "↑3 ↓5". Empty when nothing is hidden.
func (Styles) Stacked ¶
Stacked assembles the narrow-fallback layout (terminal width < NarrowWidth): the top pane, a full-width ─ rule, then the bottom pane. The top pane gets half the height (min 4 rows), the bottom the rest (min 3) — see suite standard §2.
func (Styles) TwoPane ¶
TwoPane assembles the standard two-column body (terminal width ≥ NarrowWidth): a left pane and a right pane joined by the ` ║ ` divider. The caller supplies each pane's content via a render callback that is handed the pane's computed width and the shared body height, so the tool keeps full control of what fills each pane while porticus owns the geometry and the divider.
type Theme ¶
type Theme struct {
Name string // tool name, e.g. "pensum"; rendered spaced-caps in titles
Sigil string // identity glyph, e.g. "✎"
Accent string // accent hex, e.g. "#e06474"
}
Theme is a tool's whole visual identity: the three things that vary across the suite (suite standard §4). Everything else — palette, layout, key grammar — is shared. Build a tool's styles with NewStyles(theme.Accent).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browse is the pantheon suite's shared two-pane tree-browser scaffold: the stateful left-pane node tree (TreePane), the list selection cursor (Cursor), and the auto-clearing status line (Status).
|
Package browse is the pantheon suite's shared two-pane tree-browser scaffold: the stateful left-pane node tree (TreePane), the list selection cursor (Cursor), and the auto-clearing status line (Status). |
|
Package calendar is the suite's shared month calendar: a selected day plus the navigation and rendering of the month it falls in.
|
Package calendar is the suite's shared month calendar: a selected day plus the navigation and rendering of the month it falls in. |
|
Package dates is the suite's shared relative-date vocabulary: it renders an ISO date (YYYY-MM-DD) the way every tool should show it at a glance — "today", "tmrw", "in 3d", "in 2mo" — so due dates, agendas, calendars, and birthdays read identically across the suite.
|
Package dates is the suite's shared relative-date vocabulary: it renders an ISO date (YYYY-MM-DD) the way every tool should show it at a glance — "today", "tmrw", "in 3d", "in 2mo" — so due dates, agendas, calendars, and birthdays read identically across the suite. |
|
Package input is the suite's shared text-entry chrome: the free-text add/edit editor (a soft-wrapping, content-sized textarea), the single-line field (for dates, codes, names…), and the y/n confirm prompt.
|
Package input is the suite's shared text-entry chrome: the free-text add/edit editor (a soft-wrapping, content-sized textarea), the single-line field (for dates, codes, names…), and the y/n confirm prompt. |
|
Package insights renders the suite's shared statistical chrome: compact sparklines, binary heatmaps, trend computation, and a scrollable insights page.
|
Package insights renders the suite's shared statistical chrome: compact sparklines, binary heatmaps, trend computation, and a scrollable insights page. |
|
Package keys is the pantheon suite's canonical key grammar — the single source of truth for which keys do what across every tool, so navigation, pane switching, and view selection feel identical suite-wide.
|
Package keys is the pantheon suite's canonical key grammar — the single source of truth for which keys do what across every tool, so navigation, pane switching, and view selection feel identical suite-wide. |
|
Package pick is the suite's shared search/suggest overlay: a generic, type-parameterised picker — a query input over a live-filtered, scrollable, selectable results list — rendered as a page through the porticus chrome.
|
Package pick is the suite's shared search/suggest overlay: a generic, type-parameterised picker — a query input over a live-filtered, scrollable, selectable results list — rendered as a page through the porticus chrome. |