ui

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Base Palette
	CatMauve    = lipgloss.Color("#cba6f7") // Primary/Logo
	CatLavender = lipgloss.Color("#b4befe") // Secondary
	CatSapphire = lipgloss.Color("#74c7ec") // Accent
	CatText     = lipgloss.Color("#cdd6f4") // Standard Text
	CatSubtext  = lipgloss.Color("#a6adc8") // Faint/Muted

	// Functional Colors
	CatGreen   = lipgloss.Color("#a6e3a1") // Correct
	CatRed     = lipgloss.Color("#f38ba8") // Wrong
	CatYellow  = lipgloss.Color("#f9e2af") // Warning/Highlight
	CatOverlay = lipgloss.Color("#6c7086") // Pending/Placeholder
	CatSurface = lipgloss.Color("#313244") // Background highlights
)
View Source
var (
	// The characters you've typed correctly (Soothing Green)
	CorrectStyle = lipgloss.NewStyle().Foreground(CatGreen)

	// Incorrect characters (Soft Red)
	WrongStyle = lipgloss.NewStyle().Foreground(CatRed)

	// If the user misses a space, we highlight the background so it's visible
	SpaceStyle = lipgloss.NewStyle().Background(CatRed).Foreground(CatSurface)

	// Characters remaining in the quote (Muted/Faint)
	PendingStyle = lipgloss.NewStyle().Foreground(CatOverlay)

	// The current character under the cursor (Bold & Underlined)
	HighlightStyle = lipgloss.NewStyle().
					Foreground(CatYellow).
					Underline(true).
					Bold(true)

	// Live stats during typing (minimal, no border)
	StatsStyle = lipgloss.NewStyle().
				Foreground(CatOverlay).
				Padding(0, 1)

	HeaderStyle = lipgloss.NewStyle().Foreground(CatMauve)

	// Mode selector styles
	ModeActiveStyle = lipgloss.NewStyle().
					Foreground(CatMauve).
					Bold(true).
					Padding(0, 1).
					MarginRight(1)

	ModeInactiveStyle = lipgloss.NewStyle().
						Foreground(CatOverlay).
						Padding(0, 1).
						MarginRight(1)

	ModeSelectorContainerStyle = lipgloss.NewStyle().
								Padding(0, 1).
								MarginTop(1)

	// for the views
	ViewHeaderStyle = lipgloss.NewStyle().Foreground(CatMauve).Bold(true)

	// Individual stat styling (command palette & config)
	LabelStyle = lipgloss.NewStyle().Foreground(CatLavender).Bold(true).Width(15).Align(lipgloss.Left)
	ValueStyle = lipgloss.NewStyle().Foreground(CatSubtext).Width(30).Align(lipgloss.Right)

	// Footer Section
	HelpStyle = lipgloss.NewStyle().Foreground(CatOverlay).MarginTop(1)
)
View Source
var CouikASCII = `` /* 429-byte string literal not displayed */
View Source
var CouikASCII2 = `` /* 417-byte string literal not displayed */
View Source
var CouikASCII3 = `` /* 558-byte string literal not displayed */

Functions

func CreateModeFromSelection added in v0.1.3

func CreateModeFromSelection(selection string, lang database.Language) modes.ModeStrategy

CreateModeFromSelection parses the selection string and returns the appropriate ModeStrategy. It handles dynamic cases like "15s", "words 10"

func DisplayChart added in v0.1.3

func DisplayChart(wpmSamples []float64, timesSample []time.Time, width, height int) string

func FormatTime added in v0.1.2

func FormatTime(s int) string

Types

type ApplyModelOption added in v0.1.3

type ApplyModelOption func(*Model)

func WithSameQuote added in v0.1.3

func WithSameQuote(target string) ApplyModelOption

type Model

type Model struct {
	Session        *engine.Session
	Repo           storage.HistoryRepository
	Quitting       bool
	ProgressBar    progress.Model
	TerminalWidth  int
	TerminalHeight int

	CurrentSelector components.Selector

	IsSelectingMode bool
	Mode            modes.ModeStrategy

	State core.SessionState

	TimeLeft int

	Active bool

	// quote mode selection
	QuoteType            database.QuoteCategory
	IsSelectingQuoteType bool

	// words
	InitialWords int

	// Cached config or use default
	CustomDashboard string
	CurrentLanguage database.Language

	// Cached chart for results view (prevents re-rendering shifts)
	CachedChart string

	// PR stats config
	PRs storage.Stats
	// contains filtered or unexported fields
}

func NewModel

func NewModel(target string) Model

func (Model) ApplyMode added in v0.1.3

func (m Model) ApplyMode(mode modes.ModeStrategy, options ...ApplyModelOption) Model

ApplyMode creates a new Model instance configured with the given strategy, preserving UI state from the current model

func (*Model) CacheChart added in v0.1.3

func (m *Model) CacheChart()

func (*Model) Deactivate added in v0.1.3

func (m *Model) Deactivate()

func (Model) GetDictionnaryModel

func (m Model) GetDictionnaryModel(duration int) Model

func (Model) GetDictionnaryModelWithWords

func (m Model) GetDictionnaryModelWithWords(words int, language database.Language) Model

GetDictionnaryModelWithWords creates a model with custom words length for word mode typing tests

func (*Model) GetModelFromMode added in v0.1.3

func (m *Model) GetModelFromMode(mod Model) Model

GetModelFromMode does the same as the one above but just for the specific case of keytab

func (*Model) GetSession added in v0.1.3

func (m *Model) GetSession() *engine.Session

func (*Model) GetTerminalWidth added in v0.1.3

func (m *Model) GetTerminalWidth() int

func (*Model) GetTimeLeft added in v0.1.3

func (m *Model) GetTimeLeft() int

These functions are for the implementation of the ProcessTick interface

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) IsActive added in v0.1.3

func (m *Model) IsActive() bool

func (*Model) SetState added in v0.1.3

func (m *Model) SetState(s core.SessionState)

func (*Model) SetTimeLeft added in v0.1.3

func (m *Model) SetTimeLeft(t int)

func (Model) Update

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

func (Model) View

func (m Model) View() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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