kanban

package
v0.95.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 6 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 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) 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
}

type LaneID

type LaneID string

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"
	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