layout

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 10 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")
	KEYWORD_TABS    = janet.Keyword("tabs")
	KEYWORD_BAR     = janet.Keyword("bar")
)

Functions

func Attached

func Attached(layout Layout) *tree.NodeID

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

func IsAttached added in v0.6.0

func IsAttached(tree NodeType) bool

IsAttached reports whether the node provided leads to a node that is attached.

func ValidateTree added in v0.6.0

func ValidateTree(tree NodeType) error

ValidateTree inspects a tree and ensures that it conforms to all relevant constraints, namely there should only be one PaneType with Attached=true.

Types

type BarType added in v0.8.0

type BarType struct {
	Text   *prop.String
	Bottom bool
	Node   NodeType
}

type BorderType added in v0.5.0

type BorderType struct {
	Title       *prop.String
	TitleBottom *prop.String
	Border      *prop.Border
	BorderFg    *prop.Color
	BorderBg    *prop.Color
	Node        NodeType
}

type Computable added in v0.8.0

type Computable struct {
	util.Lifetime
	*Log
	*Context
}

func NewComputable added in v0.8.0

func NewComputable(ctx context.Context) *Computable

type Context added in v0.8.0

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

func (*Context) Context added in v0.8.0

func (c *Context) Context() interface{}

func (*Context) SetContext added in v0.8.0

func (c *Context) SetContext(context interface{})

type Contextable added in v0.8.0

type Contextable interface {
	SetContext(interface{})
}

Contextable is used for passing in an execution context that will be used when running Janet functions.

type Layout

type Layout struct {
	Root NodeType
}

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 Log added in v0.8.0

type Log struct {
	zerolog.Logger
}

func NewLog added in v0.8.0

func NewLog() *Log

func (*Log) SetLogger added in v0.8.0

func (l *Log) SetLogger(log zerolog.Logger)

type Loggable added in v0.8.0

type Loggable interface {
	SetLogger(zerolog.Logger)
}

Loggable is used for passing a logger to the Screen when appropriate.

type MarginsType

type MarginsType struct {
	Cols     int
	Rows     int
	Frame    *string
	Border   *prop.Border
	BorderFg *prop.Color
	BorderBg *prop.Color
	Node     NodeType
}

type NodeChangeEvent added in v0.6.0

type NodeChangeEvent struct {
	Config NodeType
}

type NodeRemoveEvent added in v0.6.0

type NodeRemoveEvent struct{}

type NodeType

type NodeType interface{}

func AttachFirst added in v0.6.0

func AttachFirst(node NodeType) NodeType

AttachFirst attaches to the first node it can find.

func Copy added in v0.7.0

func Copy(node NodeType) NodeType

Copy recursively copies the node. This is so mutations don't affect the original.

func Detach added in v0.6.0

func Detach(node NodeType) NodeType

Detach returns a copy of node with no attachment points.

func RemoveAttached added in v0.6.0

func RemoveAttached(node NodeType) NodeType

RemoveAttached removes the attached node by replacing its nearest parent that has more than one child with a parent with that child removed, or the other child if there are no other children.

type PaneType

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

type Reusable added in v0.6.0

type Reusable interface {
	mux.Screen
	Apply(NodeType) (bool, error)
}

Reusable is used to describe a Screen that has a configuration that can change. Often a Screen does not actually need to be created from scratch when the corresponding layout node changes; it can just be updated. The reuse function checks whether the Screen can be updated to match the new configuration and updates it if possible.

type SplitType

type SplitType struct {
	Vertical bool
	Percent  *int
	Cells    *int
	Border   *prop.Border
	BorderFg *prop.Color
	BorderBg *prop.Color
	A        NodeType
	B        NodeType
}

type Tab added in v0.7.0

type Tab struct {
	Active bool
	Name   string
	Node   NodeType
}

type TabsType added in v0.7.0

type TabsType struct {
	ActiveFg, ActiveBg     *prop.Color
	InactiveFg, InactiveBg *prop.Color
	Bg                     *prop.Color
	Bottom                 bool
	Tabs                   []Tab
}

func (TabsType) Active added in v0.7.0

func (t TabsType) Active() (tab Tab)

Active returns the Tab config of the currently active tab.

func (TabsType) ActiveIndex added in v0.7.0

func (t TabsType) ActiveIndex() int

Active returns the index of the currently active tab.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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