Documentation
¶
Overview ¶
Package tui provides a Bubble Tea TUI for browsing Stripe documentation in a scrollable viewport with keyboard and mouse navigation.
Index ¶
- func NewMouseEventFilter() func(tea.Model, tea.Msg) tea.Msg
- type KeyMap
- type Model
- type Option
- func WithClient(c *docs.Client) Option
- func WithKeyMap(km KeyMap) Option
- func WithPage(p Page) Option
- func WithPaletteInput(q string) Option
- func WithRenderer(r markdown.Renderer) Option
- func WithRendererOptions(opts ...markdown.RendererOption) Option
- func WithStyles(s ui.Styles) Option
- func WithWindowSize(width, height int) Option
- type Page
- type Palette
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
Up key.Binding
Down key.Binding
PageUp key.Binding
PageDown key.Binding
Help key.Binding
Palette key.Binding
Search key.Binding
Reference key.Binding
OpenInBrowser key.Binding
Enter key.Binding
}
KeyMap defines the keybindings for the TUI.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
DefaultKeyMap returns the default set of keybindings.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the top-level Bubble Tea model for the docs TUI.
func (*Model) WithOptions ¶
WithOptions applies the given options to the Model.
type Option ¶
type Option func(*Model)
Option configures a Model.
func WithClient ¶
WithClient sets the docs client used to fetch pages.
func WithPage ¶
WithPage sets the page to display. The TUI parses the markdown content internally and derives the title from the first h1 heading.
func WithPaletteInput ¶
WithPaletteInput opens the command palette on startup with the given text pre-filled. Useful for launching the TUI from a search subcommand so the user lands directly in the search palette.
func WithRenderer ¶
WithRenderer sets the markdown renderer.
func WithRendererOptions ¶
func WithRendererOptions(opts ...markdown.RendererOption) Option
WithRendererOptions sets the options used to build the markdown renderer. The TUI rebuilds the renderer on each window resize, capping word wrap at maxWordWrap or the terminal width, whichever is smaller.
func WithWindowSize ¶
WithWindowSize pre-seeds the terminal dimensions so the viewport can be initialized in New() without waiting for the first tea.WindowSizeMsg.
type Page ¶
Page holds the raw content and metadata needed by the TUI to display a documentation page. Callers construct a Page from a fetched docs response and pass it via WithPage.
type Palette ¶
Palette wraps the foam palette model with visibility state and overlay rendering.
func (*Palette) Dismiss ¶
func (p *Palette) Dismiss()
Dismiss hides the palette and resets its state.