stories

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 6 Imported by: 0

README

stories

Package stories is an interface for registering and viewing stories. Stories are predefined configurations of cy's UI components that may also describe a sequence of user inputs that are "played" into the story after it is loaded. This is similar to Storybook.

Documentation

Index

Constants

View Source
const (
	ABit = 300 * time.Millisecond
	Some = time.Second
	More = 3 * time.Second
	ALot = 5 * time.Second
)
View Source
const TYPE_DELAY = 100 * time.Millisecond

Variables

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

Functions

func Register

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

func Send

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

func Type added in v0.1.10

func Type(msgs ...string) (result []interface{})

Simulate typing.

Types

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
	// A list of inputs that will be executed in order when the story
	// begins.
	Input []interface{}
}

func (*Config) HasInputs added in v0.1.10

func (c *Config) HasInputs() bool

type InitFunc

type InitFunc func(context.Context) (mux.Screen, error)

type Story

type Story struct {
	Name   string
	Init   InitFunc
	Config Config
}

type WaitEvent added in v0.1.10

type WaitEvent struct {
	Duration time.Duration
}

func Wait added in v0.1.10

func Wait(duration time.Duration) WaitEvent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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