Help us shape the future of Go! Take the 2026 Go Developer Survey

ui

package
v0.0.0-...-648e486 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RoleStyle = lipgloss.NewStyle().Bold(true).Foreground(CurrentTheme().Text())
	DimStyle  = CurrentTheme().Styles().Subtle
)
View Source
var ThemeManagerInstance = NewThemeManager()

Global theme manager instance

Functions

func ClearMessages

func ClearMessages(d state.Dispatcher)

func ElementViewport

func ElementViewport(width, height int) viewport.Model

func NewMessage

func NewMessage(d state.Dispatcher, provider llm.Provider, role state.Role, content string) error

Types

type BaseTheme

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

BaseTheme provides common functionality for all themes

func (*BaseTheme) Styles

func (t *BaseTheme) Styles() *ThemeStyles

type ChangeProviderAction

type ChangeProviderAction struct {
	Provider string
	Name     string
}

func (ChangeProviderAction) Execute

type ChatCompletionCompletedAction

type ChatCompletionCompletedAction struct{}

func (ChatCompletionCompletedAction) Execute

type ChatCompletionStartedAction

type ChatCompletionStartedAction struct{}

func (ChatCompletionStartedAction) Execute

type ChatInput

type ChatInput textinput.Model

func ElementInput

func ElementInput(prompt, placeholder string) ChatInput

func (ChatInput) View

func (i ChatInput) View() string

type ClearMessagesAction

type ClearMessagesAction struct{}

func (ClearMessagesAction) Execute

type DarkTheme

type DarkTheme struct {
	BaseTheme
}

DarkTheme implements a dark purple theme

func (*DarkTheme) Accent

func (t *DarkTheme) Accent() lipgloss.Color

func (*DarkTheme) Background

func (t *DarkTheme) Background() lipgloss.Color

func (*DarkTheme) Border

func (t *DarkTheme) Border() lipgloss.Color

func (*DarkTheme) Error

func (t *DarkTheme) Error() lipgloss.Color

func (*DarkTheme) Highlight

func (t *DarkTheme) Highlight() lipgloss.Color

func (*DarkTheme) Info

func (t *DarkTheme) Info() lipgloss.Color

func (*DarkTheme) Primary

func (t *DarkTheme) Primary() lipgloss.Color

func (*DarkTheme) Secondary

func (t *DarkTheme) Secondary() lipgloss.Color

func (*DarkTheme) Selection

func (t *DarkTheme) Selection() lipgloss.Color

func (*DarkTheme) Success

func (t *DarkTheme) Success() lipgloss.Color

func (*DarkTheme) Surface

func (t *DarkTheme) Surface() lipgloss.Color

func (*DarkTheme) Text

func (t *DarkTheme) Text() lipgloss.Color

func (*DarkTheme) TextSubtle

func (t *DarkTheme) TextSubtle() lipgloss.Color

func (*DarkTheme) Warning

func (t *DarkTheme) Warning() lipgloss.Color

type LightTheme

type LightTheme struct {
	BaseTheme
}

LightTheme implements Solarized Light color scheme

func (*LightTheme) Accent

func (t *LightTheme) Accent() lipgloss.Color

func (*LightTheme) Background

func (t *LightTheme) Background() lipgloss.Color

func (*LightTheme) Border

func (t *LightTheme) Border() lipgloss.Color

func (*LightTheme) Error

func (t *LightTheme) Error() lipgloss.Color

func (*LightTheme) Highlight

func (t *LightTheme) Highlight() lipgloss.Color

func (*LightTheme) Info

func (t *LightTheme) Info() lipgloss.Color

func (*LightTheme) Primary

func (t *LightTheme) Primary() lipgloss.Color

func (*LightTheme) Secondary

func (t *LightTheme) Secondary() lipgloss.Color

func (*LightTheme) Selection

func (t *LightTheme) Selection() lipgloss.Color

func (*LightTheme) Success

func (t *LightTheme) Success() lipgloss.Color

func (*LightTheme) Surface

func (t *LightTheme) Surface() lipgloss.Color

func (*LightTheme) Text

func (t *LightTheme) Text() lipgloss.Color

func (*LightTheme) TextSubtle

func (t *LightTheme) TextSubtle() lipgloss.Color

func (*LightTheme) Warning

func (t *LightTheme) Warning() lipgloss.Color

type MessageAction

type MessageAction state.Message

func (MessageAction) Execute

func (a MessageAction) Execute(s state.AppState) (state.AppState, error)

type MessageChunkAction

type MessageChunkAction struct {
	state.Message
}

func (MessageChunkAction) Execute

type REPLScreen

type REPLScreen struct {
	state.Dispatcher
	llm.Provider
	// contains filtered or unexported fields
}

REPLScreen represents the REPLScreen UI model

func NewREPL

func NewREPL(d state.Dispatcher, p llm.Provider) *REPLScreen

NewREPL creates a new REPL instance

func (*REPLScreen) Init

func (r *REPLScreen) Init() tea.Cmd

Init initializes the REPL

func (*REPLScreen) OnStateChange

func (r *REPLScreen) OnStateChange(action state.Action, newState, oldState state.AppState) (msg tea.Msg)

func (*REPLScreen) Update

func (r *REPLScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model

func (*REPLScreen) View

func (r *REPLScreen) View() string

View renders the REPL interface

type RetroTheme

type RetroTheme struct {
	BaseTheme
}

RetroTheme implements the original retro color scheme

func (*RetroTheme) Accent

func (t *RetroTheme) Accent() lipgloss.Color

func (*RetroTheme) Background

func (t *RetroTheme) Background() lipgloss.Color

func (*RetroTheme) Border

func (t *RetroTheme) Border() lipgloss.Color

func (*RetroTheme) Error

func (t *RetroTheme) Error() lipgloss.Color

func (*RetroTheme) Highlight

func (t *RetroTheme) Highlight() lipgloss.Color

func (*RetroTheme) Info

func (t *RetroTheme) Info() lipgloss.Color

func (*RetroTheme) Primary

func (t *RetroTheme) Primary() lipgloss.Color

func (*RetroTheme) Secondary

func (t *RetroTheme) Secondary() lipgloss.Color

func (*RetroTheme) Selection

func (t *RetroTheme) Selection() lipgloss.Color

func (*RetroTheme) Success

func (t *RetroTheme) Success() lipgloss.Color

func (*RetroTheme) Surface

func (t *RetroTheme) Surface() lipgloss.Color

func (*RetroTheme) Text

func (t *RetroTheme) Text() lipgloss.Color

func (*RetroTheme) TextSubtle

func (t *RetroTheme) TextSubtle() lipgloss.Color

func (*RetroTheme) Warning

func (t *RetroTheme) Warning() lipgloss.Color

type Screen

type Screen interface {
	OnStateChange(action state.Action, newState state.AppState, oldState state.AppState) tea.Msg
	tea.Model
}

type ScreenStack

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

ScreenStack implements a stack of screens. It follows LIFO order.

func NewScreenStack

func NewScreenStack(root Screen) *ScreenStack

NewScreenStack creates a new screen stack

func (*ScreenStack) Active

func (s *ScreenStack) Active() Screen

Active returns the top screen from the stack without removing it Returns the root screen if the stack is empty

func (*ScreenStack) Clear

func (s *ScreenStack) Clear()

Clear removes all screens from the stack

func (*ScreenStack) Init

func (s *ScreenStack) Init() tea.Cmd

Init implements tea.Model interface

func (*ScreenStack) Pop

func (s *ScreenStack) Pop() Screen

Pop removes and returns the top screen from the stack Returns nil if the stack is empty

func (*ScreenStack) Push

func (s *ScreenStack) Push(screen Screen) int

Push adds a screen to the top of the stack and returns the new stack size

func (*ScreenStack) Update

func (s *ScreenStack) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model interface

func (*ScreenStack) View

func (s *ScreenStack) View() string

View implements tea.Model interface

type Stack

type Stack interface {
	tea.Model
	Active() Screen
	Push(Screen) int
	Pop() Screen
	Clear()
}

Stack defines the interface for a screen stack

type SwitchThemeAction

type SwitchThemeAction struct {
	Name string
}

type Theme

type Theme interface {
	// Core colors
	Primary() lipgloss.Color
	Secondary() lipgloss.Color
	Accent() lipgloss.Color
	Background() lipgloss.Color
	Surface() lipgloss.Color
	Text() lipgloss.Color
	TextSubtle() lipgloss.Color

	// Semantic colors
	Error() lipgloss.Color
	Warning() lipgloss.Color
	Success() lipgloss.Color
	Info() lipgloss.Color

	// UI-specific colors
	Border() lipgloss.Color
	Highlight() lipgloss.Color
	Selection() lipgloss.Color

	// Get pre-configured styles
	Styles() *ThemeStyles
}

Theme defines the interface for color themes

func CurrentTheme

func CurrentTheme() Theme

Convenience function to get current theme

func NewDarkTheme

func NewDarkTheme() Theme

func NewLightTheme

func NewLightTheme() Theme

func NewRetroTheme

func NewRetroTheme() Theme

type ThemeManager

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

ThemeManager manages the current theme

func NewThemeManager

func NewThemeManager() *ThemeManager

NewThemeManager creates a new theme manager with all available themes

func (*ThemeManager) Current

func (tm *ThemeManager) Current() Theme

Current returns the current active theme

func (*ThemeManager) ListThemes

func (tm *ThemeManager) ListThemes() []string

ListThemes returns all available theme names

func (*ThemeManager) SetTheme

func (tm *ThemeManager) SetTheme(name string) error

SetTheme changes the current theme

type ThemeStyles

type ThemeStyles struct {
	Primary   lipgloss.Style
	Secondary lipgloss.Style
	Accent    lipgloss.Style
	Header    lipgloss.Style
	Highlight lipgloss.Style
	Border    lipgloss.Style
	Error     lipgloss.Style
	Warning   lipgloss.Style
	Success   lipgloss.Style
	Info      lipgloss.Style
	Subtle    lipgloss.Style
	CodeBlock lipgloss.Style
	Input     lipgloss.Style
}

ThemeStyles contains pre-configured styles for common UI elements

func CurrentStyles

func CurrentStyles() *ThemeStyles

Convenience function to get current theme styles

Jump to

Keyboard shortcuts

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