tui

package
v3.2.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MaxWidth = 120
)

Variables

View Source
var (
	ColorError   = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#FF0000", Dark: "#FF0000"})
	ColorSuccess = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "32", Dark: "42"})
	ColorHelp    = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#B2B2B2", Dark: "#4A4A4A"})
)
View Source
var DefaultStyles = &Styles{
	Child:   lipgloss.NewStyle().Padding(1, 0, 0, 0),
	Error:   lipgloss.NewStyle().Inherit(ColorError).Padding(1, 0),
	Help:    lipgloss.NewStyle().Padding(1, 0, 1, 2),
	Success: lipgloss.NewStyle().Inherit(ColorSuccess).Padding(1, 0),
}
View Source
var MinimalKeyMap = func() *KeyMap {
	m := orderedmap.NewOrderedMap()
	m.Set("quit", key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	))
	return &KeyMap{OrderedMap: m}
}()

Functions

func Cmd

func Cmd(msg tea.Msg) tea.Cmd

func Width

func Width(width int) int

Types

type ErrorMsg

type ErrorMsg struct {
	Err  error
	Exit bool
}

type KeyMap

type KeyMap struct {
	*orderedmap.OrderedMap
}

func NewKeyMap

func NewKeyMap() *KeyMap

func (*KeyMap) Add

func (m *KeyMap) Add(name string, binding key.Binding)

func (KeyMap) Copy

func (m KeyMap) Copy() *KeyMap

func (KeyMap) FullHelp

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

func (KeyMap) Matches

func (m KeyMap) Matches(msg tea.KeyMsg, keyStr string) bool

func (*KeyMap) Merge

func (m *KeyMap) Merge(kmap *KeyMap)

func (KeyMap) ShortHelp

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

type KeyMapProvider

type KeyMapProvider interface {
	KeyMap() *KeyMap
}

type ListModel

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

func NewListModel

func NewListModel(ctx context.Context, description string, repoUser string, client *graphql.Client) ListModel

func (ListModel) Confirmed

func (m ListModel) Confirmed() bool

func (ListModel) EditKeyMap

func (m ListModel) EditKeyMap() *KeyMap

func (ListModel) Init

func (m ListModel) Init() tea.Cmd

func (ListModel) KeyMap

func (m ListModel) KeyMap() *KeyMap

func (ListModel) TogglePrefixes

func (m ListModel) TogglePrefixes() ListModel

func (ListModel) Update

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

func (ListModel) View

func (m ListModel) View() string

type Model

type Model struct {
	Child  tea.Model
	KeyMap *KeyMap
	Styles *Styles
	// contains filtered or unexported fields
}

func NewModel

func NewModel(
	child tea.Model,
	keyMap *KeyMap,
	styles *Styles,
	opts ...Option,
) 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 Option

type Option func(*Model)

func WithoutHelp

func WithoutHelp() Option

type StandaloneInputModel

type StandaloneInputModel struct {
	tea.Model
	// contains filtered or unexported fields
}

func NewStandaloneInputModel

func NewStandaloneInputModel(
	inputParams prompt.InputParams,
	keyMap *KeyMap,
	styles *Styles,
	opts ...Option,
) StandaloneInputModel

func (StandaloneInputModel) Update

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

func (StandaloneInputModel) Value

func (m StandaloneInputModel) Value() (string, bool)

type StandaloneQuestionModel

type StandaloneQuestionModel struct {
	tea.Model
	// contains filtered or unexported fields
}

func NewStandaloneQuestionModel

func NewStandaloneQuestionModel(
	text string,
	keyMap *KeyMap,
	styles *Styles,
	opts ...Option,
) StandaloneQuestionModel

func (StandaloneQuestionModel) Confirmed

func (m StandaloneQuestionModel) Confirmed() bool

func (StandaloneQuestionModel) Update

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

type Styles

type Styles struct {
	Child   lipgloss.Style
	Error   lipgloss.Style
	Help    lipgloss.Style
	Success lipgloss.Style
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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