layout

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KEYWORD_PANE    = janet.Keyword("pane")
	KEYWORD_SPLIT   = janet.Keyword("split")
	KEYWORD_MARGINS = janet.Keyword("margins")
	KEYWORD_BORDERS = janet.Keyword("borders")

	// Special border behavior
	KEYWORD_NONE = janet.Keyword("none")
)

Functions

func AddMargins

func AddMargins(ctx context.Context, screen mux.Screen) mux.Screen

func Attached

func Attached(layout Layout) *tree.NodeID

Attached returns the ID field of the attached pane in the layout.

func NewStatic

func NewStatic(
	ctx context.Context,
	shouldAnimate bool,
	message string,
) *taro.Program

Types

type BorderType added in v0.5.0

type BorderType struct {
	Title       *string
	TitleBottom *string
	Border      *style.Border
	Node        NodeType
}

type Borders added in v0.5.0

type Borders struct {
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

func NewBorders added in v0.5.0

func NewBorders(ctx context.Context, screen mux.Screen) *Borders

func (*Borders) Kill added in v0.5.0

func (l *Borders) Kill()

func (*Borders) Resize added in v0.5.0

func (l *Borders) Resize(size geom.Size) error

func (*Borders) Send added in v0.5.0

func (l *Borders) Send(msg mux.Msg)

func (*Borders) Size added in v0.5.0

func (l *Borders) Size() geom.Size

func (*Borders) State added in v0.5.0

func (l *Borders) State() *tty.State

type Layout

type Layout struct {
	// contains filtered or unexported fields
}

func Attach

func Attach(layout Layout, id tree.NodeID) Layout

Attach changes the currently attached tree node to the one specified by id.

func New

func New(node NodeType) Layout

func (*Layout) MarshalJanet

func (l *Layout) MarshalJanet() interface{}

func (*Layout) UnmarshalJanet

func (l *Layout) UnmarshalJanet(value *janet.Value) (err error)

type LayoutEngine

type LayoutEngine struct {
	util.Lifetime
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

LayoutEngine is a Screen that renders a declarative layout that consists of other Screens. When the layout changes, LayoutEngine detects which Screens in the layout can be reused and which must be created from scratch.

func NewLayoutEngine

func NewLayoutEngine(
	ctx context.Context,
	tree *tree.Tree,
	muxServer *server.Server,
	settings ...Setting,
) *LayoutEngine

func (*LayoutEngine) Get

func (l *LayoutEngine) Get() Layout

Get gets the Layout this LayoutEngine is rendering.

func (*LayoutEngine) Kill

func (l *LayoutEngine) Kill()

func (*LayoutEngine) Resize

func (l *LayoutEngine) Resize(size geom.Size) error

func (*LayoutEngine) Send

func (l *LayoutEngine) Send(msg mux.Msg)

func (*LayoutEngine) Set

func (l *LayoutEngine) Set(layout Layout) error

Set changes the Layout rendered by this LayoutEngine by reusing as many existing Screens as it can.

func (*LayoutEngine) State

func (l *LayoutEngine) State() *tty.State

type Margins

type Margins struct {
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

Margins puts empty space around a Screen and centers it. In size mode, Margins attempts to keep the Screen at a fixed size (one or both dimensions fixed). In margin mode, the Screen is surrounded by fixed-size margins that do not change with the screen size.

func NewMargins

func NewMargins(ctx context.Context, screen mux.Screen) *Margins

func (*Margins) Kill

func (l *Margins) Kill()

func (*Margins) Resize

func (l *Margins) Resize(size geom.Size) error

func (*Margins) Send

func (l *Margins) Send(msg mux.Msg)

func (*Margins) Size

func (l *Margins) Size() geom.Size

func (*Margins) State

func (l *Margins) State() *tty.State

type MarginsType

type MarginsType struct {
	Cols   int
	Rows   int
	Frame  *string
	Border *style.Border
	Node   NodeType
}

type NodeType

type NodeType interface{}

type Pane

type Pane struct {
	util.Lifetime
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

func NewPane

func NewPane(
	ctx context.Context,
	tree *tree.Tree,
	server *server.Server,
	params *params.Parameters,
) *Pane

func (*Pane) Kill

func (p *Pane) Kill()

func (*Pane) Resize

func (p *Pane) Resize(size geom.Size) error

func (*Pane) Send

func (p *Pane) Send(msg mux.Msg)

func (*Pane) State

func (p *Pane) State() *tty.State

type PaneType

type PaneType struct {
	Attached     bool
	RemoveOnExit *bool
	ID           *tree.NodeID
}

type Setting

type Setting func(*LayoutEngine)

func WithParams

func WithParams(params *params.Parameters) Setting

type Split

type Split struct {
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

Split renders two screens side by side (or one above the other) at a fixed proportion of its full width or height (respectively.)

func NewSplit

func NewSplit(
	ctx context.Context,
	screenA, screenB mux.Screen,
	isVertical bool,
) *Split

func (*Split) Kill

func (s *Split) Kill()

func (*Split) Resize

func (s *Split) Resize(size geom.Size) error

func (*Split) Send

func (s *Split) Send(msg mux.Msg)

func (*Split) SetPercent

func (s *Split) SetPercent(percent int) error

func (*Split) State

func (s *Split) State() *tty.State

type SplitType

type SplitType struct {
	Vertical bool
	Percent  *int
	Cells    *int
	Border   *style.Border
	A        NodeType
	B        NodeType
}

type Static

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

func (*Static) Init

func (s *Static) Init() taro.Cmd

func (*Static) Update

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

func (*Static) View

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

Jump to

Keyboard shortcuts

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