Documentation
¶
Overview ¶
Package ui provides shared UI styling and components for the TUI application.
Index ¶
- Constants
- Variables
- func ApplyFuzzyFilter(query string, items []string) []string
- func ApplyTheme()
- func ConfigColumns() []table.Column
- func ConfigColumnsFor(room int) []table.Column
- func FitColumns(cols []table.Column, width, gutter int) table.Layout
- func FormatEmptyValue(val string) string
- func InitTheme(p theme.Palette)
- func MarkGlyph(marked bool) string
- func PaneBox(width, height int, focused bool, content string) string
- func RemoveListBackgrounds(l list.Model) list.Model
- func RenderEmptyValue(val string) string
- func RenderScrollIndicator(hasMore, hasLess bool) string
- func ScrollWindow(selected, total, rows int) (int, int)
- func TableHeader(layout table.Layout, gutter int) string
- func TableRow(layout table.Layout, values map[string]string) string
- type MarkSet
Constants ¶
const ( ColKeyBranch = "branch" ColKeyChecks = "checks" ColKeyName = "name" ColKeyPR = "pr" ColKeyPass = "pass" ColKeyRuns = "runs" ColKeyTime = "time" ColKeyWorkflow = "workflow" ColTitleBranch = "Branch" ColTitleChecks = "Checks" ColTitleName = "Name" ColTitlePR = "PR" ColTitlePass = "Pass" ColTitleRuns = "Runs" ColTitleTime = "Time" ColTitleWorkflow = "Workflow" )
Column keys and titles shared by more than one table.
const ( ColWidthReq = 3 ColMinFlag = 1 ColMinCount = 4 ColMinShort = 6 ColMinLabel = 8 ColMinName = 10 ColMaxFlag = 1 ColMaxCount = 4 ColMaxSteps = 5 ColMaxTime = 12 ColMaxStatus = 14 ColMaxValue = 24 ColMaxBranch = 28 ColMaxName = 36 WeightLow = 1 WeightMid = 2 WeightHigh = 3 PrioFirstToGo = 1 PrioSecondToGo = 2 PrioThirdToGo = 3 )
Column sizing vocabulary shared by every table, in display cells. Naming the floors keeps a table readable as a set of tradeoffs rather than a wall of digits. Every column holding a short value is capped, because surplus width spread across them pushes a row's cells so far apart that the eye has to travel between them on a wide terminal.
const PaneBorderSize = 2
PaneBorderSize is the space a pane's border occupies on each axis, which is what separates the width a pane is given from the width its content gets.
const RowGutterWidth = 2
RowGutterWidth is the "> " selection gutter and any status glyph that sit left of the first column, which the table itself never sees.
Variables ¶
var ( PrimaryColor color.Color SecondaryColor color.Color AccentColor color.Color MutedColor color.Color SoftMutedColor color.Color TextColor color.Color ModalBgColor color.Color ErrorColor color.Color LinkColor color.Color )
Colors used throughout the UI.
var ( BorderStyle lipgloss.Style CLIPreviewStyle lipgloss.Style ErrorStyle lipgloss.Style ErrorTitleStyle lipgloss.Style FocusedBorderStyle lipgloss.Style HelpStyle lipgloss.Style LinkStyle lipgloss.Style NormalStyle lipgloss.Style SelectedStyle lipgloss.Style SubtitleStyle lipgloss.Style TabActiveStyle lipgloss.Style TabInactiveStyle lipgloss.Style TableDefaultStyle lipgloss.Style TableDimmedStyle lipgloss.Style TableHeaderStyle lipgloss.Style TableItalicStyle lipgloss.Style TableRowStyle lipgloss.Style TableSelectedStyle lipgloss.Style TitleStyle lipgloss.Style )
Styles for the application (initialized in ApplyTheme).
Functions ¶
func ApplyFuzzyFilter ¶
ApplyFuzzyFilter returns items filtered by query using fuzzy matching. Returns original items if query is empty.
func ApplyTheme ¶
func ApplyTheme()
ApplyTheme updates all colors and styles from the current palette. The three roles beyond theme.Semantic are named here because only this application needs them: a softer muted for defaults, a modal ground, and a link color.
func ConfigColumns ¶ added in v1.2.0
ConfigColumns describes the workflow-input table at a width that fits every column. Name is the column a reader scans, so it keeps the most weight.
func ConfigColumnsFor ¶ added in v1.10.0
ConfigColumnsFor is the input table narrowed to what a pane room cells wide holds, selection gutter included. Dropping a column by priority is not enough on its own: the header then carries an overflow marker naming what it dropped, and that marker is what wraps a header one cell too wide onto a second line, costing the pane the row its bottom border sits on.
func FitColumns ¶ added in v1.2.0
FitColumns resolves cols against the room a pane leaves for its rows, past the gutter its selection indicator and status glyphs occupy.
func FormatEmptyValue ¶
FormatEmptyValue returns the display string for a value, showing ("") for empty strings.
func PaneBox ¶ added in v1.10.0
PaneBox draws content inside a pane of exactly width by height cells. Content is truncated rather than wrapped, because a wrapped line costs the pane the bottom border MaxHeight then clips in its place.
func RemoveListBackgrounds ¶
RemoveListBackgrounds removes all backgrounds from a list.Model for modal overlay.
func RenderEmptyValue ¶
RenderEmptyValue returns a styled string for a value, using italic style for empty strings.
func RenderScrollIndicator ¶
RenderScrollIndicator renders scroll arrows (^ and v) for lists.
func ScrollWindow ¶ added in v1.7.0
ScrollWindow returns the half-open range of rows a pane should draw so that selected stays visible. A negative selected holds the window at the top, which is what a cleared selection wants.
func TableHeader ¶ added in v1.2.0
TableHeader renders a column header indented past the row gutter.
Types ¶
type MarkSet ¶ added in v1.10.0
type MarkSet struct {
// contains filtered or unexported fields
}
MarkSet is the set of rows a verb acts on instead of the cursor: `space` marks a row, and the action menu then offers the verb over the marked set. Keys are whatever the pane names its rows by, so a set outlives a reordering of the list it came from.
func (*MarkSet) Clear ¶ added in v1.10.0
func (s *MarkSet) Clear()
Clear drops every mark, which is what finishing a batch verb does: leaving them set would make the next verb act on rows the reader has moved past.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package modal provides modal dialogs for user interactions in the TUI application.
|
Package modal provides modal dialogs for user interactions in the TUI application. |
|
Package panes provides the main UI panes for workflow, history, and configuration views.
|
Package panes provides the main UI panes for workflow, history, and configuration views. |
|
Package timeline lays out a workflow run as bars on a shared time axis.
|
Package timeline lays out a workflow run as bars on a shared time axis. |