ui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconPending = "○"
	IconRunning = "◐" // or use spinner
	IconSuccess = "✓"
	IconFailed  = "✗"
)

Status icons

View Source
const (
	// Text input widths
	DefaultInputWidth = 50

	// Modal and dialog dimensions
	DefaultModalMaxHeight  = 20
	DefaultDialogMaxWidth  = 80
	ErrorDialogMaxWidth    = 120 // Error modals are wider to show detailed output
	DefaultDialogMaxHeight = 30
	MinContentWidth        = 20
	MinContentHeight       = 5
	DialogPaddingAllowance = 6  // Padding around dialog content
	DialogChromeAllowance  = 10 // Title, summary, footer space

	// Resource list rendering
	DefaultMaxTypeLength = 50
	MinTypeLength        = 20

	// Text formatting
	DefaultMaxStringLength   = 30
	MinFormattedStringLength = 20
	ArrayItemTruncateLength  = 30
	ArrayItemTruncateDisplay = 27 // Length to show before "..."
)

Layout constants for UI components

View Source
const (
	OpCreate        = pulumi.OpCreate
	OpUpdate        = pulumi.OpUpdate
	OpDelete        = pulumi.OpDelete
	OpSame          = pulumi.OpSame
	OpReplace       = pulumi.OpReplace
	OpCreateReplace = pulumi.OpCreateReplace
	OpDeleteReplace = pulumi.OpDeleteReplace
	OpRead          = pulumi.OpRead
	OpRefresh       = pulumi.OpRefresh
)

ResourceOp constants - aliased from pulumi package

View Source
const (
	OperationUp      = pulumi.OperationUp
	OperationRefresh = pulumi.OperationRefresh
	OperationDestroy = pulumi.OperationDestroy
)

OperationType constants - aliased from pulumi package

View Source
const FlashDuration = 100 * time.Millisecond

FlashDuration is how long the highlight flash lasts

View Source
const ToastDuration = 4 * time.Second

ToastDuration is how long the toast is visible

Variables

View Source
var (
	ColorPrimary           = lipgloss.Color("#7aa2f7")
	ColorSecondary         = lipgloss.Color("#bb9af7")
	ColorText              = lipgloss.Color("#c0caf5")
	ColorDim               = lipgloss.Color("#565f89")
	ColorError             = lipgloss.Color("#f7768e")
	ColorBg                = lipgloss.Color("#1a1b26")
	ColorSelection         = lipgloss.Color("#283457") // subtle selection highlight (visual range)
	ColorDiscreteSelection = lipgloss.Color("#3d4f2f") // discrete selection (green-ish)
	ColorBothSelection     = lipgloss.Color("#4a3f5c") // both visual and discrete (purple-ish)
	ColorFlash             = lipgloss.Color("#3d59a1") // brighter flash highlight

	// Operation colors
	ColorCreate  = lipgloss.Color("#9ece6a") // green
	ColorUpdate  = lipgloss.Color("#e0af68") // yellow/orange
	ColorDelete  = lipgloss.Color("#f7768e") // red
	ColorReplace = lipgloss.Color("#bb9af7") // purple
	ColorRefresh = lipgloss.Color("#7dcfff") // cyan
	ColorSuccess = lipgloss.Color("#9ece6a") // green (same as create)

	// Flag colors
	ColorTarget  = lipgloss.Color("#7dcfff") // cyan
	ColorExclude = lipgloss.Color("#f7768e") // red (same as error/delete)
	ColorProtect = lipgloss.Color("#f5a623") // masterlock yellow
)

Color palette (Tokyo Night)

View Source
var (
	// Text styles
	LabelStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorSecondary)

	ValueStyle = lipgloss.NewStyle().
				Foreground(ColorText)

	DimStyle = lipgloss.NewStyle().
				Foreground(ColorDim)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(ColorError)

	// Box styles
	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorDim).
				Padding(0, 1)

	// Dialog styles
	DialogStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorPrimary).
				Padding(1, 2)

	DialogTitleStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorPrimary).
						MarginBottom(1)

	// Operation styles
	OpCreateStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorCreate)

	OpUpdateStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorUpdate)

	OpDeleteStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorDelete)

	OpReplaceStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorReplace)

	OpRefreshStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorRefresh)

	// Execution status styles
	StatusPendingStyle = lipgloss.NewStyle().Foreground(ColorDim)
	StatusRunningStyle = lipgloss.NewStyle().Foreground(ColorPrimary)
	StatusSuccessStyle = lipgloss.NewStyle().Foreground(ColorSuccess)
	StatusFailedStyle  = lipgloss.NewStyle().Foreground(ColorError)

	// Scroll indicator styles - bright cyan for high visibility
	ScrollIndicatorStyle = lipgloss.NewStyle().
							Bold(true).
							Foreground(ColorRefresh) // Use bright cyan for better visibility

	// Cursor and selection styles
	CursorStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorPrimary)

	SelectionStyle = lipgloss.NewStyle().
					Background(ColorSelection)

	// Flag badge styles
	FlagTargetStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorTarget)

	FlagReplaceStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorReplace)

	FlagExcludeStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorExclude)

	FlagProtectStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorProtect)

	// View mode label styles
	ViewLabelStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(ColorPrimary)

	// Tree connector style for component resources
	TreeLineStyle = lipgloss.NewStyle().
					Foreground(ColorDim)
)

Styles

View Source
var Keys = KeyMap{

	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	),
	PageUp: key.NewBinding(
		key.WithKeys("pgup", "ctrl+b"),
		key.WithHelp("pgup", "page up"),
	),
	PageDown: key.NewBinding(
		key.WithKeys("pgdown", "ctrl+f"),
		key.WithHelp("pgdn", "page down"),
	),
	Home: key.NewBinding(
		key.WithKeys("home", "g"),
		key.WithHelp("g", "top"),
	),
	End: key.NewBinding(
		key.WithKeys("end", "G"),
		key.WithHelp("G", "bottom"),
	),

	ToggleTarget: key.NewBinding(
		key.WithKeys("T"),
		key.WithHelp("T", "toggle target"),
	),
	ToggleReplace: key.NewBinding(
		key.WithKeys("R"),
		key.WithHelp("R", "toggle replace"),
	),
	ToggleExclude: key.NewBinding(
		key.WithKeys("E"),
		key.WithHelp("E", "toggle exclude"),
	),
	ClearFlags: key.NewBinding(
		key.WithKeys("c"),
		key.WithHelp("c", "clear flags"),
	),
	ClearAllFlags: key.NewBinding(
		key.WithKeys("C"),
		key.WithHelp("C", "clear all flags"),
	),

	VisualMode: key.NewBinding(
		key.WithKeys("v"),
		key.WithHelp("v", "visual select"),
	),
	ToggleSelect: key.NewBinding(
		key.WithKeys(" "),
		key.WithHelp("space", "toggle select"),
	),
	Escape: key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "cancel"),
	),

	PreviewUp: key.NewBinding(
		key.WithKeys("u"),
		key.WithHelp("u", "preview up"),
	),
	PreviewRefresh: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "preview refresh"),
	),
	PreviewDestroy: key.NewBinding(
		key.WithKeys("d"),
		key.WithHelp("d", "preview destroy"),
	),

	ExecuteUp: key.NewBinding(
		key.WithKeys("ctrl+u"),
		key.WithHelp("ctrl+u", "execute up"),
	),
	ExecuteRefresh: key.NewBinding(
		key.WithKeys("ctrl+r"),
		key.WithHelp("ctrl+r", "execute refresh"),
	),
	ExecuteDestroy: key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "execute destroy"),
	),

	CopyResource: key.NewBinding(
		key.WithKeys("y"),
		key.WithHelp("y", "copy resource JSON"),
	),
	CopyAllResources: key.NewBinding(
		key.WithKeys("Y"),
		key.WithHelp("Y", "copy all resources JSON"),
	),

	ToggleDetails: key.NewBinding(
		key.WithKeys("D"),
		key.WithHelp("D", "toggle details"),
	),

	SelectStack: key.NewBinding(
		key.WithKeys("s"),
		key.WithHelp("s", "select stack"),
	),

	SelectWorkspace: key.NewBinding(
		key.WithKeys("w"),
		key.WithHelp("w", "select workspace"),
	),

	ViewHistory: key.NewBinding(
		key.WithKeys("h"),
		key.WithHelp("h", "view history"),
	),

	Import: key.NewBinding(
		key.WithKeys("I"),
		key.WithHelp("I", "import resource"),
	),

	DeleteFromState: key.NewBinding(
		key.WithKeys("x"),
		key.WithHelp("x", "delete from state"),
	),

	ToggleProtect: key.NewBinding(
		key.WithKeys("P"),
		key.WithHelp("P", "toggle protect"),
	),

	OpenResource: key.NewBinding(
		key.WithKeys("o"),
		key.WithHelp("o", "open resource"),
	),

	Filter: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "filter"),
	),

	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
}

Keys is the default keybinding configuration

Functions

func CalculateDuration

func CalculateDuration(startStr, endStr string) string

CalculateDuration calculates the duration between two RFC3339 time strings and returns a human-readable string. Returns empty string on parse error.

func CalculateVisibleHeight

func CalculateVisibleHeight(totalHeight, itemCount, padding int) int

CalculateVisibleHeight returns the number of lines available for items. Accounts for padding and scroll indicators if content is scrollable.

func CopyToClipboardWithCountCmd

func CopyToClipboardWithCountCmd(text string, count int) tea.Cmd

CopyToClipboardWithCountCmd returns a command to copy text to the clipboard with a count

func EnsureCursorVisible

func EnsureCursorVisible(cursor, scrollOffset, itemCount, visibleHeight int) int

EnsureCursorVisible adjusts scroll offset to keep cursor visible within the viewport. Returns the new scroll offset.

func FormatTime

func FormatTime(timeStr, format string) string

FormatTime parses an RFC3339 time string and formats it with the given format. Returns the original string if parsing fails.

func FormatTimeStyled

func FormatTimeStyled(timeStr, format string, maxLen int, style lipgloss.Style) string

FormatTimeStyled parses an RFC3339 time string and formats it with styling. If parsing fails and the string is longer than maxLen, it truncates the string. Pass maxLen <= 0 to skip truncation on parse failure.

func IsScrollable

func IsScrollable(totalHeight, itemCount, padding int) bool

IsScrollable returns true if there are more items than can fit in the base height.

func MoveCursor

func MoveCursor(cursor, delta, itemCount int) int

MoveCursor moves the cursor by delta, clamping to valid range [0, itemCount-1]. Returns the new cursor position.

func RenderCenteredLoading

func RenderCenteredLoading(spin spinner.Model, msg string, width, height int) string

RenderCenteredLoading renders a loading state with spinner centered in the given dimensions

func RenderCenteredMessage

func RenderCenteredMessage(msg string, width, height int) string

RenderCenteredMessage renders a dim message centered in the given dimensions

func RenderFilterBar added in v0.6.0

func RenderFilterBar(filter *FilterState, matchCount, totalCount, width int) string

RenderFilterBar renders a filter bar with match count

func RenderHistoryKind

func RenderHistoryKind(kind string) string

RenderHistoryKind renders a history operation kind with appropriate styling

func RenderHistoryResult

func RenderHistoryResult(result string) string

RenderHistoryResult renders a history operation result with appropriate styling

func RenderOp

func RenderOp(op ResourceOp) string

RenderOp renders a resource operation with appropriate styling

func RenderPaddedError

func RenderPaddedError(err error) string

RenderPaddedError renders an error with padding

func RenderResourceChanges

func RenderResourceChanges(changes map[string]int, format ResourceChangesFormat) string

RenderResourceChanges renders a map of resource changes with appropriate styling. The changes map typically has keys: "create", "update", "delete", "replace", "same".

func RenderScrollDownIndicator

func RenderScrollDownIndicator(canScroll bool) string

RenderScrollDownIndicator renders a down scroll indicator with proper spacing. Returns styled arrow if canScroll is true, otherwise returns empty spacing.

func RenderScrollDownIndicatorWithConfig

func RenderScrollDownIndicatorWithConfig(canScroll bool, config ScrollIndicatorConfig) string

RenderScrollDownIndicatorWithConfig renders a down scroll indicator with custom configuration.

func RenderScrollHint

func RenderScrollHint(canScrollUp, canScrollDown bool, padding string) string

RenderScrollHint renders a text-based scroll hint for dialogs/modals. This uses text like "↑↓ more" rather than arrow symbols for inline hints.

func RenderScrollIndicators

func RenderScrollIndicators(isScrollable, canScrollUp, canScrollDown bool, config ScrollIndicatorConfig) (upIndicator, downIndicator string)

RenderScrollIndicators renders both up and down scroll indicators based on current scroll state. This is the unified method for rendering scroll indicators throughout the UI. Returns upIndicator, downIndicator strings (both include newlines when non-empty).

func RenderScrollUpIndicator

func RenderScrollUpIndicator(canScroll bool) string

RenderScrollUpIndicator renders an up scroll indicator with proper spacing. Returns styled arrow if canScroll is true, otherwise returns empty spacing.

func RenderScrollUpIndicatorWithConfig

func RenderScrollUpIndicatorWithConfig(canScroll bool, config ScrollIndicatorConfig) string

RenderScrollUpIndicatorWithConfig renders an up scroll indicator with custom configuration.

func RenderStatus

func RenderStatus(status ItemStatus) string

RenderStatus renders a status with appropriate styling

Types

type ConfirmModal

type ConfirmModal struct {
	ModalBase // Embedded modal base for common functionality
	// contains filtered or unexported fields
}

ConfirmModal is a reusable confirmation dialog with keybind actions

func NewConfirmModal

func NewConfirmModal() *ConfirmModal

NewConfirmModal creates a new confirmation modal

func (*ConfirmModal) GetBulkResources added in v0.8.0

func (m *ConfirmModal) GetBulkResources() []SelectedResource

GetBulkResources returns the stored bulk resources (nil for single-resource operations)

func (*ConfirmModal) GetContextName

func (m *ConfirmModal) GetContextName() string

GetContextName returns the stored context name

func (*ConfirmModal) GetContextType

func (m *ConfirmModal) GetContextType() string

GetContextType returns the stored context type

func (*ConfirmModal) GetContextURN

func (m *ConfirmModal) GetContextURN() string

GetContextURN returns the stored context URN

func (*ConfirmModal) Hide

func (m *ConfirmModal) Hide()

Hide hides the confirmation modal and clears context

func (*ConfirmModal) IsBulkOperation added in v0.8.0

func (m *ConfirmModal) IsBulkOperation() bool

IsBulkOperation returns true if this is a bulk operation with multiple resources

func (*ConfirmModal) SetKeys

func (m *ConfirmModal) SetKeys(cancel, confirm string)

SetKeys customizes the keybinds (default: y to confirm, n to cancel)

func (*ConfirmModal) SetLabels

func (m *ConfirmModal) SetLabels(cancel, confirm string)

SetLabels customizes the action labels

func (*ConfirmModal) Show

func (m *ConfirmModal) Show(title, message, warning string)

Show shows the confirmation modal with the given content

func (*ConfirmModal) ShowBulkWithContext added in v0.8.0

func (m *ConfirmModal) ShowBulkWithContext(title, message, warning string, resources []SelectedResource)

ShowBulkWithContext shows the modal for bulk operations with multiple resources

func (*ConfirmModal) ShowWithContext

func (m *ConfirmModal) ShowWithContext(title, message, warning, contextURN, contextName, contextType string)

ShowWithContext shows the modal and stores context data

func (*ConfirmModal) Update

func (m *ConfirmModal) Update(msg tea.KeyMsg) (confirmed, cancelled bool, cmd tea.Cmd)

Update handles key events and returns confirmation status and any tea command.

func (*ConfirmModal) View

func (m *ConfirmModal) View() string

View renders the confirmation modal

type CopiedToClipboardMsg

type CopiedToClipboardMsg struct {
	Success bool
	Count   int // Number of items copied (for visual feedback)
}

CopiedToClipboardMsg is sent after text is copied to the clipboard

type CursorState

type CursorState struct {
	Cursor       int
	ScrollOffset int
}

CursorState holds cursor and scroll state for list components

type DetailPanel

type DetailPanel struct {
	PanelBase // Embed common panel functionality
	// contains filtered or unexported fields
}

DetailPanel is a floating panel showing resource details

func NewDetailPanel

func NewDetailPanel() *DetailPanel

NewDetailPanel creates a new detail panel component

func (*DetailPanel) FilterActive added in v0.6.0

func (d *DetailPanel) FilterActive() bool

FilterActive returns whether the filter is currently active

func (*DetailPanel) SetResource

func (d *DetailPanel) SetResource(resource *ResourceItem)

SetResource sets the resource to display details for

func (*DetailPanel) Update added in v0.6.0

func (d *DetailPanel) Update(msg tea.KeyMsg) tea.Cmd

Update handles key events for the detail panel

func (*DetailPanel) View

func (d *DetailPanel) View() string

View renders the detail panel

type DetailPanelContent

type DetailPanelContent struct {
	Header       string // Header text (e.g., resource name)
	Content      string // Main content to display
	Width        int    // Panel width
	Height       int    // Panel height
	ScrollOffset int    // Current scroll position
}

DetailPanelContent holds the parameters for rendering a detail panel

type DetailPanelResult

type DetailPanelResult struct {
	Rendered        string   // The fully rendered panel
	VisibleLines    []string // The visible content lines (for selection extraction)
	NewScrollOffset int      // Adjusted scroll offset (clamped to valid range)
}

DetailPanelResult holds the result of rendering a detail panel

func RenderDetailPanel

func RenderDetailPanel(params DetailPanelContent) DetailPanelResult

RenderDetailPanel renders a scrollable detail panel with header and content. This consolidates the common rendering logic between DetailPanel and HistoryDetailPanel.

type DiffRenderer

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

DiffRenderer handles rendering of property diffs

func NewDiffRenderer

func NewDiffRenderer(maxWidth int) *DiffRenderer

NewDiffRenderer creates a new diff renderer with the specified max width

func (*DiffRenderer) ClearKeyFilter added in v0.6.0

func (r *DiffRenderer) ClearKeyFilter()

ClearKeyFilter removes the key filter

func (*DiffRenderer) RenderCombinedProperties

func (r *DiffRenderer) RenderCombinedProperties(resource *ResourceItem) string

RenderCombinedProperties renders inputs and outputs in a single unified diff view Properties that exist in both inputs and outputs are shown once (from inputs for diff) Output-only properties (computed values like id, arn) are shown separately at the end

func (*DiffRenderer) SetKeyFilter added in v0.6.0

func (r *DiffRenderer) SetKeyFilter(filter func(key string) bool)

SetKeyFilter sets a filter function for property keys Only keys where filter(key) returns true will be displayed

type DiffType

type DiffType int

DiffType represents the type of change for a value

const (
	DiffUnchanged DiffType = iota
	DiffAdded
	DiffRemoved
	DiffModified
)

type ErrorModal

type ErrorModal struct {
	ModalBase // Embedded modal base for common functionality
	// contains filtered or unexported fields
}

ErrorModal is a modal dialog for displaying detailed error information

func NewErrorModal

func NewErrorModal() *ErrorModal

NewErrorModal creates a new error modal

func (*ErrorModal) SetSize

func (m *ErrorModal) SetSize(width, height int)

SetSize sets the dialog dimensions for centering and sizes the viewport

func (*ErrorModal) Show

func (m *ErrorModal) Show(title, summary, details string)

Show shows the error modal with the given content

func (*ErrorModal) Update

func (m *ErrorModal) Update(msg tea.KeyMsg) (dismissed bool, cmd tea.Cmd)

Update handles key events

func (*ErrorModal) View

func (m *ErrorModal) View() string

View renders the error modal

type FilterState added in v0.6.0

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

FilterState manages filter state for list components

func NewFilterState added in v0.6.0

func NewFilterState() FilterState

NewFilterState creates a new filter state

func (*FilterState) Activate added in v0.6.0

func (f *FilterState) Activate()

Activate enters filter mode, resetting any previous filter text

func (*FilterState) Active added in v0.6.0

func (f *FilterState) Active() bool

Active returns whether filter input mode is active (user is typing)

func (*FilterState) ActiveOrApplied added in v0.6.0

func (f *FilterState) ActiveOrApplied() bool

ActiveOrApplied returns true if the filter is either being typed in or has text applied

func (*FilterState) Applied added in v0.6.0

func (f *FilterState) Applied() bool

Applied returns whether a filter is currently applied (has text)

func (*FilterState) Clear added in v0.6.0

func (f *FilterState) Clear()

Clear clears the filter text but stays in filter mode

func (*FilterState) Deactivate added in v0.6.0

func (f *FilterState) Deactivate()

Deactivate exits filter mode but keeps filter text applied

func (*FilterState) Matches added in v0.6.0

func (f *FilterState) Matches(text string) bool

Matches returns true if the given text matches the filter (case-insensitive)

func (*FilterState) MatchesAny added in v0.6.0

func (f *FilterState) MatchesAny(texts ...string) bool

MatchesAny returns true if any of the given texts match the filter (case-insensitive)

func (*FilterState) Text added in v0.6.0

func (f *FilterState) Text() string

Text returns the current filter text

func (*FilterState) Update added in v0.6.0

func (f *FilterState) Update(msg tea.KeyMsg) (tea.Cmd, bool)

Update handles key events when filter is active Returns: (tea.Cmd, handled bool)

func (*FilterState) View added in v0.6.0

func (f *FilterState) View() string

View returns the filter input view

type FlashClearMsg

type FlashClearMsg struct{}

FlashClearMsg is sent to clear the flash highlight

type FocusLayer

type FocusLayer int

FocusLayer represents what component currently owns keyboard input

const (
	FocusMain              FocusLayer = iota // Normal app interaction (resource list, history list)
	FocusDetailsPanel                        // Details panel is open and capturing scroll keys
	FocusHelp                                // Help dialog open
	FocusStackSelector                       // Stack selector modal
	FocusWorkspaceSelector                   // Workspace selector modal
	FocusImportModal                         // Import modal
	FocusStackInitModal                      // Stack creation modal
	FocusConfirmModal                        // Confirmation dialog
	FocusErrorModal                          // Error dialog (highest priority)
)

func (FocusLayer) String

func (f FocusLayer) String() string

String returns a human-readable name for the focus layer

type FocusStack

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

FocusStack manages the stack of focus layers. The stack always has at least one element (FocusMain at the bottom).

func NewFocusStack

func NewFocusStack() FocusStack

NewFocusStack creates a new focus stack with FocusMain as the base layer

func (*FocusStack) Clear

func (f *FocusStack) Clear()

Clear resets the stack to just the base FocusMain layer

func (*FocusStack) Current

func (f *FocusStack) Current() FocusLayer

Current returns the current focus layer (top of stack)

func (*FocusStack) Depth

func (f *FocusStack) Depth() int

Depth returns the number of layers in the stack (including FocusMain)

func (*FocusStack) Has

func (f *FocusStack) Has(layer FocusLayer) bool

Has returns true if the given layer is anywhere in the stack

func (*FocusStack) Pop

func (f *FocusStack) Pop() FocusLayer

Pop removes and returns the top focus layer. Returns FocusMain if only the base layer remains (never pops below FocusMain).

func (*FocusStack) Push

func (f *FocusStack) Push(layer FocusLayer)

Push adds a new focus layer to the top of the stack. Does nothing if the layer is already at the top (prevents duplicate pushes).

func (*FocusStack) Remove

func (f *FocusStack) Remove(layer FocusLayer)

Remove removes a specific layer from anywhere in the stack. This is useful when a modal is hidden by some external event.

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

Header renders the top header bar

func NewHeader

func NewHeader() Header

NewHeader creates a new header component

func (*Header) IsLoading

func (h *Header) IsLoading() bool

IsLoading returns whether the header is in loading state

func (*Header) SetData

func (h *Header) SetData(data *HeaderData)

SetData sets the header data

func (*Header) SetError

func (h *Header) SetError(err error)

SetError sets an error state

func (*Header) SetOperation

func (h *Header) SetOperation(op OperationType)

SetOperation sets the current operation type

func (*Header) SetPreviewSummary

func (h *Header) SetPreviewSummary(summary PreviewSummary, state PreviewState)

SetPreviewSummary is a compatibility method that converts PreviewSummary to ResourceSummary

func (*Header) SetSpinner

func (h *Header) SetSpinner(s spinner.Model)

SetSpinner updates the spinner model

func (*Header) SetSummary

func (h *Header) SetSummary(summary ResourceSummary, state HeaderState)

SetSummary updates the resource summary in the header

func (*Header) SetViewMode

func (h *Header) SetViewMode(mode ViewMode)

SetViewMode sets the current view mode

func (*Header) SetWidth

func (h *Header) SetWidth(width int)

SetWidth sets the header width

func (*Header) Spinner

func (h *Header) Spinner() spinner.Model

Spinner returns the spinner model for updates

func (*Header) View

func (h *Header) View() string

View renders the header

type HeaderData

type HeaderData struct {
	ProgramName string
	StackName   string
	Runtime     string
}

HeaderData contains the data displayed in the header

type HeaderState

type HeaderState int

HeaderState represents the current state of the header

const (
	HeaderLoading HeaderState = iota
	HeaderRunning
	HeaderDone
	HeaderError
)

type HelpDialog

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

HelpDialog renders a help overlay

func NewHelpDialog

func NewHelpDialog() *HelpDialog

NewHelpDialog creates a new help dialog

func (*HelpDialog) GotoBottom

func (h *HelpDialog) GotoBottom()

GotoBottom scrolls to the bottom of the help content

func (*HelpDialog) GotoTop

func (h *HelpDialog) GotoTop()

GotoTop scrolls to the top of the help content

func (*HelpDialog) SetSize

func (h *HelpDialog) SetSize(width, height int)

SetSize sets the dialog dimensions for centering

func (*HelpDialog) Update

func (h *HelpDialog) Update(msg tea.KeyMsg)

Update handles key events for scrolling

func (*HelpDialog) View

func (h *HelpDialog) View() string

View renders the help dialog centered on screen

type HelpItem

type HelpItem struct {
	Key  string
	Desc string
}

HelpItem represents a single help entry

type HistoryDetailPanel

type HistoryDetailPanel struct {
	PanelBase // Embed common panel functionality
	// contains filtered or unexported fields
}

HistoryDetailPanel is a floating panel showing history update details

func NewHistoryDetailPanel

func NewHistoryDetailPanel() *HistoryDetailPanel

NewHistoryDetailPanel creates a new history detail panel component

func (*HistoryDetailPanel) SetItem

func (d *HistoryDetailPanel) SetItem(item *HistoryItem)

SetItem sets the history item to display details for

func (*HistoryDetailPanel) View

func (d *HistoryDetailPanel) View() string

View renders the history detail panel

type HistoryItem

type HistoryItem struct {
	Version         int
	Kind            string // "update", "preview", "refresh", "destroy"
	StartTime       string
	EndTime         string
	Message         string
	Result          string         // "succeeded", "failed", "in-progress"
	ResourceChanges map[string]int // e.g., {"create": 2, "update": 1}
	User            string         // git.author who ran the update
	UserEmail       string         // git.author.email
}

HistoryItem represents a single update in the history list

type HistoryList

type HistoryList struct {
	ListBase // Embed common list functionality for loading/error state
	// contains filtered or unexported fields
}

HistoryList is a scrollable list of stack history updates

func NewHistoryList

func NewHistoryList() *HistoryList

NewHistoryList creates a new HistoryList component

func (*HistoryList) AtBottom

func (h *HistoryList) AtBottom() bool

AtBottom returns true if scrolled to bottom

func (*HistoryList) AtTop

func (h *HistoryList) AtTop() bool

AtTop returns true if scrolled to top

func (*HistoryList) Clear

func (h *HistoryList) Clear()

Clear resets the list

func (*HistoryList) FilterActive added in v0.6.0

func (h *HistoryList) FilterActive() bool

FilterActive returns whether the filter is currently active (typing) or applied (has text)

func (*HistoryList) FilterInputActive added in v0.6.0

func (h *HistoryList) FilterInputActive() bool

FilterInputActive returns true if the filter is actively receiving input (user is typing)

func (*HistoryList) SelectedItem

func (h *HistoryList) SelectedItem() *HistoryItem

SelectedItem returns the currently selected item, or nil if none

func (*HistoryList) SetItems

func (h *HistoryList) SetItems(items []HistoryItem)

SetItems replaces all items

func (*HistoryList) SetSize

func (h *HistoryList) SetSize(width, height int)

SetSize sets the dimensions for the list and ensures cursor is visible

func (*HistoryList) TotalItems

func (h *HistoryList) TotalItems() int

TotalItems returns the total number of items

func (*HistoryList) Update

func (h *HistoryList) Update(msg tea.Msg) tea.Cmd

Update handles key events

func (*HistoryList) View

func (h *HistoryList) View() string

View renders the history list

type ImportModal

type ImportModal struct {
	ModalBase // Embedded modal base for common functionality
	// contains filtered or unexported fields
}

ImportModal is a modal dialog for importing a resource

func NewImportModal

func NewImportModal() *ImportModal

NewImportModal creates a new import modal

func (*ImportModal) GetImportID

func (m *ImportModal) GetImportID() string

GetImportID returns the entered import ID

func (*ImportModal) GetParentURN

func (m *ImportModal) GetParentURN() string

GetParentURN returns the parent URN for the resource being imported

func (*ImportModal) GetResourceName

func (m *ImportModal) GetResourceName() string

GetResourceName returns the name of the resource being imported

func (*ImportModal) GetResourceType

func (m *ImportModal) GetResourceType() string

GetResourceType returns the type of the resource being imported

func (*ImportModal) GetResourceURN

func (m *ImportModal) GetResourceURN() string

GetResourceURN returns the URN of the resource being imported

func (*ImportModal) Hide

func (m *ImportModal) Hide()

Hide hides the import modal

func (*ImportModal) SetError

func (m *ImportModal) SetError(err error)

SetError sets an error to display

func (*ImportModal) SetLoadingSuggestions

func (m *ImportModal) SetLoadingSuggestions(loading bool)

SetLoadingSuggestions sets the loading state

func (*ImportModal) SetSuggestions

func (m *ImportModal) SetSuggestions(suggestions []ImportSuggestion)

SetSuggestions sets the import suggestions from plugins

func (*ImportModal) Show

func (m *ImportModal) Show(resourceType, resourceName, resourceURN, parentURN string)

Show shows the import modal for the given resource

func (*ImportModal) Update

func (m *ImportModal) Update(msg tea.KeyMsg) (confirmed bool, cmd tea.Cmd)

Update handles key events and returns true if import was confirmed, false if cancelled

func (*ImportModal) View

func (m *ImportModal) View() string

View renders the import modal

type ImportSuggestion

type ImportSuggestion struct {
	ID          string
	Label       string
	Description string
	PluginName  string
}

ImportSuggestion represents a single import suggestion from a plugin

type InfoLine

type InfoLine struct {
	Label string
	Value string
}

InfoLine represents a key-value pair displayed in the modal header

type ItemStatus

type ItemStatus int

ItemStatus represents execution progress

const (
	StatusNone    ItemStatus = iota // Preview/stack view (not executing)
	StatusPending                   // Queued for execution
	StatusRunning                   // Currently executing
	StatusSuccess                   // Completed successfully
	StatusFailed                    // Failed
)

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Home     key.Binding
	End      key.Binding

	// Selection flags (uppercase)
	ToggleTarget  key.Binding
	ToggleReplace key.Binding
	ToggleExclude key.Binding
	ClearFlags    key.Binding
	ClearAllFlags key.Binding

	// Visual mode
	VisualMode   key.Binding
	ToggleSelect key.Binding
	Escape       key.Binding

	// Operations - Preview (lowercase)
	PreviewUp      key.Binding
	PreviewRefresh key.Binding
	PreviewDestroy key.Binding

	// Operations - Execute (ctrl+key)
	ExecuteUp      key.Binding
	ExecuteRefresh key.Binding
	ExecuteDestroy key.Binding

	// Copy resource
	CopyResource     key.Binding
	CopyAllResources key.Binding

	// Details panel
	ToggleDetails key.Binding

	// Stack selector
	SelectStack key.Binding

	// Workspace selector
	SelectWorkspace key.Binding

	// History view
	ViewHistory key.Binding

	// Import
	Import key.Binding

	// Delete from state
	DeleteFromState key.Binding

	// Toggle protection
	ToggleProtect key.Binding

	// Open resource
	OpenResource key.Binding

	// Filter
	Filter key.Binding

	// General
	Help key.Binding
	Quit key.Binding
}

KeyMap defines all application keybindings

func (*KeyMap) FullHelp

func (k *KeyMap) FullHelp() [][]key.Binding

FullHelp returns keybindings for the full help view

func (*KeyMap) ShortHelp

func (k *KeyMap) ShortHelp() []key.Binding

ShortHelp returns keybindings for the short help view

type ListBase

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

ListBase provides common list functionality for list components. Note: This is a partial base - lists have complex state that varies significantly. Use this for common loading/error state management.

func (*ListBase) ClearError

func (l *ListBase) ClearError()

ClearError clears the error state

func (*ListBase) Error

func (l *ListBase) Error() error

Error returns the current error, or nil if none

func (*ListBase) Height

func (l *ListBase) Height() int

Height returns the list height

func (*ListBase) InitSpinner

func (l *ListBase) InitSpinner()

InitSpinner initializes the spinner with default settings

func (*ListBase) IsLoading

func (l *ListBase) IsLoading() bool

IsLoading returns true if in loading state

func (*ListBase) IsReady

func (l *ListBase) IsReady() bool

IsReady returns true if the list has been sized

func (*ListBase) RenderLoadingState

func (l *ListBase) RenderLoadingState() (string, bool)

RenderLoadingState renders the loading spinner if loading, error if error, or empty string. Returns (rendered string, handled bool). If handled is true, use the rendered string. If handled is false, render items normally.

func (*ListBase) SetError

func (l *ListBase) SetError(err error)

SetError sets an error state and clears loading

func (*ListBase) SetLoading

func (l *ListBase) SetLoading(loading bool, msg string)

SetLoading sets the loading state with an optional message

func (*ListBase) SetSize

func (l *ListBase) SetSize(width, height int)

SetSize sets the dimensions for the list

func (*ListBase) SetSpinner

func (l *ListBase) SetSpinner(s spinner.Model)

SetSpinner updates the spinner model

func (*ListBase) Spinner

func (l *ListBase) Spinner() spinner.Model

Spinner returns the spinner model for tick updates

func (*ListBase) Width

func (l *ListBase) Width() int

Width returns the list width

type ModalBase

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

ModalBase provides common functionality for modal dialogs

func (*ModalBase) CenterDialog

func (m *ModalBase) CenterDialog(dialog string) string

CenterDialog centers the given dialog content on screen

func (*ModalBase) Height

func (m *ModalBase) Height() int

Height returns the modal height

func (*ModalBase) Hide

func (m *ModalBase) Hide()

Hide hides the modal

func (*ModalBase) RenderDialog

func (m *ModalBase) RenderDialog(title, content, footer string) string

RenderDialog creates a dialog with title, content, and footer, then centers it

func (*ModalBase) RenderDialogWithStyle

func (m *ModalBase) RenderDialogWithStyle(style lipgloss.Style, parts ...string) string

RenderDialogWithStyle creates a dialog with custom style, then centers it

func (*ModalBase) RenderScrollableDialog

func (m *ModalBase) RenderScrollableDialog(params ScrollableDialogContent) ScrollableDialogResult

RenderScrollableDialog renders a dialog with scrollable content

func (*ModalBase) ResetScroll

func (m *ModalBase) ResetScroll()

ResetScroll resets the scroll offset to 0

func (*ModalBase) ScrollDown

func (m *ModalBase) ScrollDown(lines int)

ScrollDown scrolls the content down by the given number of lines

func (*ModalBase) ScrollOffset

func (m *ModalBase) ScrollOffset() int

ScrollOffset returns the current scroll offset

func (*ModalBase) ScrollUp

func (m *ModalBase) ScrollUp(lines int)

ScrollUp scrolls the content up by the given number of lines

func (*ModalBase) SetScrollOffset

func (m *ModalBase) SetScrollOffset(offset int)

SetScrollOffset sets the scroll offset directly

func (*ModalBase) SetSize

func (m *ModalBase) SetSize(width, height int)

SetSize sets the modal dimensions for centering

func (*ModalBase) Show

func (m *ModalBase) Show()

Show shows the modal

func (*ModalBase) Toggle

func (m *ModalBase) Toggle()

Toggle toggles the modal visibility

func (*ModalBase) Visible

func (m *ModalBase) Visible() bool

Visible returns whether the modal is visible

func (*ModalBase) Width

func (m *ModalBase) Width() int

Width returns the modal width

type OperationType

type OperationType = pulumi.OperationType

OperationType represents an operation type (up, refresh, destroy)

type PanelBase

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

PanelBase provides common panel functionality for detail panels. Embed this in panel types to get standard visibility, scroll, and size management.

func (*PanelBase) Height

func (p *PanelBase) Height() int

Height returns the panel height

func (*PanelBase) Hide

func (p *PanelBase) Hide()

Hide hides the panel

func (*PanelBase) ResetScroll

func (p *PanelBase) ResetScroll()

ResetScroll resets the scroll offset to 0

func (*PanelBase) ScrollDown

func (p *PanelBase) ScrollDown(lines int)

ScrollDown scrolls the content down by the given number of lines

func (*PanelBase) ScrollOffset

func (p *PanelBase) ScrollOffset() int

ScrollOffset returns the current scroll offset

func (*PanelBase) ScrollUp

func (p *PanelBase) ScrollUp(lines int)

ScrollUp scrolls the content up by the given number of lines

func (*PanelBase) SetScrollOffset

func (p *PanelBase) SetScrollOffset(offset int)

SetScrollOffset sets the scroll offset directly

func (*PanelBase) SetSize

func (p *PanelBase) SetSize(width, height int)

SetSize sets the dimensions for the panel

func (*PanelBase) Show

func (p *PanelBase) Show()

Show shows the panel and resets scroll offset

func (*PanelBase) Toggle

func (p *PanelBase) Toggle()

Toggle toggles the panel visibility and resets scroll offset

func (*PanelBase) Visible

func (p *PanelBase) Visible() bool

Visible returns whether the panel is visible

func (*PanelBase) Width

func (p *PanelBase) Width() int

Width returns the panel width

type PreviewState

type PreviewState int

PreviewState represents the current state of the preview (for backwards compatibility)

const (
	PreviewLoading PreviewState = iota
	PreviewRunning
	PreviewDone
	PreviewError
)

type PreviewSummary

type PreviewSummary struct {
	Create  int
	Update  int
	Delete  int
	Replace int
	Total   int
}

PreviewSummary contains counts of each operation type (for backwards compatibility)

type ResourceChangesFormat

type ResourceChangesFormat int

ResourceChangesFormat specifies the output format for RenderResourceChanges

const (
	// ResourceChangesCompact renders as: +2 ~1 ±1 -0
	ResourceChangesCompact ResourceChangesFormat = iota
	// ResourceChangesExpanded renders as: + 2 created, ~ 1 updated, etc.
	ResourceChangesExpanded
)

type ResourceFlags

type ResourceFlags struct {
	Target  bool // --target flag for update
	Replace bool // --replace flag for update
	Exclude bool // exclude from update (mutually exclusive with Target/Replace)
}

ResourceFlags tracks selection flags for a resource

type ResourceItem

type ResourceItem struct {
	URN            string
	Type           string
	Name           string
	Op             ResourceOp     // OpSame for stack view, actual op for preview/exec
	Status         ItemStatus     // Execution progress
	Parent         string         // Parent URN for component hierarchy
	Sequence       int            // Event sequence number from Pulumi engine (for ordering)
	Depth          int            // Nesting depth (0 = root)
	IsLast         bool           // True if this is the last child of its parent
	CurrentOp      ResourceOp     // Current step being executed (for replace: create-replacement or delete-replaced)
	Protected      bool           // Whether the resource is protected from deletion
	Inputs         map[string]any // Resource inputs/args from stack state
	Outputs        map[string]any // Resource outputs from stack state
	OldInputs      map[string]any // Previous inputs (for updates/deletes)
	OldOutputs     map[string]any // Previous outputs (for updates/deletes)
	Provider       string         // Provider reference string (URN::ID format)
	ProviderInputs map[string]any // Provider's configuration inputs
}

ResourceItem is the generic representation of a resource

type ResourceJSON

type ResourceJSON struct {
	URN     string         `json:"urn"`
	Type    string         `json:"type"`
	Inputs  map[string]any `json:"inputs,omitempty"`
	Outputs map[string]any `json:"outputs,omitempty"`
}

ResourceJSON is the JSON structure for copying a resource Matches Pulumi's native output format as closely as possible

type ResourceList

type ResourceList struct {
	ListBase // Embed common list functionality for loading/error state
	// contains filtered or unexported fields
}

ResourceList is the reusable scrollable list component

func NewResourceList

func NewResourceList(flags map[string]ResourceFlags) *ResourceList

NewResourceList creates a new ResourceList component

func (*ResourceList) AddItem

func (r *ResourceList) AddItem(item ResourceItem)

AddItem adds a single item (for streaming) If an item with the same URN exists, it updates the existing item

func (*ResourceList) AtBottom

func (r *ResourceList) AtBottom() bool

AtBottom returns true if scrolled to bottom

func (*ResourceList) AtTop

func (r *ResourceList) AtTop() bool

AtTop returns true if scrolled to top

func (*ResourceList) Clear

func (r *ResourceList) Clear()

Clear resets the list for a new view

func (*ResourceList) ClearAllFlags

func (r *ResourceList) ClearAllFlags()

ClearAllFlags clears all flags

func (*ResourceList) ClearDiscreteSelections added in v0.8.0

func (r *ResourceList) ClearDiscreteSelections()

ClearDiscreteSelections clears all discrete selections

func (*ResourceList) ClearFlash

func (r *ResourceList) ClearFlash()

ClearFlash clears the flash highlight

func (*ResourceList) CopyAllResourcesJSON

func (r *ResourceList) CopyAllResourcesJSON() tea.Cmd

CopyAllResourcesJSON copies all visible resources as JSON array to the clipboard

func (*ResourceList) CopyResourceJSON

func (r *ResourceList) CopyResourceJSON() tea.Cmd

CopyResourceJSON copies the selected resource as JSON to the clipboard

func (*ResourceList) FilterActive added in v0.6.0

func (r *ResourceList) FilterActive() bool

FilterActive returns whether the filter is currently active (typing) or applied (has text)

func (*ResourceList) FilterInputActive added in v0.6.0

func (r *ResourceList) FilterInputActive() bool

FilterInputActive returns true if the filter is actively receiving input (user is typing)

func (*ResourceList) FilterText added in v0.6.0

func (r *ResourceList) FilterText() string

FilterText returns the current filter text

func (*ResourceList) GetExcludeURNs

func (r *ResourceList) GetExcludeURNs() []string

GetExcludeURNs returns URNs flagged for exclusion

func (*ResourceList) GetReplaceURNs

func (r *ResourceList) GetReplaceURNs() []string

GetReplaceURNs returns URNs flagged for --replace

func (*ResourceList) GetSelectedResourcesForStateDelete added in v0.8.0

func (r *ResourceList) GetSelectedResourcesForStateDelete() []SelectedResource

GetSelectedResourcesForStateDelete returns selected resources that can be deleted from state. It excludes the root stack resource (pulumi:pulumi:Stack) as it cannot be deleted. Returns the union of discrete selections and visual range, or just the cursor item if neither is active.

func (*ResourceList) GetTargetURNs

func (r *ResourceList) GetTargetURNs() []string

GetTargetURNs returns URNs flagged for --target

func (*ResourceList) HasDiscreteSelections added in v0.8.0

func (r *ResourceList) HasDiscreteSelections() bool

HasDiscreteSelections returns true if any items are discretely selected

func (*ResourceList) HasFlags

func (r *ResourceList) HasFlags() bool

HasFlags returns true if any resources have flags set

func (*ResourceList) IsDiscretelySelected added in v0.8.0

func (r *ResourceList) IsDiscretelySelected(urn string) bool

IsDiscretelySelected returns true if an item is discretely selected (via space key)

func (*ResourceList) ScrollPercent

func (r *ResourceList) ScrollPercent() float64

ScrollPercent returns the current scroll percentage (0-100)

func (*ResourceList) SelectedItem

func (r *ResourceList) SelectedItem() *ResourceItem

SelectedItem returns a pointer to the currently selected item, or nil if none

func (*ResourceList) SetItems

func (r *ResourceList) SetItems(items []ResourceItem)

SetItems replaces all items

func (*ResourceList) SetShowAllOps

func (r *ResourceList) SetShowAllOps(show bool)

SetShowAllOps sets whether to show all ops or filter out OpSame

func (*ResourceList) SetSize

func (r *ResourceList) SetSize(width, height int)

SetSize sets the dimensions for the list and ensures cursor is visible

func (*ResourceList) Summary

func (r *ResourceList) Summary() ResourceSummary

Summary returns the current summary

func (*ResourceList) TotalLines

func (r *ResourceList) TotalLines() int

TotalLines returns the total number of visible lines

func (*ResourceList) Update

func (r *ResourceList) Update(msg tea.Msg) tea.Cmd

Update handles key events and returns any commands

func (*ResourceList) UpdateItemStatus

func (r *ResourceList) UpdateItemStatus(urn string, status ItemStatus)

UpdateItemStatus updates the status of an item by URN

func (*ResourceList) View

func (r *ResourceList) View() string

View renders the resource list component

func (*ResourceList) VisibleCount

func (r *ResourceList) VisibleCount() int

VisibleCount returns the number of visible resources

func (*ResourceList) VisibleLines

func (r *ResourceList) VisibleLines() int

VisibleLines returns the number of lines that fit on screen

func (*ResourceList) VisualMode

func (r *ResourceList) VisualMode() bool

VisualMode returns whether visual selection mode is active

type ResourceOp

type ResourceOp = pulumi.ResourceOp

ResourceOp represents a resource operation type (create, update, delete, etc.)

type ResourceSummary

type ResourceSummary struct {
	Total   int
	Same    int // Only counted when showAllOps=true
	Create  int
	Update  int
	Delete  int
	Replace int
	Refresh int
}

ResourceSummary contains counts of each operation type

type ScrollIndicatorConfig

type ScrollIndicatorConfig struct {
	Padding       string // Padding before the arrow (default: "  ")
	IncludeMore   bool   // Whether to include "more" text after the arrow
	TrailingSpace bool   // Whether to reserve space when indicator is not shown (prevents layout jumps)
}

ScrollIndicatorConfig configures the scroll indicator rendering

func DefaultScrollConfig

func DefaultScrollConfig() ScrollIndicatorConfig

DefaultScrollConfig returns the default scroll indicator configuration

type ScrollableDialogContent

type ScrollableDialogContent struct {
	Title        string
	Content      string
	Footer       string
	MaxHeight    int // Maximum content height before scrolling kicks in
	ScrollOffset int // Current scroll position
	DialogWidth  int // Width of the dialog
}

ScrollableDialogContent holds parameters for rendering scrollable dialog content

type ScrollableDialogResult

type ScrollableDialogResult struct {
	Rendered        string // The fully rendered dialog
	NewScrollOffset int    // Adjusted scroll offset (clamped to valid range)
	TotalLines      int    // Total content lines
	VisibleLines    int    // Number of visible lines
	CanScroll       bool   // Whether scrolling is available
}

ScrollableDialogResult holds the result of rendering scrollable content

type SelectedResource added in v0.8.0

type SelectedResource struct {
	URN  string
	Name string
	Type string
}

SelectedResource represents a selected resource with its URN and name

type SelectorDialog

type SelectorDialog[T SelectorItem] struct {
	// contains filtered or unexported fields
}

SelectorDialog is a generic modal dialog for selecting an item from a list

func NewSelectorDialog

func NewSelectorDialog[T SelectorItem](title string) *SelectorDialog[T]

NewSelectorDialog creates a new selector dialog with the given title

func (*SelectorDialog[T]) HasItems

func (s *SelectorDialog[T]) HasItems() bool

HasItems returns whether any items are available

func (*SelectorDialog[T]) Hide

func (s *SelectorDialog[T]) Hide()

Hide hides the selector dialog

func (*SelectorDialog[T]) SelectedItem

func (s *SelectorDialog[T]) SelectedItem() *T

SelectedItem returns the currently selected item, or nil if none

func (*SelectorDialog[T]) SetEmptyText

func (s *SelectorDialog[T]) SetEmptyText(text string)

SetEmptyText sets the text shown when no items are available

func (*SelectorDialog[T]) SetError

func (s *SelectorDialog[T]) SetError(err error)

SetError sets an error state

func (*SelectorDialog[T]) SetExtraInfoRenderer

func (s *SelectorDialog[T]) SetExtraInfoRenderer(fn func(item T) string)

SetExtraInfoRenderer sets a function to render extra info after the item label

func (*SelectorDialog[T]) SetItemRenderer

func (s *SelectorDialog[T]) SetItemRenderer(fn func(item T, isCursor bool) string)

SetItemRenderer sets a custom item renderer function

func (*SelectorDialog[T]) SetItems

func (s *SelectorDialog[T]) SetItems(items []T)

SetItems sets the list of available items and positions cursor on current item

func (*SelectorDialog[T]) SetLoading

func (s *SelectorDialog[T]) SetLoading(loading bool)

SetLoading sets the loading state

func (*SelectorDialog[T]) SetLoadingText

func (s *SelectorDialog[T]) SetLoadingText(text string)

SetLoadingText sets the text shown while loading

func (*SelectorDialog[T]) SetMaxVisible

func (s *SelectorDialog[T]) SetMaxVisible(maxItems int)

SetMaxVisible sets the maximum number of visible items before scrolling

func (*SelectorDialog[T]) SetSize

func (s *SelectorDialog[T]) SetSize(width, height int)

SetSize sets the dialog dimensions for centering

func (*SelectorDialog[T]) SetTitle

func (s *SelectorDialog[T]) SetTitle(title string)

SetTitle sets the dialog title

func (*SelectorDialog[T]) Show

func (s *SelectorDialog[T]) Show()

Show shows the selector dialog

func (*SelectorDialog[T]) Update

func (s *SelectorDialog[T]) Update(msg tea.KeyMsg) (selected bool, cmd tea.Cmd)

Update handles key events and returns true if an item was selected

func (*SelectorDialog[T]) View

func (s *SelectorDialog[T]) View() string

View renders the selector dialog

func (*SelectorDialog[T]) Visible

func (s *SelectorDialog[T]) Visible() bool

Visible returns whether the selector is visible

type SelectorItem

type SelectorItem interface {
	// Label returns the display text for the item
	Label() string
	// IsCurrent returns true if this is the currently selected/active item
	IsCurrent() bool
}

SelectorItem is an interface for items that can be displayed in a SelectorDialog

type StackInitModal

type StackInitModal struct {
	*StepModal
	// contains filtered or unexported fields
}

StackInitModal wraps StepModal with stack initialization-specific logic

func NewStackInitModal

func NewStackInitModal() *StackInitModal

NewStackInitModal creates a new stack init modal

func (*StackInitModal) GetPassphrase

func (m *StackInitModal) GetPassphrase() string

GetPassphrase returns the entered passphrase

func (*StackInitModal) GetSecretsProvider

func (m *StackInitModal) GetSecretsProvider() string

GetSecretsProvider returns the selected/entered secrets provider

func (*StackInitModal) GetStackName

func (m *StackInitModal) GetStackName() string

GetStackName returns the selected/entered stack name

func (*StackInitModal) IsComplete

func (m *StackInitModal) IsComplete() bool

IsComplete returns true if all required steps have been completed

func (*StackInitModal) NeedsPassphrase

func (m *StackInitModal) NeedsPassphrase() bool

NeedsPassphrase returns true if the passphrase step should be shown

func (*StackInitModal) SetAuthEnv

func (m *StackInitModal) SetAuthEnv(env map[string]string)

SetAuthEnv sets the auth environment from plugins

func (*StackInitModal) SetBackendInfo

func (m *StackInitModal) SetBackendInfo(user, url string)

SetBackendInfo sets the backend connection information

func (*StackInitModal) SetStackFiles

func (m *StackInitModal) SetStackFiles(files []pulumi.StackFileInfo)

SetStackFiles sets the available stack files

func (*StackInitModal) ShouldSkipPassphrase

func (m *StackInitModal) ShouldSkipPassphrase() bool

ShouldSkipPassphrase returns true if we should skip the passphrase step

func (*StackInitModal) Show

func (m *StackInitModal) Show()

Show shows the modal and resets state

func (*StackInitModal) Update

func (m *StackInitModal) Update(msg tea.KeyMsg) (StepModalAction, tea.Cmd)

Update handles key events and manages step transitions

type StackItem

type StackItem struct {
	Name      string
	Current   bool
	IsNewItem bool        // Special flag for "create new stack" option
	Source    StackSource // Where the stack information comes from
}

StackItem represents a stack in the selector

func (StackItem) IsCurrent

func (s StackItem) IsCurrent() bool

IsCurrent implements SelectorItem

func (StackItem) Label

func (s StackItem) Label() string

Label implements SelectorItem

type StackSelector

type StackSelector struct {
	*SelectorDialog[StackItem]
	// contains filtered or unexported fields
}

StackSelector is a modal dialog for selecting a stack

func NewStackSelector

func NewStackSelector() *StackSelector

NewStackSelector creates a new stack selector

func (*StackSelector) HasStacks

func (s *StackSelector) HasStacks() bool

HasStacks returns whether any stacks are available

func (*StackSelector) IsNewStackSelected

func (s *StackSelector) IsNewStackSelected() bool

IsNewStackSelected returns true if the "new stack" option is selected

func (*StackSelector) SelectedStack

func (s *StackSelector) SelectedStack() string

SelectedStack returns the currently selected stack name Returns empty string if "new stack" option is selected

func (*StackSelector) SetShowNewOption

func (s *StackSelector) SetShowNewOption(show bool)

SetShowNewOption controls whether the "new stack" option is shown

func (*StackSelector) SetStacks

func (s *StackSelector) SetStacks(stacks []StackItem)

SetStacks sets the list of available stacks

func (*StackSelector) Update

func (s *StackSelector) Update(msg tea.KeyMsg) (selected bool, cmd tea.Cmd)

Update handles key events and returns true if a stack was selected

func (*StackSelector) View

func (s *StackSelector) View() string

View renders the stack selector dialog

type StackSource added in v0.5.1

type StackSource int

StackSource indicates where the stack information comes from

const (
	StackSourceBackend StackSource = iota // Stack exists in the backend
	StackSourceFile                       // Stack has a config file but may not exist in backend
)

type StepModal

type StepModal struct {
	ModalBase
	// contains filtered or unexported fields
}

StepModal is a multi-step modal dialog with navigation support

func NewStepModal

func NewStepModal(title string) *StepModal

NewStepModal creates a new step modal

func (*StepModal) ClearError

func (m *StepModal) ClearError()

ClearError clears any displayed error

func (*StepModal) CurrentStep

func (m *StepModal) CurrentStep() int

CurrentStep returns the current step index

func (*StepModal) GetResult

func (m *StepModal) GetResult(step int) string

GetResult returns the collected result for a specific step

func (*StepModal) IsLastStep

func (m *StepModal) IsLastStep() bool

IsLastStep returns true if on the final step

func (*StepModal) NextStep

func (m *StepModal) NextStep() bool

NextStep advances to the next step, saving the current result

func (*StepModal) PrevStep

func (m *StepModal) PrevStep() bool

PrevStep goes back to the previous step

func (*StepModal) SetError

func (m *StepModal) SetError(err error)

SetError sets an error to display

func (*StepModal) SetResult

func (m *StepModal) SetResult(step int, value string)

SetResult sets a result for a specific step (useful for pre-populating)

func (*StepModal) SetStepInfoLines

func (m *StepModal) SetStepInfoLines(step int, lines []InfoLine)

SetStepInfoLines sets info lines for a specific step

func (*StepModal) SetStepSuggestions

func (m *StepModal) SetStepSuggestions(step int, suggestions []StepSuggestion)

SetStepSuggestions sets suggestions for a specific step

func (*StepModal) SetStepWarning

func (m *StepModal) SetStepWarning(step int, warning string)

SetStepWarning sets a warning for a specific step

func (*StepModal) SetSteps

func (m *StepModal) SetSteps(steps []StepModalStep)

SetSteps configures the modal steps

func (*StepModal) Show

func (m *StepModal) Show()

Show shows the modal and resets to first step

func (*StepModal) Update

func (m *StepModal) Update(msg tea.KeyMsg) (StepModalAction, tea.Cmd)

Update handles key events and returns the action taken

func (*StepModal) View

func (m *StepModal) View() string

View renders the step modal

type StepModalAction

type StepModalAction int

StepModalAction represents an action taken by the user in a step modal

const (
	StepModalActionNone    StepModalAction = iota
	StepModalActionNext                    // Move to next step
	StepModalActionPrev                    // Move to previous step
	StepModalActionConfirm                 // Confirm final step
	StepModalActionCancel                  // Cancel the modal
)

type StepModalStep

type StepModalStep struct {
	Title            string
	InfoLines        []InfoLine       // Read-only info display at top
	Suggestions      []StepSuggestion // Selectable list items
	InputLabel       string           // Label for text input
	InputPlaceholder string
	Warning          string // Warning message (shown in yellow)
	FooterHints      string // Custom footer hints
	PasswordMode     bool   // Mask input like a password
}

StepModalStep defines the configuration for a single step in the modal

type StepSuggestion

type StepSuggestion struct {
	ID          string
	Label       string
	Description string
	Source      string // e.g., plugin name or "from Pulumi.dev.yaml"
	Warning     string // Per-item warning (e.g., "has existing encryption")
}

StepSuggestion represents a selectable suggestion item

type Toast

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

Toast is a temporary notification message

func NewToast

func NewToast() *Toast

NewToast creates a new toast component

func (*Toast) Hide

func (t *Toast) Hide()

Hide hides the toast

func (*Toast) Show

func (t *Toast) Show(message string) tea.Cmd

Show displays a toast message

func (*Toast) View

func (t *Toast) View(width int) string

View renders the toast

func (*Toast) Visible

func (t *Toast) Visible() bool

Visible returns whether the toast is visible

type ToastHideMsg

type ToastHideMsg struct{}

ToastHideMsg hides the toast after timeout

type ToastMsg

type ToastMsg struct {
	Message string
}

ToastMsg triggers showing a toast

type ViewMode

type ViewMode int

ViewMode represents the current view

const (
	ViewStack ViewMode = iota
	ViewPreview
	ViewExecute
	ViewHistory
)

func (ViewMode) String

func (v ViewMode) String() string

type WorkspaceItem

type WorkspaceItem struct {
	Path         string
	RelativePath string // Path relative to current working directory
	Name         string
	Current      bool
}

WorkspaceItem represents a workspace in the selector

func (WorkspaceItem) IsCurrent

func (w WorkspaceItem) IsCurrent() bool

IsCurrent implements SelectorItem

func (WorkspaceItem) Label

func (w WorkspaceItem) Label() string

Label implements SelectorItem

type WorkspaceSelector

type WorkspaceSelector struct {
	*SelectorDialog[WorkspaceItem]
}

WorkspaceSelector is a modal dialog for selecting a workspace

func NewWorkspaceSelector

func NewWorkspaceSelector() *WorkspaceSelector

NewWorkspaceSelector creates a new workspace selector

func (*WorkspaceSelector) HasWorkspaces

func (s *WorkspaceSelector) HasWorkspaces() bool

HasWorkspaces returns whether any workspaces are available

func (*WorkspaceSelector) SelectedWorkspace

func (s *WorkspaceSelector) SelectedWorkspace() *WorkspaceItem

SelectedWorkspace returns the currently selected workspace

func (*WorkspaceSelector) SetWorkspaces

func (s *WorkspaceSelector) SetWorkspaces(workspaces []WorkspaceItem)

SetWorkspaces sets the list of available workspaces

func (*WorkspaceSelector) Update

func (s *WorkspaceSelector) Update(msg tea.KeyMsg) (selected bool, cmd tea.Cmd)

Update handles key events and returns true if a workspace was selected

func (*WorkspaceSelector) View

func (s *WorkspaceSelector) View() string

View renders the workspace selector dialog

Jump to

Keyboard shortcuts

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