ui

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package ui provides the main UI for the kat application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgram

func NewProgram(cfg *Config, cmd common.Commander) *tea.Program

NewProgram returns a new Tea program.

Types

type Config

type Config struct {
	// KeyBinds contains key binding configurations for different UI components.
	KeyBinds *KeyBinds `json:"keybinds,omitempty" jsonschema:"title=Key Binds"`
	// Themes defines custom color for the UI, defined as a map of theme name to theme config.
	// Themes can be referenced by name in the global and/or profile UI configs.
	Themes map[string]ThemeConfig `json:"themes,omitempty" jsonschema:"title=Themes"`
	// UI contains general UI display settings.
	UI *UIConfig `json:"ui,omitempty" jsonschema:"title=UI"`
}

Config contains TUI-specific configuration.

func NewConfig

func NewConfig() *Config

func (*Config) EnsureDefaults

func (c *Config) EnsureDefaults()

type GotResultMsg

type GotResultMsg command.Output

type KeyBinds

type KeyBinds struct {
	// Common contains key bindings that apply across all UI components.
	Common *common.KeyBinds `json:"common,omitempty" jsonschema:"title=Common Key Binds"`
	// List contains key bindings specific to list views.
	List *list.KeyBinds `json:"list,omitempty" jsonschema:"title=List Key Binds"`
	// Menu contains key bindings specific to menu views.
	Menu *menu.KeyBinds `json:"menu,omitempty" jsonschema:"title=Menu Key Binds"`
	// Pager contains key bindings specific to the pager view.
	Pager *pager.KeyBinds `json:"pager,omitempty" jsonschema:"title=Pager Key Binds"`
}

KeyBinds contains key binding configurations for different UI components.

func NewKeyBinds

func NewKeyBinds() *KeyBinds

func (*KeyBinds) EnsureDefaults

func (kb *KeyBinds) EnsureDefaults()

func (*KeyBinds) Validate

func (kb *KeyBinds) Validate() error

type OverlayState

type OverlayState int

type ShowResultMsg

type ShowResultMsg struct{}

type State

type State int

State is the top-level application State.

func (State) String

func (s State) String() string

type ThemeConfig

type ThemeConfig struct {
	// Styles contains the style entries for Chroma rendering, which uses the same syntax as Pygments.
	// Define a map of Pygments Tokens (https://pygments.org/docs/tokens/)
	// to Pygments Styles (http://pygments.org/docs/styles/).
	Styles chroma.StyleEntries `json:"styles,omitempty" jsonschema:"title=Styles"`
}

ThemeConfig defines custom theme configuration.

type UIConfig

type UIConfig struct {
	// MinimumDelay specifies the minimum delay before updating the display.
	MinimumDelay *time.Duration `json:"minimumDelay,omitempty" jsonschema:"title=Minimum Delay,type=string,default=200ms"`
	// Compact enables compact display mode with reduced spacing.
	Compact *bool `json:"compact,omitempty" jsonschema:"title=Enable Compact Display,default=false"`
	// WordWrap enables automatic word wrapping for long text.
	WordWrap *bool `json:"wordWrap,omitempty" jsonschema:"title=Enable Word Wrap,default=true"`
	// ChromaRendering enables syntax highlighting using Chroma.
	ChromaRendering *bool `json:"chromaRendering,omitempty" jsonschema:"title=Enable Chroma Rendering,default=true"`
	// LineNumbers enables line numbers in the display.
	LineNumbers *bool `json:"lineNumbers,omitempty" jsonschema:"title=Enable Line Numbers,default=true"`
	// Theme specifies the theme name to use. This can be a custom theme added under `themes`,
	// or a theme from the Chroma Style Gallery: https://xyproto.github.io/splash/docs/
	Theme string `json:"theme,omitempty" jsonschema:"title=Theme Name"`
}

func (*UIConfig) EnsureDefaults

func (c *UIConfig) EnsureDefaults()

func (UIConfig) JSONSchemaExtend added in v0.15.0

func (c UIConfig) JSONSchemaExtend(schema *jsonschema.Schema)

Directories

Path Synopsis
Package ansis provides utilities for ANSI text styling and manipulation.
Package ansis provides utilities for ANSI text styling and manipulation.
Package filepicker provides a file picker component for Bubble Tea applications.
Package filepicker provides a file picker component for Bubble Tea applications.
Package overlay provides terminal UI overlay functionality for placing foreground content on top of background content, similar to modal dialogs or popup windows in terminal applications.
Package overlay provides terminal UI overlay functionality for placing foreground content on top of background content, similar to modal dialogs or popup windows in terminal applications.

Jump to

Keyboard shortcuts

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