ui

package
v0.0.0-...-748c6ad Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Heavily borrowed from: https://github.com/charmbracelet/bubbletea/tree/master/examples/credit-card-form

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormRoute

func FormRoute(inputs ...*Input) router.RouteInitializer
func MenuRenderer(props MenuProps, w, h int) string

func PreviewRoute

func PreviewRoute(names *batch.Names) router.RouteInitializer

func Quit

func Quit() tea.Msg

func TermSize

func TermSize() (int, int)

func ValidateBool

func ValidateBool(v string) error

func ValidateInt

func ValidateInt(a string) error

Types

type App

type App struct {
	reactea.BasicComponent
	reactea.BasicPropfulComponent[reactea.NoProps]
	// contains filtered or unexported fields
}

func New

func New(names *batch.Names) *App

func (*App) Init

func (c *App) Init(reactea.NoProps) tea.Cmd

func (*App) Quit

func (c *App) Quit()

func (*App) Render

func (c *App) Render(w, h int) string

func (*App) Route

func (c *App) Route(r MenuEntry) *App

func (*App) Update

func (c *App) Update(msg tea.Msg) tea.Cmd

type Form

type Form struct {
	reactea.BasicComponent
	reactea.BasicPropfulComponent[FormProps]
	// contains filtered or unexported fields
}

func NewForm

func NewForm() *Form

func (*Form) Init

func (c *Form) Init(props FormProps) tea.Cmd

func (*Form) Render

func (c *Form) Render(int, int) string

func (*Form) Update

func (c *Form) Update(msg tea.Msg) tea.Cmd

type FormProps

type FormProps struct {
	Inputs []*Input
}

type Input

func CaseForm

func CaseForm() []*Input

func FindReplaceForm

func FindReplaceForm() []*Input

func NameForm

func NameForm() []*Input

func NewInput

func NewInput() *Input

func NewPaddingForm

func NewPaddingForm() []*Input

func (*Input) Init

func (c *Input) Init(props InputProps) tea.Cmd

func (*Input) Render

func (c *Input) Render(int, int) string

func (*Input) Save

func (c *Input) Save()

func (*Input) Update

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

type InputProps

type InputProps struct {
	SetValue func(any)
}
type MenuEntry int
const (
	Name MenuEntry = iota
	Num
	Case
	Replace
	View
	Menu
)
func (m MenuEntry) Key() string
func (m MenuEntry) Render() string
func (i MenuEntry) String() string
type MenuProps = int

type Preview

type Preview struct {
	reactea.BasicComponent
	reactea.BasicPropfulComponent[PreviewProps]
	// contains filtered or unexported fields
}

func NewPreview

func NewPreview() *Preview

func (*Preview) Init

func (c *Preview) Init(props PreviewProps) tea.Cmd

func (*Preview) Render

func (c *Preview) Render(w, h int) string

func (*Preview) Update

func (c *Preview) Update(msg tea.Msg) tea.Cmd

type PreviewProps

type PreviewProps struct {
	Names *batch.Names
	Quit  func()
}

type QuitMsg

type QuitMsg struct{}

Jump to

Keyboard shortcuts

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