Documentation
¶
Index ¶
- type BackMsg
- type Config
- type DetailsRenderer
- type DrillDownMsg
- type FooterRenderer
- type HeaderRenderer
- type Item
- type ItemExpandedMsg
- type ItemSelectedMsg
- type ItemsUpdatedMsg
- type Model
- func (m *Model) AddItem(item Item)
- func (m Model) Config() Config
- func (m Model) FocusedPane() PaneType
- func (m Model) Height() int
- func (m Model) Init() tea.Cmd
- func (m Model) IsExpanded(id string) bool
- func (m Model) IsInDrillDown() bool
- func (m Model) Items() []Item
- func (m Model) LeftPaneWidth() int
- func (m Model) NavigationPath() []string
- func (m Model) NavigationStack() []NavigationFrame
- func (m *Model) RefreshViewports()
- func (m *Model) RemoveItemByID(id string) bool
- func (m Model) RightPaneWidth() int
- func (m Model) RootItems() []Item
- func (m Model) SelectedID() string
- func (m Model) SelectedIndex() int
- func (m Model) SelectedItem() Item
- func (m *Model) SetItems(items []Item)
- func (m Model) Styles() *styles.Styles
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m *Model) UpdateItemByID(id string, newItem Item) bool
- func (m *Model) UpdateItems(items []Item)
- func (m Model) View() string
- func (m Model) Width() int
- type NavigationFrame
- type PaneType
- type QuitMsg
- type Section
- type SectionGrouper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Required
Styles *styles.Styles
DetailsRenderer DetailsRenderer
// Optional: title shown in the left pane header (default: none)
Title string
// Optional with defaults
LeftPaneRatio float64 // Default: 0.4
MaxExpandDepth int // Default: 2
SectionGrouper SectionGrouper // Default: no sections
HeaderRenderer HeaderRenderer // Default: standard header with title and breadcrumb
// Section names (if using default grouper)
// e.g., {"resource": "Resources"}
SectionNames map[string]string
}
Config configures the split-pane model.
type DetailsRenderer ¶
type DetailsRenderer interface {
RenderDetails(item Item, width int, styles *styles.Styles) string
}
DetailsRenderer renders the right pane content for a selected item. Consumers implement this for domain-specific detail views.
type DrillDownMsg ¶
type DrillDownMsg struct {
Item Item
}
DrillDownMsg is sent when drilling into an item
type FooterRenderer ¶
type FooterRenderer interface {
}
FooterRenderer renders custom footer content. Optional - if nil, uses default keyboard hints footer.
type HeaderRenderer ¶
HeaderRenderer customizes the left pane header. Optional - if nil, uses default header with title and breadcrumb.
type Item ¶
type Item interface {
// GetID provides a unique identifier that is primarily
// used for expansion tracking in the split pane
GetID() string
// GetName provides a human-readable name for the item
GetName() string
// GetIcon provides a status icon (styled when not selected)
GetIcon(selected bool) string
// GetAction provides action badge text (e.g "CREATE", "UPDATE", etc.)
GetAction() string
// GetDepth provides the nesting depth for indentation
GetDepth() int
// GetParentID returns the parent item ID (empty for top-level items)
GetParentID() string
// GetItemType returns the type for section grouping (e.g., "resource", "child")
GetItemType() string
// IsExpandable indicates whether the item can be expanded in-place
IsExpandable() bool
// CanDrillDown indicates whether the item can be drilled into for detailed view
CanDrillDown() bool
// GetChildren provides a list of child items
// displayed when the current item is expanded
GetChildren() []Item
}
Item represents a selectable item in the left pane. Consumers implement this interface for their domain-specific items.
type ItemExpandedMsg ¶
ItemExpandedMsg is sent when an item is expanded/collapsed
type ItemSelectedMsg ¶
type ItemSelectedMsg struct {
Item Item
}
ItemSelectedMsg is sent when the selected item changes
type ItemsUpdatedMsg ¶
type ItemsUpdatedMsg struct{}
ItemsUpdatedMsg can be sent to trigger a viewport refresh when items have been modified externally
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is a Bubble Tea model for a two-pane split view. Left pane shows a navigable list; right pane shows details.
func (*Model) AddItem ¶
AddItem adds an item to the end of the root items list. If currently in drill-down, the item is added to root but the view refreshes appropriately.
func (Model) FocusedPane ¶
FocusedPane returns which pane currently has focus.
func (Model) IsExpanded ¶
IsExpanded returns true if the item with the given ID is expanded.
func (Model) IsInDrillDown ¶
IsInDrillDown returns true if currently viewing a drilled-down item.
func (Model) LeftPaneWidth ¶
LeftPaneWidth returns the left pane width.
func (Model) NavigationPath ¶
NavigationPath returns the breadcrumb path as a slice of names.
func (Model) NavigationStack ¶
func (m Model) NavigationStack() []NavigationFrame
NavigationStack returns the navigation stack for drill-down.
func (*Model) RefreshViewports ¶ added in v0.1.3
func (m *Model) RefreshViewports()
RefreshViewports forces a re-render of both viewport contents. Use this when item data has changed but items themselves haven't been replaced, or when you need to ensure the displayed content is up-to-date.
func (*Model) RemoveItemByID ¶
RemoveItemByID removes an item by ID from root items. Returns true if the item was found and removed.
func (Model) RightPaneWidth ¶
RightPaneWidth returns the right pane width.
func (Model) SelectedID ¶
SelectedID returns the ID of the currently selected item.
func (Model) SelectedIndex ¶
SelectedIndex returns the currently selected index.
func (Model) SelectedItem ¶
SelectedItem returns the currently selected item, or nil if none. Uses ID-based lookup to ensure the correct item is returned even after updates.
func (*Model) SetItems ¶
SetItems sets the items to display, resetting all state. Use UpdateItems() instead if you want to preserve selection and expansion state.
func (*Model) UpdateItemByID ¶
UpdateItemByID replaces an item by ID in both root and current items. Returns true if the item was found and updated.
func (*Model) UpdateItems ¶
UpdateItems replaces items while preserving user state where possible. - Preserves selection if the selected item still exists (by ID) - Preserves expansion state for items that still exist - Properly handles drill-down mode by refreshing children from updated parent
type NavigationFrame ¶
NavigationFrame represents a frame in the drill-down navigation stack