ui

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlueprintLocalFilePicker

func BlueprintLocalFilePicker(styles *stylespkg.Styles) (filepicker.Model, error)

BlueprintLocalFilePicker creates a new filepicker model for selecting a local blueprint file relative to the current working directory.

func SafeWidth added in v0.1.2

func SafeWidth(width int) int

SafeWidth returns a safe width for separator lines, ensuring it's never negative.

func ToFullBlueprintPath

func ToFullBlueprintPath(blueprintFile, source string) string

ToFullBlueprintPath returns the full path to the blueprint file based on the source.

func ToFullFilePath added in v0.1.4

func ToFullFilePath(file, source string) string

ToFullFilePath returns the full path including the scheme for remote sources.

Types

type BluelinkListItem

type BluelinkListItem struct {
	Key   string
	Label string
	Desc  string
}

BluelinkListItem represents an item in a Bluelink list component.

func (BluelinkListItem) Description

func (i BluelinkListItem) Description() string

func (BluelinkListItem) FilterValue

func (i BluelinkListItem) FilterValue() string

func (BluelinkListItem) Title

func (i BluelinkListItem) Title() string

type ClearSelectedBlueprintMsg

type ClearSelectedBlueprintMsg struct{}

ClearSelectedBlueprintMsg is sent to clear the current blueprint selection.

type ClearSelectedFileMsg added in v0.1.4

type ClearSelectedFileMsg struct{}

ClearSelectedFileMsg is sent to clear the current selection.

type ItemDelegate

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

ItemDelegate renders list items using Bluelink styles.

func (ItemDelegate) Height

func (d ItemDelegate) Height() int

func (ItemDelegate) Render

func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item)

func (ItemDelegate) Spacing

func (d ItemDelegate) Spacing() int

func (ItemDelegate) Update

func (d ItemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd

type SelectBlueprintFileErrorMsg

type SelectBlueprintFileErrorMsg struct {
	Err error
}

SelectBlueprintFileErrorMsg is sent when there's an error during blueprint selection.

type SelectBlueprintModel

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

SelectBlueprintModel wraps SelectFileModel with blueprint-specific configuration.

func NewSelectBlueprint

func NewSelectBlueprint(
	blueprintFile string,
	autoSelect bool,
	action string,
	styles *stylespkg.Styles,
	fp *filepicker.Model,
) (*SelectBlueprintModel, error)

NewSelectBlueprint creates a new blueprint selection model.

func (SelectBlueprintModel) Init

func (m SelectBlueprintModel) Init() tea.Cmd

func (SelectBlueprintModel) SelectedFile added in v0.1.4

func (m SelectBlueprintModel) SelectedFile() string

SelectedFile returns the currently selected blueprint file path.

func (SelectBlueprintModel) SelectedSource added in v0.1.4

func (m SelectBlueprintModel) SelectedSource() string

SelectedSource returns the source type of the selected blueprint file.

func (SelectBlueprintModel) Update

func (m SelectBlueprintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectBlueprintModel) View

func (m SelectBlueprintModel) View() string

type SelectBlueprintMsg

type SelectBlueprintMsg struct {
	BlueprintFile string
	Source        string
}

SelectBlueprintMsg is sent when a blueprint file has been selected.

type SelectBlueprintSourceMsg

type SelectBlueprintSourceMsg struct {
	Source string
}

SelectBlueprintSourceMsg is sent when a blueprint source has been selected.

type SelectBlueprintStartMsg

type SelectBlueprintStartMsg struct {
	Selection string
}

SelectBlueprintStartMsg is sent when the user makes a selection at the start screen.

type SelectFileConfig added in v0.1.4

type SelectFileConfig struct {
	// InitialFile is the default file path or URL to pre-select.
	InitialFile string
	// AutoSelect automatically selects the initial file without user interaction.
	AutoSelect bool
	// Action is used in prompts (e.g., "import", "validate", "deploy").
	Action string
	// Styles provides theming for the UI components.
	Styles *stylespkg.Styles
	// FilePicker is the configured file picker for local file selection.
	FilePicker *filepicker.Model
	// FileTypeName is an optional descriptor for the file type (e.g., "blueprint", "state archive").
	// When set, it's interpolated into prompts like "Pick a blueprint file:".
	// If empty, generic "file" terminology is used.
	FileTypeName string
	// RemoteFileConfig provides configuration for remote file input.
	RemoteFileConfig *SelectRemoteFileConfig
	// SupportedSources specifies which file sources are available for selection.
	// If nil or empty, all sources are supported (Local, S3, GCS, Azure Blob, HTTPS).
	SupportedSources []string
}

SelectFileConfig holds configuration for the file selector.

type SelectFileErrorMsg added in v0.1.4

type SelectFileErrorMsg struct {
	Err error
}

SelectFileErrorMsg is sent when there's an error during file selection.

type SelectFileModel added in v0.1.4

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

SelectFileModel provides a generalized file selection interface that supports both local files and remote storage (S3, GCS, Azure Blob, HTTPS).

func NewSelectFile added in v0.1.4

func NewSelectFile(config SelectFileConfig) (*SelectFileModel, error)

NewSelectFile creates a new file selection model.

func (SelectFileModel) Init added in v0.1.4

func (m SelectFileModel) Init() tea.Cmd

func (SelectFileModel) SelectedFile added in v0.1.4

func (m SelectFileModel) SelectedFile() string

SelectedFile returns the currently selected file path.

func (SelectFileModel) SelectedSource added in v0.1.4

func (m SelectFileModel) SelectedSource() string

SelectedSource returns the source type of the selected file.

func (SelectFileModel) Update added in v0.1.4

func (m SelectFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectFileModel) View added in v0.1.4

func (m SelectFileModel) View() string

type SelectFileMsg added in v0.1.4

type SelectFileMsg struct {
	File   string
	Source string
}

SelectFileMsg is sent when a file has been selected.

type SelectFileSourceMsg added in v0.1.4

type SelectFileSourceMsg struct {
	Source string
}

SelectFileSourceMsg is sent when a source has been selected.

type SelectFileStartMsg added in v0.1.4

type SelectFileStartMsg struct {
	Selection string
}

SelectFileStartMsg is sent when the user makes a selection at the start screen.

type SelectLocalFileModel added in v0.1.4

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

SelectLocalFileModel provides a file picker for selecting local files.

func NewSelectLocalFile added in v0.1.4

func NewSelectLocalFile(
	fp *filepicker.Model,
	styles *stylespkg.Styles,
	prompt string,
	fileTypeName string,
) (*SelectLocalFileModel, error)

NewSelectLocalFile creates a new local file selection model.

func (SelectLocalFileModel) Init added in v0.1.4

func (m SelectLocalFileModel) Init() tea.Cmd

func (SelectLocalFileModel) Update added in v0.1.4

func (m SelectLocalFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectLocalFileModel) View added in v0.1.4

func (m SelectLocalFileModel) View() string

type SelectModel

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

func NewSelect

func NewSelect(
	title string,
	listItems []list.Item,
	styles *stylespkg.Styles,
	selectCommand func(string) tea.Cmd,
	enableFiltering bool,
) *SelectModel

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

func (SelectModel) Update

func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectModel) View

func (m SelectModel) View() string

type SelectRemoteFileConfig added in v0.1.4

type SelectRemoteFileConfig struct {
	// URLTitle is the title for the HTTPS URL input field.
	// Defaults to "HTTPS resource URL".
	URLTitle string
	// URLDescription is the description for the HTTPS URL input field.
	// Defaults to "The public URL of the file to download."
	URLDescription string
	// URLPlaceholder is the placeholder for the HTTPS URL input field.
	// Defaults to "https://assets.example.com/project.blueprint.yaml".
	URLPlaceholder string
	// BucketNameTitle overrides the bucket name title for a specific source.
	// Map keys are source constants (e.g., consts.FileSourceS3).
	BucketNameTitle map[string]string
	// BucketNameDescription overrides the bucket name description for a specific source.
	BucketNameDescription map[string]string
	// BucketNamePlaceholder overrides the bucket name placeholder for a specific source.
	BucketNamePlaceholder map[string]string
	// ObjectPathDescription overrides the object path description for a specific source.
	ObjectPathDescription map[string]string
}

SelectRemoteFileConfig holds configuration for remote file selection.

type SelectRemoteFileModel added in v0.1.4

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

SelectRemoteFileModel provides forms for selecting files from remote sources.

func NewSelectRemoteFile added in v0.1.4

func NewSelectRemoteFile(
	initialFile string,
	styles *stylespkg.Styles,
	config *SelectRemoteFileConfig,
) *SelectRemoteFileModel

NewSelectRemoteFile creates a new remote file selection model.

func (SelectRemoteFileModel) Init added in v0.1.4

func (m SelectRemoteFileModel) Init() tea.Cmd

func (SelectRemoteFileModel) Update added in v0.1.4

func (m SelectRemoteFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectRemoteFileModel) View added in v0.1.4

func (m SelectRemoteFileModel) View() string

type SelectWithPreviewModel

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

func NewSelectWithPreview

func NewSelectWithPreview(
	title string,
	listItems []list.Item,
	styles *stylespkg.Styles,
	selectCommand func(string) tea.Cmd,
	enableFiltering bool,
) *SelectWithPreviewModel

func (SelectWithPreviewModel) Init

func (m SelectWithPreviewModel) Init() tea.Cmd

func (SelectWithPreviewModel) Update

func (m SelectWithPreviewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectWithPreviewModel) View

func (m SelectWithPreviewModel) View() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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