bubbles

package
v0.19.821 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Neutral colors - use terminal's default colors
	BorderColor = styles.BorderInactiveColor

	// Base styles
	BaseStyle = lipgloss.NewStyle().
				Padding(0, 1)

	// Status message styles
	InfoStyle = lipgloss.NewStyle().
				Foreground(styles.InfoColor).
				Bold(true).
				Padding(0, 1)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(styles.ErrorColor).
				Bold(true).
				Padding(0, 1)

	WarningStyle = lipgloss.NewStyle().
					Foreground(styles.WarningColor).
					Bold(true).
					Padding(0, 1)

	SuccessStyle = lipgloss.NewStyle().
					Foreground(styles.SuccessColor).
					Bold(true).
					Padding(0, 1)

	// Interactive styles
	FocusedStyle = lipgloss.NewStyle().
					Foreground(styles.PrimaryColor).
					Bold(true)

	BlurredStyle = lipgloss.NewStyle().
					Foreground(styles.SubtleColor)

	// Border styles: padded but border-less
	BorderStyle = lipgloss.NewStyle().
				Padding(1)

	FocusedBorderStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(styles.PrimaryColor).
						Padding(1, 2)
)

Common styles and colors for consistent theming Using ANSI colors to respect terminal color schemes

View Source
var (
	EvaluationHeaderStyle = lipgloss.NewStyle().
							Foreground(styles.AccentColor).
							Bold(true).
							Underline(true).
							Margin(1, 0)

	EvaluationTipStyle = lipgloss.NewStyle().
						Foreground(styles.InfoColor).
						Italic(true).
						Padding(0, 1)
)

Evaluation journey specific styling

Functions

func ColoredText

func ColoredText(text, color string) string

ColoredText returns text styled with the given hex color.

func Confirm

func Confirm(prompt string, interactive bool) (bool, error)

Confirm shows a yes/no confirmation dialog

func ConfirmWithDefault

func ConfirmWithDefault(prompt string, defaultYes, interactive bool) (bool, error)

ConfirmWithDefault shows a confirmation with a default choice

func DetectUserJourney

func DetectUserJourney(orgName string, userData map[string]interface{}) string

Helper function to detect user journey from org or other data

func EvaluationConfirm

func EvaluationConfirm(prompt string, interactive bool) (bool, error)

EvaluationConfirm shows a confirmation with evaluation journey styling

func Green

func Green(text string) string

func ParseOrgSelection

func ParseOrgSelection(selection string) (name, id string)

func PromptWithAutoApprove

func PromptWithAutoApprove(autoApprove, interactive bool, msg string, vars ...interface{}) error

PromptWithAutoApprove prompts for confirmation unless auto-approved or non-interactive

func Red

func Red(text string) string

func RenderMarkdownTable

func RenderMarkdownTable(headers []string, rows [][]string) string

RenderMarkdown renders a simple markdown-like table

func RunOnboarding

func RunOnboarding(userJourney string, interactive bool) error

RunOnboarding runs the onboarding flow. When interactive is false, it prints a simplified checklist to stdout.

func RunSpinnerWithContext

func RunSpinnerWithContext(ctx context.Context, message string, operation func(ctx context.Context) error, json, interactive bool) error

RunSpinnerWithContext runs a spinner for the duration of a context operation

func SelectApp

func SelectApp(apps []AppOption, interactive bool) (string, error)

func SelectFromItems

func SelectFromItems(title string, items []SelectorItem, interactive bool) (string, error)

func SelectFromItemsWithMaxRows

func SelectFromItemsWithMaxRows(title string, items []SelectorItem, maxVisibleRows int, interactive bool) (string, error)

func SelectFromOptions

func SelectFromOptions(title string, options []string, interactive bool) (string, error)

func SelectFromOptionsWithMaxRows

func SelectFromOptionsWithMaxRows(title string, options []string, maxVisibleRows int, interactive bool) (string, error)

func SelectInstall

func SelectInstall(installs []InstallOption, interactive bool) (string, error)

func SelectOrg

func SelectOrg(orgs []OrgOption, searchFn func(string) ([]OrgOption, error), interactive bool) (string, error)

func SelectWorkflow

func SelectWorkflow(workflows []WorkflowOption, interactive bool) (string, error)

func ShowConfirmDialog

func ShowConfirmDialog(message string, interactive bool) (bool, error)

Show displays the confirmation dialog and returns the result This provides a pterm-compatible API for easy migration

func ShowEvaluationWelcome

func ShowEvaluationWelcome()

ShowEvaluationWelcome displays the evaluation welcome message

func Yellow

func Yellow(text string) string

Types

type AppOption

type AppOption struct {
	ID   string
	Name string
}

type ConfirmDialogModel

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

ConfirmDialogModel represents an interactive confirmation dialog

func NewConfirmDialog

func NewConfirmDialog(message string) ConfirmDialogModel

NewConfirmDialog creates a new confirmation dialog

func (ConfirmDialogModel) Init

func (m ConfirmDialogModel) Init() tea.Cmd

Init initializes the confirmation dialog

func (ConfirmDialogModel) Result

func (m ConfirmDialogModel) Result() (bool, bool)

Result returns whether the dialog was confirmed

func (ConfirmDialogModel) Update

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

Update handles messages for the confirmation dialog

func (ConfirmDialogModel) View

func (m ConfirmDialogModel) View() tea.View

View renders the confirmation dialog

type ConfirmModel

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

ConfirmModel represents a yes/no confirmation dialog

func NewConfirmModel

func NewConfirmModel(prompt string) ConfirmModel

NewConfirmModel creates a new confirmation model

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

Init initializes the confirmation model

func (ConfirmModel) Result

func (m ConfirmModel) Result() bool

Result returns the confirmation result

func (ConfirmModel) Selected

func (m ConfirmModel) Selected() bool

Selected returns whether a choice was made

func (ConfirmModel) Update

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

Update handles messages for the confirmation model

func (ConfirmModel) View

func (m ConfirmModel) View() tea.View

View renders the confirmation dialog

type FinalRenderMsg

type FinalRenderMsg struct{}

FinalRenderMsg is used to trigger a final render before quitting

type InstallOption

type InstallOption struct {
	ID   string
	Name string
}

type MultiSpinnerModel

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

MultiSpinnerModel manages multiple concurrent spinners

func NewMultiSpinner

func NewMultiSpinner() MultiSpinnerModel

NewMultiSpinner creates a new multi-spinner model

func (*MultiSpinnerModel) AddSpinner

func (m *MultiSpinnerModel) AddSpinner(id, message string)

AddSpinner adds a new spinner to the collection

func (MultiSpinnerModel) AllCompleted

func (m MultiSpinnerModel) AllCompleted() bool

AllCompleted checks if all spinners are completed

func (MultiSpinnerModel) HasErrors

func (m MultiSpinnerModel) HasErrors() bool

HasErrors checks if any spinners completed with errors

func (MultiSpinnerModel) Init

func (m MultiSpinnerModel) Init() tea.Cmd

Init initializes all spinners

func (MultiSpinnerModel) Update

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

Update handles messages for all spinners

func (MultiSpinnerModel) View

func (m MultiSpinnerModel) View() tea.View

View renders all spinners

type MultiSpinnerView

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

MultiSpinnerView provides a high-level interface for managing multiple spinners

func NewMultiSpinnerView

func NewMultiSpinnerView(interactive bool) *MultiSpinnerView

NewMultiSpinnerView creates a new multi-spinner view

func (*MultiSpinnerView) AddSpinner

func (v *MultiSpinnerView) AddSpinner(id, message string)

AddSpinner adds a new spinner

func (*MultiSpinnerView) AllCompleted

func (v *MultiSpinnerView) AllCompleted() bool

AllCompleted checks if all spinners are completed

func (*MultiSpinnerView) CompleteSpinner

func (v *MultiSpinnerView) CompleteSpinner(id string, success bool, finalMsg string)

CompleteSpinner marks a spinner as completed

func (*MultiSpinnerView) HasErrors

func (v *MultiSpinnerView) HasErrors() bool

HasErrors checks if any spinners completed with errors

func (*MultiSpinnerView) Start

func (v *MultiSpinnerView) Start()

Start begins the multi-spinner display

func (*MultiSpinnerView) Stop

func (v *MultiSpinnerView) Stop()

Stop stops the multi-spinner display

func (*MultiSpinnerView) UpdateSpinner

func (v *MultiSpinnerView) UpdateSpinner(id, message string)

UpdateSpinner updates a spinner's message

func (*MultiSpinnerView) Wait

func (v *MultiSpinnerView) Wait()

Wait waits for all spinners to complete

type OnboardingModel

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

OnboardingModel represents the onboarding flow

func NewOnboardingModel

func NewOnboardingModel(userJourney string) OnboardingModel

NewOnboardingModel creates a new onboarding model

func (OnboardingModel) Init

func (m OnboardingModel) Init() tea.Cmd

Init initializes the onboarding model

func (OnboardingModel) Update

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

Update handles messages for the onboarding model

func (OnboardingModel) View

func (m OnboardingModel) View() tea.View

View renders the onboarding interface

type OnboardingStep

type OnboardingStep struct {
	Title       string
	Description string
	Action      string
	Completed   bool
}

OnboardingStep represents a single step in the onboarding flow

type OrgOption

type OrgOption struct {
	ID           string
	Name         string
	IsEvaluation bool
}

type RenderCompleteMsg

type RenderCompleteMsg struct{}

RenderCompleteMsg is used to tell bubbletea that the final render is complete TODO(ja): lol wtf

type SelectorItem

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

SelectorItem represents an item in the selector list

func (SelectorItem) Description

func (i SelectorItem) Description() string

func (SelectorItem) FilterValue

func (i SelectorItem) FilterValue() string

Implement list.Item interface

func (SelectorItem) IsEvaluation

func (i SelectorItem) IsEvaluation() bool

func (SelectorItem) Title

func (i SelectorItem) Title() string

func (SelectorItem) Value

func (i SelectorItem) Value() string

type SelectorModel

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

SelectorModel represents the list selection component

func NewSelectorModel

func NewSelectorModel(title string, items []SelectorItem) SelectorModel

NewSelectorModel creates a new selector model

func NewSelectorModelWithMaxRows

func NewSelectorModelWithMaxRows(title string, items []SelectorItem, maxVisibleRows int) SelectorModel

NewSelectorModelWithMaxRows creates a new selector model with a specific max visible rows

func (SelectorModel) Choice

func (m SelectorModel) Choice() string

Choice returns the selected choice value

func (SelectorModel) Init

func (m SelectorModel) Init() tea.Cmd

Init initializes the selector model

func (SelectorModel) Selected

func (m SelectorModel) Selected() bool

Selected returns whether a choice was made

func (SelectorModel) Update

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

Update handles messages for the selector model

func (SelectorModel) View

func (m SelectorModel) View() tea.View

View renders the selector

type SpinnerCompleteMsg

type SpinnerCompleteMsg struct {
	ID       string
	Success  bool
	FinalMsg string
}

SpinnerCompleteMsg is used to mark spinners as completed

type SpinnerModel

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

SpinnerModel represents a spinner with status and message handling

func NewSpinnerModel

func NewSpinnerModel(json bool) SpinnerModel

NewSpinnerModel creates a new spinner model

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model

func (SpinnerModel) Update

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

Update handles messages for the spinner model

func (SpinnerModel) View

func (m SpinnerModel) View() tea.View

View renders the spinner

type SpinnerMsg

type SpinnerMsg string

SpinnerMsg is used to update the spinner message

type SpinnerResult

type SpinnerResult struct {
	Success bool
	Message string
	Error   error
}

SpinnerResult represents the final state of a spinner operation

type SpinnerResultMsg

type SpinnerResultMsg SpinnerResult

SpinnerResultMsg is used to set the final result

type SpinnerState

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

SpinnerState represents the state of an individual spinner

type SpinnerUpdateMsg

type SpinnerUpdateMsg struct {
	ID      string
	Message string
}

SpinnerUpdateMsg is used to update spinner messages

type SpinnerView

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

SpinnerView provides a high-level interface similar to the original spinner_view

func NewSpinnerView

func NewSpinnerView(json, interactive bool) *SpinnerView

NewSpinnerView creates a new spinner view

func (*SpinnerView) Fail

func (v *SpinnerView) Fail(err error)

Fail completes the spinner with an error message

func (*SpinnerView) Start

func (v *SpinnerView) Start(text string)

Start begins the spinner with the given message

func (*SpinnerView) Success

func (v *SpinnerView) Success(text string)

Success completes the spinner with a success message

func (*SpinnerView) Update

func (v *SpinnerView) Update(text string)

Update changes the spinner message

type TableModel

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

TableModel represents a data table component

func NewInteractiveTableModel

func NewInteractiveTableModel(data [][]string) TableModel

NewInteractiveTableModel creates a new interactive table model

func NewTableModel

func NewTableModel(data [][]string) TableModel

NewTableModel creates a new table model

func (TableModel) Init

func (m TableModel) Init() tea.Cmd

Init initializes the table model

func (TableModel) Update

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

Update handles messages for the table model

func (TableModel) View

func (m TableModel) View() tea.View

View renders the table

type TableView

type TableView struct{}

TableView provides a high-level interface for rendering tables

func NewTableView

func NewTableView() *TableView

NewTableView creates a new table view

func (*TableView) Print

func (v *TableView) Print(msg string)

Print displays a simple message

func (*TableView) Render

func (v *TableView) Render(data [][]string)

Render displays a table with the given data

func (*TableView) RenderInteractive

func (v *TableView) RenderInteractive(data [][]string, interactive bool) error

RenderInteractive displays an interactive table that users can navigate. When interactive is false, it falls back to rendering a static table.

func (*TableView) RenderKeyValue

func (v *TableView) RenderKeyValue(pairs map[string]string)

RenderKeyValue renders key-value pairs in a table format

func (*TableView) RenderPaging

func (v *TableView) RenderPaging(data [][]string, offset, limit int, hasMore bool)

RenderPaging displays a table with pagination information

type WorkflowOption

type WorkflowOption struct {
	ID     string
	Name   string
	Type   string
	Status string
}

Jump to

Keyboard shortcuts

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