carddetail

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package carddetail renders the full-card overlay and its direct-store comment and blocker-link actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMutationMessage

func IsMutationMessage(message tea.Msg) bool

IsMutationMessage identifies action results without exposing their concrete message types to the root package.

Types

type DriftBackend

type DriftBackend interface {
	Provenance(string, string) ([]store.ImportLink, error)
	CheckDrift(context.Context, string, string, string) (forge.Drift, error)
	AcceptDrift(context.Context, string, string, string, string) (string, error)
}

type Model

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

Model owns the overlay's task snapshot, enriched detail, and the bubbles viewport that carries its scroll state.

func New

func New(reader Reader, user string, styles *theme.Styles) Model

New creates a closed detail pane. A nil reader still shows board-resident task fields; enrichment is simply unavailable to lightweight model tests.

The styles are the design system of spec section 6: the pane never builds a lipgloss style, it composes the cached ones, and it hands the palette-derived markdown config to glamour through the injectable renderer.

func (Model) Armed

func (m Model) Armed() bool

Armed reports whether the pane's destructive prompt has taken its second step. Spec section 1.9 Armed, which is the one state in the TUI that recolors an overlay header band (section 10.1.4, ratified call 6).

func (Model) BrandMounted

func (m Model) BrandMounted() bool

BrandMounted reports whether this pane's branded engine is ticking.

func (*Model) ClearSelection added in v1.7.3

func (m *Model) ClearSelection() bool

func (*Model) Close

func (m *Model) Close()

Close dismisses the pane and invalidates any in-flight result by clearing the current task identity.

func (*Model) ConsumeChanged

func (m *Model) ConsumeChanged() bool

ConsumeChanged reports one acknowledged mutation exactly once.

func (Model) IsDestructivePrompt

func (m Model) IsDestructivePrompt() bool

IsDestructivePrompt reports whether the overlay is showing a prompt whose affirmative carries the ButtonDanger variant of spec section 5.4. Both steps of the comment and link delete - the Delete arm and the Confirm delete - are the same prompt, so the transition between them does not re-arm the root's destructive-prompt grace (spec section 10.3.3).

func (Model) IsOpen

func (m Model) IsOpen() bool

IsOpen reports whether the overlay currently owns input and rendering.

func (Model) MouseHandler

func (m Model) MouseHandler(width, height int) func(tea.MouseMsg) tea.Cmd

MouseHandler routes wheel scrolling within the pane and left-click dismissal outside it. The root disables this handler while nested detail input is active.

func (*Model) NoticeUnknownTaskRef

func (m *Model) NoticeUnknownTaskRef(seq int)

NoticeUnknownTaskRef reports a reference that addresses no card the board holds. Spec section 10.8.5: nothing was attempted and nothing failed, so this is a notice in the body rather than the pinned failure block, and an unresolvable reference costs the reader one line instead of a dismissed pane.

func (*Model) Open

func (m *Model) Open(task board.Task) tea.Cmd

Open resets the pane to task and returns the asynchronous enrichment load.

func (*Model) Overlay

func (m *Model) Overlay(background string, width, height int) string

Overlay composes the pane over the board without making carddetail own the board renderer. Input routing remains the root model's responsibility.

func (Model) OwnsInput

func (m Model) OwnsInput() bool

OwnsInput is the root-routing seam for text entry, selection, confirmation, and in-flight writes. Destructive or focus-changing root shortcuts must not run while it returns true.

func (Model) PointerSession

func (m Model) PointerSession() uint64

PointerSession identifies one open detail owner independently of harmless render generations.

func (*Model) PointerSurface

func (m *Model) PointerSurface(background string, width, height int) pointer.Surface

PointerSurface renders the detail overlay and returns the immutable pointer map produced from this exact layout pass. The root selects it as the active top-most surface, so carddetail never exposes board hit regions while open.

func (*Model) Refresh

func (m *Model) Refresh(task board.Task) tea.Cmd

Refresh replaces the board-resident snapshot and serializes enrichment IO. Repeated refreshes during a load collapse into one successor for the latest task snapshot.

func (*Model) Resize

func (m *Model) Resize(width, height int)

Resize updates the viewport used to bound persistent scroll state.

func (*Model) ResolvePointerMessage

func (m *Model) ResolvePointerMessage(message tea.Msg) (tea.Msg, bool)

ResolvePointerMessage unwraps a message only while the exact rendered detail session and nested action state are still current. A release queued from an older pane cannot mutate a reopened task or a later confirmation.

func (*Model) SetClock

func (m *Model) SetClock(now func() time.Time)

SetClock injects the wall clock the branded engine's elapsed suffix reads through, so a test can pin the suffix without pinning the frame.

func (*Model) SetDriftBackend

func (m *Model) SetDriftBackend(backend DriftBackend, ctx context.Context)

func (*Model) SetFrontMost

func (m *Model) SetFrontMost(front bool) tea.Cmd

SetFrontMost is the background handoff of spec section 10.2.6: a pane that is not front-most stops its engine and remounts at step 0 on return.

It is also where a newly armed operation mounts, because the root calls it after every routed message. That is one rule instead of two: an engine ticks exactly when its surface is front-most and its gate is open, and no start path has to remember to open a chain of its own.

func (*Model) SetStyles

func (m *Model) SetStyles(styles *theme.Styles)

SetStyles adopts a rebuilt design system. Spec section 6.3: the root resolves the palette again when tea.BackgroundColorMsg answers, and every pane it owns has to follow it or the frame renders two palettes at once.

func (Model) TaskID

func (m Model) TaskID() string

TaskID returns the displayed task's durable ID, or empty while closed.

func (Model) TerminalSelectionActive added in v1.7.3

func (m Model) TerminalSelectionActive() bool

func (Model) TerminalSelectionView added in v1.7.3

func (m Model) TerminalSelectionView(width, height int) string

func (*Model) Update

func (m *Model) Update(message tea.Msg) tea.Cmd

Update handles enrichment results and overlay scrolling.

func (*Model) View

func (m *Model) View(width, height int) string

View renders the centered overlay panel sized for the current terminal. The panel carries no shadow here: a shadow needs something to fall on, and this path has no board behind it.

type OpenTaskRefMsg

type OpenTaskRefMsg struct{ Seq int }

OpenTaskRefMsg asks the root to open the card a rendered kb://task reference addresses. The pane cannot resolve a sequence number itself: the board is the root's, and so is the card-opening path a click on a board card already takes, so the reference reuses it rather than growing a second one.

It crosses the session guard of ResolvePointerMessage like every other detail pointer message, so a release queued from a pane that has since been reopened on another card opens nothing.

type Reader

type Reader interface {
	Comments(user, taskRef string) ([]store.Comment, error)
	TaskLinks(user, taskID string) (store.TaskLinks, error)
	Tombstone(user, taskID string) (store.Tombstone, bool, error)
}

Reader is the store projection needed to enrich a board task for display.

type Writer

type Writer interface {
	AddComment(user, taskRef, author, body string) (store.Comment, error)
	DeleteComment(user string, id int) (store.Comment, error)
	Link(user, blockerRef, blockedRef string) (blocker, blocked board.Task, err error)
	Unlink(user, aRef, bRef string) error
}

Writer is the direct SQLite projection used by detail actions. Reader stays separate so read-only and lightweight callers do not need mutation stubs.

Jump to

Keyboard shortcuts

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