stories

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stories = make(map[string]Story)

Functions

func Initialize

func Initialize(ctx context.Context, filter string) (*taro.Program, error)

func NewBrowser

func NewBrowser(
	ctx context.Context,
	stories []Story,
) *taro.Program

func NewViewer

func NewViewer(
	ctx context.Context,
	screen mux.Screen,
	config Config,
) *taro.Program

func Register

func Register(name string, init InitFunc, config Config)

func Send

func Send(s mux.Screen, msgs ...interface{})

Types

type Browser

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

A Browser lets the user switch between different stories.

func (*Browser) Init

func (s *Browser) Init() tea.Cmd

func (*Browser) Update

func (s *Browser) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Browser) View

func (s *Browser) View(state *tty.State)

type Config

type Config struct {
	// If zero, the story will resize
	Size geom.Size
	// If true, the viewer captures the screen immediately and uses that
	// instead of a live view.
	IsSnapshot bool
}

type InitFunc

type InitFunc func(context.Context) mux.Screen

type Story

type Story struct {
	Name string
	Init InitFunc
	// contains filtered or unexported fields
}

type Viewer

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

A Viewer shows a single story.

func (*Viewer) Init

func (v *Viewer) Init() tea.Cmd

func (*Viewer) Update

func (v *Viewer) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Viewer) View

func (v *Viewer) View(state *tty.State)

Jump to

Keyboard shortcuts

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