Documentation
¶
Overview ¶
Package ui provides consistent styling and components for the Waymon CLI
Index ¶
- Variables
- func Center(width int, content string) string
- func CreateSeparator(width int, char string) string
- func FormatActionItem(index int, action string) string
- func FormatAppHeader(mode, status string) string
- func FormatControl(key, desc string) string
- func FormatListItem(item string, active bool) string
- func FormatNextStepsHeader() string
- func FormatSetupHeader(title string) string
- func FormatSetupPhase(phase string) string
- func FormatSetupResult(success bool, step, message string) string
- func FormatStatus(connected bool, status string) string
- func FormatSummaryHeader(title string) string
- func FormatSummaryStatus(allSuccess, needsRelogin bool) string
- func Right(width int, content string) string
- type CaptureStartMsg
- type CaptureStopMsg
- type ClientConnectedMsg
- type ClientDisconnectedMsg
- type ClientModel
- type ConnectedMsg
- type Connection
- type ConnectionList
- type Control
- type ControlStatusMsg
- type ControlsHelp
- type DebugServerModel
- type DisconnectedMsg
- type FullscreenServerModel
- type InfoPanel
- type InlineClientModel
- type InlineServerModel
- func (m *InlineServerModel) AddLogEntry(entry LogEntry)
- func (m *InlineServerModel) GetAuthChannel() chan bool
- func (m *InlineServerModel) Init() tea.Cmd
- func (m *InlineServerModel) SetMessage(msgType, message string)
- func (m *InlineServerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *InlineServerModel) View() string
- type LogEntry
- type LogMsg
- type Message
- type MessageType
- type Monitor
- type MonitorInfo
- type ProgressIndicator
- type ReconnectingMsg
- type SSHAuthApprovedMsg
- type SSHAuthDeniedMsg
- type SSHAuthRequestMsg
- type ServerModel
- func (m *ServerModel) AddLogEntry(entry LogEntry)
- func (m *ServerModel) Init() tea.Cmd
- func (m *ServerModel) SetClientManager(cm *server.ClientManager)
- func (m *ServerModel) SetServer(srv interface{ ... })
- func (m *ServerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *ServerModel) View() string
- type SetClientManagerMsg
- type SetServerMsg
- type SimpleClientModel
- type SimpleServerModel
- type StatusBar
- type TickMsg
- type WaitingApprovalMsg
Constants ¶
This section is empty.
Variables ¶
var ( // Primary colors ColorPrimary = lipgloss.Color("39") // Bright blue ColorSecondary = lipgloss.Color("205") // Pink/magenta ColorSuccess = lipgloss.Color("82") // Green ColorWarning = lipgloss.Color("214") // Orange ColorError = lipgloss.Color("196") // Red ColorInfo = lipgloss.Color("86") // Cyan // Neutral colors ColorText = lipgloss.Color("252") // Light gray ColorSubtle = lipgloss.Color("241") // Medium gray ColorMuted = lipgloss.Color("238") // Dark gray ColorHighlight = lipgloss.Color("255") // White // Status colors ColorConnected = ColorSuccess ColorDisconnected = ColorError ColorActive = ColorPrimary ColorInactive = ColorSubtle )
Color palette - consistent across the application
var ( // Text styles TextStyle = lipgloss.NewStyle(). Foreground(ColorText) SubtleStyle = lipgloss.NewStyle(). Foreground(ColorSubtle) MutedStyle = lipgloss.NewStyle(). Foreground(ColorMuted) // Emphasis styles BoldStyle = lipgloss.NewStyle(). Bold(true) ItalicStyle = lipgloss.NewStyle(). Italic(true) // Header styles HeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). MarginBottom(1) SubheaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorText) // Title styles TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). Background(ColorMuted). Padding(0, 1) // Status styles SuccessStyle = lipgloss.NewStyle(). Foreground(ColorSuccess) WarningStyle = lipgloss.NewStyle(). Foreground(ColorWarning) ErrorStyle = lipgloss.NewStyle(). Foreground(ColorError) InfoStyle = lipgloss.NewStyle(). Foreground(ColorInfo) // Box styles BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorSubtle). Padding(1, 2) // List styles ListStyle = lipgloss.NewStyle(). MarginLeft(2) ListItemStyle = lipgloss.NewStyle(). Foreground(ColorText) // Spinner style SpinnerStyle = lipgloss.NewStyle(). Foreground(ColorSecondary) )
Base styles - building blocks for other styles
var ( // Server UI styles ServerHeaderStyle = HeaderStyle. Render("Waymon Server") ServerStatusStyle = SubtleStyle // Client UI styles ClientHeaderStyle = HeaderStyle. Render("Waymon Client") ClientStatusStyle = SubtleStyle // Connection status styles ConnectedIndicator = lipgloss.NewStyle(). Foreground(ColorConnected). Render("●") DisconnectedIndicator = lipgloss.NewStyle(). Foreground(ColorDisconnected). Render("○") // Control help styles ControlsHeaderStyle = SubheaderStyle. MarginTop(1) ControlKeyStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary) ControlDescStyle = lipgloss.NewStyle(). Foreground(ColorText) )
Component-specific styles
var ( TableHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). BorderBottom(true). BorderStyle(lipgloss.NormalBorder()). BorderForeground(ColorSubtle) TableRowStyle = lipgloss.NewStyle(). Foreground(ColorText) TableCellStyle = lipgloss.NewStyle(). PaddingRight(2) )
Table styles
var ( SpinnerDot = []string{"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"} SpinnerLine = []string{"|", "/", "-", "\\"} SpinnerCircle = []string{"◐", "◓", "◑", "◒"} )
Spinner presets
var ( // Status icons IconSuccess = "✓" IconError = "✗" IconWarning = "!" IconInfo = "i" IconProcessing = "~" IconCheck = "✓" IconCross = "✗" // Application icons IconSetup = "»" IconServer = "S" IconClient = "C" IconConfig = "*" IconNetwork = "#" IconSummary = "=" IconSteps = "→" IconPhase = "·" // Progress icons IconProgress = "..." IconDone = "✓" IconPending = "·" )
Icons and indicators for consistent app-wide usage (using simple ASCII/Unicode symbols)
var ( // Setup header styles SetupHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary) SetupPhaseStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorInfo) // Setup result styles SetupSuccessStyle = lipgloss.NewStyle(). Foreground(ColorSuccess) SetupErrorStyle = lipgloss.NewStyle(). Foreground(ColorError) SetupWarningStyle = lipgloss.NewStyle(). Foreground(ColorWarning) // Setup summary styles SummaryHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary) SummarySuccessStyle = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) SummaryWarningStyle = lipgloss.NewStyle(). Foreground(ColorWarning). Bold(true) SummaryErrorStyle = lipgloss.NewStyle(). Foreground(ColorError). Bold(true) // Action item styles ActionItemStyle = lipgloss.NewStyle(). Foreground(ColorText). MarginLeft(1) )
Setup-specific styles
Functions ¶
func CreateSeparator ¶
CreateSeparator creates a horizontal line separator
func FormatActionItem ¶
func FormatAppHeader ¶
FormatAppHeader creates a uniform header in format: WAYMON | MODE | STATUS
func FormatControl ¶
Helper functions for consistent formatting
func FormatListItem ¶
func FormatNextStepsHeader ¶
func FormatNextStepsHeader() string
func FormatSetupPhase ¶
func FormatSetupResult ¶
func FormatStatus ¶
func FormatSummaryHeader ¶
func FormatSummaryStatus ¶
Types ¶
type ClientConnectedMsg ¶
type ClientConnectedMsg struct{ ClientAddr string }
Message types for reactive updates
type ClientDisconnectedMsg ¶
type ClientDisconnectedMsg struct{ ClientAddr string }
Message types for reactive updates
type ClientModel ¶
type ClientModel struct {
// contains filtered or unexported fields
}
ClientModel represents the UI model for the client
func NewClientModel ¶
func NewClientModel(serverAddr string, inputReceiver *client.InputReceiver, version string) *ClientModel
NewClientModel creates a new client UI model
func (*ClientModel) AddLogEntry ¶
func (m *ClientModel) AddLogEntry(entry LogEntry)
AddLogEntry adds a new log entry to the client buffer
func (*ClientModel) SetMessage ¶
func (m *ClientModel) SetMessage(msgType, message string)
SetMessage sets a temporary message
func (*ClientModel) SetProgram ¶
func (m *ClientModel) SetProgram(p *tea.Program)
SetProgram sets the tea.Program for sending updates
type Connection ¶
Connection represents a connection entry
type ConnectionList ¶
type ConnectionList struct {
Title string
Connections []Connection
Width int
}
ConnectionList shows a list of connections
func (*ConnectionList) View ¶
func (c *ConnectionList) View() string
View renders the connection list
type ControlStatusMsg ¶
type ControlStatusMsg struct {
Status client.ControlStatus
}
ControlStatusMsg is sent when control status changes
type ControlsHelp ¶
ControlsHelp displays keyboard controls
type DebugServerModel ¶
type DebugServerModel struct {
// contains filtered or unexported fields
}
DebugServerModel is a minimal TUI for debugging
func NewDebugServerModel ¶
func NewDebugServerModel() *DebugServerModel
NewDebugServerModel creates a debug server UI
func (*DebugServerModel) Init ¶
func (m *DebugServerModel) Init() tea.Cmd
func (*DebugServerModel) View ¶
func (m *DebugServerModel) View() string
type FullscreenServerModel ¶
type FullscreenServerModel struct {
// contains filtered or unexported fields
}
FullscreenServerModel represents the full-screen TUI model for the server
func NewFullscreenServerModel ¶
func NewFullscreenServerModel(port int, serverName string) *FullscreenServerModel
NewFullscreenServerModel creates a new server UI model
func (*FullscreenServerModel) Init ¶
func (m *FullscreenServerModel) Init() tea.Cmd
Init initializes the model
func (*FullscreenServerModel) View ¶
func (m *FullscreenServerModel) View() string
View renders the UI
type InlineClientModel ¶
type InlineClientModel struct {
// contains filtered or unexported fields
}
InlineClientModel represents the inline UI model for the client
func NewInlineClientModel ¶
func NewInlineClientModel(serverAddr string) *InlineClientModel
NewInlineClientModel creates a new inline client UI model
func (*InlineClientModel) AddLogEntry ¶
func (m *InlineClientModel) AddLogEntry(entry LogEntry)
AddLogEntry adds a new log entry to the client buffer
func (*InlineClientModel) Init ¶
func (m *InlineClientModel) Init() tea.Cmd
Init initializes the inline client model
func (*InlineClientModel) SetMessage ¶
func (m *InlineClientModel) SetMessage(msgType, message string)
SetMessage sets a temporary message
func (*InlineClientModel) View ¶
func (m *InlineClientModel) View() string
View renders the inline client UI with status bar + logs
type InlineServerModel ¶
type InlineServerModel struct {
// contains filtered or unexported fields
}
InlineServerModel represents the inline UI model for the server
func NewInlineServerModel ¶
func NewInlineServerModel(port int, serverName string) *InlineServerModel
NewInlineServerModel creates a new inline server UI model
func (*InlineServerModel) AddLogEntry ¶
func (m *InlineServerModel) AddLogEntry(entry LogEntry)
AddLogEntry adds a new log entry to the buffer
func (*InlineServerModel) GetAuthChannel ¶
func (m *InlineServerModel) GetAuthChannel() chan bool
GetAuthChannel returns the current auth channel for approval responses
func (*InlineServerModel) Init ¶
func (m *InlineServerModel) Init() tea.Cmd
Init initializes the inline server model
func (*InlineServerModel) SetMessage ¶
func (m *InlineServerModel) SetMessage(msgType, message string)
SetMessage sets a temporary message
func (*InlineServerModel) View ¶
func (m *InlineServerModel) View() string
View renders the inline server UI with status bar + logs
type Message ¶
type Message struct {
Type MessageType
Content string
}
Message displays a styled message
type MessageType ¶
type MessageType int
MessageType represents the type of message
const ( MessageInfo MessageType = iota MessageSuccess MessageWarning MessageError )
type MonitorInfo ¶
MonitorInfo displays monitor configuration
type ProgressIndicator ¶
ProgressIndicator shows progress
func (*ProgressIndicator) View ¶
func (p *ProgressIndicator) View() string
View renders the progress indicator
type ReconnectingMsg ¶
type ReconnectingMsg struct{ Status string }
Message types for reactive updates
type SSHAuthApprovedMsg ¶
type SSHAuthApprovedMsg struct{ Fingerprint string }
Message types for reactive updates
type SSHAuthDeniedMsg ¶
type SSHAuthDeniedMsg struct{ Fingerprint string }
Message types for reactive updates
type SSHAuthRequestMsg ¶
type SSHAuthRequestMsg struct {
ClientAddr string
PublicKey string
Fingerprint string
ResponseChan chan bool
}
Message types for reactive updates
type ServerModel ¶
type ServerModel struct {
// contains filtered or unexported fields
}
ServerModel represents the redesigned server UI model where server is the controller
func NewServerModel ¶
func NewServerModel(port int, serverName, version string) *ServerModel
NewServerModel creates a new redesigned server UI model
func (*ServerModel) AddLogEntry ¶
func (m *ServerModel) AddLogEntry(entry LogEntry)
AddLogEntry adds a new log entry to the buffer
func (*ServerModel) Init ¶
func (m *ServerModel) Init() tea.Cmd
Init initializes the redesigned model
func (*ServerModel) SetClientManager ¶
func (m *ServerModel) SetClientManager(cm *server.ClientManager)
SetClientManager sets the client manager for real-time updates
func (*ServerModel) SetServer ¶
func (m *ServerModel) SetServer(srv interface{ Stop() })
SetServer sets the server instance for proper shutdown handling
func (*ServerModel) View ¶
func (m *ServerModel) View() string
View renders the redesigned server UI
type SetClientManagerMsg ¶
type SetClientManagerMsg struct{ ClientManager interface{} }
Message types for reactive updates
type SetServerMsg ¶
type SetServerMsg struct{ Server interface{ Stop() } }
Message types for reactive updates
type SimpleClientModel ¶
type SimpleClientModel struct {
// contains filtered or unexported fields
}
SimpleClientModel is a simplified client UI
func NewSimpleClientModel ¶
func NewSimpleClientModel(serverAddress, serverName string) *SimpleClientModel
NewSimpleClientModel creates a new simple client model
func (*SimpleClientModel) Init ¶
func (m *SimpleClientModel) Init() tea.Cmd
func (*SimpleClientModel) SetCapturing ¶
func (m *SimpleClientModel) SetCapturing(capturing bool)
SetCapturing updates the capturing state
func (*SimpleClientModel) SetEdgeDetector ¶
func (m *SimpleClientModel) SetEdgeDetector(ed *input.EdgeDetector)
SetEdgeDetector sets the edge detector for the model
func (*SimpleClientModel) View ¶
func (m *SimpleClientModel) View() string
type SimpleServerModel ¶
type SimpleServerModel struct {
// contains filtered or unexported fields
}
SimpleServerModel is a simplified server UI
func NewSimpleServerModel ¶
func NewSimpleServerModel(port int, name string) *SimpleServerModel
NewSimpleServerModel creates a new simple server model
func (*SimpleServerModel) Init ¶
func (m *SimpleServerModel) Init() tea.Cmd
func (*SimpleServerModel) View ¶
func (m *SimpleServerModel) View() string
type StatusBar ¶
type StatusBar struct {
Width int
Title string
Status string
Connected bool
ShowSpinner bool
// contains filtered or unexported fields
}
StatusBar represents a reusable status bar component
func NewStatusBar ¶
NewStatusBar creates a new status bar