tui

package
v0.0.0-...-bc9612b Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	KeyMap: textarea.DefaultKeyMap,
	Blur: key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "toggle focus"),
	),
	Print: key.NewBinding(
		key.WithKeys("ctrl+p"),
		key.WithHelp("ctrl+p", "print"),
	),
	Help: key.NewBinding(
		key.WithKeys("ctrl+h"),
		key.WithHelp("ctrl+h", "help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("ctrl+c", "ctrl+q"),
		key.WithHelp("ctrl+c/ctrl+q", "quit"),
	),
}
View Source
var DefaultStyles = Styles{
	Main: lipgloss.NewStyle(),
	Help: help.New().Styles,
}

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	textarea.KeyMap

	Blur  key.Binding
	Print key.Binding
	Help  key.Binding
	Quit  key.Binding
}

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type Model

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

func New

func New(driver escpos.Driver) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Run

func (m Model) Run() error

func (*Model) SetKeyMap

func (m *Model) SetKeyMap(keymap KeyMap)

func (*Model) SetStyles

func (m *Model) SetStyles(styles Styles)

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Styles

type Styles struct {
	Main     lipgloss.Style
	Textarea TextareaStyles
	Help     help.Styles
}

type TextareaStyles

type TextareaStyles struct {
	Focused textarea.Style
	Blurred textarea.Style
}

Jump to

Keyboard shortcuts

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