text

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BottomRight stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	location := geom.DEFAULT_SIZE
	location.C -= 1
	location.R -= 1
	return New(
		ctx,
		WithInline(location, geom.DEFAULT_SIZE),
	), nil
}
View Source
var FullBottom stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
	)
	return f, nil
}
View Source
var FullTop stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
	)
	return f, nil
}
View Source
var Placeholder stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		WithPlaceholder("placeholder"),
		WithPrompt("placeholder example"),
	)
	return f, nil
}
View Source
var Preset stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		WithPreset("preset text"),
		WithPrompt("preset example"),
	)
	return f, nil
}
View Source
var TopLeft stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	return New(
		ctx,
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}

Functions

func New

func New(
	ctx context.Context,
	settings ...Setting,
) *taro.Program

func WithReverse added in v0.2.9

func WithReverse(ctx context.Context, t *Text)

Types

type AcceptedEvent

type AcceptedEvent struct {
	Text string
}

type Setting

type Setting func(context.Context, *Text)

func WithAnimation

func WithAnimation(image image.Image, creator anim.Creator) Setting

func WithInline

func WithInline(location, size geom.Vec2) Setting

WithInline displays Text as a small window at the provided location on the screen.

func WithPlaceholder

func WithPlaceholder(placeholder string) Setting

WithPlaceholder controls the string that is shown when the input is empty.

func WithPreset

func WithPreset(preset string) Setting

WithPreset prefills the text input with a string.

func WithPrompt

func WithPrompt(prompt string) Setting

WithPrompt controls the prompt text shown below (or above) the text input.

func WithResult

func WithResult(result chan<- interface{}) Setting

type Text

type Text struct {
	util.Lifetime
	// contains filtered or unexported fields
}

func (*Text) Init

func (t *Text) Init() taro.Cmd

func (*Text) Update

func (t *Text) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Text) View

func (t *Text) View(state *tty.State)

Jump to

Keyboard shortcuts

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