Documentation
¶
Index ¶
- Variables
- func CloseAllDialogs() tea.Cmd
- func CloseDialog(dialogID string) tea.Cmd
- func CloseTopDialog() tea.Cmd
- func NewConfirmDialogWithConfig(config ConfirmDialogConfig, modalConfig ModalConfig) (*ConfirmDialog, ModalConfig)
- func OpenDialog(dialog Dialog) tea.Cmd
- func OpenModalWithConfig(dialog Dialog, config ModalConfig) tea.Cmd
- func RenderBackdrop(width, height int) string
- func RenderDialogBox(content string, width int) string
- func SendDialogResult(dialogID string, result interface{}, err error) tea.Cmd
- type AnimationConfig
- type BackdropRenderer
- func (b *BackdropRenderer) Disable()
- func (b *BackdropRenderer) Enable()
- func (b *BackdropRenderer) GetOpacity() float64
- func (b *BackdropRenderer) GetStyle() BackdropStyle
- func (b *BackdropRenderer) IsEnabled() bool
- func (b *BackdropRenderer) Render() string
- func (b *BackdropRenderer) SetOpacity(opacity float64)
- func (b *BackdropRenderer) SetSize(width, height int)
- func (b *BackdropRenderer) SetStyle(style BackdropStyle)
- type BackdropStyle
- type CloseAllDialogsMsg
- type CloseDialogMsg
- type CommandPaletteMsg
- type ConfirmDialog
- func (d *ConfirmDialog) GetResult() *bool
- func (d *ConfirmDialog) ID() string
- func (d *ConfirmDialog) Init() tea.Cmd
- func (d *ConfirmDialog) IsClosing() bool
- func (d *ConfirmDialog) Result() interface{}
- func (d *ConfirmDialog) SetSize(width, height int)
- func (d *ConfirmDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (d *ConfirmDialog) View() string
- type ConfirmDialogConfig
- type Dialog
- type DialogManager
- func (dm *DialogManager) Clear()
- func (dm *DialogManager) CloseByID(id string) tea.Cmd
- func (dm *DialogManager) CloseTop() tea.Cmd
- func (dm *DialogManager) DisableFocusTrap() tea.Cmd
- func (dm *DialogManager) EnableFocusTrap() tea.Cmd
- func (dm *DialogManager) GetCount() int
- func (dm *DialogManager) GetFocusTrap() *FocusTrap
- func (dm *DialogManager) GetShortcutManager() *ShortcutManager
- func (dm *DialogManager) GetTop() Dialog
- func (dm *DialogManager) GetTopModal() *Modal
- func (dm *DialogManager) HasDialogs() bool
- func (dm *DialogManager) OpenModal(dialog Dialog, config ModalConfig) tea.Cmd
- func (dm *DialogManager) RegisterShortcut(key string, handler func() tea.Msg)
- func (dm *DialogManager) SetSize(width, height int)
- func (dm *DialogManager) SetZIndex(id string, zIndex int) tea.Cmd
- func (dm *DialogManager) Update(msg tea.Msg) tea.Cmd
- func (dm *DialogManager) View() string
- type DialogResultMsg
- type FilePickerMsg
- type FocusTrap
- func (f *FocusTrap) Activate()
- func (f *FocusTrap) AddFocusableElement(id string)
- func (f *FocusTrap) ClearFocusableElements()
- func (f *FocusTrap) Deactivate()
- func (f *FocusTrap) Disable()
- func (f *FocusTrap) Enable()
- func (f *FocusTrap) FocusFirst() string
- func (f *FocusTrap) FocusLast() string
- func (f *FocusTrap) GetCurrentFocusID() string
- func (f *FocusTrap) GetCurrentFocusIndex() int
- func (f *FocusTrap) GetFocusableCount() int
- func (f *FocusTrap) GetFocusableElements() []string
- func (f *FocusTrap) HandleKey(key string) (handled bool, nextFocus string)
- func (f *FocusTrap) HandleMessage(msg tea.Msg) (handled bool, nextFocus string, cmd tea.Cmd)
- func (f *FocusTrap) HasFocusableElements() bool
- func (f *FocusTrap) IsActive() bool
- func (f *FocusTrap) IsEnabled() bool
- func (f *FocusTrap) NextFocusable() string
- func (f *FocusTrap) PrevFocusable() string
- func (f *FocusTrap) RemoveFocusableElement(id string)
- func (f *FocusTrap) Reset()
- func (f *FocusTrap) SetCurrentFocusIndex(index int)
- func (f *FocusTrap) SetFocusableElements(ids []string)
- type HelpMsg
- type InputDialog
- func (d *InputDialog) GetResult() *string
- func (d *InputDialog) ID() string
- func (d *InputDialog) Init() tea.Cmd
- func (d *InputDialog) IsClosing() bool
- func (d *InputDialog) Result() interface{}
- func (d *InputDialog) SetSize(width, height int)
- func (d *InputDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (d *InputDialog) View() string
- type InputDialogConfig
- type Modal
- func (m *Modal) CalculatePosition(containerWidth, containerHeight int)
- func (m *Modal) GetConfig() ModalConfig
- func (m *Modal) GetDialog() Dialog
- func (m *Modal) GetPosition() (int, int)
- func (m *Modal) GetZIndex() int
- func (m *Modal) HasFocusTrap() bool
- func (m *Modal) ID() string
- func (m *Modal) Init() tea.Cmd
- func (m *Modal) IsClosing() bool
- func (m *Modal) IsFocused() bool
- func (m *Modal) IsVisible() bool
- func (m *Modal) Result() interface{}
- func (m *Modal) SetFocused(focused bool)
- func (m *Modal) SetPosition(x, y int)
- func (m *Modal) SetSize(width, height int)
- func (m *Modal) SetVisible(visible bool)
- func (m *Modal) SetZIndex(zIndex int)
- func (m *Modal) ShouldCloseOnBackdrop() bool
- func (m *Modal) ShouldCloseOnEsc() bool
- func (m *Modal) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Modal) View() string
- type ModalConfig
- type OpenDialogMsg
- type OpenModalMsg
- type SearchMsg
- type SelectDialog
- func (d *SelectDialog) GetResult() *string
- func (d *SelectDialog) GetSelectedOption() *SelectOption
- func (d *SelectDialog) ID() string
- func (d *SelectDialog) Init() tea.Cmd
- func (d *SelectDialog) IsClosing() bool
- func (d *SelectDialog) Result() interface{}
- func (d *SelectDialog) SetSize(width, height int)
- func (d *SelectDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (d *SelectDialog) View() string
- type SelectDialogConfig
- type SelectOption
- type SettingsMsg
- type ShortcutHandler
- type ShortcutInfo
- type ShortcutManager
- func (s *ShortcutManager) ClearShortcuts()
- func (s *ShortcutManager) Disable()
- func (s *ShortcutManager) Enable()
- func (s *ShortcutManager) GetAllShortcuts() map[string]ShortcutHandler
- func (s *ShortcutManager) GetShortcut(key string) ShortcutHandler
- func (s *ShortcutManager) GetShortcutCount() int
- func (s *ShortcutManager) GetShortcutKeys() []string
- func (s *ShortcutManager) HandleKey(key string) (bool, tea.Cmd)
- func (s *ShortcutManager) HandleMessage(msg tea.Msg) (bool, tea.Cmd)
- func (s *ShortcutManager) HasShortcut(key string) bool
- func (s *ShortcutManager) IsEnabled() bool
- func (s *ShortcutManager) RegisterCommandPalette(handler ShortcutHandler)
- func (s *ShortcutManager) RegisterCommonShortcuts()
- func (s *ShortcutManager) RegisterFilePicker(handler ShortcutHandler)
- func (s *ShortcutManager) RegisterHelp(handler ShortcutHandler)
- func (s *ShortcutManager) RegisterSearch(handler ShortcutHandler)
- func (s *ShortcutManager) RegisterSettings(handler ShortcutHandler)
- func (s *ShortcutManager) RegisterShortcut(key string, handler ShortcutHandler)
- func (s *ShortcutManager) Toggle()
- func (s *ShortcutManager) UnregisterShortcut(key string)
Constants ¶
This section is empty.
Variables ¶
var ( // DarkBackdrop is a dark semi-transparent backdrop (60% opacity) DarkBackdrop = BackdropStyle{ Enabled: true, Opacity: 0.6, Color: lipgloss.Color("#000000"), BlurChars: "", } // LightBackdrop is a light semi-transparent backdrop (40% opacity) LightBackdrop = BackdropStyle{ Enabled: true, Opacity: 0.4, Color: lipgloss.Color("#FFFFFF"), BlurChars: "", } // BlurBackdrop is a backdrop with blur effect (70% opacity) BlurBackdrop = BackdropStyle{ Enabled: true, Opacity: 0.7, Color: lipgloss.Color("#000000"), BlurChars: "░▒▓", } // NoBackdrop is an invisible backdrop (disabled) NoBackdrop = BackdropStyle{ Enabled: false, Opacity: 0.0, Color: lipgloss.Color("#000000"), BlurChars: "", } // PurpleBackdrop is a purple-tinted backdrop matching AINative branding PurpleBackdrop = BackdropStyle{ Enabled: true, Opacity: 0.5, Color: lipgloss.Color("#8B5CF6"), BlurChars: "", } // HeavyBlurBackdrop is a heavily blurred backdrop (80% opacity) HeavyBlurBackdrop = BackdropStyle{ Enabled: true, Opacity: 0.8, Color: lipgloss.Color("#000000"), BlurChars: "░░▒▒▓▓", } )
Pre-defined backdrop styles
var ( // Dialog container styles DialogContainerStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("#8B5CF6")). Padding(1, 2). Background(lipgloss.Color("#1A1A2E")). Foreground(lipgloss.Color("#E0E0E0")) // Light text // Dialog title styles DialogTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#8B5CF6")). Align(lipgloss.Center). Width(40) // Dialog description styles DialogDescriptionStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#B0B0B0")). Align(lipgloss.Left). MarginTop(1). MarginBottom(1) // Button styles ButtonActiveStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(lipgloss.Color("#8B5CF6")). Padding(0, 2). Margin(0, 1) ButtonInactiveStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#808080")). Background(lipgloss.Color("#2A2A3E")). Padding(0, 2). Margin(0, 1) // Input field styles InputFieldStyle = lipgloss.NewStyle(). Border(lipgloss.NormalBorder()). BorderForeground(lipgloss.Color("#8B5CF6")). Padding(0, 1). Width(36) InputFieldFocusedStyle = lipgloss.NewStyle(). Border(lipgloss.NormalBorder()). BorderForeground(lipgloss.Color("#A78BFA")). Padding(0, 1). Width(36) // List item styles for SelectDialog ListItemStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#E0E0E0")). Padding(0, 2) ListItemSelectedStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(lipgloss.Color("#8B5CF6")). Padding(0, 2) ListItemHoverStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#A78BFA")). Padding(0, 2) // Error message styles ErrorTextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#EF4444")). Bold(true). MarginTop(1) // Help text styles HelpTextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#6B7280")). Italic(true). MarginTop(1). Align(lipgloss.Center) // Success message styles SuccessTextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#10B981")). Bold(true) // Warning message styles WarningTextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#F59E0B")). Bold(true) )
Dialog styles following AINative branding
Functions ¶
func CloseAllDialogs ¶
CloseAllDialogs creates a command to close all dialogs
func CloseDialog ¶
CloseDialog creates a command to close a dialog
func CloseTopDialog ¶
CloseTopDialog creates a command to close the top dialog
func NewConfirmDialogWithConfig ¶
func NewConfirmDialogWithConfig(config ConfirmDialogConfig, modalConfig ModalConfig) (*ConfirmDialog, ModalConfig)
NewConfirmDialogWithConfig creates a confirm dialog with custom modal configuration
func OpenDialog ¶
OpenDialog creates a command to open a dialog
func OpenModalWithConfig ¶
func OpenModalWithConfig(dialog Dialog, config ModalConfig) tea.Cmd
OpenModalWithConfig creates a command to open a modal with configuration
func RenderBackdrop ¶
RenderBackdrop creates a semi-transparent backdrop (deprecated - use BackdropRenderer)
func RenderDialogBox ¶
RenderDialogBox renders a dialog box at the center
Types ¶
type AnimationConfig ¶
type AnimationConfig struct {
FadeIn bool // Enable fade-in effect
FadeOut bool // Enable fade-out effect
Duration int // Animation duration in milliseconds
InitialAlpha float64 // Initial opacity (0.0 - 1.0)
FinalAlpha float64 // Final opacity (0.0 - 1.0)
}
AnimationConfig defines animation behavior for modals
type BackdropRenderer ¶
type BackdropRenderer struct {
// contains filtered or unexported fields
}
BackdropRenderer creates semi-transparent overlays
func NewBackdropRenderer ¶
func NewBackdropRenderer(width, height int, style BackdropStyle) *BackdropRenderer
NewBackdropRenderer creates a new backdrop renderer
func (*BackdropRenderer) Disable ¶
func (b *BackdropRenderer) Disable()
Disable disables the backdrop
func (*BackdropRenderer) GetOpacity ¶
func (b *BackdropRenderer) GetOpacity() float64
GetOpacity returns the current backdrop opacity
func (*BackdropRenderer) GetStyle ¶
func (b *BackdropRenderer) GetStyle() BackdropStyle
GetStyle returns the current backdrop style
func (*BackdropRenderer) IsEnabled ¶
func (b *BackdropRenderer) IsEnabled() bool
IsEnabled returns true if the backdrop is enabled
func (*BackdropRenderer) Render ¶
func (b *BackdropRenderer) Render() string
Render creates the backdrop overlay
func (*BackdropRenderer) SetOpacity ¶
func (b *BackdropRenderer) SetOpacity(opacity float64)
SetOpacity updates the backdrop opacity
func (*BackdropRenderer) SetSize ¶
func (b *BackdropRenderer) SetSize(width, height int)
SetSize updates the backdrop dimensions
func (*BackdropRenderer) SetStyle ¶
func (b *BackdropRenderer) SetStyle(style BackdropStyle)
SetStyle updates the backdrop style
type BackdropStyle ¶
type BackdropStyle struct {
Enabled bool // Whether backdrop is enabled
Opacity float64 // Opacity level (0.0 - 1.0)
Color lipgloss.Color // Backdrop color
BlurChars string // Characters to use for blur effect (e.g., "░▒▓")
}
BackdropStyle defines backdrop appearance and behavior
type CloseAllDialogsMsg ¶
type CloseAllDialogsMsg struct{}
CloseAllDialogsMsg signals to close all dialogs
type CloseDialogMsg ¶
type CloseDialogMsg struct {
// DialogID is optional - if empty, closes the top dialog
DialogID string
}
CloseDialogMsg signals to close the top dialog
type CommandPaletteMsg ¶
type CommandPaletteMsg struct{}
CommandPaletteMsg signals to open the command palette
type ConfirmDialog ¶
type ConfirmDialog struct {
// contains filtered or unexported fields
}
ConfirmDialog represents a Yes/No confirmation dialog
func NewConfirmDialog ¶
func NewConfirmDialog(config ConfirmDialogConfig) *ConfirmDialog
NewConfirmDialog creates a new confirm dialog
func (*ConfirmDialog) GetResult ¶
func (d *ConfirmDialog) GetResult() *bool
GetResult returns the boolean result (convenience method)
func (*ConfirmDialog) IsClosing ¶
func (d *ConfirmDialog) IsClosing() bool
IsClosing returns true if the dialog is requesting to be closed
func (*ConfirmDialog) Result ¶
func (d *ConfirmDialog) Result() interface{}
Result returns the dialog result
func (*ConfirmDialog) SetSize ¶
func (d *ConfirmDialog) SetSize(width, height int)
SetSize updates the dialog dimensions
type ConfirmDialogConfig ¶
type ConfirmDialogConfig struct {
ID string
Title string
Description string
YesLabel string // Default: "Yes"
NoLabel string // Default: "No"
DefaultYes bool // Default: false (No is selected)
}
ConfirmDialogConfig contains configuration for a confirm dialog
type Dialog ¶
type Dialog interface {
tea.Model
// ID returns a unique identifier for this dialog
ID() string
// SetSize updates the dialog dimensions
SetSize(width, height int)
// IsClosing returns true if the dialog is requesting to be closed
IsClosing() bool
// Result returns the dialog result (if any)
Result() interface{}
}
Dialog represents the interface that all dialogs must implement
type DialogManager ¶
type DialogManager struct {
// contains filtered or unexported fields
}
DialogManager manages a stack of modals with advanced features
func NewDialogManager ¶
func NewDialogManager() *DialogManager
NewDialogManager creates a new dialog manager
func (*DialogManager) Clear ¶
func (dm *DialogManager) Clear()
Clear removes all modals from the stack
func (*DialogManager) CloseByID ¶
func (dm *DialogManager) CloseByID(id string) tea.Cmd
CloseByID closes a specific modal by ID
func (*DialogManager) CloseTop ¶
func (dm *DialogManager) CloseTop() tea.Cmd
CloseTop closes the top modal and returns its result
func (*DialogManager) DisableFocusTrap ¶
func (dm *DialogManager) DisableFocusTrap() tea.Cmd
DisableFocusTrap disables focus trapping
func (*DialogManager) EnableFocusTrap ¶
func (dm *DialogManager) EnableFocusTrap() tea.Cmd
EnableFocusTrap enables focus trapping
func (*DialogManager) GetCount ¶
func (dm *DialogManager) GetCount() int
GetCount returns the number of dialogs in the stack
func (*DialogManager) GetFocusTrap ¶
func (dm *DialogManager) GetFocusTrap() *FocusTrap
GetFocusTrap returns the focus trap
func (*DialogManager) GetShortcutManager ¶
func (dm *DialogManager) GetShortcutManager() *ShortcutManager
GetShortcutManager returns the shortcut manager
func (*DialogManager) GetTop ¶
func (dm *DialogManager) GetTop() Dialog
GetTop returns the top dialog, or nil if stack is empty
func (*DialogManager) GetTopModal ¶
func (dm *DialogManager) GetTopModal() *Modal
GetTopModal returns the top modal, or nil if stack is empty
func (*DialogManager) HasDialogs ¶
func (dm *DialogManager) HasDialogs() bool
HasDialogs returns true if there are any dialogs open
func (*DialogManager) OpenModal ¶
func (dm *DialogManager) OpenModal(dialog Dialog, config ModalConfig) tea.Cmd
OpenModal opens a modal with the specified configuration
func (*DialogManager) RegisterShortcut ¶
func (dm *DialogManager) RegisterShortcut(key string, handler func() tea.Msg)
RegisterShortcut registers a global keyboard shortcut
func (*DialogManager) SetSize ¶
func (dm *DialogManager) SetSize(width, height int)
SetSize updates the manager dimensions
func (*DialogManager) SetZIndex ¶
func (dm *DialogManager) SetZIndex(id string, zIndex int) tea.Cmd
SetZIndex sets the z-index for a specific modal
func (*DialogManager) Update ¶
func (dm *DialogManager) Update(msg tea.Msg) tea.Cmd
Update handles dialog-related messages
func (*DialogManager) View ¶
func (dm *DialogManager) View() string
View renders all modals as layers
type DialogResultMsg ¶
DialogResultMsg is sent when a dialog completes with a result
type FocusTrap ¶
type FocusTrap struct {
// contains filtered or unexported fields
}
FocusTrap manages focus within modal boundaries It prevents Tab/Shift+Tab from leaving the modal
func (*FocusTrap) AddFocusableElement ¶
AddFocusableElement adds a focusable element ID
func (*FocusTrap) ClearFocusableElements ¶
func (f *FocusTrap) ClearFocusableElements()
ClearFocusableElements clears all focusable elements
func (*FocusTrap) Deactivate ¶
func (f *FocusTrap) Deactivate()
Deactivate deactivates the focus trap
func (*FocusTrap) FocusFirst ¶
FocusFirst sets focus to the first focusable element
func (*FocusTrap) GetCurrentFocusID ¶
GetCurrentFocusID returns the ID of the currently focused element
func (*FocusTrap) GetCurrentFocusIndex ¶
GetCurrentFocusIndex returns the current focus index
func (*FocusTrap) GetFocusableCount ¶
GetFocusableCount returns the number of focusable elements
func (*FocusTrap) GetFocusableElements ¶
GetFocusableElements returns the list of focusable element IDs
func (*FocusTrap) HandleKey ¶
HandleKey handles keyboard navigation within the focus trap Returns (handled, nextFocusID)
func (*FocusTrap) HandleMessage ¶
HandleMessage handles Bubble Tea messages for focus navigation
func (*FocusTrap) HasFocusableElements ¶
HasFocusableElements returns true if there are any focusable elements
func (*FocusTrap) NextFocusable ¶
NextFocusable returns the ID of the next focusable element
func (*FocusTrap) PrevFocusable ¶
PrevFocusable returns the ID of the previous focusable element
func (*FocusTrap) RemoveFocusableElement ¶
RemoveFocusableElement removes a focusable element ID
func (*FocusTrap) Reset ¶
func (f *FocusTrap) Reset()
Reset resets the focus trap to its initial state
func (*FocusTrap) SetCurrentFocusIndex ¶
SetCurrentFocusIndex sets the current focus index
func (*FocusTrap) SetFocusableElements ¶
SetFocusableElements sets the list of focusable element IDs
type InputDialog ¶
type InputDialog struct {
// contains filtered or unexported fields
}
InputDialog represents a text input dialog with validation
func NewInputDialog ¶
func NewInputDialog(config InputDialogConfig) *InputDialog
NewInputDialog creates a new input dialog
func (*InputDialog) GetResult ¶
func (d *InputDialog) GetResult() *string
GetResult returns the string result (convenience method)
func (*InputDialog) IsClosing ¶
func (d *InputDialog) IsClosing() bool
IsClosing returns true if the dialog is requesting to be closed
func (*InputDialog) Result ¶
func (d *InputDialog) Result() interface{}
Result returns the dialog result
func (*InputDialog) SetSize ¶
func (d *InputDialog) SetSize(width, height int)
SetSize updates the dialog dimensions
type InputDialogConfig ¶
type InputDialogConfig struct {
ID string
Title string
Description string
Placeholder string
DefaultValue string
Validator func(string) error // Optional validation function
}
InputDialogConfig contains configuration for an input dialog
type Modal ¶
type Modal struct {
// contains filtered or unexported fields
}
Modal wraps a Dialog with advanced modal features
func NewModal ¶
func NewModal(dialog Dialog, config ModalConfig) *Modal
NewModal creates a new modal wrapper around a dialog
func (*Modal) CalculatePosition ¶
CalculatePosition calculates the centered position for the modal
func (*Modal) GetConfig ¶
func (m *Modal) GetConfig() ModalConfig
GetConfig returns the modal configuration
func (*Modal) GetPosition ¶
GetPosition returns the modal's position
func (*Modal) HasFocusTrap ¶
HasFocusTrap returns true if focus should be trapped in this modal
func (*Modal) SetFocused ¶
SetFocused controls modal focus state
func (*Modal) SetPosition ¶
SetPosition sets the modal's position
func (*Modal) SetVisible ¶
SetVisible controls modal visibility
func (*Modal) ShouldCloseOnBackdrop ¶
ShouldCloseOnBackdrop returns true if clicking backdrop should close this modal
func (*Modal) ShouldCloseOnEsc ¶
ShouldCloseOnEsc returns true if ESC should close this modal
type ModalConfig ¶
type ModalConfig struct {
ZIndex int // Z-index for layering (default: auto-increment)
Backdrop BackdropStyle // Backdrop appearance
CloseOnEsc bool // Allow ESC key to close (default: true)
CloseOnBackdrop bool // Allow clicking backdrop to close (default: false)
TrapFocus bool // Trap focus within modal (default: true)
MaxWidth int // Maximum modal width (0 = no limit)
MaxHeight int // Maximum modal height (0 = no limit)
CenterX bool // Center horizontally (default: true)
CenterY bool // Center vertically (default: true)
AnimationConfig *AnimationConfig // Optional animation configuration
}
ModalConfig configures modal behavior and appearance
func BlurModalConfig ¶
func BlurModalConfig() ModalConfig
BlurModalConfig returns a modal configuration with blur backdrop effect
func DefaultModalConfig ¶
func DefaultModalConfig() ModalConfig
DefaultModalConfig returns a sensible default modal configuration
func MinimalModalConfig ¶
func MinimalModalConfig() ModalConfig
MinimalModalConfig returns a minimal modal configuration with no backdrop
type OpenDialogMsg ¶
type OpenDialogMsg struct {
Dialog Dialog
}
OpenDialogMsg signals to open a new dialog
type OpenModalMsg ¶
type OpenModalMsg struct {
Dialog Dialog
Config ModalConfig
}
OpenModalMsg signals to open a modal with custom configuration
type SelectDialog ¶
type SelectDialog struct {
// contains filtered or unexported fields
}
SelectDialog represents a list selection dialog with search
func NewSelectDialog ¶
func NewSelectDialog(config SelectDialogConfig) *SelectDialog
NewSelectDialog creates a new select dialog
func (*SelectDialog) GetResult ¶
func (d *SelectDialog) GetResult() *string
GetResult returns the string result (convenience method)
func (*SelectDialog) GetSelectedOption ¶
func (d *SelectDialog) GetSelectedOption() *SelectOption
GetSelectedOption returns the selected option (convenience method)
func (*SelectDialog) IsClosing ¶
func (d *SelectDialog) IsClosing() bool
IsClosing returns true if the dialog is requesting to be closed
func (*SelectDialog) Result ¶
func (d *SelectDialog) Result() interface{}
Result returns the dialog result
func (*SelectDialog) SetSize ¶
func (d *SelectDialog) SetSize(width, height int)
SetSize updates the dialog dimensions
type SelectDialogConfig ¶
type SelectDialogConfig struct {
ID string
Title string
Description string
Options []SelectOption
DefaultIdx int // Default selected index
Searchable bool // Enable search mode
}
SelectDialogConfig contains configuration for a select dialog
type SelectOption ¶
SelectOption represents an option in the select dialog
type ShortcutHandler ¶
ShortcutHandler is a function that handles a keyboard shortcut
type ShortcutInfo ¶
type ShortcutInfo struct {
Key string // The key combination
Description string // What the shortcut does
}
ShortcutInfo represents information about a shortcut
func GetCommonShortcutHelp ¶
func GetCommonShortcutHelp() []ShortcutInfo
GetShortcutHelp returns help information for all registered shortcuts This is useful for displaying help dialogs
type ShortcutManager ¶
type ShortcutManager struct {
// contains filtered or unexported fields
}
ShortcutManager handles global modal keyboard shortcuts
func NewShortcutManager ¶
func NewShortcutManager() *ShortcutManager
NewShortcutManager creates a new shortcut manager
func (*ShortcutManager) ClearShortcuts ¶
func (s *ShortcutManager) ClearShortcuts()
ClearShortcuts removes all shortcuts
func (*ShortcutManager) Disable ¶
func (s *ShortcutManager) Disable()
Disable disables shortcut handling
func (*ShortcutManager) Enable ¶
func (s *ShortcutManager) Enable()
Enable enables shortcut handling
func (*ShortcutManager) GetAllShortcuts ¶
func (s *ShortcutManager) GetAllShortcuts() map[string]ShortcutHandler
GetAllShortcuts returns all registered shortcuts
func (*ShortcutManager) GetShortcut ¶
func (s *ShortcutManager) GetShortcut(key string) ShortcutHandler
GetShortcut returns the handler for a shortcut, or nil if not found
func (*ShortcutManager) GetShortcutCount ¶
func (s *ShortcutManager) GetShortcutCount() int
GetShortcutCount returns the number of registered shortcuts
func (*ShortcutManager) GetShortcutKeys ¶
func (s *ShortcutManager) GetShortcutKeys() []string
GetShortcutKeys returns all registered shortcut keys
func (*ShortcutManager) HandleKey ¶
func (s *ShortcutManager) HandleKey(key string) (bool, tea.Cmd)
HandleKey processes a key event and triggers the appropriate shortcut Returns (handled, command)
func (*ShortcutManager) HandleMessage ¶
HandleMessage processes a Bubble Tea message for shortcuts
func (*ShortcutManager) HasShortcut ¶
func (s *ShortcutManager) HasShortcut(key string) bool
HasShortcut checks if a shortcut is registered
func (*ShortcutManager) IsEnabled ¶
func (s *ShortcutManager) IsEnabled() bool
IsEnabled returns true if shortcut handling is enabled
func (*ShortcutManager) RegisterCommandPalette ¶
func (s *ShortcutManager) RegisterCommandPalette(handler ShortcutHandler)
RegisterCommandPalette registers Ctrl+K for command palette
func (*ShortcutManager) RegisterCommonShortcuts ¶
func (s *ShortcutManager) RegisterCommonShortcuts()
RegisterCommonShortcuts registers all common shortcuts with default handlers
func (*ShortcutManager) RegisterFilePicker ¶
func (s *ShortcutManager) RegisterFilePicker(handler ShortcutHandler)
RegisterFilePicker registers Ctrl+P for file picker
func (*ShortcutManager) RegisterHelp ¶
func (s *ShortcutManager) RegisterHelp(handler ShortcutHandler)
RegisterHelp registers F1 or Ctrl+? for help
func (*ShortcutManager) RegisterSearch ¶
func (s *ShortcutManager) RegisterSearch(handler ShortcutHandler)
RegisterSearch registers Ctrl+F for search
func (*ShortcutManager) RegisterSettings ¶
func (s *ShortcutManager) RegisterSettings(handler ShortcutHandler)
RegisterSettings registers Ctrl+, for settings
func (*ShortcutManager) RegisterShortcut ¶
func (s *ShortcutManager) RegisterShortcut(key string, handler ShortcutHandler)
RegisterShortcut adds a global shortcut
func (*ShortcutManager) Toggle ¶
func (s *ShortcutManager) Toggle()
Toggle toggles shortcut handling on/off
func (*ShortcutManager) UnregisterShortcut ¶
func (s *ShortcutManager) UnregisterShortcut(key string)
UnregisterShortcut removes a global shortcut