ui

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Shared formatting and small layout helpers used by the renderers in ui.go: number/duration/byte formatting plus visible-width text cutting. Rendering primitives live in spark.go, styles in theme.go.

Package ui renders the toktop dashboard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrailleChart

func BrailleChart(vals []float64, w, h int, st ChartStyle) string

BrailleChart renders an area chart as braille dot-matrix, btop-style: every terminal cell is a 2x4 dot grid, so a w*h chart resolves w*2 by h*4 dots - far finer than the block ramp. Values fill upward from the baseline. With FadeAge, older columns fade toward black; Grid columns draw a faint dotted baseline guide through empty cells (used to mark timescale boundaries).

func GaugeBar

func GaugeBar(pct float64, w int, heat func(float64) lipgloss.Color) string

GaugeBar renders "[██████░░░░] 62%"-style meter content without label.

func StaticFrame

func StaticFrame(cfg Config, s core.Snapshot, w, h int) string

StaticFrame renders one snapshot for non-interactive output (--once).

Types

type ChartStyle

type ChartStyle struct {
	Heat    func(float64) lipgloss.Color
	FadeAge bool         // bloom: older columns melt into the background
	Grid    map[int]bool // columns marked true get a faint vertical guide
}

ChartStyle tunes BrailleChart rendering.

type Config

type Config struct {
	Version    string
	Demo       bool
	IngestAddr string
	PollEvery  time.Duration // sampling cadence; anchors the chart timescale
	Prober     Prober        // nil disables manual probing
	// FeedErr receives one message if the ingest endpoint dies after startup.
	// nil (or silent) means it is up: stderr is invisible under the alternate
	// screen, so without this in-band signal the UI would advertise a dead
	// endpoint forever.
	FeedErr <-chan string
}

Config wires the dashboard to its data source.

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, ch <-chan core.Snapshot) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Prober

type Prober interface {
	ProbeAll()
}

Prober fires synthetic generation probes on demand.

Jump to

Keyboard shortcuts

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