ui

package
v0.0.0-...-87c05f3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorPrimary   = lipgloss.Color("#7C6AF7") // soft purple
	ColorSecondary = lipgloss.Color("#5DD8A4") // mint green
	ColorMuted     = lipgloss.Color("#6B7280") // gray
	ColorDanger    = lipgloss.Color("#F87171") // soft red
	ColorWarning   = lipgloss.Color("#FBBF24") // amber
	ColorSuccess   = lipgloss.Color("#34D399") // green
	ColorText      = lipgloss.Color("#F3F4F6") // near white
	ColorSubtext   = lipgloss.Color("#9CA3AF") // light gray
	ColorBorder    = lipgloss.Color("#374151") // dark gray
	ColorHighlight = lipgloss.Color("#1F2937") // dark bg highlight
)
View Source
var (
	// App container
	AppStyle = lipgloss.NewStyle().
				Padding(1, 2)

	// Title banner
	TitleStyle = lipgloss.NewStyle().
				Foreground(ColorPrimary).
				Bold(true).
				PaddingBottom(0)

	SubtitleStyle = lipgloss.NewStyle().
					Foreground(ColorSubtext).
					PaddingBottom(1)

	// Section headers inside views
	SectionTitleStyle = lipgloss.NewStyle().
						Foreground(ColorSecondary).
						Bold(true).
						PaddingTop(1).
						PaddingBottom(0)

	// Normal menu item
	MenuItemStyle = lipgloss.NewStyle().
					Foreground(ColorText).
					PaddingLeft(2)

	// Selected menu item
	MenuItemSelectedStyle = lipgloss.NewStyle().
							Foreground(ColorPrimary).
							Bold(true).
							PaddingLeft(0)

	// Cursor indicator
	CursorStyle = lipgloss.NewStyle().
				Foreground(ColorPrimary).
				Bold(true)

	// Dimmed / muted text
	MutedStyle = lipgloss.NewStyle().
				Foreground(ColorMuted)

	// Success message
	SuccessStyle = lipgloss.NewStyle().
					Foreground(ColorSuccess).
					Bold(true)

	// Error / warning message
	ErrorStyle = lipgloss.NewStyle().
				Foreground(ColorDanger).
				Bold(true)

	WarningStyle = lipgloss.NewStyle().
					Foreground(ColorWarning)

	// Help bar at the bottom
	HelpStyle = lipgloss.NewStyle().
				Foreground(ColorMuted).
				PaddingTop(1)

	// Box / panel
	PanelStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorBorder).
				Padding(0, 1).
				MarginTop(1)

	// Active panel
	PanelActiveStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(ColorPrimary).
						Padding(0, 1).
						MarginTop(1)

	// File in the status list
	FileNameStyle = lipgloss.NewStyle().
					Foreground(ColorText)

	FileTagStagedStyle = lipgloss.NewStyle().
						Foreground(ColorSuccess).
						Bold(true)

	FileTagModifiedStyle = lipgloss.NewStyle().
							Foreground(ColorWarning).
							Bold(true)

	FileTagNewStyle = lipgloss.NewStyle().
					Foreground(ColorSecondary).
					Bold(true)

	FileTagDeletedStyle = lipgloss.NewStyle().
						Foreground(ColorDanger).
						Bold(true)

	// Badge: current branch label
	BranchBadgeStyle = lipgloss.NewStyle().
						Background(ColorPrimary).
						Foreground(lipgloss.Color("#FFFFFF")).
						Bold(true).
						Padding(0, 1).
						MarginRight(1)

	// Checkbox styles
	CheckboxChecked = lipgloss.NewStyle().
					Foreground(ColorSuccess).Bold(true)

	CheckboxUnchecked = lipgloss.NewStyle().
						Foreground(ColorMuted)

	// Text input prompt
	InputPromptStyle = lipgloss.NewStyle().
						Foreground(ColorPrimary).
						Bold(true)

	InputHintStyle = lipgloss.NewStyle().
					Foreground(ColorMuted).
					Italic(true)

	// Step indicator
	StepStyle = lipgloss.NewStyle().
				Foreground(ColorSecondary).
				Bold(true)

	// Divider
	DividerStyle = lipgloss.NewStyle().
					Foreground(ColorBorder)
)

Functions

func Divider

func Divider(width int) string

Divider returns a horizontal rule string

func FileIcon

func FileIcon(code string) string

FileIcon returns an icon based on git status code

func FileTagStyle

func FileTagStyle(code string) lipgloss.Style

FileTagStyle returns the appropriate style for a status code

func IsTypeable

func IsTypeable(key string) bool

IsTypeable returns true if the key message is printable text (including paste). Rejects control keys like arrows, ctrl combos, function keys, etc.

func LoadBranches

func LoadBranches() tea.Cmd

func LoadCommitFiles

func LoadCommitFiles() tea.Cmd

func LoadStatus

func LoadStatus() tea.Cmd

func SanitizeInput

func SanitizeInput(s string) string

SanitizeInput cleans pasted text by removing bracketed paste escape sequences and other terminal artifacts. Handles all forms:

  • \x1b[200~text\x1b[201~ (full sequence)
  • [text] (bubbletea strips the escapes, leaves brackets)
  • [text (only leading bracket)
  • text] (only trailing bracket)

Types

type App

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

func NewApp

func NewApp() App

func (App) Init

func (a App) Init() tea.Cmd

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (App) View

func (a App) View() string

type BranchesModel

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

func NewBranchesModel

func NewBranchesModel() BranchesModel

func (BranchesModel) Update

func (m BranchesModel) Update(msg tea.Msg) (BranchesModel, tea.Cmd, bool)

func (BranchesModel) View

func (m BranchesModel) View() string

type CommitModel

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

func NewCommitModel

func NewCommitModel() CommitModel

func (CommitModel) Update

func (m CommitModel) Update(msg tea.Msg) (CommitModel, tea.Cmd, bool)

func (CommitModel) View

func (m CommitModel) View() string

type ConfigModel

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

func NewConfigModel

func NewConfigModel() ConfigModel

func (ConfigModel) Update

func (m ConfigModel) Update(msg tea.Msg) (ConfigModel, tea.Cmd, bool)

func (ConfigModel) View

func (m ConfigModel) View() string

type InitModel

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

func NewInitModel

func NewInitModel() InitModel

func (InitModel) Update

func (m InitModel) Update(msg tea.Msg) (InitModel, tea.Cmd, bool)

func (InitModel) View

func (m InitModel) View() string
type MenuItem struct {
	Key   string
	Scene Scene
}
type MenuModel struct {
	// contains filtered or unexported fields
}

func NewMenuModel

func NewMenuModel() MenuModel
func (m MenuModel) Update(msg tea.Msg) (MenuModel, tea.Cmd, Scene)
func (m MenuModel) View() string

type PushPullModel

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

func NewPushPullModel

func NewPushPullModel() PushPullModel

func (PushPullModel) Update

func (m PushPullModel) Update(msg tea.Msg) (PushPullModel, tea.Cmd, bool)

func (PushPullModel) View

func (m PushPullModel) View() string

type Scene

type Scene int

Scene represents which screen is currently shown

const (
	SceneMenu Scene = iota
	SceneInit
	SceneStatus
	SceneCommit
	ScenePushPull
	SceneBranches
	SceneConfig
)

type StatusModel

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

func NewStatusModel

func NewStatusModel() StatusModel

func (StatusModel) Update

func (m StatusModel) Update(msg tea.Msg) (StatusModel, tea.Cmd, bool)

func (StatusModel) View

func (m StatusModel) View() string

type TextInput

type TextInput struct {
	Value       string
	Placeholder string
	// contains filtered or unexported fields
}

TextInput is a reusable single-line text input with cursor movement support. Supports: typing, backspace, delete, left/right arrows, home/end, paste.

func NewTextInput

func NewTextInput(placeholder string) TextInput

func (TextInput) SetValue

func (t TextInput) SetValue(v string) TextInput

func (TextInput) Update

func (t TextInput) Update(msg tea.KeyMsg) (TextInput, bool)

Update handles key messages. Returns updated TextInput and whether Enter was pressed.

func (TextInput) View

func (t TextInput) View() string

View renders the input box

func (TextInput) ViewWithLabel

func (t TextInput) ViewWithLabel(label, hint string) string

ViewWithLabel renders label + input + hint

Jump to

Keyboard shortcuts

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