tui

package
v0.0.0-...-c947b55 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorProfileName

func ColorProfileName(profile termenv.Profile) string

ColorProfileName returns a human-readable name for the color profile

func DetectColorProfile

func DetectColorProfile() termenv.Profile

DetectColorProfile returns the terminal's color capability

func Run

func Run(service core.TaskService, cfg *config.Config) error

Run starts the TUI application Returns an error if the TUI fails to start or exits with an error

Types

type AppState

type AppState int

AppState represents the current application state

const (
	// StateNormal is the default state for navigation and task operations
	StateNormal AppState = iota
	// StateFilterInput is active when user is entering a filter
	StateFilterInput
	// StateHelp is active when help screen is shown
	StateHelp
	// StateConfirm is active when user needs to confirm an action
	StateConfirm
	// StateModifyInput is active when user is entering task modifications
	StateModifyInput
	// StateAnnotateInput is active when user is adding an annotation
	StateAnnotateInput
	// StateNewTaskInput is active when user is creating a new task
	StateNewTaskInput
	// StateResourcePicker is active when user is selecting a resource (URL or file) to open
	StateResourcePicker
	// StateTaskValidation is active when user is shown task validation warnings (TODOs or blocking tasks)
	StateTaskValidation
)

func (AppState) String

func (s AppState) String() string

String returns the string representation of AppState

type AutocompleteDataLoadedMsg

type AutocompleteDataLoadedMsg struct {
	Projects []string
	Tags     []string
	Err      error
}

AutocompleteDataLoadedMsg is sent when autocomplete data (projects/tags) has been loaded

type CalendarSyncCompletedMsg

type CalendarSyncCompletedMsg struct {
	Result *calendar.SyncResult
	Err    error
}

CalendarSyncCompletedMsg is sent when calendar sync completes

type ColorScheme

type ColorScheme struct {
	// Priority colors
	PriorityHigh   lipgloss.Color
	PriorityMedium lipgloss.Color
	PriorityLow    lipgloss.Color

	// Due date colors
	DueOverdue lipgloss.Color
	DueToday   lipgloss.Color
	DueSoon    lipgloss.Color

	// Status colors
	StatusActive    lipgloss.Color
	StatusWaiting   lipgloss.Color
	StatusCompleted lipgloss.Color

	// UI element colors
	HeaderFg      lipgloss.Color
	FooterFg      lipgloss.Color
	SeparatorFg   lipgloss.Color
	SelectionBg   lipgloss.Color
	SelectionFg   lipgloss.Color
	SidebarBorder lipgloss.Color
	SidebarTitle  lipgloss.Color
	LabelFg       lipgloss.Color
	ValueFg       lipgloss.Color
	DimFg         lipgloss.Color
	ErrorFg       lipgloss.Color
	SuccessFg     lipgloss.Color
	TagFg         lipgloss.Color

	// Section colors
	SectionActiveFg   lipgloss.Color
	SectionActiveBg   lipgloss.Color
	SectionInactiveFg lipgloss.Color
}

ColorScheme defines the color palette for the TUI

type ErrorMsg

type ErrorMsg struct {
	Err error
}

ErrorMsg is sent when an error occurs

type FilePathMatch

type FilePathMatch struct {
	Path       string // The actual file path (expanded and normalized)
	Annotation string // The full annotation text containing this path
}

FilePathMatch represents a file path found in an annotation

func ExtractFilePathsFromAnnotations

func ExtractFilePathsFromAnnotations(task *core.Task) []FilePathMatch

ExtractFilePathsFromAnnotations extracts all file paths from a task's annotations Supports: - Absolute paths: /home/user/file.txt, /tmp/data - Paths with spaces (quoted): "/home/user/my documents/file.txt" - Paths with escaped spaces: /home/user/my\ documents/file.txt - Home directory paths: ~/documents/file.txt - Relative paths: ./file.txt, ../parent/file - file:// URLs: file:///home/user/file.txt (with %20 for spaces)

func (FilePathMatch) FormatForDisplay

func (f FilePathMatch) FormatForDisplay() string

FormatForDisplay formats a FilePathMatch for display in the picker Shows the full annotation text so users can recognize which path they want

type Model

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

Model represents the main TUI application model

func NewModel

func NewModel(service core.TaskService, cfg *config.Config) Model

NewModel creates a new TUI model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model and returns the initial command

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model

func (Model) View

func (m Model) View() string

View renders the TUI to a string

type ProjectSummaryLoadedMsg

type ProjectSummaryLoadedMsg struct {
	Summaries []core.ProjectSummary
	Err       error
}

ProjectSummaryLoadedMsg is sent when project summaries have been loaded

type RefreshMsg

type RefreshMsg struct{}

RefreshMsg is sent to trigger a task list refresh

type ResourceMatch

type ResourceMatch struct {
	Resource   string       // The actual URL or file path
	Annotation string       // The full annotation text containing this resource
	Type       ResourceType // Whether this is a URL or file path
}

ResourceMatch represents a resource (URL or file path) found in an annotation

func ExtractResourcesFromAnnotations

func ExtractResourcesFromAnnotations(task *core.Task) []ResourceMatch

ExtractResourcesFromAnnotations extracts all URLs and file paths from a task's annotations Returns a combined, deduplicated list of resources

func (ResourceMatch) FormatForDisplay

func (r ResourceMatch) FormatForDisplay() string

FormatForDisplay formats a ResourceMatch for display in the picker

type ResourceType

type ResourceType int

ResourceType indicates whether a resource is a URL or a file path

const (
	ResourceTypeURL ResourceType = iota
	ResourceTypeFile
)

type StatusMsg

type StatusMsg struct {
	Message string
	IsError bool
}

StatusMsg is sent to display a status message to the user

type Styles

type Styles struct {

	// Pre-computed styles
	Header              lipgloss.Style
	Footer              lipgloss.Style
	Separator           lipgloss.Style
	Selection           lipgloss.Style
	Normal              lipgloss.Style
	SidebarBorder       lipgloss.Style
	SidebarTitle        lipgloss.Style
	Label               lipgloss.Style
	Value               lipgloss.Style
	Dim                 lipgloss.Style
	Error               lipgloss.Style
	Success             lipgloss.Style
	Tag                 lipgloss.Style
	LoadingIndicator    lipgloss.Style
	SectionActive       lipgloss.Style
	SectionInactive     lipgloss.Style
	SectionCount        lipgloss.Style
	TasklistHeader      lipgloss.Style
	GroupHeader         lipgloss.Style
	InputPrompt         lipgloss.Style
	InputHint           lipgloss.Style
	FloatingWindowBox   lipgloss.Style
	FloatingWindowTitle lipgloss.Style
	// contains filtered or unexported fields
}

Styles holds all the lipgloss styles for the TUI

func NewStyles

func NewStyles(theme Theme) *Styles

NewStyles creates a new Styles instance with the given theme

func (*Styles) DueDate

func (s *Styles) DueDate(task interface {
	IsOverdue() bool
	IsDueToday() bool
	IsDueSoon() bool
}) lipgloss.Style

DueDate returns a style for a due date based on its urgency

func (*Styles) GetTheme

func (s *Styles) GetTheme() Theme

GetTheme returns the current theme

func (*Styles) Priority

func (s *Styles) Priority(priority string) lipgloss.Style

Priority returns a style for the given priority level

func (*Styles) TaskStatus

func (s *Styles) TaskStatus(status string) lipgloss.Style

TaskStatus returns a style for a task based on its status

func (*Styles) ToSectionsStyles

func (s *Styles) ToSectionsStyles() components.SectionsStyles

ToSectionsStyles converts Styles to component-specific SectionsStyles

func (*Styles) ToSidebarStyles

func (s *Styles) ToSidebarStyles() components.SidebarStyles

ToSidebarStyles converts Styles to component-specific SidebarStyles

func (*Styles) ToTaskListStyles

func (s *Styles) ToTaskListStyles() components.TaskListStyles

ToTaskListStyles converts Styles to component-specific TaskListStyles

type TaskModifiedMsg

type TaskModifiedMsg struct {
	UUID string
	Err  error
}

TaskModifiedMsg is sent when a task has been modified

type TasksLoadedMsg

type TasksLoadedMsg struct {
	Tasks []core.Task
	Err   error
}

TasksLoadedMsg is sent when tasks have been loaded from the service

type Theme

type Theme struct {
	Name   string
	Colors ColorScheme
}

Theme represents a complete visual theme

func DefaultDarkTheme

func DefaultDarkTheme() Theme

DefaultDarkTheme returns the default dark color scheme

func DefaultLightTheme

func DefaultLightTheme() Theme

DefaultLightTheme returns a light color scheme

func ThemeFromConfig

func ThemeFromConfig(cfgTheme *config.Theme) Theme

ThemeFromConfig converts a config.Theme to a tui.Theme

type URLMatch

type URLMatch struct {
	URL        string // The actual URL
	Annotation string // The full annotation text containing this URL
}

URLMatch represents a URL found in an annotation with optional display text

func ExtractURLsFromAnnotations

func ExtractURLsFromAnnotations(task *core.Task) []URLMatch

ExtractURLsFromAnnotations extracts all URLs from a task's annotations Supports: - Plain URLs (http://, https://, ftp://) - Markdown links: [text](url) - URLs with complex query strings and fragments

func (URLMatch) FormatForDisplay

func (u URLMatch) FormatForDisplay() string

FormatForDisplay formats a URLMatch for display in the picker Shows the full annotation text so users can recognize which URL they want

type ViewMode

type ViewMode int

ViewMode represents the view layout mode

const (
	// ViewModeList shows only the task list
	ViewModeList ViewMode = iota
	// ViewModeListWithSidebar shows task list with detail sidebar
	ViewModeListWithSidebar
	// ViewModeSmall shows task list optimized for small screens (2 lines per task)
	ViewModeSmall
	// ViewModeSmallTaskDetail shows full-screen task details on small screens
	ViewModeSmallTaskDetail
)

func (ViewMode) String

func (v ViewMode) String() string

String returns the string representation of ViewMode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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