Documentation
¶
Index ¶
- Constants
- func Elapsed(d time.Duration) string
- func Fit(value string, kind Kind, width int) string
- func Matches(row Row, query string) bool
- func Render(p Panel, style Style) []string
- func ReservedKeys() []string
- func Schema() []byte
- func Scroll(top, at, height, total int) int
- func ShellJoin(argv []string) string
- func ShellQuote(arg string) string
- func Since(t time.Time) string
- func Validate(p *Panel) error
- func ValidateTargets(p *Panel) error
- func Window[T any](lines []T, at, height, top int) []T
- type Action
- type Column
- type Field
- type Invalid
- type Kind
- type Layout
- type Line
- type Mark
- type Panel
- type Retry
- type Row
- type RowTone
- type Section
- type Span
- type Style
- type Tone
- type Transport
Constants ¶
const Version = 1
Variables ¶
This section is empty.
Functions ¶
func ReservedKeys ¶ added in v0.2.0
func ReservedKeys() []string
func ShellQuote ¶
func ValidateTargets ¶
Types ¶
type Action ¶
type Action struct {
Key string `json:"key"`
Label string `json:"label"`
Verb string `json:"verb,omitempty"`
Args []string `json:"args,omitempty"`
Input string `json:"input,omitempty"`
Choices []string `json:"choices,omitempty"`
Confirm string `json:"confirm,omitempty"`
Panel string `json:"panel,omitempty"`
Global bool `json:"global,omitempty"`
Retry []Retry `json:"retry,omitempty"`
Help string `json:"help,omitempty"`
}
type Layout ¶ added in v0.2.0
type Layout string
Layout is how a section's rows are placed. Columns is the default and the only one that aligns anything; Lines draws each row's one field as it was written, which is what content too wide or too exact to be a column needs.
type Panel ¶
type Panel struct {
Version int `json:"bango"`
ID string `json:"id"`
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
Empty string `json:"empty,omitempty"`
// At is the row the cursor starts on. Without it every panel opens at the
// top, which is right for a list and wrong for a file somebody was sent
// into at a particular line.
At string `json:"at,omitempty"`
Hints []string `json:"hints,omitempty"`
Order []string `json:"order,omitempty"`
Sections []Section `json:"sections,omitempty"`
Actions map[string]Action `json:"actions,omitempty"`
}
func (Panel) ActionNames ¶
type Row ¶
type Row struct {
ID string `json:"id"`
Mark Mark `json:"mark,omitempty"`
Fields []Field `json:"fields"`
Note string `json:"note,omitempty"`
Actions []string `json:"actions,omitempty"`
Facts []string `json:"facts,omitempty"`
Preview []string `json:"preview,omitempty"`
Children []Row `json:"children,omitempty"`
Dim bool `json:"dim,omitempty"`
Tone RowTone `json:"tone,omitempty"`
Target string `json:"target,omitempty"`
}
type RowTone ¶ added in v0.2.0
type RowTone string
RowTone is what a whole row is, when that is a thing worth saying: a line added, a line taken away. A renderer draws the difference; it never works out which is which from the text, which is why a panel of diff needs no renderer that understands one.
type Span ¶ added in v0.2.0
A Span is a stretch of a value the producer has already decided something about, counted in runes from the start of it. A renderer paints one. It never works one out, which is what keeps a panel of code from needing a renderer that can read the language it is in.
type Tone ¶ added in v0.2.0
type Tone string
Tone is what a span is, not what colour it is. A renderer decides the colour, the way it does for a Kind or a Mark.