model

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeTaskDetailParams

func EncodeTaskDetailParams(p TaskDetailParams) map[string]interface{}

EncodeTaskDetailParams converts typed params into a navigation params map.

func EncodeTaskEditParams

func EncodeTaskEditParams(p TaskEditParams) map[string]interface{}

EncodeTaskEditParams converts typed params into a navigation params map.

func FieldLabel

func FieldLabel(field EditField) string

FieldLabel returns a human-readable label for the field

func GetPluginName

func GetPluginName(id ViewID) string

GetPluginName extracts the plugin name from a plugin ViewID

func IsEditableField

func IsEditableField(field EditField) bool

IsEditableField returns true if the field can be edited (not just viewed)

func IsPluginViewID

func IsPluginViewID(id ViewID) bool

IsPluginViewID checks if a ViewID is for a plugin view

Types

type EditField

type EditField string

EditField identifies an editable field in task edit mode

const (
	EditFieldTitle       EditField = "title"
	EditFieldStatus      EditField = "status"
	EditFieldType        EditField = "type"
	EditFieldPriority    EditField = "priority"
	EditFieldAssignee    EditField = "assignee"
	EditFieldPoints      EditField = "points"
	EditFieldDescription EditField = "description"
)

func NextField

func NextField(current EditField) EditField

NextField returns the next field in the edit cycle (stops at last field, no wrapping)

func PrevField

func PrevField(current EditField) EditField

PrevField returns the previous field in the edit cycle (stops at first field, no wrapping)

type HeaderAction

type HeaderAction struct {
	ID           string
	Key          tcell.Key
	Rune         rune
	Label        string
	Modifier     tcell.ModMask
	ShowInHeader bool
}

HeaderAction is a controller-free DTO representing an action for the header. Used to avoid import cycles between model and controller packages.

type HeaderConfig

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

HeaderConfig manages ALL header state - both content AND visibility. Thread-safe model that notifies listeners when state changes.

func NewHeaderConfig

func NewHeaderConfig() *HeaderConfig

NewHeaderConfig creates a new header config with default state

func (*HeaderConfig) AddListener

func (hc *HeaderConfig) AddListener(listener func()) int

AddListener registers a callback for header config changes. Returns a listener ID that can be used to remove the listener.

func (*HeaderConfig) ClearViewStats

func (hc *HeaderConfig) ClearViewStats()

ClearViewStats clears all view-specific stats

func (*HeaderConfig) GetBurndown

func (hc *HeaderConfig) GetBurndown() []store.BurndownPoint

GetBurndown returns the current burndown chart data

func (*HeaderConfig) GetPluginActions

func (hc *HeaderConfig) GetPluginActions() []HeaderAction

GetPluginActions returns the plugin navigation header actions

func (*HeaderConfig) GetStats

func (hc *HeaderConfig) GetStats() map[string]StatValue

GetStats returns all stats (base + view) merged together

func (*HeaderConfig) GetUserPreference

func (hc *HeaderConfig) GetUserPreference() bool

GetUserPreference returns the user's preferred visibility

func (*HeaderConfig) GetViewActions

func (hc *HeaderConfig) GetViewActions() []HeaderAction

GetViewActions returns the current view's header actions

func (*HeaderConfig) IsVisible

func (hc *HeaderConfig) IsVisible() bool

IsVisible returns whether the header is currently visible

func (*HeaderConfig) RemoveListener

func (hc *HeaderConfig) RemoveListener(id int)

RemoveListener removes a previously registered listener by ID

func (*HeaderConfig) SetBaseStat

func (hc *HeaderConfig) SetBaseStat(key, value string, priority int)

SetBaseStat sets a global stat (displayed in all views)

func (*HeaderConfig) SetBurndown

func (hc *HeaderConfig) SetBurndown(points []store.BurndownPoint)

SetBurndown updates the burndown chart data

func (*HeaderConfig) SetPluginActions

func (hc *HeaderConfig) SetPluginActions(actions []HeaderAction)

SetPluginActions updates the plugin navigation header actions

func (*HeaderConfig) SetUserPreference

func (hc *HeaderConfig) SetUserPreference(preference bool)

SetUserPreference sets the user's preferred visibility

func (*HeaderConfig) SetViewActions

func (hc *HeaderConfig) SetViewActions(actions []HeaderAction)

SetViewActions updates the view-specific header actions

func (*HeaderConfig) SetViewStat

func (hc *HeaderConfig) SetViewStat(key, value string, priority int)

SetViewStat sets a view-specific stat

func (*HeaderConfig) SetVisible

func (hc *HeaderConfig) SetVisible(visible bool)

SetVisible sets the current header visibility

func (*HeaderConfig) ToggleUserPreference

func (hc *HeaderConfig) ToggleUserPreference()

ToggleUserPreference toggles the user preference and updates visible state

type LayoutModel

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

LayoutModel manages the screen layout state - what content view is displayed. Thread-safe model that notifies listeners when content changes.

func NewLayoutModel

func NewLayoutModel() *LayoutModel

NewLayoutModel creates a new layout model with default state

func (*LayoutModel) AddListener

func (lm *LayoutModel) AddListener(listener func()) int

AddListener registers a callback for layout changes. Returns a listener ID that can be used to remove the listener.

func (*LayoutModel) GetContentParams

func (lm *LayoutModel) GetContentParams() map[string]any

GetContentParams returns the current content view parameters

func (*LayoutModel) GetContentViewID

func (lm *LayoutModel) GetContentViewID() ViewID

GetContentViewID returns the current content view identifier

func (*LayoutModel) GetRevision

func (lm *LayoutModel) GetRevision() uint64

GetRevision returns the current revision counter

func (*LayoutModel) RemoveListener

func (lm *LayoutModel) RemoveListener(id int)

RemoveListener removes a previously registered listener by ID

func (*LayoutModel) SetContent

func (lm *LayoutModel) SetContent(viewID ViewID, params map[string]any)

SetContent updates the current content view and notifies listeners

func (*LayoutModel) Touch

func (lm *LayoutModel) Touch()

Touch increments the revision and notifies listeners without changing viewID/params. Use when the current view's internal UI state changes and RootLayout must recompute derived layout (e.g., header visibility after fullscreen toggle).

type PluginConfig

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

PluginConfig holds selection state for a plugin view

func NewPluginConfig

func NewPluginConfig(name string) *PluginConfig

NewPluginConfig creates a plugin config

func (*PluginConfig) AddSelectionListener

func (pc *PluginConfig) AddSelectionListener(listener PluginSelectionListener) int

AddSelectionListener registers a callback for selection changes

func (*PluginConfig) ClampSelection

func (pc *PluginConfig) ClampSelection(taskCount int)

ClampSelection ensures selection is within bounds for the current lane.

func (*PluginConfig) ClearSearchResults

func (pc *PluginConfig) ClearSearchResults()

ClearSearchResults clears search and restores pre-search selection

func (*PluginConfig) GetColumnsForLane added in v0.1.2

func (pc *PluginConfig) GetColumnsForLane(lane int) int

GetColumnsForLane returns the number of grid columns for a lane.

func (*PluginConfig) GetPluginName

func (pc *PluginConfig) GetPluginName() string

GetPluginName returns the plugin name

func (*PluginConfig) GetScrollOffsetForLane added in v0.1.2

func (pc *PluginConfig) GetScrollOffsetForLane(lane int) int

GetScrollOffsetForLane returns the scroll offset (top visible row) for a lane.

func (*PluginConfig) GetSearchQuery

func (pc *PluginConfig) GetSearchQuery() string

GetSearchQuery returns the current search query

func (*PluginConfig) GetSearchResults

func (pc *PluginConfig) GetSearchResults() []task.SearchResult

GetSearchResults returns current search results (nil if no search active)

func (*PluginConfig) GetSelectedIndex

func (pc *PluginConfig) GetSelectedIndex() int

GetSelectedIndex returns the selected task index for the current lane.

func (*PluginConfig) GetSelectedIndexForLane added in v0.1.2

func (pc *PluginConfig) GetSelectedIndexForLane(lane int) int

GetSelectedIndexForLane returns the selected index for a lane.

func (*PluginConfig) GetSelectedLane added in v0.1.2

func (pc *PluginConfig) GetSelectedLane() int

GetSelectedLane returns the selected lane index.

func (*PluginConfig) GetViewMode

func (pc *PluginConfig) GetViewMode() ViewMode

GetViewMode returns the current view mode

func (*PluginConfig) IsSearchActive

func (pc *PluginConfig) IsSearchActive() bool

IsSearchActive returns true if search is currently active

func (*PluginConfig) MoveSelection

func (pc *PluginConfig) MoveSelection(direction string, taskCount int) bool

MoveSelection moves selection in a direction within the current lane.

func (*PluginConfig) RemoveSelectionListener

func (pc *PluginConfig) RemoveSelectionListener(id int)

RemoveSelectionListener removes a listener by ID

func (*PluginConfig) SavePreSearchState

func (pc *PluginConfig) SavePreSearchState()

SavePreSearchState saves current selection for later restoration

func (*PluginConfig) SetConfigIndex

func (pc *PluginConfig) SetConfigIndex(index int)

SetConfigIndex sets the config index for this plugin

func (*PluginConfig) SetLaneLayout added in v0.1.2

func (pc *PluginConfig) SetLaneLayout(columns []int)

SetLaneLayout configures lane columns and resets selection state as needed.

func (*PluginConfig) SetScrollOffsetForLane added in v0.1.2

func (pc *PluginConfig) SetScrollOffsetForLane(lane int, offset int)

SetScrollOffsetForLane sets the scroll offset for a specific lane.

func (*PluginConfig) SetSearchResults

func (pc *PluginConfig) SetSearchResults(results []task.SearchResult, query string)

SetSearchResults sets filtered search results and query

func (*PluginConfig) SetSelectedIndex

func (pc *PluginConfig) SetSelectedIndex(idx int)

SetSelectedIndex sets the selected task index for the current lane.

func (*PluginConfig) SetSelectedIndexForLane added in v0.1.2

func (pc *PluginConfig) SetSelectedIndexForLane(lane int, idx int)

SetSelectedIndexForLane sets the selected index for a specific lane.

func (*PluginConfig) SetSelectedLane added in v0.1.2

func (pc *PluginConfig) SetSelectedLane(lane int)

SetSelectedLane sets the selected lane index.

func (*PluginConfig) SetSelectedLaneAndIndex added in v0.1.2

func (pc *PluginConfig) SetSelectedLaneAndIndex(lane int, idx int)

func (*PluginConfig) SetViewMode

func (pc *PluginConfig) SetViewMode(mode string)

SetViewMode sets the view mode from a string value

func (*PluginConfig) ToggleViewMode

func (pc *PluginConfig) ToggleViewMode()

ToggleViewMode switches between compact and expanded view modes

type PluginSelectionListener

type PluginSelectionListener func()

PluginSelectionListener is called when plugin selection changes

type SearchState

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

SearchState holds reusable search state that can be embedded in any view config

func (*SearchState) ClearSearchResults

func (ss *SearchState) ClearSearchResults() (int, string, int)

ClearSearchResults clears search and returns the pre-search state Returns: (preSearchIndex, preSearchPane, preSearchRow)

func (*SearchState) GetSearchQuery

func (ss *SearchState) GetSearchQuery() string

GetSearchQuery returns the current search query

func (*SearchState) GetSearchResults

func (ss *SearchState) GetSearchResults() []task.SearchResult

GetSearchResults returns current search results (nil if no search active)

func (*SearchState) IsSearchActive

func (ss *SearchState) IsSearchActive() bool

IsSearchActive returns true if search is currently active

func (*SearchState) SavePreSearchPaneState added in v0.0.4

func (ss *SearchState) SavePreSearchPaneState(paneID string, row int)

SavePreSearchPaneState saves the current pane and row for board view

func (*SearchState) SavePreSearchState

func (ss *SearchState) SavePreSearchState(index int)

SavePreSearchState saves the current selection index for grid-based views

func (*SearchState) SetSearchResults

func (ss *SearchState) SetSearchResults(results []task.SearchResult, query string)

SetSearchResults sets filtered search results and query

type StatValue

type StatValue struct {
	Value    string
	Priority int
}

StatValue represents a single stat entry for the header

type TaskDetailParams

type TaskDetailParams struct {
	TaskID string
}

TaskDetailParams are params for TaskDetailViewID.

func DecodeTaskDetailParams

func DecodeTaskDetailParams(params map[string]interface{}) TaskDetailParams

DecodeTaskDetailParams converts a navigation params map into typed params.

type TaskEditParams

type TaskEditParams struct {
	TaskID string
	Draft  *taskpkg.Task
	Focus  EditField
}

TaskEditParams are params for TaskEditViewID.

func DecodeTaskEditParams

func DecodeTaskEditParams(params map[string]interface{}) TaskEditParams

DecodeTaskEditParams converts a navigation params map into typed params.

type ViewID

type ViewID string

ViewID identifies a view type

const (
	TaskDetailViewID   ViewID = "task_detail"
	TaskEditViewID     ViewID = "task_edit"
	PluginViewIDPrefix ViewID = "plugin:" // Prefix for plugin views
)

view identifiers

func MakePluginViewID

func MakePluginViewID(name string) ViewID

MakePluginViewID creates a ViewID for a plugin with the given name

type ViewMode

type ViewMode string

ViewMode represents the display mode for task boxes

const (
	ViewModeCompact  ViewMode = "compact"  // 3-line display (5 total height with border)
	ViewModeExpanded ViewMode = "expanded" // 7-line display (9 total height with border)
)

Jump to

Keyboard shortcuts

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