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 ¶
- func MinimumWidth(columns, columnWidth, outerWidth int) int
- func ThemeLanePalette(lane agentstatus.LaneID) color.Color
- func UsesCompact(width, columns, columnWidth, outerWidth int) bool
- type Action
- type ActionKind
- type Board
- func (b Board) CardAt(s Selection) (Card, bool)
- func (b Board) Clamp(s Selection) Selection
- func (b Board) ColumnCount() int
- func (b Board) ItemCount(column int) int
- func (b Board) MoveColumn(s Selection, delta int) Selection
- func (b Board) MoveRow(s Selection, delta int) Selection
- func (b Board) PositionOf(id string) (Position, bool)
- func (b Board) PreserveSelection(previous Board, s Selection) Selection
- type Card
- type CardRenderer
- type CellState
- type Component
- func (c *Component) Board() Board
- func (c *Component) ClearHover()
- func (c *Component) Compact(width, minColumnWidth int) bool
- func (c *Component) HandlePointer(kind PointerKind, region HitRegion) Action
- func (c *Component) MoveColumn(delta int)
- func (c *Component) MoveInColumn(column, delta int)
- func (c *Component) MoveRow(delta int)
- func (c *Component) Render(options RenderOptions) RenderResult
- func (c *Component) ScrollLane(column, delta int)
- func (c *Component) Select(selection Selection)
- func (c *Component) Selection() Selection
- func (c *Component) SetBoard(board Board)
- func (c *Component) VisibleCards(maxCards int) []Card
- type HitRegion
- type Lane
- type LaneID
- type LanePalette
- type Layout
- type Line
- type PointerKind
- type Position
- type RegionKind
- type RenderOptions
- type RenderResult
- type Selection
- type Span
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinimumWidth ¶
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 ¶
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 CardRenderer ¶
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) ClearHover ¶
func (c *Component) ClearHover()
func (*Component) HandlePointer ¶
func (c *Component) HandlePointer(kind PointerKind, region HitRegion) Action
func (*Component) MoveColumn ¶
func (*Component) MoveInColumn ¶ added in v0.98.0
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) Render ¶
func (c *Component) Render(options RenderOptions) RenderResult
func (*Component) ScrollLane ¶
func (*Component) VisibleCards ¶
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 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 ¶
CalculateLayout mirrors the existing Sidecar board geometry while keeping height constraints testable independently of a view renderer.
type PointerKind ¶
type PointerKind string
const ( PointerHover PointerKind = "hover" PointerClick PointerKind = "click" PointerDoubleClick PointerKind = "double-click" )
type RegionKind ¶
type RegionKind string
const ( RegionColumn RegionKind = "column" RegionColumnBody RegionKind = "column-body" RegionCard RegionKind = "card" )