model

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TaskDetailViewName = "Tiki Detail"
	TaskDetailViewDesc = "tiki overview. Quick edit, edit dependencies, tags or edit source file"

	TaskEditViewName = "Task Edit"
	TaskEditViewDesc = "Cycle through fields to edit title, status, priority and other"

	DepsEditorViewName = "Dependencies"
	DepsEditorViewDesc = "Move a tiki to Blocks to make it block edited tiki. Move it to Depends to make edited tiki depend on it"
)

built-in view names and descriptions for the header info section

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"
	EditFieldDue         EditField = "due"
	EditFieldRecurrence  EditField = "recurrence"
	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 NextFieldSkipping added in v0.3.1

func NextFieldSkipping(current EditField, skip func(EditField) bool) EditField

NextFieldSkipping returns the next field, skipping fields where skip returns true.

func PrevField

func PrevField(current EditField) EditField

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

func PrevFieldSkipping added in v0.3.1

func PrevFieldSkipping(current EditField, skip func(EditField) bool) EditField

PrevFieldSkipping returns the previous field, skipping fields where skip returns true.

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) 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) 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) GetViewDescription added in v0.3.1

func (hc *HeaderConfig) GetViewDescription() string

GetViewDescription returns the current view description

func (*HeaderConfig) GetViewName added in v0.3.1

func (hc *HeaderConfig) GetViewName() string

GetViewName returns the current view name

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) 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) SetViewInfo added in v0.3.1

func (hc *HeaderConfig) SetViewInfo(name, description string)

SetViewInfo sets the current view name and description for the header info section

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 MessageLevel added in v0.3.1

type MessageLevel string

MessageLevel identifies the severity of a statusline message. Determines which color pair is used when rendering the message.

const (
	MessageLevelInfo  MessageLevel = "info"
	MessageLevelError MessageLevel = "error"
)

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) GetWidthForLane added in v0.3.1

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

GetWidthForLane returns the flex proportion for a lane.

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, widths []int)

SetLaneLayout configures lane columns and widths, and resets selection state as needed. Pass nil for widths to use equal proportions for all lanes.

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 statusline

type StatuslineConfig added in v0.3.1

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

StatuslineConfig manages statusline state — left stats, right message, and visibility. Thread-safe model that notifies listeners when state changes.

func NewStatuslineConfig added in v0.3.1

func NewStatuslineConfig() *StatuslineConfig

NewStatuslineConfig creates a new statusline config with default state

func (*StatuslineConfig) AddListener added in v0.3.1

func (sc *StatuslineConfig) AddListener(listener func()) int

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

func (*StatuslineConfig) ClearMessage added in v0.3.1

func (sc *StatuslineConfig) ClearMessage()

ClearMessage clears the right-section message

func (*StatuslineConfig) ClearRightViewStats added in v0.3.1

func (sc *StatuslineConfig) ClearRightViewStats()

ClearRightViewStats clears all right-aligned view-specific stats

func (*StatuslineConfig) ClearViewStats added in v0.3.1

func (sc *StatuslineConfig) ClearViewStats()

ClearViewStats clears all view-specific stats

func (*StatuslineConfig) DismissAutoHide added in v0.3.1

func (sc *StatuslineConfig) DismissAutoHide() bool

DismissAutoHide is called on every keypress. If auto-hide is active, it clears the message but keeps the statusline bar visible. Returns true if a message was dismissed.

func (*StatuslineConfig) GetLeftStats added in v0.3.1

func (sc *StatuslineConfig) GetLeftStats() map[string]StatValue

GetLeftStats returns all left stats (base + view) merged together

func (*StatuslineConfig) GetMessage added in v0.3.1

func (sc *StatuslineConfig) GetMessage() (string, MessageLevel, bool)

GetMessage returns the current message, its level, and whether auto-hide is active

func (*StatuslineConfig) GetRightViewStats added in v0.3.1

func (sc *StatuslineConfig) GetRightViewStats() map[string]StatValue

GetRightViewStats returns all right-aligned view stats

func (*StatuslineConfig) IsVisible added in v0.3.1

func (sc *StatuslineConfig) IsVisible() bool

IsVisible returns whether the statusline is currently visible

func (*StatuslineConfig) RemoveListener added in v0.3.1

func (sc *StatuslineConfig) RemoveListener(id int)

RemoveListener removes a previously registered listener by ID

func (*StatuslineConfig) SetLeftStat added in v0.3.1

func (sc *StatuslineConfig) SetLeftStat(key, value string, priority int)

SetLeftStat sets a base stat (displayed in all views)

func (*StatuslineConfig) SetMessage added in v0.3.1

func (sc *StatuslineConfig) SetMessage(text string, level MessageLevel, autoHide bool)

SetMessage sets the right-section message with a severity level. If autoHide is true, the message is dismissed on the next keypress (via DismissAutoHide). Setting a message makes the statusline visible.

func (*StatuslineConfig) SetRightViewStat added in v0.3.1

func (sc *StatuslineConfig) SetRightViewStat(key, value string, priority int)

SetRightViewStat sets a right-aligned view-specific stat (e.g. task count)

func (*StatuslineConfig) SetRightViewStats added in v0.3.1

func (sc *StatuslineConfig) SetRightViewStats(stats map[string]StatValue)

SetRightViewStats replaces all right view stats in a single notification

func (*StatuslineConfig) SetViewStat added in v0.3.1

func (sc *StatuslineConfig) SetViewStat(key, value string, priority int)

SetViewStat sets a view-specific stat

func (*StatuslineConfig) SetViewStats added in v0.3.1

func (sc *StatuslineConfig) SetViewStats(stats map[string]StatValue)

SetViewStats replaces all view-specific left stats in a single notification

func (*StatuslineConfig) SetVisible added in v0.3.1

func (sc *StatuslineConfig) SetVisible(visible bool)

SetVisible sets the statusline visibility

type TaskDetailParams

type TaskDetailParams struct {
	TaskID   string
	ReadOnly bool
}

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
	DescOnly bool
	TagsOnly bool
}

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