kanban

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kanban provides reusable board data, stable selection, navigation, and layout calculations. Consumers resolve domain objects before building cards and resolve semantic card IDs back into their own actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinimumWidth

func MinimumWidth(columns, columnWidth, outerWidth int) int

func ThemeLanePalette added in v0.98.0

func ThemeLanePalette(lane agentstatus.LaneID) color.Color

ThemeLanePalette is the theme's lane colours, as the global browser draws.

func UsesCompact

func UsesCompact(width, columns, columnWidth, outerWidth int) bool

Types

type Action

type Action struct {
	Kind   ActionKind
	CardID string
	LaneID LaneID
}

type ActionKind

type ActionKind string
const (
	ActionNone      ActionKind = ""
	ActionSelected  ActionKind = "selected"
	ActionActivated ActionKind = "activated"
)

type Board

type Board struct {
	Lanes []Lane
}

func (Board) CardAt

func (b Board) CardAt(s Selection) (Card, bool)

func (Board) Clamp

func (b Board) Clamp(s Selection) Selection

func (Board) ColumnCount

func (b Board) ColumnCount() int

func (Board) ItemCount

func (b Board) ItemCount(column int) int

func (Board) MoveColumn

func (b Board) MoveColumn(s Selection, delta int) Selection

func (Board) MoveRow

func (b Board) MoveRow(s Selection, delta int) Selection

func (Board) PositionOf

func (b Board) PositionOf(id string) (Position, bool)

func (Board) PreserveSelection

func (b Board) PreserveSelection(previous Board, s Selection) Selection

type Card

type Card struct {
	ID       string
	Title    string
	Subtitle string
	Detail   string
	Meta     string
	// Lines, when non-empty, takes precedence over Title/Subtitle/Detail/Meta.
	Lines []Line
}

type CardRenderer

type CardRenderer func(card Card, line, width int, selected, hovered bool) string

type CellState

type CellState string
const (
	CellReady   CellState = "ready"
	CellLoading CellState = "loading"
	CellError   CellState = "error"
	CellEmpty   CellState = "empty"
)

type Component

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

Component owns reusable board interaction state. It deliberately emits semantic card IDs; consumers keep domain actions and payloads source-local.

func (*Component) Board

func (c *Component) Board() Board

func (*Component) ClearHover

func (c *Component) ClearHover()

func (*Component) Compact

func (c *Component) Compact(width, minColumnWidth int) bool

func (*Component) HandlePointer

func (c *Component) HandlePointer(kind PointerKind, region HitRegion) Action

func (*Component) MoveColumn

func (c *Component) MoveColumn(delta int)

func (*Component) MoveInColumn added in v0.98.0

func (c *Component) MoveInColumn(column, delta int)

MoveInColumn targets the lane under a wheel gesture and moves its selection. Keeping selection and viewport together means the next render can follow the newly selected card without snapping a separately scrolled viewport back.

func (*Component) MoveRow

func (c *Component) MoveRow(delta int)

func (*Component) Render

func (c *Component) Render(options RenderOptions) RenderResult

func (*Component) ScrollLane

func (c *Component) ScrollLane(column, delta int)

func (*Component) Select

func (c *Component) Select(selection Selection)

func (*Component) Selection

func (c *Component) Selection() Selection

func (*Component) SetBoard

func (c *Component) SetBoard(board Board)

func (*Component) VisibleCards

func (c *Component) VisibleCards(maxCards int) []Card

VisibleCards returns the actual per-lane card window used by Render. It also scrolls the selected card into view, so background consumers such as the animation scheduler cannot drift from the next painted frame.

type HitRegion

type HitRegion struct {
	Kind       RegionKind
	Column     int
	Row        int
	CardID     string
	X, Y, W, H int
}

type Lane

type Lane struct {
	ID          LaneID
	Label       string
	HeaderColor color.Color
	State       CellState
	Message     string
	Cards       []Card
}

func AgentLane added in v0.98.0

func AgentLane(lane agentstatus.LaneID, palette LanePalette) Lane

AgentLane is the one definition of an agent-activity lane, for whichever board is drawing it: its identity, its label and mark, and the header colour the caller's palette gives it.

Both Kanban boards — the project's and the global browser's — build their shared lanes from here, and neither words one itself. Two tables of labels is how the same lane came to read "Blocked" on one board and "Needs Attention" on the other; a rename now lands once.

Lane.State is left zero: whether a lane is ready, loading or errored is what a particular board knows about a particular refresh, not something the lane is. A board that draws empty lanes differently sets it.

A board with a lane of its own — the project's Shells column has no global counterpart — still defines that one itself. What is shared is the lanes both boards have, not the set.

type LaneID

type LaneID string

type LanePalette added in v0.98.0

type LanePalette func(agentstatus.LaneID) color.Color

LanePalette answers the colour a board draws a lane's header in.

Colour is not part of a lane's identity here: the two boards arrived with hues of their own, and sharing the definition of what a lane *is* must not re-theme either of them. A board states its palette; ThemeLanePalette is the theme's own lane colours, for a board that wants them.

type Layout

type Layout struct {
	ColumnWidth  int
	ColumnWidths []int
	CardHeight   int
	MaxCards     int
	ContentRows  int
}

func CalculateLayout

func CalculateLayout(width, height, columns, minColumnWidth, cardHeight int) Layout

CalculateLayout mirrors the existing Sidecar board geometry while keeping height constraints testable independently of a view renderer.

type Line

type Line struct{ Spans []Span }

Line is one rendered row of a card.

type PointerKind

type PointerKind string
const (
	PointerHover       PointerKind = "hover"
	PointerClick       PointerKind = "click"
	PointerDoubleClick PointerKind = "double-click"
)

type Position

type Position struct {
	Column int
	Row    int
}

type RegionKind

type RegionKind string
const (
	RegionColumn     RegionKind = "column"
	RegionColumnBody RegionKind = "column-body"
	RegionCard       RegionKind = "card"
)

type RenderOptions

type RenderOptions struct {
	Width, Height  int
	Header         string
	HeaderRight    string
	MinColumnWidth int
	CardHeight     int
	RenderCard     CardRenderer
}

type RenderResult

type RenderResult struct {
	View    string
	Regions []HitRegion
	Compact bool
}

type Selection

type Selection struct {
	Column int
	Row    int
}

type Span

type Span struct {
	Text       string
	Foreground color.Color // nil inherits
	Background color.Color // nil for none
	Bold       bool
}

Span is a styled run of text within a card line.

Jump to

Keyboard shortcuts

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