Help us shape the future of Go! Take the 2026 Go Developer Survey

layouttree

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSplitRatio = 0.5
)

Variables

This section is empty.

Functions

func EncodeLayout

func EncodeLayout(node Node) (string, error)

func HasLeaf

func HasLeaf(node Node, leafID string) bool

func HasPane

func HasPane(node Node, paneID string) bool

func HasTile

func HasTile(node Node, tileID string) bool

func LayoutEmpty

func LayoutEmpty(node Node) bool

func LeafIDs

func LeafIDs(node Node) []string

func LeftNeighbour

func LeftNeighbour(tree Node, leafID string, surviving map[string]bool) string

func PaneIDs

func PaneIDs(node Node) []string

func TileFractionByID

func TileFractionByID(node Node, tileID string) (float64, bool)

func TileIDs

func TileIDs(node Node) []string

func Validate

func Validate(node Node) error

Types

type Direction

type Direction string
const (
	DirectionVertical   Direction = "vertical"
	DirectionHorizontal Direction = "horizontal"
)

type MoveBetweenLayoutsResult

type MoveBetweenLayoutsResult struct {
	SourceLayout Node
	TargetLayout Node
	Leaf         Node
	FinalLeafID  string
}

func MoveLeafBetweenLayouts

func MoveLeafBetweenLayouts(source, target Node, leafID, anchorID, splitID string, direction Direction, before bool, ratio float64, conflictSuffix string) (MoveBetweenLayoutsResult, bool)

type Node

type Node struct {
	Type          string             `json:"type"`
	PaneID        string             `json:"pane_id,omitempty"`
	TileID        string             `json:"tile_id,omitempty"`
	TileKind      string             `json:"tile_kind,omitempty"`
	TileParams    string             `json:"tile_params,omitempty"`
	TileSessionID protocol.SessionID `json:"tile_session_id,omitempty"`
	SplitID       string             `json:"split_id,omitempty"`
	Direction     Direction          `json:"direction,omitempty"`
	Ratio         float64            `json:"ratio,omitempty"`
	RatioLocked   bool               `json:"ratio_locked,omitempty"`
	RatioMode     RatioMode          `json:"ratio_mode,omitempty"`
	Children      []Node             `json:"children,omitempty"`
}

func DecodeLayout

func DecodeLayout(layoutJSON string) (Node, error)

func DefaultLayout

func DefaultLayout(paneID string) Node

func DockTile

func DockTile(node Node, anchorID string, direction Direction, before bool, splitID string, tileID string, tileKind string, tileParams string, tileSessionID protocol.SessionID, ratio float64) (Node, bool)

func MoveLeaf

func MoveLeaf(node Node, leafID, anchorID, splitID string, direction Direction, before bool, ratio float64) (Node, bool)

func Rebalance

func Rebalance(node Node) Node

func Remove

func Remove(node Node, paneID string) (Node, bool)

func SetSplitRatio

func SetSplitRatio(node Node, splitID string, ratio float64) (Node, bool)

func Split

func Split(node Node, targetLeafID, newPaneID, splitID string, direction Direction, ratio float64) (Node, bool)

func UpdateTileParams

func UpdateTileParams(node Node, tileID, tileParams string) (Node, bool)

func UpdateTileSessionID

func UpdateTileSessionID(node Node, tileID string, sessionID protocol.SessionID) (Node, bool)

type RatioMode

type RatioMode string
const (
	RatioModeAutomatic RatioMode = "automatic"
	RatioModePreferred RatioMode = "preferred"
)

type TileKind

type TileKind string
const (
	TileKindMarkdown TileKind = "markdown"
	TileKindBrowser  TileKind = "browser"
	TileKindSeed     TileKind = "seed"
	TileKindNotebook TileKind = "notebook"
)

type TileLeaf

type TileLeaf struct {
	TileID        string
	TileKind      string
	TileParams    string
	TileSessionID protocol.SessionID
}

func TileLeaves

func TileLeaves(node Node) []TileLeaf

type ValidationError

type ValidationError struct {
	Path   string
	Reason string
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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