bubbletree

package module
v0.0.0-...-e724f18 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 6 Imported by: 0

README

bubbletree

A BubbleTea tree bubble with open/close on branches

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocationString

func LocationString(location []int) string

Types

type BubbleTreeModel

type BubbleTreeModel struct {
	KeyMap  KeyMap
	Current []int
	Styles  Styles
	Tree    Tree
	// contains filtered or unexported fields
}

func NewBubbleTreeModel

func NewBubbleTreeModel(t Tree) BubbleTreeModel

func (BubbleTreeModel) Init

func (m BubbleTreeModel) Init() tea.Cmd

func (BubbleTreeModel) Update

func (m BubbleTreeModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (BubbleTreeModel) View

func (m BubbleTreeModel) View() string

type CursorStyle

type CursorStyle int
const (
	Chevron CursorStyle = iota
	Highlight
)

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Open   key.Binding
	Close  key.Binding
	Quit   key.Binding
	Action key.Binding
	Top    key.Binding
	Bottom key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

type SelectedNode

type SelectedNode *Tree

type Styles

type Styles struct {
	Graphics            TreeGraphics
	CursorStyle         CursorStyle
	SelectedHighlight   lipgloss.Style
	UnSelectedHighlight lipgloss.Style
	Lines               lipgloss.Style
}

func DefaultStyles

func DefaultStyles() Styles

type Tree

type Tree struct {
	Title       string // this is what will be displayed in the tree
	Description string // this is what will be displayed when I suss how to get modal messages popping up and they click ? on a node
	Open        bool   // is the node open or closed in the ui
	Children    []Tree // Other nodes in the tree
	Level       int    // probably not needed

	Debug string
	// contains filtered or unexported fields
}

func (*Tree) LastOpenChild

func (t *Tree) LastOpenChild() *Tree

func (Tree) String

func (t Tree) String() string

func (Tree) View

func (t Tree) View(initial int, current []int, style Styles) string

func (*Tree) WalkTree

func (t *Tree) WalkTree(parentLocationId []int)

type TreeGraphics

type TreeGraphics struct {
	VerticalLine   string
	JoinLine       string
	HorizontalLine string
	Chevron        string
	Open           string
	Close          string
}

func DefaultTreeGraphics

func DefaultTreeGraphics() TreeGraphics

Jump to

Keyboard shortcuts

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