ui

package
v0.0.0-...-c75bb4f Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

This module contains colors from github.com/charmbracelet/x/exp/charmtone

See: https://github.com/charmbracelet/x/blob/main/exp/charmtone/charmtone.go

See https://patorjk.com/software/taag/

NOTE: these aren't used anymore but are left in because they're cool

TODO: Use glamour to render the markdown produced by [formatTaskForView] TODO: remove the ID from the table

Index

Constants

View Source
const (
	// U+25CF Black Circle
	StatusTodoSymbol = "●"
	// U+25D0 Circle with Left Half Black
	StatusInProgressSymbol = "◐"
	// U+25A0 Black Square
	StatusBlockedSymbol = "■"
	// U+2713 Check Mark
	StatusDoneSymbol = "✓"
	// U+26AB Medium Black Circle
	StatusAbandonedSymbol = "⚫"
	// U+25CB White Circle
	StatusPendingSymbol = "○"
	// U+2713 Check Mark
	StatusCompletedSymbol = "✓"
	// U+2717 Ballot X
	StatusDeletedSymbol = "✗"
	// U+2605 Black Star
	PriorityHighSymbol = "★"
	// U+2606 White Star
	PriorityMediumSymbol = "☆"
	// U+25E6 White Bullet
	PriorityLowSymbol = "◦"
	// U+25CB White Circle
	PriorityNoneSymbol = "○"
	// Three stars
	PriorityHighPattern = "★★★"
	// Two stars, one outline
	PriorityMediumPattern = "★★☆"
	// One star, two outline
	PriorityLowPattern = "★☆☆"
	// Three outline stars
	PriorityNonePattern = "☆☆☆"
)

Variables

View Source
var (
	PrimaryColors     = []Key{Guac, Julep, Bok, Pickle, NeueGuac}
	SecondaryColors   = []Key{Malibu, Sardine, Lichen}
	TertiaryColors    = []Key{Violet, Mauve, Plum, Orchid, Charple, Hazy}
	ProvisionalColors = []Key{NeueGuac, NeueZinc}
	AdditionColors    = []Key{Pickle, Gator, Spinach}
	DeletionColors    = []Key{Pom, Steak, Toast}
)
View Source
var (
	ColorBGBase      = Pepper.Hex()   // #201F26 - Darkest base
	ColorBGSecondary = BBQ.Hex()      // #2d2c35 - Secondary background
	ColorBGTertiary  = Charcoal.Hex() // #3A3943 - Tertiary/elevated
	ColorBGInput     = Iron.Hex()     // #4D4C57 - Input fields/focus

	ColorTextPrimary   = Salt.Hex()   // #F1EFEF - Primary text (brightest)
	ColorTextSecondary = Smoke.Hex()  // #BFBCC8 - Secondary text
	ColorTextMuted     = Squid.Hex()  // #858392 - Muted/comments
	ColorTextDimmed    = Oyster.Hex() // #605F6B - Dimmed text

	ColorPrimary = Malibu.Hex()   // #00A4FF - Blue (primary accent)
	ColorSuccess = Julep.Hex()    // #00FFB2 - Green (success/positive)
	ColorError   = Sriracha.Hex() // #EB4268 - Red (errors)
	ColorWarning = Tang.Hex()     // #FF985A - Orange (warnings)
	ColorInfo    = Violet.Hex()   // #C259FF - Purple (info)
	ColorAccent  = Lichen.Hex()   // #5CDFEA - Teal (secondary accent)

	PrimaryStyle  = newStyle().Foreground(lipgloss.Color(ColorPrimary))
	SuccessStyle  = newBoldStyle().Foreground(lipgloss.Color(ColorSuccess))
	ErrorStyle    = newBoldStyle().Foreground(lipgloss.Color(ColorError))
	WarningStyle  = newBoldStyle().Foreground(lipgloss.Color(ColorWarning))
	InfoStyle     = newStyle().Foreground(lipgloss.Color(ColorTextSecondary))
	AccentStyle   = newStyle().Foreground(lipgloss.Color(ColorAccent))
	TextStyle     = newStyle().Foreground(lipgloss.Color(ColorTextPrimary))
	MutedStyle    = newStyle().Foreground(lipgloss.Color(ColorTextMuted))
	TitleStyle    = newPBoldStyle(0, 1).Foreground(lipgloss.Color(ColorPrimary))
	SubtitleStyle = newEmStyle().Foreground(lipgloss.Color(ColorAccent))

	BoxStyle      = newPStyle(1, 2).Border(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color(ColorPrimary))
	ErrorBoxStyle = newPStyle(1, 2).Border(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color(ColorError))
	HeaderStyle   = newPBoldStyle(0, 1).Foreground(lipgloss.Color(ColorPrimary))
	CellStyle     = newPStyle(0, 1).Foreground(lipgloss.Color(ColorTextPrimary))

	ListItemStyle     = newStyle().Foreground(lipgloss.Color(ColorTextPrimary)).PaddingLeft(2)
	SelectedItemStyle = newBoldStyle().Foreground(lipgloss.Color(ColorPrimary)).PaddingLeft(2)

	TableStyle         = newStyle().BorderStyle(lipgloss.NormalBorder()).BorderForeground(lipgloss.Color(ColorTextMuted))
	TableHeaderStyle   = newBoldStyle().Foreground(lipgloss.Color(ColorAccent))
	TableTitleStyle    = newBoldStyle().Foreground(lipgloss.Color(ColorPrimary))
	TableSelectedStyle = newBoldStyle().Foreground(lipgloss.Color(ColorTextPrimary)).Background(lipgloss.Color(ColorBGInput))

	TaskTitleStyle = newBoldStyle().Foreground(lipgloss.Color(ColorTextPrimary))
	TaskIDStyle    = newStyle().Foreground(lipgloss.Color(ColorTextMuted)).Width(8)

	StatusTodo       = newStyle().Foreground(lipgloss.Color(ColorTextMuted))  // Gray (muted)
	StatusInProgress = newStyle().Foreground(lipgloss.Color(ColorPrimary))    // Blue (active)
	StatusBlocked    = newStyle().Foreground(lipgloss.Color(ColorError))      // Red (blocked)
	StatusDone       = newStyle().Foreground(lipgloss.Color(ColorSuccess))    // Green (success)
	StatusPending    = newStyle().Foreground(lipgloss.Color(ColorWarning))    // Orange (pending)
	StatusCompleted  = newStyle().Foreground(lipgloss.Color(ColorSuccess))    // Green (completed)
	StatusAbandoned  = newStyle().Foreground(lipgloss.Color(ColorTextDimmed)) // Dimmed gray (abandoned)
	StatusDeleted    = newStyle().Foreground(lipgloss.Color(Pom.Hex()))       // Dark red (deleted)

	PriorityHigh   = newBoldStyle().Foreground(lipgloss.Color(Pom.Hex()))  // #FF388B - Bright red
	PriorityMedium = newStyle().Foreground(lipgloss.Color(Tang.Hex()))     // #FF985A - Orange
	PriorityLow    = newStyle().Foreground(lipgloss.Color(ColorAccent))    // #5CDFEA - Teal (low)
	PriorityNone   = newStyle().Foreground(lipgloss.Color(ColorTextMuted)) // #858392 - Gray (no priority)
	PriorityLegacy = newStyle().Foreground(lipgloss.Color(Urchin.Hex()))   // #C337E0 - Magenta (legacy)

	MovieStyle = newBoldStyle().Foreground(lipgloss.Color(Coral.Hex()))  // #FF577D - Pink/coral
	TVStyle    = newBoldStyle().Foreground(lipgloss.Color(Violet.Hex())) // #C259FF - Purple
	BookStyle  = newBoldStyle().Foreground(lipgloss.Color(Guac.Hex()))   // #12C78F - Green
	MusicStyle = newBoldStyle().Foreground(lipgloss.Color(Lichen.Hex())) // #5CDFEA - Teal

	AdditionStyle = newStyle().Foreground(lipgloss.Color(Pickle.Hex())) // #00A475 - Green
	DeletionStyle = newStyle().Foreground(lipgloss.Color(Pom.Hex()))    // #AB2454 - Red
)
View Source
var (
	TodoStyle           = StatusTodo
	InProgressStyle     = StatusInProgress
	BlockedStyle        = StatusBlocked
	DoneStyle           = StatusDone
	AbandonedStyle      = StatusAbandoned
	PendingStyle        = StatusPending
	CompletedStyle      = StatusCompleted
	DeletedStyle        = StatusDeleted
	PriorityHighStyle   = PriorityHigh
	PriorityMediumStyle = PriorityMedium
	PriorityLowStyle    = PriorityLow
	PriorityNoneStyle   = PriorityNone
	PriorityLegacyStyle = PriorityLegacy
)

Type aliases for status and priority styles (now defined in palette.go)

View Source
var Expect = AssertionHelpers{}
View Source
var NoteleafColorScheme fang.ColorSchemeFunc = noteleafColorScheme

Functions

func Accent

func Accent(format string, a ...any)

Accent prints accent-colored text

func Accentln

func Accentln(format string, a ...any)

Accentln prints accent-colored text with a newline

func Box

func Box(format string, a ...any)

Box prints content in a styled box

func Boxln

func Boxln(format string, a ...any)

Boxln prints content in a styled box with a newline

func Error

func Error(format string, a ...any)

Error prints a formatted error message

func ErrorBox

func ErrorBox(format string, a ...any)

ErrorBox prints error content in a styled error box

func ErrorBoxln

func ErrorBoxln(format string, a ...any)

ErrorBoxln prints error content in a styled error box with a newline

func Errorln

func Errorln(format string, a ...any)

Errorln prints a formatted error message with a newline

func FormatPriorityIndicator

func FormatPriorityIndicator(priority string) string

FormatPriorityIndicator returns a styled priority pattern

func FormatPriorityWithText

func FormatPriorityWithText(priority string) string

FormatPriorityWithText returns a styled priority with text description

func FormatStatusIndicator

func FormatStatusIndicator(status string) string

FormatStatusIndicator returns a styled status symbol and text

func FormatStatusWithText

func FormatStatusWithText(status string) string

FormatStatusWithText returns a styled status symbol with status text

func FormatTaskPriority

func FormatTaskPriority(task *models.Task) string

FormatTaskPriority returns a complete priority display with pattern, priority, and description

func FormatTaskStatus

func FormatTaskStatus(task *models.Task) string

FormatTaskStatus returns a complete status display with symbol, status, and description

func GetAllPriorityPatterns

func GetAllPriorityPatterns() map[string]string

GetAllPriorityPatterns returns a map of all priority patterns for reference

func GetAllPrioritySymbols

func GetAllPrioritySymbols() map[string]string

GetAllPrioritySymbols returns a map of all priority symbols for reference

func GetAllStatusSymbols

func GetAllStatusSymbols() map[string]string

GetAllStatusSymbols returns a map of all status symbols for reference

func GetPriorityDescription

func GetPriorityDescription(priority string) string

GetPriorityDescription returns a human-friendly description of the priority

func GetPriorityDisplayType

func GetPriorityDisplayType(priority string) string

GetPriorityDisplayType returns the display type for a priority (text, numeric, or legacy)

func GetPriorityPattern

func GetPriorityPattern(priority string) string

GetPriorityPattern returns the star pattern for a given priority

func GetPriorityStyle

func GetPriorityStyle(priority string) lipgloss.Style

GetPriorityStyle returns the color style for a given priority

func GetPrioritySymbol

func GetPrioritySymbol(priority string) string

GetPrioritySymbol returns the unicode symbol for a given priority

func GetStatusDescription

func GetStatusDescription(status string) string

GetStatusDescription returns a human-friendly description of the status

func GetStatusStyle

func GetStatusStyle(status string) lipgloss.Style

GetStatusStyle returns the color style for a given status

Defaults to pending style

func GetStatusSymbol

func GetStatusSymbol(status string) string

GetStatusSymbol returns the unicode symbol for a given status

Default to pending
func Header(format string, a ...any)

func Headerln

func Headerln(format string, a ...any)

func Info

func Info(format string, a ...any)

Info prints a formatted info message

func Infoln

func Infoln(format string, a ...any)

Infoln prints a formatted info message with a newline

func Infop

func Infop(format string, a ...any)

Infop prints a formatted info message, sans icon

func Infopln

func Infopln(format string, a ...any)

Infopln prints a formatted info message with a newline, sans icon

func IsValidStatusTransition

func IsValidStatusTransition(from, to string) bool

IsValidStatusTransition checks if a status transition is logically valid

From todo, can go to in-progress, blocked, done, or abandoned
From in-progress, can go to blocked, done, abandoned, or back to todo
From blocked, can go to todo, in-progress, done, or abandoned
From done, can only be reopened to todo or in-progress
From abandoned, can be reopened to todo or in-progress

func Muted

func Muted(format string, a ...any)

Muted prints muted/secondary text

func Mutedln

func Mutedln(format string, a ...any)

Mutedln prints muted/secondary text with a newline

func Newline

func Newline()

func ObfuscateMiddle

func ObfuscateMiddle(s string, left, right int) string

ObfuscateMiddle returns a string where the middle portion is replaced by "..." TODO: move to package utils or shared

func Plain

func Plain(format string, a ...any)

func Plainln

func Plainln(format string, a ...any)

func Primary

func Primary(format string, a ...any)

Primary prints primary-colored text

func Primaryln

func Primaryln(format string, a ...any)

Primaryln prints primary-colored text with a newline

func PriorityLegend

func PriorityLegend() string

PriorityLegend returns a formatted legend showing all priority patterns

func StatusLegend

func StatusLegend() string

StatusLegend returns a formatted legend showing all status symbols

func Subtitle

func Subtitle(format string, a ...any)

Subtitle prints a formatted subtitle

func Subtitleln

func Subtitleln(format string, a ...any)

Subtitleln prints a formatted subtitle with a newline

func Success

func Success(format string, a ...any)

Success prints a formatted success message

func Successln

func Successln(format string, a ...any)

Successln prints a formatted success message with a newline

func Title

func Title(format string, a ...any)

Title prints a formatted title

func Titleln

func Titleln(format string, a ...any)

Titleln prints a formatted title with a newline

func Warning

func Warning(format string, a ...any)

Warning prints a formatted warning message

func Warningln

func Warningln(format string, a ...any)

Warningln prints a formatted warning message with a newline

Types

type Action

type Action struct {
	Key         string
	Description string
	Handler     func(record DataRecord) tea.Cmd
}

Action defines an action that can be performed on a record

type AssertionHelpers

type AssertionHelpers struct{}

func (*AssertionHelpers) AssertModelState

func (ah *AssertionHelpers) AssertModelState(t *testing.T, suite *TUITestSuite, checker func(tea.Model) bool, msg string)

func (*AssertionHelpers) AssertViewContains

func (ah *AssertionHelpers) AssertViewContains(t *testing.T, suite *TUITestSuite, expected string, msg string)

func (*AssertionHelpers) AssertViewNotContains

func (ah *AssertionHelpers) AssertViewNotContains(t *testing.T, suite *TUITestSuite, unexpected string, msg string)

func (*AssertionHelpers) AssertZeroTime

func (ah *AssertionHelpers) AssertZeroTime(t *testing.T, getter func() time.Time, label string)

type AuthForm

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

AuthForm provides an interactive form for AT Protocol authentication

func NewAuthForm

func NewAuthForm(initialHandle string, opts AuthFormOptions) *AuthForm

NewAuthForm creates a new authentication form

func (*AuthForm) Run

func (af *AuthForm) Run() (*AuthFormResult, error)

Run displays the auth form and returns the entered credentials

type AuthFormOptions

type AuthFormOptions struct {
	Output io.Writer
	Input  io.Reader
	Width  int
	Height int
}

AuthFormOptions configures the auth form display

type AuthFormResult

type AuthFormResult struct {
	Handle   string
	Password string
	Canceled bool
}

AuthFormResult holds the submitted credentials

type BookDataSource

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

BookDataSource adapts BookRepository to work with DataList

func (*BookDataSource) Count

func (b *BookDataSource) Count(ctx context.Context, opts ListOptions) (int, error)

func (*BookDataSource) Load

func (b *BookDataSource) Load(ctx context.Context, opts ListOptions) ([]ListItem, error)

func (*BookDataSource) Search

func (b *BookDataSource) Search(ctx context.Context, query string, opts ListOptions) ([]ListItem, error)

type BookRecord

type BookRecord struct {
	*models.Book
}

BookRecord adapts models.Book to work with DataList

func (*BookRecord) GetDescription

func (b *BookRecord) GetDescription() string

func (*BookRecord) GetField

func (b *BookRecord) GetField(name string) any

func (*BookRecord) GetFilterValue

func (b *BookRecord) GetFilterValue() string

func (*BookRecord) GetTitle

func (b *BookRecord) GetTitle() string

type ControlledInput

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

ControlledInput provides controlled input simulation

func (*ControlledInput) QueueMessage

func (ci *ControlledInput) QueueMessage(msg tea.Msg)

func (*ControlledInput) Read

func (ci *ControlledInput) Read(p []byte) (n int, err error)

Read is primarily for compatibility - actual input comes through channels

type ControlledOutput

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

ControlledOutput captures program output for verification

func (*ControlledOutput) GetOutput

func (co *ControlledOutput) GetOutput() []byte

func (*ControlledOutput) GetWrites

func (co *ControlledOutput) GetWrites() [][]byte

func (*ControlledOutput) Write

func (co *ControlledOutput) Write(p []byte) (n int, err error)

type DataList

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

DataList handles list display and interaction

func NewBookDataList

func NewBookDataList(repo utils.TestBookRepository, opts DataListOptions, status string) *DataList

NewBookDataList creates a new DataList for browsing books

func NewBookListFromList

func NewBookListFromList(repo utils.TestBookRepository, output io.Writer, input io.Reader, static bool, status string) *DataList

NewBookListFromList creates a BookList-compatible interface using DataList

func NewDataList

func NewDataList(source ListSource, opts DataListOptions) *DataList

NewDataList creates a new data list

func NewNoteDataList

func NewNoteDataList(repo utils.TestNoteRepository, opts DataListOptions, showArchived bool, tags []string) *DataList

NewNoteDataList creates a new DataList for browsing notes

func NewNoteListFromList

func NewNoteListFromList(repo utils.TestNoteRepository, output io.Writer, input io.Reader, static bool, showArchived bool, tags []string) *DataList

NewNoteListFromList creates a NoteList-compatible interface using DataList

func NewPublicationDataList

func NewPublicationDataList(repo utils.TestNoteRepository, opts DataListOptions, filter string) *DataList

NewPublicationDataList creates a new DataList for browsing published/draft documents

func NewPublicationListFromList

func NewPublicationListFromList(repo utils.TestNoteRepository, output io.Writer, input io.Reader, static bool, filter string) *DataList

NewPublicationListFromList creates a publication list using DataList

func (*DataList) Browse

func (dl *DataList) Browse(ctx context.Context) error

Browse opens an interactive list interface

func (*DataList) BrowseWithOptions

func (dl *DataList) BrowseWithOptions(ctx context.Context, listOpts ListOptions) error

BrowseWithOptions opens an interactive list with custom options

type DataListKeyMap

type DataListKeyMap struct {
	Up      key.Binding
	Down    key.Binding
	Enter   key.Binding
	View    key.Binding
	Search  key.Binding
	Refresh key.Binding
	Quit    key.Binding
	Back    key.Binding
	Help    key.Binding
	Numbers []key.Binding
	Actions map[string]key.Binding
}

DataListKeyMap defines key bindings for list navigation

func DefaultDataListKeys

func DefaultDataListKeys() DataListKeyMap

DefaultDataListKeys returns the default key bindings for lists

func (DataListKeyMap) FullHelp

func (k DataListKeyMap) FullHelp() [][]key.Binding

func (DataListKeyMap) ShortHelp

func (k DataListKeyMap) ShortHelp() []key.Binding

type DataListOptions

type DataListOptions struct {
	Output       io.Writer
	Input        io.Reader
	Static       bool
	Title        string
	Actions      []ListAction
	ViewHandler  func(item ListItem) string
	ItemRenderer func(item ListItem, selected bool) string
	ShowSearch   bool
	Searchable   bool
}

DataListOptions configures list behavior

type DataOptions

type DataOptions struct {
	Filters   map[string]any
	SortBy    string
	SortOrder string
	Limit     int
	Offset    int
}

DataOptions configures data loading

type DataRecord

type DataRecord interface {
	models.Model
	GetField(name string) any
}

DataRecord represents a single row of data in a table

type DataSource

type DataSource interface {
	Load(ctx context.Context, opts DataOptions) ([]DataRecord, error)
	Count(ctx context.Context, opts DataOptions) (int, error)
}

DataSource provides data for the table

type DataTable

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

DataTable handles table display and interaction

func NewDataTable

func NewDataTable(source DataSource, opts DataTableOptions) *DataTable

NewDataTable creates a new data table

func NewProjectDataTable

func NewProjectDataTable(repo ProjectRepository, opts DataTableOptions) *DataTable

NewProjectDataTable creates a new DataTable for browsing projects

func NewProjectListFromTable

func NewProjectListFromTable(repo ProjectRepository, output io.Writer, input io.Reader, static bool) *DataTable

NewProjectListFromTable creates a ProjectList-compatible interface using DataTable

func NewTagDataTable

func NewTagDataTable(repo TagRepository, opts DataTableOptions) *DataTable

NewTagDataTable creates a new DataTable for browsing tags

func NewTagListFromTable

func NewTagListFromTable(repo TagRepository, output io.Writer, input io.Reader, static bool) *DataTable

NewTagListFromTable creates a TagList-compatible interface using DataTable

func NewTaskDataTable

func NewTaskDataTable(repo utils.TestTaskRepository, opts DataTableOptions, showAll bool, status, priority, project string) *DataTable

NewTaskDataTable creates a new DataTable for browsing tasks

func NewTaskListFromTable

func NewTaskListFromTable(repo utils.TestTaskRepository, output io.Writer, input io.Reader, static bool, showAll bool, status, priority, project string) *DataTable

NewTaskListFromTable creates a TaskList-compatible interface using DataTable

func (*DataTable) Browse

func (dt *DataTable) Browse(ctx context.Context) error

Browse opens an interactive table interface

func (*DataTable) BrowseWithOptions

func (dt *DataTable) BrowseWithOptions(ctx context.Context, dataOpts DataOptions) error

BrowseWithOptions opens an interactive table with custom data options

type DataTableKeyMap

type DataTableKeyMap struct {
	Up      key.Binding
	Down    key.Binding
	Enter   key.Binding
	View    key.Binding
	Refresh key.Binding
	Quit    key.Binding
	Back    key.Binding
	Help    key.Binding
	Numbers []key.Binding
	Actions map[string]key.Binding
}

DataTableKeyMap defines key bindings for table navigation

func DefaultDataTableKeys

func DefaultDataTableKeys() DataTableKeyMap

DefaultDataTableKeys returns the default key bindings

func (DataTableKeyMap) FullHelp

func (k DataTableKeyMap) FullHelp() [][]key.Binding

func (DataTableKeyMap) ShortHelp

func (k DataTableKeyMap) ShortHelp() []key.Binding

type DataTableOptions

type DataTableOptions struct {
	Output      io.Writer
	Input       io.Reader
	Static      bool
	Title       string
	Fields      []Field
	Actions     []Action
	ViewHandler func(record DataRecord) string
}

DataTableOptions configures table behavior

type Field

type Field struct {
	Name      string
	Title     string
	Width     int
	Formatter func(value any) string
}

Field defines a column in the table

type Key

type Key int

Key is a type for color keys.

const (
	Cumin Key = iota
	Tang
	Yam
	Paprika
	Bengal
	Uni
	Sriracha
	Coral
	Salmon
	Chili
	Cherry
	Tuna
	Macaron
	Pony
	Cheeky
	Flamingo
	Dolly
	Blush
	Urchin
	Mochi
	Lilac
	Prince
	Violet
	Mauve
	Grape
	Plum
	Orchid
	Jelly
	Charple
	Hazy
	Ox
	Sapphire
	Guppy
	Oceania
	Thunder
	Anchovy
	Damson
	Malibu
	Sardine
	Zinc
	Turtle
	Lichen
	Guac
	Julep
	Bok
	Mustard
	Citron
	Zest
	Pepper
	BBQ
	Charcoal
	Iron
	Oyster
	Squid
	Smoke
	Ash
	Salt
	Butter

	// Diffs: additions. The brightest color in this set is Julep, defined above.
	Pickle
	Gator
	Spinach

	// Diffs: deletions. The brightest color in this set is Cherry, defined above.
	Pom
	Steak
	Toast

	// Provisional.
	NeueGuac
	NeueZinc
)

func (Key) Hex

func (k Key) Hex() string

func (Key) IsPrimary

func (k Key) IsPrimary() bool

func (Key) IsSecondary

func (k Key) IsSecondary() bool

func (Key) IsTertiary

func (k Key) IsTertiary() bool

func (Key) RGBA

func (k Key) RGBA() (r, g, b, a uint32)

RGBA returns the red, green, blue, and alpha values of the color for interface color.Color

func (Key) String

func (k Key) String() string

type KeyWithTiming

type KeyWithTiming struct {
	KeyType tea.KeyType
	Runes   []rune
	Delay   time.Duration
}

KeyWithTiming represents a key press with optional delay

type ListAction

type ListAction struct {
	Key         string
	Description string
	Handler     func(item ListItem) tea.Cmd
}

ListAction defines an action that can be performed on a list item

type ListItem

type ListItem interface {
	models.Model
	GetTitle() string
	GetDescription() string
	GetFilterValue() string
}

ListItem represents a single item in a list

type ListOptions

type ListOptions struct {
	Filters   map[string]any
	SortBy    string
	SortOrder string
	Limit     int
	Offset    int
	Search    string
}

ListOptions configures data loading for lists

type ListSource

type ListSource interface {
	Load(ctx context.Context, opts ListOptions) ([]ListItem, error)
	Count(ctx context.Context, opts ListOptions) (int, error)
	Search(ctx context.Context, query string, opts ListOptions) ([]ListItem, error)
}

ListSource provides data for the list

type Logo int
const (
	Colossal Logo = iota
	Georgia
	Alligator
	ANSI
	ANSIShadow
)

func (Logo) Colored

func (l Logo) Colored() string

Colored returns a colored version of the logo using lipgloss with vertical spiral design Creates a vertical spiral effect by coloring character by character:

Combine line position and character position & use modulo to build wave-like transitions

func (Logo) ColoredInViewport

func (l Logo) ColoredInViewport(renderer ...*lipgloss.Renderer) string

ColoredInViewport returns the colored logo rendered inside a viewport bubble

func (Logo) String

func (l Logo) String() string

type MockTaskRepository

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

MockTaskRepository provides a mock implementation for testing

func NewMockTaskRepository

func NewMockTaskRepository() *MockTaskRepository

func (*MockTaskRepository) AddTask

func (m *MockTaskRepository) AddTask(task *models.Task)

func (*MockTaskRepository) GetUpdatedTasks

func (m *MockTaskRepository) GetUpdatedTasks() []*models.Task

type NoteDataSource

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

NoteDataSource adapts NoteRepository to work with DataList

func (*NoteDataSource) Count

func (n *NoteDataSource) Count(ctx context.Context, opts ListOptions) (int, error)

func (*NoteDataSource) Load

func (n *NoteDataSource) Load(ctx context.Context, opts ListOptions) ([]ListItem, error)

func (*NoteDataSource) Search

func (n *NoteDataSource) Search(ctx context.Context, query string, opts ListOptions) ([]ListItem, error)

type NoteRecord

type NoteRecord struct {
	*models.Note
}

NoteRecord adapts models.Note to work with DataList (since notes work better as a list than table)

func (*NoteRecord) GetDescription

func (n *NoteRecord) GetDescription() string

func (*NoteRecord) GetField

func (n *NoteRecord) GetField(name string) any

func (*NoteRecord) GetFilterValue

func (n *NoteRecord) GetFilterValue() string

func (*NoteRecord) GetTitle

func (n *NoteRecord) GetTitle() string

type Palette

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

Palette provides semantic color access

func NewPalette

func NewPalette(isDark bool) *Palette

NewPalette creates a new palette instance

type ProjectDataSource

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

ProjectDataSource adapts ProjectRepository to work with DataTable

func (*ProjectDataSource) Count

func (p *ProjectDataSource) Count(ctx context.Context, opts DataOptions) (int, error)

func (*ProjectDataSource) Load

func (p *ProjectDataSource) Load(ctx context.Context, opts DataOptions) ([]DataRecord, error)

type ProjectRepository

type ProjectRepository interface {
	GetProjects(ctx context.Context) ([]repo.ProjectSummary, error)
}

ProjectRepository interface for dependency injection in tests

type ProjectSummaryRecord

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

ProjectSummaryRecord adapts repo.ProjectSummary to work with DataTable

func (*ProjectSummaryRecord) GetCreatedAt

func (p *ProjectSummaryRecord) GetCreatedAt() time.Time

func (*ProjectSummaryRecord) GetField

func (p *ProjectSummaryRecord) GetField(name string) any

func (*ProjectSummaryRecord) GetID

func (p *ProjectSummaryRecord) GetID() int64

Use task count as pseudo-ID since projects don't have IDs

func (*ProjectSummaryRecord) GetTableName

func (p *ProjectSummaryRecord) GetTableName() string

func (*ProjectSummaryRecord) GetUpdatedAt

func (p *ProjectSummaryRecord) GetUpdatedAt() time.Time

func (*ProjectSummaryRecord) SetCreatedAt

func (p *ProjectSummaryRecord) SetCreatedAt(t time.Time)

func (*ProjectSummaryRecord) SetID

func (p *ProjectSummaryRecord) SetID(id int64)

func (*ProjectSummaryRecord) SetUpdatedAt

func (p *ProjectSummaryRecord) SetUpdatedAt(t time.Time)

type PublicationDataSource

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

PublicationDataSource loads notes with leaflet metadata

func (*PublicationDataSource) Count

func (p *PublicationDataSource) Count(ctx context.Context, opts ListOptions) (int, error)

func (*PublicationDataSource) Load

func (*PublicationDataSource) Search

func (p *PublicationDataSource) Search(ctx context.Context, query string, opts ListOptions) ([]ListItem, error)

type PublicationRecord

type PublicationRecord struct {
	*models.Note
}

PublicationRecord adapts models.Note with leaflet metadata to work with DataList

func (*PublicationRecord) GetDescription

func (p *PublicationRecord) GetDescription() string

func (*PublicationRecord) GetField

func (p *PublicationRecord) GetField(name string) any

func (*PublicationRecord) GetFilterValue

func (p *PublicationRecord) GetFilterValue() string

func (*PublicationRecord) GetTitle

func (p *PublicationRecord) GetTitle() string

type PublicationView

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

PublicationView handles publication viewing UI with pager

func NewPublicationView

func NewPublicationView(note *models.Note, opts PublicationViewOptions) *PublicationView

NewPublicationView creates a new publication view UI component

func (*PublicationView) Show

func (pv *PublicationView) Show(ctx context.Context) error

Show displays the publication in interactive mode with pager

type PublicationViewOptions

type PublicationViewOptions struct {
	Output io.Writer
	Input  io.Reader
	Static bool
	Width  int
	Height int
}

PublicationViewOptions configures the publication view UI behavior

type SwitchCaseTest

type SwitchCaseTest struct {
	Name        string
	Input       any
	Expected    any
	ShouldError bool
	Setup       func(*TUITestSuite)
	Verify      func(*testing.T, *TUITestSuite)
}

Test generators for switch case coverage

type TUITestOption

type TUITestOption func(*TUITestSuite)

TUITestOption configures the test suite

func WithInitialSize

func WithInitialSize(width, height int) TUITestOption

WithInitialSize sets the initial terminal size by storing size for program initialization

func WithTimeout

func WithTimeout(timeout time.Duration) TUITestOption

WithTimeout sets a global timeout for operations

type TUITestSuite

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

TUITestSuite provides comprehensive testing infrastructure for BubbleTea models with channel-based control and signal handling for interactive testing

func CreateTestSuiteWithModel

func CreateTestSuiteWithModel(t *testing.T, model tea.Model, opts ...TUITestOption) *TUITestSuite

CreateTestSuiteWithModel is a helper to create a test suite with a specific model

This should be used in individual test files where the model type is known

func NewTUITestSuite

func NewTUITestSuite(t *testing.T, model tea.Model, opts ...TUITestOption) *TUITestSuite

NewTUITestSuite creates a new TUI test suite with controlled I/O and channels

func (*TUITestSuite) Close

func (suite *TUITestSuite) Close()

Close properly shuts down the test suite

func (*TUITestSuite) GetCurrentModel

func (suite *TUITestSuite) GetCurrentModel() tea.Model

GetCurrentModel returns the latest model state (thread-safe)

func (*TUITestSuite) GetCurrentView

func (suite *TUITestSuite) GetCurrentView() string

GetCurrentView returns the latest view output

func (*TUITestSuite) GetOutput

func (suite *TUITestSuite) GetOutput() []byte

GetOutput returns all captured output

func (*TUITestSuite) SendKey

func (suite *TUITestSuite) SendKey(keyType tea.KeyType, runes ...rune) error

SendKey sends a key press message to the model

func (*TUITestSuite) SendKeyString

func (suite *TUITestSuite) SendKeyString(s string) error

SendKeyString sends a string as key runes

func (*TUITestSuite) SendMessage

func (suite *TUITestSuite) SendMessage(msg tea.Msg) error

SendMessage sends an arbitrary message to the model

func (*TUITestSuite) SimulateKeySequence

func (suite *TUITestSuite) SimulateKeySequence(keys []KeyWithTiming) error

SimulateKeySequence sends a sequence of keys with timing

func (*TUITestSuite) Start

func (suite *TUITestSuite) Start()

Start begins the test program in a goroutine with time to initialize

func (*TUITestSuite) WaitFor

func (suite *TUITestSuite) WaitFor(condition func(tea.Model) bool, timeout time.Duration) error

WaitFor waits for a condition to be met within the timeout

func (*TUITestSuite) WaitForView

func (suite *TUITestSuite) WaitForView(contains string, timeout time.Duration) error

WaitForView waits for a view to contain specific content

type TagDataSource

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

TagDataSource adapts TagRepository to work with DataTable

func (*TagDataSource) Count

func (t *TagDataSource) Count(ctx context.Context, opts DataOptions) (int, error)

func (*TagDataSource) Load

func (t *TagDataSource) Load(ctx context.Context, opts DataOptions) ([]DataRecord, error)

type TagRepository

type TagRepository interface {
	GetTags(ctx context.Context) ([]repo.TagSummary, error)
}

TagRepository interface for dependency injection in tests

type TagSummaryRecord

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

TagSummaryRecord adapts repo.TagSummary to work with DataTable

func (*TagSummaryRecord) GetCreatedAt

func (t *TagSummaryRecord) GetCreatedAt() time.Time

func (*TagSummaryRecord) GetField

func (t *TagSummaryRecord) GetField(name string) any

func (*TagSummaryRecord) GetID

func (t *TagSummaryRecord) GetID() int64

Use task count as pseudo-ID since tags don't have IDs

func (*TagSummaryRecord) GetTableName

func (t *TagSummaryRecord) GetTableName() string

func (*TagSummaryRecord) GetUpdatedAt

func (t *TagSummaryRecord) GetUpdatedAt() time.Time

func (*TagSummaryRecord) SetCreatedAt

func (t *TagSummaryRecord) SetCreatedAt(time time.Time)

func (*TagSummaryRecord) SetID

func (t *TagSummaryRecord) SetID(id int64)

func (*TagSummaryRecord) SetUpdatedAt

func (t *TagSummaryRecord) SetUpdatedAt(time time.Time)

type TaskDataSource

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

TaskDataSource adapts TaskRepository to work with DataTable

func (*TaskDataSource) Count

func (t *TaskDataSource) Count(ctx context.Context, opts DataOptions) (int, error)

func (*TaskDataSource) Load

func (t *TaskDataSource) Load(ctx context.Context, opts DataOptions) ([]DataRecord, error)

type TaskEditOptions

type TaskEditOptions struct {
	Output io.Writer
	Input  io.Reader
	Width  int
	Height int
}

type TaskEditor

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

func NewTaskEditor

func NewTaskEditor(task *models.Task, repo utils.TestTaskRepository, opts TaskEditOptions) *TaskEditor

func (*TaskEditor) Edit

func (te *TaskEditor) Edit(ctx context.Context) (*models.Task, error)

type TaskRecord

type TaskRecord struct {
	*models.Task
}

TaskRecord adapts models.Task to work with DataTable

func (*TaskRecord) GetField

func (t *TaskRecord) GetField(name string) any

type TaskView

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

TaskView handles task detail viewing UI

func NewTaskView

func NewTaskView(task *models.Task, opts TaskViewOptions) *TaskView

NewTaskView creates a new task view UI component

func (*TaskView) Show

func (tv *TaskView) Show(ctx context.Context) error

Show displays the task in interactive mode

type TaskViewOptions

type TaskViewOptions struct {
	// Output destination (stdout for interactive, buffer for testing)
	Output io.Writer
	// Input source (stdin for interactive, strings reader for testing)
	Input io.Reader
	// Enable static mode (no interactive components)
	Static bool
	// Width and height for viewport sizing
	Width  int
	Height int
}

TaskViewOptions configures the task view UI behavior

Jump to

Keyboard shortcuts

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