tui

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

projects.go implements the interactive project selector TUI using Bubble Tea. Users can toggle projects on/off for selective indexing during onboarding.

Package tui provides the terminal UI components for mnemo using Bubble Tea and Lip Gloss. It includes the first-run onboarding experience and the interactive project selector.

Index

Constants

View Source
const (
	ProgressCharFull  = "█"
	ProgressCharHalf  = "▓"
	ProgressCharLight = "░"
	ProgressCharEmpty = "─"
)

Progress bar characters

View Source
const (
	BoxTopLeft     = "╭"
	BoxTopRight    = "╮"
	BoxBottomLeft  = "╰"
	BoxBottomRight = "╯"
	BoxHorizontal  = "─"
	BoxVertical    = "│"
	BoxCross       = "┼"
)

Box drawing characters for premium feel

View Source
const (
	Sparkle   = "✦"
	Brain     = "◈"
	Rocket    = "▸"
	Lightning = "↯"
	Star      = "★"
	Diamond   = "◆"
	Arrow     = "→"
	Check     = "✓"
	Dot       = "•"
)

Decorative characters

View Source
const BannerWidth = 21

Large ASCII banner with gradient-like coloring

Variables

View Source
var (
	// Background gradient simulation (dark to darker)
	Base      = lipgloss.Color("#0d0d14") // Deepest space
	Surface   = lipgloss.Color("#13131f") // Elevated surface
	Overlay   = lipgloss.Color("#1a1a2e") // Cards, panels
	Highlight = lipgloss.Color("#242438") // Hover states

	// MNEMO Brand Colors (Cyan Spectrum)
	Primary   = lipgloss.Color("#00D9FF") // Cyan Bright - brand
	Secondary = lipgloss.Color("#0A99B5") // Cyan Mid - depth
	Accent    = lipgloss.Color("#2DD4BF") // Aqua - active/connected
	Warm      = lipgloss.Color("#2DD4BF") // Aqua - discoveries

	// Text hierarchy
	TextBright = lipgloss.Color("#f8fafc") // Headlines
	Text       = lipgloss.Color("#e2e8f0") // Body
	TextMuted  = lipgloss.Color("#94a3b8") // Secondary
	TextDim    = lipgloss.Color("#475569") // Disabled

	// Semantic
	Success = lipgloss.Color("#4ade80") // Green
	Warning = lipgloss.Color("#fbbf24") // Amber
	Error   = lipgloss.Color("#f87171") // Red

	// Gradient stops for simulated gradients (Cyan spectrum)
	GradientStart = lipgloss.Color("#00D9FF") // Cyan Bright
	GradientMid   = lipgloss.Color("#0A99B5") // Cyan Mid
	GradientEnd   = lipgloss.Color("#0D3D50") // Cyan Deep
)
View Source
var (
	// Full screen container
	FullScreen = lipgloss.NewStyle().
				Background(Base)

	// Centered content box
	CenteredBox = lipgloss.NewStyle().
				Align(lipgloss.Center).
				AlignVertical(lipgloss.Center)

	// Title styles
	TitleGiant = lipgloss.NewStyle().
				Bold(true).
				Foreground(TextBright).
				MarginBottom(1)

	TitleAccent = lipgloss.NewStyle().
				Bold(true).
				Foreground(Primary)

	// Subtitle
	Subtitle = lipgloss.NewStyle().
				Foreground(TextMuted).
				Italic(true)

	// Progress bar styles
	ProgressFilled = lipgloss.NewStyle().
					Foreground(Accent)

	ProgressEmpty = lipgloss.NewStyle().
					Foreground(Highlight)

	// Stat box
	StatBox = lipgloss.NewStyle().
			Border(lipgloss.RoundedBorder()).
			BorderForeground(Primary).
			Padding(1, 3).
			Margin(0, 1)

	StatNumber = lipgloss.NewStyle().
				Bold(true).
				Foreground(Accent)

	StatLabel = lipgloss.NewStyle().
				Foreground(TextMuted)

	// Discovery items
	DiscoveryItem = lipgloss.NewStyle().
					Foreground(Warm).
					PaddingLeft(2)

	// Command hints
	CommandStyle = lipgloss.NewStyle().
					Foreground(Accent).
					Bold(true)

	CommandDesc = lipgloss.NewStyle().
				Foreground(TextMuted)

	// Welcome box (glass effect simulation)
	WelcomeBox = lipgloss.NewStyle().
				Border(lipgloss.DoubleBorder()).
				BorderForeground(Primary).
				Padding(2, 4).
				Align(lipgloss.Center)

	// Spinner
	SpinnerStyle = lipgloss.NewStyle().
					Foreground(Accent)

	// Dimmed text for secondary info
	Dimmed = lipgloss.NewStyle().
			Foreground(TextDim)
)
View Source
var BrailleSpinner = []string{
	"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏",
}

Alternative braille spinner

View Source
var SpinnerFrames = []string{
	"◐", "◓", "◑", "◒",
}

Spinner frames with neural network theme

Functions

func RenderBanner

func RenderBanner() string

func RenderGradientLine

func RenderGradientLine(width int) string

Decorative line with cyan gradient effect

func RunProjectSelector

func RunProjectSelector(active, inactive []ProjectItem, onComplete func(enabled []string, disabled []string)) error

Types

type ProjectItem

type ProjectItem struct {
	Path         string
	Name         string
	LastActivity time.Time
	Status       string
	Selected     bool
}

ProjectItem represents a single project in the selector list.

type ProjectSelectorModel

type ProjectSelectorModel struct {
	OnComplete func(enabled []string, disabled []string)
	// contains filtered or unexported fields
}

ProjectSelectorModel is the Bubble Tea model for the interactive project selector.

func NewProjectSelectorModel

func NewProjectSelectorModel(active, inactive []ProjectItem) ProjectSelectorModel

NewProjectSelectorModel creates a new project selector with active projects pre-selected.

func (ProjectSelectorModel) Init

func (m ProjectSelectorModel) Init() tea.Cmd

func (ProjectSelectorModel) Update

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

func (ProjectSelectorModel) View

func (m ProjectSelectorModel) View() string

Jump to

Keyboard shortcuts

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