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
- Variables
- func Accent(format string, a ...any)
- func Accentln(format string, a ...any)
- func Box(format string, a ...any)
- func Boxln(format string, a ...any)
- func Error(format string, a ...any)
- func ErrorBox(format string, a ...any)
- func ErrorBoxln(format string, a ...any)
- func Errorln(format string, a ...any)
- func FormatPriorityIndicator(priority string) string
- func FormatPriorityWithText(priority string) string
- func FormatStatusIndicator(status string) string
- func FormatStatusWithText(status string) string
- func FormatTaskPriority(task *models.Task) string
- func FormatTaskStatus(task *models.Task) string
- func GetAllPriorityPatterns() map[string]string
- func GetAllPrioritySymbols() map[string]string
- func GetAllStatusSymbols() map[string]string
- func GetPriorityDescription(priority string) string
- func GetPriorityDisplayType(priority string) string
- func GetPriorityPattern(priority string) string
- func GetPriorityStyle(priority string) lipgloss.Style
- func GetPrioritySymbol(priority string) string
- func GetStatusDescription(status string) string
- func GetStatusStyle(status string) lipgloss.Style
- func GetStatusSymbol(status string) string
- func Header(format string, a ...any)
- func Headerln(format string, a ...any)
- func Info(format string, a ...any)
- func Infoln(format string, a ...any)
- func Infop(format string, a ...any)
- func Infopln(format string, a ...any)
- func IsValidStatusTransition(from, to string) bool
- func Muted(format string, a ...any)
- func Mutedln(format string, a ...any)
- func Newline()
- func ObfuscateMiddle(s string, left, right int) string
- func Plain(format string, a ...any)
- func Plainln(format string, a ...any)
- func Primary(format string, a ...any)
- func Primaryln(format string, a ...any)
- func PriorityLegend() string
- func StatusLegend() string
- func Subtitle(format string, a ...any)
- func Subtitleln(format string, a ...any)
- func Success(format string, a ...any)
- func Successln(format string, a ...any)
- func Title(format string, a ...any)
- func Titleln(format string, a ...any)
- func Warning(format string, a ...any)
- func Warningln(format string, a ...any)
- type Action
- type AssertionHelpers
- func (ah *AssertionHelpers) AssertModelState(t *testing.T, suite *TUITestSuite, checker func(tea.Model) bool, msg string)
- func (ah *AssertionHelpers) AssertViewContains(t *testing.T, suite *TUITestSuite, expected string, msg string)
- func (ah *AssertionHelpers) AssertViewNotContains(t *testing.T, suite *TUITestSuite, unexpected string, msg string)
- func (ah *AssertionHelpers) AssertZeroTime(t *testing.T, getter func() time.Time, label string)
- type AuthForm
- type AuthFormOptions
- type AuthFormResult
- type BookDataSource
- type BookRecord
- type ControlledInput
- type ControlledOutput
- type DataList
- func NewBookDataList(repo utils.TestBookRepository, opts DataListOptions, status string) *DataList
- func NewBookListFromList(repo utils.TestBookRepository, output io.Writer, input io.Reader, static bool, ...) *DataList
- func NewDataList(source ListSource, opts DataListOptions) *DataList
- func NewNoteDataList(repo utils.TestNoteRepository, opts DataListOptions, showArchived bool, ...) *DataList
- func NewNoteListFromList(repo utils.TestNoteRepository, output io.Writer, input io.Reader, static bool, ...) *DataList
- func NewPublicationDataList(repo utils.TestNoteRepository, opts DataListOptions, filter string) *DataList
- func NewPublicationListFromList(repo utils.TestNoteRepository, output io.Writer, input io.Reader, static bool, ...) *DataList
- type DataListKeyMap
- type DataListOptions
- type DataOptions
- type DataRecord
- type DataSource
- type DataTable
- func NewDataTable(source DataSource, opts DataTableOptions) *DataTable
- func NewProjectDataTable(repo ProjectRepository, opts DataTableOptions) *DataTable
- func NewProjectListFromTable(repo ProjectRepository, output io.Writer, input io.Reader, static bool) *DataTable
- func NewTagDataTable(repo TagRepository, opts DataTableOptions) *DataTable
- func NewTagListFromTable(repo TagRepository, output io.Writer, input io.Reader, static bool) *DataTable
- func NewTaskDataTable(repo utils.TestTaskRepository, opts DataTableOptions, showAll bool, ...) *DataTable
- func NewTaskListFromTable(repo utils.TestTaskRepository, output io.Writer, input io.Reader, static bool, ...) *DataTable
- type DataTableKeyMap
- type DataTableOptions
- type Field
- type Key
- type KeyWithTiming
- type ListAction
- type ListItem
- type ListOptions
- type ListSource
- type Logo
- type MockTaskRepository
- type NoteDataSource
- type NoteRecord
- type Palette
- type ProjectDataSource
- type ProjectRepository
- type ProjectSummaryRecord
- func (p *ProjectSummaryRecord) GetCreatedAt() time.Time
- func (p *ProjectSummaryRecord) GetField(name string) any
- func (p *ProjectSummaryRecord) GetID() int64
- func (p *ProjectSummaryRecord) GetTableName() string
- func (p *ProjectSummaryRecord) GetUpdatedAt() time.Time
- func (p *ProjectSummaryRecord) SetCreatedAt(t time.Time)
- func (p *ProjectSummaryRecord) SetID(id int64)
- func (p *ProjectSummaryRecord) SetUpdatedAt(t time.Time)
- type PublicationDataSource
- type PublicationRecord
- type PublicationView
- type PublicationViewOptions
- type SwitchCaseTest
- type TUITestOption
- type TUITestSuite
- func (suite *TUITestSuite) Close()
- func (suite *TUITestSuite) GetCurrentModel() tea.Model
- func (suite *TUITestSuite) GetCurrentView() string
- func (suite *TUITestSuite) GetOutput() []byte
- func (suite *TUITestSuite) SendKey(keyType tea.KeyType, runes ...rune) error
- func (suite *TUITestSuite) SendKeyString(s string) error
- func (suite *TUITestSuite) SendMessage(msg tea.Msg) error
- func (suite *TUITestSuite) SimulateKeySequence(keys []KeyWithTiming) error
- func (suite *TUITestSuite) Start()
- func (suite *TUITestSuite) WaitFor(condition func(tea.Model) bool, timeout time.Duration) error
- func (suite *TUITestSuite) WaitForView(contains string, timeout time.Duration) error
- type TagDataSource
- type TagRepository
- type TagSummaryRecord
- func (t *TagSummaryRecord) GetCreatedAt() time.Time
- func (t *TagSummaryRecord) GetField(name string) any
- func (t *TagSummaryRecord) GetID() int64
- func (t *TagSummaryRecord) GetTableName() string
- func (t *TagSummaryRecord) GetUpdatedAt() time.Time
- func (t *TagSummaryRecord) SetCreatedAt(time time.Time)
- func (t *TagSummaryRecord) SetID(id int64)
- func (t *TagSummaryRecord) SetUpdatedAt(time time.Time)
- type TaskDataSource
- type TaskEditOptions
- type TaskEditor
- type TaskRecord
- type TaskView
- type TaskViewOptions
Constants ¶
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 ¶
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} )
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 )
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)
var Expect = AssertionHelpers{}
var NoteleafColorScheme fang.ColorSchemeFunc = noteleafColorScheme
Functions ¶
func ErrorBoxln ¶
ErrorBoxln prints error content in a styled error box with a newline
func FormatPriorityIndicator ¶
FormatPriorityIndicator returns a styled priority pattern
func FormatPriorityWithText ¶
FormatPriorityWithText returns a styled priority with text description
func FormatStatusIndicator ¶
FormatStatusIndicator returns a styled status symbol and text
func FormatStatusWithText ¶
FormatStatusWithText returns a styled status symbol with status text
func FormatTaskPriority ¶
FormatTaskPriority returns a complete priority display with pattern, priority, and description
func FormatTaskStatus ¶
FormatTaskStatus returns a complete status display with symbol, status, and description
func GetAllPriorityPatterns ¶
GetAllPriorityPatterns returns a map of all priority patterns for reference
func GetAllPrioritySymbols ¶
GetAllPrioritySymbols returns a map of all priority symbols for reference
func GetAllStatusSymbols ¶
GetAllStatusSymbols returns a map of all status symbols for reference
func GetPriorityDescription ¶
GetPriorityDescription returns a human-friendly description of the priority
func GetPriorityDisplayType ¶
GetPriorityDisplayType returns the display type for a priority (text, numeric, or legacy)
func GetPriorityPattern ¶
GetPriorityPattern returns the star pattern for a given priority
func GetPriorityStyle ¶
GetPriorityStyle returns the color style for a given priority
func GetPrioritySymbol ¶
GetPrioritySymbol returns the unicode symbol for a given priority
func GetStatusDescription ¶
GetStatusDescription returns a human-friendly description of the status
func GetStatusStyle ¶
GetStatusStyle returns the color style for a given status
Defaults to pending style
func GetStatusSymbol ¶
GetStatusSymbol returns the unicode symbol for a given status
Default to pending
func IsValidStatusTransition ¶
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 ObfuscateMiddle ¶
ObfuscateMiddle returns a string where the middle portion is replaced by "..." TODO: move to package utils or shared
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 Subtitleln ¶
Subtitleln prints a formatted subtitle 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 ¶
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 ¶
AuthFormOptions configures the auth form display
type AuthFormResult ¶
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 ¶
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)
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
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) 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 ¶
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) 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 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) IsSecondary ¶
func (Key) IsTertiary ¶
func (Key) RGBA ¶
RGBA returns the red, green, blue, and alpha values of the color for interface color.Color
type KeyWithTiming ¶
KeyWithTiming represents a key press with optional delay
type ListAction ¶
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 ¶
type Logo int
func (Logo) Colored ¶
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 ¶
ColoredInViewport returns the colored logo rendered inside a viewport bubble
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 ¶
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
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 (p *PublicationDataSource) Load(ctx context.Context, opts ListOptions) ([]ListItem, error)
func (*PublicationDataSource) Search ¶
func (p *PublicationDataSource) Search(ctx context.Context, query string, opts ListOptions) ([]ListItem, error)
type PublicationRecord ¶
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
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) 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 TaskEditor ¶
type TaskEditor struct {
// contains filtered or unexported fields
}
func NewTaskEditor ¶
func NewTaskEditor(task *models.Task, repo utils.TestTaskRepository, opts TaskEditOptions) *TaskEditor
type TaskRecord ¶
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
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