ui

package
v0.8.14 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TabGapDistance = 2
	HeaderPadDist  = 2

	FavChar      = "  ★"
	AutoplayChar = " Auto"
	PlayChar     = "\u2877"
	PauseChar    = "\u28FF"
	LineChar     = "\u2847"
)
View Source
const IndexStringPadAmt = 3
View Source
const MaxFieldLen = 30

Variables

View Source
var Themes = []Theme{
	{
		Name:  "Duo Yellow",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Duo Green",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Duo Blue",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Duo Red",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Mono Yellow",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Mono Green",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Mono Blue",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Mono Red",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
	{
		Name:  "Grayscale",
		Dark:  ColorProfile{/* contains filtered or unexported fields */},
		Light: ColorProfile{/* contains filtered or unexported fields */},
	},
}

Functions

func IndexString added in v0.8.0

func IndexString(index int) string

func NrInputValidator added in v0.8.0

func NrInputValidator(s string) error

func PadFieldName added in v0.8.0

func PadFieldName(v string, padAmt *int) string

Types

type Checkbox added in v0.8.10

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

func NewCheckbox added in v0.8.10

func NewCheckbox(label string, defValue bool, s *Style) *Checkbox

func (*Checkbox) Init added in v0.8.10

func (c *Checkbox) Init() tea.Cmd

func (*Checkbox) IsFocused added in v0.8.10

func (c *Checkbox) IsFocused() bool

func (*Checkbox) Label added in v0.8.10

func (c *Checkbox) Label() string

func (*Checkbox) SetFocused added in v0.8.10

func (c *Checkbox) SetFocused(v bool)

func (*Checkbox) SetValue added in v0.8.10

func (c *Checkbox) SetValue(v bool)

func (*Checkbox) Toggle added in v0.8.10

func (c *Checkbox) Toggle()

func (*Checkbox) Update added in v0.8.10

func (c *Checkbox) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Checkbox) Value added in v0.8.10

func (c *Checkbox) Value() bool

func (*Checkbox) View added in v0.8.10

func (c *Checkbox) View() string

type ColorProfile added in v0.8.0

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

type FormElement added in v0.8.0

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

func NewFormElement added in v0.8.0

func NewFormElement(opts ...FormElementOpt) *FormElement

func (*FormElement) Blur added in v0.8.0

func (e *FormElement) Blur()

func (*FormElement) Checkbox added in v0.8.10

func (e *FormElement) Checkbox() *Checkbox

func (*FormElement) Description added in v0.8.0

func (e *FormElement) Description() string

func (*FormElement) Focus added in v0.8.0

func (e *FormElement) Focus() tea.Cmd

Focus: - input: 1.Focus + 2.SetActive(noop) - optionList: 1.Focus

func (*FormElement) IsActive added in v0.8.0

func (e *FormElement) IsActive() bool

func (*FormElement) Keymap added in v0.8.0

func (e *FormElement) Keymap() help.KeyMap

func (*FormElement) SetActive added in v0.8.0

func (e *FormElement) SetActive()

SetActive: - input: noop - optionList: 2.SetActive

func (*FormElement) SetValue added in v0.8.0

func (e *FormElement) SetValue(v any)

func (*FormElement) TextInput added in v0.8.0

func (e *FormElement) TextInput() *textinput.Model

func (*FormElement) Update added in v0.8.0

func (e *FormElement) Update(msg tea.Msg) (*FormElement, tea.Cmd)

func (*FormElement) Value added in v0.8.0

func (e *FormElement) Value() string

func (*FormElement) View added in v0.8.0

func (e *FormElement) View() string

type FormElementOpt added in v0.8.0

type FormElementOpt func(f *FormElement)

func WithCheckbox added in v0.8.10

func WithCheckbox(c *Checkbox) FormElementOpt

func WithDescription added in v0.8.0

func WithDescription(desc string) FormElementOpt

func WithOptionList added in v0.8.0

func WithOptionList(o *OptionList) FormElementOpt

func WithTextInput added in v0.8.0

func WithTextInput(i *textinput.Model) FormElementOpt

type JumpInfo added in v0.8.0

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

func (*JumpInfo) JumpTimeout added in v0.8.0

func (j *JumpInfo) JumpTimeout() time.Duration

func (*JumpInfo) LastPosition added in v0.8.0

func (j *JumpInfo) LastPosition() int

func (*JumpInfo) NewPosition added in v0.8.0

func (j *JumpInfo) NewPosition(digit int) int

type Model added in v0.3.3

type Model struct {
	Progr *tea.Program
	// contains filtered or unexported fields
}

func NewModel added in v0.3.3

func NewModel(ctx context.Context, cfg *config.Value, b *browser.API, p *player.Player) *Model

func (*Model) Init added in v0.3.3

func (m *Model) Init() tea.Cmd

func (*Model) Quit added in v0.3.3

func (m *Model) Quit()

func (*Model) Update added in v0.3.3

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

func (Model) View added in v0.3.3

func (m Model) View() string

type OptionList added in v0.8.0

type OptionList struct {
	PartialCallbackFn func(int)
	DoneCallbackFn    func(int)

	Keymap optionsKeymap
	// contains filtered or unexported fields
}

func NewOptionList added in v0.8.0

func NewOptionList(prompt string, options []OptionValue, startIdx int, s *Style) OptionList

func (*OptionList) Init added in v0.8.0

func (o *OptionList) Init() tea.Cmd

func (*OptionList) IsActive added in v0.8.0

func (o *OptionList) IsActive() bool

IsActive: 1.focused + 2.active

func (*OptionList) IsFocused added in v0.8.0

func (o *OptionList) IsFocused() bool

IsFocused: 1.focused

func (*OptionList) SetActive added in v0.8.0

func (o *OptionList) SetActive(v bool)

func (*OptionList) SetFocused added in v0.8.0

func (o *OptionList) SetFocused(v bool)

func (*OptionList) SetIdx added in v0.8.0

func (o *OptionList) SetIdx(v int)

func (*OptionList) SetQuick added in v0.8.0

func (o *OptionList) SetQuick(v bool)

func (*OptionList) Update added in v0.8.0

func (o *OptionList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*OptionList) View added in v0.8.0

func (o *OptionList) View() string

type OptionMsg added in v0.8.0

type OptionMsg struct {
	SelIdx     int
	PreviewIdx int
	Done       bool
	CallbackFn func(int)
}

type OptionValue added in v0.8.0

type OptionValue struct {
	IdxView  int
	NameView string
}

type Style added in v0.8.0

type Style struct {
	PrimaryColorStyle   lipgloss.Style
	SecondaryColorStyle lipgloss.Style

	// general
	BaseBold       lipgloss.Style
	DocStyle       lipgloss.Style
	StatusBarStyle lipgloss.Style
	ViewStyle      lipgloss.Style
	NoItemsStyle   lipgloss.Style

	// station delegate
	PrefixStyle                 lipgloss.Style
	NowPlayingPrefixStyle       lipgloss.Style
	SelNowPlayingStyle          lipgloss.Style
	SelNowPlayingDescStyle      lipgloss.Style
	SelItemStyle                lipgloss.Style
	SelDescStyle                lipgloss.Style
	SelectedBorderStyle         lipgloss.Style
	SelectedBorderStyleInactive lipgloss.Style

	// header
	SongTitleStyle lipgloss.Style
	ItalicStyle    lipgloss.Style

	// tabs
	InactiveTabBorder         lipgloss.Style
	InactiveTabInner          lipgloss.Style
	InactiveTabInnerHighlight lipgloss.Style
	ActiveTabBorder           lipgloss.Style
	ActiveTabInner            lipgloss.Style
	ActiveTabInnerHighlight   lipgloss.Style
	TabGap                    lipgloss.Style

	// help
	HelpStyle lipgloss.Style

	// textInput
	PromptStyle    lipgloss.Style
	SelPromptStyle lipgloss.Style

	// station info
	InfoFieldNameStyle lipgloss.Style

	// history
	HistoryDescStyle    lipgloss.Style
	HistorySelItemStyle lipgloss.Style
	HistorySelDescStyle lipgloss.Style

	// settings
	SettingDescription lipgloss.Style
	// contains filtered or unexported fields
}

func NewStyle added in v0.8.0

func NewStyle(themeIdx int) *Style

func (*Style) GetSecondColor added in v0.8.0

func (s *Style) GetSecondColor() string

func (*Style) HelpStyles added in v0.8.0

func (s *Style) HelpStyles() help.Styles

func (*Style) NewInputModel added in v0.8.0

func (s *Style) NewInputModel(
	prompt, placeholder string,
	prevSugg *key.Binding,
	nextSugg *key.Binding,
	acceptSugg *key.Binding,
	validator textinput.ValidateFunc,
) textinput.Model

func (*Style) SetThemeIdx added in v0.8.0

func (s *Style) SetThemeIdx(themeIdx int)

func (*Style) TextInputSyle added in v0.8.0

func (s *Style) TextInputSyle(textInput *textinput.Model, prompt, placeholder string)

type Theme added in v0.8.0

type Theme struct {
	Name  string
	Dark  ColorProfile
	Light ColorProfile
}

Jump to

Keyboard shortcuts

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