Documentation
¶
Index ¶
- type CollapseToggleMsg
- type Focusable
- type KeyCapturer
- type MinimalTopNav
- func (m *MinimalTopNav) Dock() Side
- func (m *MinimalTopNav) GetActiveIndex() int
- func (m *MinimalTopNav) GetPages() []Page
- func (m *MinimalTopNav) Height() int
- func (m *MinimalTopNav) Init() tea.Cmd
- func (m *MinimalTopNav) SetActiveIndex(i int)
- func (m *MinimalTopNav) SetPages(p []Page)
- func (m *MinimalTopNav) SetShowNumbers(show bool)
- func (m *MinimalTopNav) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *MinimalTopNav) View() tea.View
- func (m *MinimalTopNav) Width() int
- type NavFocusMsg
- type NavKeyMap
- type Navigator
- type NumberLabeled
- type Page
- type SelectedMsg
- type Side
- type Sidebar
- func (m *Sidebar) Dock() Side
- func (m *Sidebar) GetActiveIndex() int
- func (m *Sidebar) GetPages() []Page
- func (m *Sidebar) Height() int
- func (m *Sidebar) Init() tea.Cmd
- func (m *Sidebar) SetActiveIndex(i int)
- func (m *Sidebar) SetFocused(f bool)
- func (m *Sidebar) SetPages(p []Page)
- func (m *Sidebar) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Sidebar) View() tea.View
- func (m *Sidebar) Width() int
- type TabHoverMsg
- type Tabs
- func (m *Tabs) Dock() Side
- func (m *Tabs) GetActiveIndex() int
- func (m *Tabs) GetPages() []Page
- func (m *Tabs) Height() int
- func (m *Tabs) Init() tea.Cmd
- func (m *Tabs) SetActiveIndex(i int)
- func (m *Tabs) SetPages(p []Page)
- func (m *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Tabs) View() tea.View
- func (m *Tabs) Width() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollapseToggleMsg ¶
type CollapseToggleMsg struct{}
CollapseToggleMsg is emitted when the user clicks the collapse/expand handle at the top of the sidebar. The router forwards it to the nav's Update so the sidebar can toggle its own collapsed state, then triggers a layout resize.
type Focusable ¶ added in v0.1.2
type Focusable interface {
SetFocused(bool)
}
Focusable is implemented by navigators that support keyboard focus (the sidebar). Navigators with no focus concept (tabs) omit it; the router uses a capability check rather than a concrete-type assertion to drive focus.
type KeyCapturer ¶
type KeyCapturer interface {
CapturesKeys() bool
}
KeyCapturer can be implemented by page models that need exclusive keyboard focus. When CapturesKeys returns true the router will bypass its own global key shortcuts (quit, page-cycling) and will not forward key events to the navigation component, ensuring every keystroke reaches the active page.
type MinimalTopNav ¶ added in v0.1.9
type MinimalTopNav struct {
// contains filtered or unexported fields
}
MinimalTopNav is a compact top-docked navigator styled like the inspector's tab line: a single horizontal row of labels, the active one highlighted, with no borders. A leading per-tab number ("1:", "2:", …) is optional and defaults to hidden. The number keys 1–9 select a tab directly only when the user has enabled "Number Key Select" in Settings (off by default); the router maps the digits for top-docked navs independently of whether the prefix is shown.
func NewMinimalTopNav ¶ added in v0.1.9
func NewMinimalTopNav() *MinimalTopNav
NewMinimalTopNav returns a minimal top nav with the default page set and the number prefixes hidden.
func (*MinimalTopNav) Dock ¶ added in v0.1.9
func (m *MinimalTopNav) Dock() Side
func (*MinimalTopNav) GetActiveIndex ¶ added in v0.1.9
func (m *MinimalTopNav) GetActiveIndex() int
func (*MinimalTopNav) GetPages ¶ added in v0.1.9
func (m *MinimalTopNav) GetPages() []Page
func (*MinimalTopNav) Height ¶ added in v0.1.9
func (m *MinimalTopNav) Height() int
func (*MinimalTopNav) Init ¶ added in v0.1.9
func (m *MinimalTopNav) Init() tea.Cmd
func (*MinimalTopNav) SetActiveIndex ¶ added in v0.1.9
func (m *MinimalTopNav) SetActiveIndex(i int)
func (*MinimalTopNav) SetPages ¶ added in v0.1.9
func (m *MinimalTopNav) SetPages(p []Page)
func (*MinimalTopNav) SetShowNumbers ¶ added in v0.1.9
func (m *MinimalTopNav) SetShowNumbers(show bool)
SetShowNumbers toggles the leading per-tab number prefix.
func (*MinimalTopNav) View ¶ added in v0.1.9
func (m *MinimalTopNav) View() tea.View
func (*MinimalTopNav) Width ¶ added in v0.1.9
func (m *MinimalTopNav) Width() int
Width reports the horizontal layout space consumed; a top nav stacks above content and reserves no side width.
type NavFocusMsg ¶
NavFocusMsg signals that the sidebar has gained or lost keyboard focus. The sidebar emits NavFocusMsg{Focused: true} when clicked and NavFocusMsg{Focused: false} when Esc is pressed inside it. The router emits NavFocusMsg{Focused: false} when the page-content area is clicked so the sidebar's visual focus indicator is updated.
type NavKeyMap ¶
type NavKeyMap struct {
}
NavKeyMap defines key bindings used when the sidebar has keyboard focus.
func DefaultNavKeyMap ¶
func DefaultNavKeyMap() NavKeyMap
DefaultNavKeyMap returns the default key bindings for sidebar navigation.
type Navigator ¶
type Navigator interface {
// Dock reports which edge the navigator occupies, letting the router lay it
// out and route input without type-asserting concrete navigator types.
}
type NumberLabeled ¶ added in v0.1.9
type NumberLabeled interface {
SetShowNumbers(bool)
}
NumberLabeled is implemented by navigators that can optionally show a leading per-item number prefix (the minimal top nav). The router applies the user's preference via this capability without asserting a concrete type.
type SelectedMsg ¶
type SelectedMsg struct {
PageIndex int
}
SelectedMsg is emitted when a navigation item is selected (via click or key).
type Side ¶ added in v0.1.2
type Side int
Side indicates where a navigation component docks relative to the page content.
type Sidebar ¶
type Sidebar struct {
// Pages is the full page list (Settings last when present).
Pages []Page
// ActiveIndex is the globally active page index (mirrors the router).
ActiveIndex int
page.Base
// contains filtered or unexported fields
}
Sidebar is a panel-style Navigator backed by a bubbles/list for the main navigation items, with the Settings page pinned to the very bottom.
func New ¶
func New() *Sidebar
New creates a Sidebar with the standard Home / Inspector / Settings pages.
func (*Sidebar) GetActiveIndex ¶
func (*Sidebar) SetActiveIndex ¶
func (*Sidebar) SetFocused ¶
SetFocused lets the router update the sidebar's visual focus state without going through the message loop (e.g. when Tab cycles pages).
type TabHoverMsg ¶
type TabHoverMsg struct{ Index int }
TabHoverMsg reports that the mouse is over a tab index (or -1 for none).