components

package
v0.0.0-...-f4c0d56 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	THEME_INFO    = "#8866e9"
	THEME_PRIMARY = "#006bbb"
	THEME_SUCCESS = "#027b77"
	THEME_WARNING = "#ff7b52"
	THEME_DANGER  = "#d251a6"
)
View Source
const (
	KeySpace    = " "
	KeyDown     = "down"
	KeyUp       = "up"
	KeyJ        = "j"
	KeyQ        = "q"
	KeyK        = "k"
	KeyEnter    = "enter"
	KeyCtrlC    = "ctrl+c"
	KeyCtrlR    = "ctrl+r"
	KeyESC      = "esc"
	KeyTab      = "tab"
	KeyShiftTab = "shift+tab"
)

Variables

View Source
var FontColor = lipgloss.NewStyle().Foreground

Functions

func UseBatchSpinner

func UseBatchSpinner(style *BatchSpinnerStyle, payload *BatchSpinnerPayLoad)

func UseMultiSelect

func UseMultiSelect(style *MultiSelectStyle, payload *MultiSelectPayLoad) []int

func UseRepl

func UseRepl(questions []string) []string

func UseSimpleList

func UseSimpleList(style *SimpleListStyle, payload *SimpleListPayLoad) int

func UseSpinner

func UseSpinner(style *SpinnerStyle, payload *SpinnerPayLoad)

func UseTextInput

func UseTextInput(style *TextInputStyle, payload *TextInputPayLoad) []string

Types

type BatchSpinnerPayLoad

type BatchSpinnerPayLoad struct {
	Task []BatchTask
}

func DefaultBatchSpinnerPayLoad

func DefaultBatchSpinnerPayLoad() *BatchSpinnerPayLoad

type BatchSpinnerStyle

type BatchSpinnerStyle struct {
	CurrentPkgNameStyle lipgloss.Style
	DoneStyle           lipgloss.Style
	CheckMark           lipgloss.Style
	ErrorMask           lipgloss.Style
}

func DefaultBatchSpinnerStyle

func DefaultBatchSpinnerStyle() *BatchSpinnerStyle

type BatchTask

type BatchTask struct {
	Name     string
	Callback func() bool //TODO: show error msg
}

type FancyListItem

type FancyListItem struct {
	ChoiceTitle  string
	ChoiceDetail string
}

func UseFancyList

func UseFancyList(style *FancyListStyle, payload *FancyListPayLoad) FancyListItem

func (FancyListItem) Description

func (i FancyListItem) Description() string

func (FancyListItem) FilterValue

func (i FancyListItem) FilterValue() string

func (FancyListItem) Title

func (i FancyListItem) Title() string

type FancyListPayLoad

type FancyListPayLoad struct {
	Title   string
	Choices []list.Item
}

func DefaultFancyListPayLoad

func DefaultFancyListPayLoad() *FancyListPayLoad

type FancyListStyle

type FancyListStyle struct {
	DocStyle lipgloss.Style
}

func DefaultFancyListStyle

func DefaultFancyListStyle() *FancyListStyle

type MultiSelectPayLoad

type MultiSelectPayLoad struct {
	Title   string
	Choices []string
}

func DefaultMultiSelectPayLoad

func DefaultMultiSelectPayLoad() *MultiSelectPayLoad

type MultiSelectStyle

type MultiSelectStyle struct {
}

func DefaultMultiSelectStyle

func DefaultMultiSelectStyle() *MultiSelectStyle

type SimpleListPayLoad

type SimpleListPayLoad struct {
	Title              string
	Choices            []string
	QuitTextWithChoice string
	QuitText           string
	ShowQuitText       bool
}

func DefaultSimpleListPayload

func DefaultSimpleListPayload() *SimpleListPayLoad

type SimpleListStyle

type SimpleListStyle struct {
	Width, Height     int
	QuitTextStyle     lipgloss.Style
	TitleStyle        lipgloss.Style
	HelpStyle         lipgloss.Style
	ItemStyle         lipgloss.Style
	SelectedItemStyle lipgloss.Style
	PaginationStyle   lipgloss.Style
}

func DefaultSimpleListStyle

func DefaultSimpleListStyle() *SimpleListStyle

type SpinnerPayLoad

type SpinnerPayLoad struct {
	Callback func()
}

type SpinnerStyle

type SpinnerStyle struct {
	SpinnerStyle spinner.Spinner
}

func DefaultSpinnerStyle

func DefaultSpinnerStyle() *SpinnerStyle

type TextInputFormat

type TextInputFormat struct {
	Name      string
	EchoMode  bool
	CharLimit int
}

type TextInputPayLoad

type TextInputPayLoad struct {
	Texts []TextInputFormat
}

func DefaultTextInputPayLoad

func DefaultTextInputPayLoad() *TextInputPayLoad

type TextInputStyle

type TextInputStyle struct {
	FocusedStyle        lipgloss.Style
	BlurredStyle        lipgloss.Style
	CursorStyle         lipgloss.Style
	NoStyle             lipgloss.Style
	HelpStyle           lipgloss.Style
	CursorModeHelpStyle lipgloss.Style
	FocusedButton       string
	BlurredButton       string
}

func DefaultTextStyle

func DefaultTextStyle() *TextInputStyle

Jump to

Keyboard shortcuts

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