panels

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package panels contains JSON TUI panel components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPalette

func ApplyPalette(p tuipanels.Palette)

ApplyPalette updates all panel style variables to match the given palette.

func PrettyNode

func PrettyNode(n *node.Node) string

PrettyNode pretty-prints a node's value for the preview panel.

func StatusBar

func StatusBar(n *node.Node, width int, searchMode bool, searchQuery string, yankFeedback string, version string) string

StatusBar renders the bottom status bar for the JSON TUI.

Types

type LensID

type LensID int

LensID identifies an active lens.

const (
	LensTypeGen LensID = iota + 1
	LensSchema
	LensYAML
	LensMerkle
	LensStats
	LensQuery
)

type LensPanel

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

LensPanel is the bottom-right panel — shows output from the active analysis lens.

func NewLensPanel

func NewLensPanel(root *node.Node, w, h int) LensPanel

NewLensPanel creates a lens panel.

func (*LensPanel) ActiveLens

func (p *LensPanel) ActiveLens() LensID

ActiveLens returns the current lens ID.

func (*LensPanel) HandleKey

func (p *LensPanel) HandleKey(key string) bool

HandleKey processes keypresses when the lens panel is focused. Returns true if a key was consumed.

func (*LensPanel) Resize

func (p *LensPanel) Resize(w, h int)

func (*LensPanel) SetCursorNode

func (p *LensPanel) SetCursorNode(n *node.Node)

func (*LensPanel) SetFocused

func (p *LensPanel) SetFocused(f bool)

func (*LensPanel) View

func (p *LensPanel) View() string

View renders the lens panel.

type PreviewPanel

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

PreviewPanel shows the value of the currently selected tree node.

func NewPreviewPanel

func NewPreviewPanel(w, h int) PreviewPanel

NewPreviewPanel creates a preview panel.

func (*PreviewPanel) HandleKey

func (p *PreviewPanel) HandleKey(key string) bool

HandleKey handles scrolling when this panel is focused.

func (*PreviewPanel) Resize

func (p *PreviewPanel) Resize(w, h int)

func (*PreviewPanel) SetFocused

func (p *PreviewPanel) SetFocused(f bool)

func (*PreviewPanel) SetNode

func (p *PreviewPanel) SetNode(n *node.Node)

SetNode updates the preview to show the given node's value.

func (*PreviewPanel) View

func (p *PreviewPanel) View() string

View returns the rendered preview content.

type TreeNode

type TreeNode struct {
	Node      *node.Node
	Depth     int
	IsLast    bool
	Collapsed bool // only valid for KindObject and KindArray
}

TreeNode is a flattened representation of a node for the tree panel. The flat list is pre-computed on expand/collapse; View() just slices it.

type TreePanel

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

TreePanel is the left panel — a navigable, collapsible JSON tree.

func NewTreePanel

func NewTreePanel(root *node.Node, w, h int) TreePanel

NewTreePanel creates a tree panel from the root node.

func (*TreePanel) CursorNode

func (p *TreePanel) CursorNode() *node.Node

CursorNode returns the currently highlighted node.

func (*TreePanel) Resize

func (p *TreePanel) Resize(w, h int)

func (*TreePanel) SetFocused

func (p *TreePanel) SetFocused(f bool)

func (*TreePanel) SetSearch

func (p *TreePanel) SetSearch(s string)

func (*TreePanel) Update

func (p *TreePanel) Update(msg tea.KeyMsg) (changed bool)

Update handles keystrokes when the tree panel is focused.

func (*TreePanel) View

func (p *TreePanel) View() string

View renders the tree panel content.

type TypeGenSubMode

type TypeGenSubMode int

TypeGenSubMode selects the typegen output language.

const (
	TypeGenGo TypeGenSubMode = iota
	TypeGenTS
	TypeGenJSONSchema
)

Jump to

Keyboard shortcuts

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