dialog

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CenterPosition added in v1.16.0

func CenterPosition(screenWidth, screenHeight, dialogWidth, dialogHeight int) (row, col int)

CenterPosition calculates the centered position for a dialog given screen and dialog dimensions. Returns (row, col) suitable for use in Dialog.Position().

func HandleConfirmKeys added in v1.16.0

func HandleConfirmKeys(msg tea.KeyPressMsg, keyMap ConfirmKeyMap, onYes, onNo func() (layout.Model, tea.Cmd)) (layout.Model, tea.Cmd, bool)

HandleConfirmKeys handles Yes/No key presses for confirmation dialogs. Returns the command to execute and whether a key was matched.

func HandleQuit added in v1.16.0

func HandleQuit(msg tea.KeyPressMsg) tea.Cmd

HandleQuit checks for ctrl+c and returns tea.Quit if matched.

func RenderHelp added in v1.16.0

func RenderHelp(text string, contentWidth int) string

RenderHelp renders help text at the bottom of a dialog.

func RenderOptions added in v1.16.0

func RenderOptions(text string, contentWidth int) string

RenderOptions renders option buttons text centered.

func RenderSeparator added in v1.16.0

func RenderSeparator(contentWidth int) string

RenderSeparator renders a horizontal separator line.

func RenderTitle added in v1.16.0

func RenderTitle(title string, contentWidth int, style lipgloss.Style) string

RenderTitle renders a dialog title with the given style and width.

Types

type BaseDialog added in v1.16.0

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

BaseDialog provides common functionality for dialog implementations. It handles size management, position calculation, and common UI patterns.

func (*BaseDialog) CenterDialog added in v1.16.0

func (b *BaseDialog) CenterDialog(renderedDialog string) (row, col int)

CenterDialog returns the (row, col) position to center a rendered dialog.

func (*BaseDialog) ComputeDialogWidth added in v1.16.0

func (b *BaseDialog) ComputeDialogWidth(percent, minWidth, maxWidth int) int

ComputeDialogWidth calculates dialog width based on screen percentage with bounds.

func (*BaseDialog) ContentWidth added in v1.16.0

func (b *BaseDialog) ContentWidth(dialogWidth, paddingX int) int

ContentWidth calculates the inner content width given dialog width and padding.

func (*BaseDialog) Height added in v1.16.0

func (b *BaseDialog) Height() int

Height returns the current height.

func (*BaseDialog) SetSize added in v1.16.0

func (b *BaseDialog) SetSize(width, height int) tea.Cmd

SetSize updates the dialog dimensions.

func (*BaseDialog) Width added in v1.16.0

func (b *BaseDialog) Width() int

Width returns the current width.

type CloseAllDialogsMsg added in v1.5.14

type CloseAllDialogsMsg struct{}

CloseAllDialogsMsg is sent to close all dialogs in the stack

type CloseDialogMsg

type CloseDialogMsg struct{}

CloseDialogMsg is sent to close the current (topmost) dialog

type CommandExecuteMsg added in v1.6.0

type CommandExecuteMsg struct {
	Command commands.Item
}

CommandExecuteMsg is sent when a command is selected

type ConfirmKeyMap added in v1.16.0

type ConfirmKeyMap struct {
	Yes key.Binding
	No  key.Binding
}

ConfirmKeyMap defines key bindings for confirmation dialogs (Yes/No).

func DefaultConfirmKeyMap added in v1.16.0

func DefaultConfirmKeyMap() ConfirmKeyMap

DefaultConfirmKeyMap returns the standard Yes/No key bindings.

type Dialog

type Dialog interface {
	layout.Model
	Position() (int, int) // Returns (row, col) for dialog placement
}

Dialog defines the interface that all dialogs must implement

func NewAttachmentPreviewDialog added in v1.14.0

func NewAttachmentPreviewDialog(preview editor.AttachmentPreview) Dialog

NewAttachmentPreviewDialog returns a dialog that shows attachment content in a scrollable view.

func NewCommandPaletteDialog added in v1.6.0

func NewCommandPaletteDialog(categories []commands.Category) Dialog

NewCommandPaletteDialog creates a new command palette dialog

func NewExitConfirmationDialog added in v1.16.0

func NewExitConfirmationDialog() Dialog

NewExitConfirmationDialog creates a new exit confirmation dialog.

func NewMCPPromptInputDialog added in v1.9.25

func NewMCPPromptInputDialog(promptName string, promptInfo mcptools.PromptInfo) Dialog

NewMCPPromptInputDialog creates a new MCP prompt input dialog

func NewMaxIterationsDialog added in v1.3.6

func NewMaxIterationsDialog(maxIterations int, appInstance *app.App) Dialog

NewMaxIterationsDialog creates a new max iterations confirmation dialog

func NewOAuthAuthorizationDialog added in v1.5.6

func NewOAuthAuthorizationDialog(serverURL string, appInstance *app.App) Dialog

NewOAuthAuthorizationDialog creates a new OAuth authorization confirmation dialog

func NewToolConfirmationDialog

func NewToolConfirmationDialog(msg *runtime.ToolCallConfirmationEvent, sessionState *service.SessionState) Dialog

NewToolConfirmationDialog creates a new tool confirmation dialog

type ExitConfirmedMsg added in v1.16.0

type ExitConfirmedMsg struct{}

ExitConfirmedMsg is sent when the user confirms they want to exit.

type MCPPromptInputDialog added in v1.9.25

type MCPPromptInputDialog struct {
	BaseDialog
	// contains filtered or unexported fields
}

MCPPromptInputDialog implements Dialog for collecting MCP prompt parameters

func (*MCPPromptInputDialog) Init added in v1.9.25

func (d *MCPPromptInputDialog) Init() tea.Cmd

Init initializes the MCP prompt input dialog

func (*MCPPromptInputDialog) Position added in v1.9.25

func (d *MCPPromptInputDialog) Position() (row, col int)

Position calculates the position to center the dialog

func (*MCPPromptInputDialog) Update added in v1.9.25

func (d *MCPPromptInputDialog) Update(msg tea.Msg) (layout.Model, tea.Cmd)

Update handles messages for the MCP prompt input dialog

func (*MCPPromptInputDialog) View added in v1.9.25

func (d *MCPPromptInputDialog) View() string

View renders the MCP prompt input dialog

type Manager

type Manager interface {
	layout.Model

	GetLayers() []*lipgloss.Layer
	Open() bool
}

Manager manages the dialog stack and rendering

func New

func New() Manager

New creates a new dialog component manager

type OpenDialogMsg

type OpenDialogMsg struct {
	Model Dialog
}

OpenDialogMsg is sent to open a new dialog

type RuntimeResumeMsg added in v1.9.7

type RuntimeResumeMsg struct {
	Response runtime.ResumeType
}

type ToolConfirmationResponse

type ToolConfirmationResponse struct {
	Response string // "approve", "reject", or "approve-session"
}

ToolConfirmationResponse represents the user's response to tool confirmation

Jump to

Keyboard shortcuts

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