kit

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package kit holds the shared Bubble Tea widgets and rendering primitives used by the stats and links screens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(keys, desc string) key.Binding

Bind is shorthand for a key.Binding whose help key and trigger match.

func Center

func Center(bg, fg string, width, height int) string

Center composites fg over bg, centered. The background stays visible but drops to the backdrop gray so the dialog owns the eye.

func CompactNum added in v0.1.2

func CompactNum(v float64) string

CompactNum renders a count compactly to ~3 significant figures: 938 → "938", 1500 → "1.5k", 51240 → "51.2k", 131881 → "132k", 1_500_000 → "1.5M". Keeps dashboard columns narrow and glanceable.

func ISODate

func ISODate(s string) string

ISODate keeps the YYYY-MM-DD prefix of an ISO 8601 timestamp.

func MiniSpark

func MiniSpark(pts []api.MetricPoint, width int) string

MiniSpark draws a compact sparkline covering the WHOLE series: when there are more points than columns they are summed into buckets, so old activity is never silently cut off the left edge.

func NewHelp

func NewHelp() help.Model

NewHelp builds a help bubble in the dashboard's palette: keys at hint gray, descriptions a step fainter.

func NiceCeil

func NiceCeil(v float64) float64

NiceCeil rounds up to a 1/2/2.5/5×10ⁿ boundary so axis steps are even.

func OrNever

func OrNever(s string) string

OrNever renders an empty value as "never".

func PadToWidth

func PadToWidth(s string, w int) string

PadToWidth right-pads by display width (emoji-safe, unlike %-*s).

func ParseBucketTime

func ParseBucketTime(label string) (time.Time, bool)

ParseBucketTime parses a backend time-bucket label.

func TruncateToWidth

func TruncateToWidth(s string, w int) string

TruncateToWidth trims a string to at most w display columns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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