tui

package
v0.0.0-...-9dc31f9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShortCutKeyColor  = "#47A4AC"
	ShortCutDescColor = "#BAEBDA"
)
View Source
const (
	UIWidth = 79

	SummaryPageSize = 10
	DetailPageSize  = 16

	ColorError         = "#CF002E"
	ColorDetailTitle   = "#DE3E93"
	ColorPromptBorder  = "#DE3E93"
	ColorTextLightGray = "#FFFDF5"
	ColorTableBorder   = "#47A4AC"
	ColorTableText     = "#BAEBDA"
)

Variables

View Source
var BlurredStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorTableText))
View Source
var DeleteStyle = lipgloss.NewStyle().
	Margin(1, 1).
	Padding(1, 2).
	Foreground(lipgloss.Color(ColorPromptBorder)).
	Align(lipgloss.Center).
	Border(lipgloss.RoundedBorder(), true, true, true, true).
	BorderForeground(lipgloss.Color(ColorPromptBorder)).
	Render
View Source
var ErrStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorError)).Render
View Source
var FocusedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorPromptBorder))
View Source
var InputStyle = lipgloss.NewStyle().
	Margin(1, 1).
	Padding(1, 2).
	Border(lipgloss.RoundedBorder(), true, true, true, true).
	BorderForeground(lipgloss.Color(ColorPromptBorder)).
	Render
View Source
var InputTitleStyle = lipgloss.NewStyle().
	Width(defaultInputWidth).
	Foreground(lipgloss.Color(ColorTextLightGray)).
	Background(lipgloss.Color(ColorDetailTitle)).
	Padding(0, 1).
	Align(lipgloss.Center)
View Source
var LogoStyle = lipgloss.NewStyle().
	Foreground(lipgloss.Color(ColorLogo)).
	Padding(0, 1)
View Source
var NoStyle = lipgloss.NewStyle()
View Source
var PromptStyle = lipgloss.NewStyle().
	Width(UIWidth).
	Align(lipgloss.Center)
View Source
var ShortcutDescStyle = lipgloss.NewStyle().
	Foreground(lipgloss.Color(ShortCutDescColor))
View Source
var ShortcutKeyStyle = lipgloss.NewStyle().
	Foreground(lipgloss.Color(ShortCutKeyColor))
View Source
var TableStyle = lipgloss.NewStyle().
	Foreground(lipgloss.Color(ColorTableText)).
	BorderForeground(lipgloss.Color(ColorTableBorder)).
	Align(lipgloss.Right)

Functions

func ShortcutRow

func ShortcutRow(shortcuts []Shortcut) string

func StartTea

func StartTea(tb util2.TimeBox)

Types

type AddPrompt

type AddPrompt struct {
	State util2.PromptState

	Result util2.InputResult
	// contains filtered or unexported fields
}

func AddBox

func AddBox() AddPrompt

func AddSpan

func AddSpan(boxName string) AddPrompt

func EditBox

func EditBox(box util2.Box) AddPrompt

func (AddPrompt) Init

func (m AddPrompt) Init() tea.Cmd

func (AddPrompt) Update

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

func (AddPrompt) View

func (m AddPrompt) View() string

type DeletePrompt

type DeletePrompt struct {
	HasAnswer bool
	Answer    bool
	// contains filtered or unexported fields
}

func NewDeletePrompt

func NewDeletePrompt(txt string) DeletePrompt

func (DeletePrompt) Init

func (m DeletePrompt) Init() tea.Cmd

func (DeletePrompt) Update

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

func (DeletePrompt) View

func (m DeletePrompt) View() string

type Model

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

func New

func New(tb util2.TimeBox) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Shortcut

type Shortcut struct {
	Key       string
	Desc      string
	KeyStyle  lipgloss.Style
	DescStyle lipgloss.Style
}

func NewShortcut

func NewShortcut(key, desc string) Shortcut

func (Shortcut) DescLength

func (s Shortcut) DescLength() int

func (Shortcut) KeyLength

func (s Shortcut) KeyLength() int

func (Shortcut) Length

func (s Shortcut) Length() int

func (Shortcut) String

func (s Shortcut) String() string

Jump to

Keyboard shortcuts

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