app

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HexWhite        = "#FFFFFF"
	HexBrightPurple = "#B198E5"
	HexBrightGreen  = "#3CCE92"

	DefaultWidth = 30
	ListHeight   = 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App is the main application struct that holds the items to be displayed

func NewApp

func NewApp(items []string, targetVar string) *App

NewApp initializes a new App instance with the provided items and target variable

func (*App) Run

func (a *App) Run() error

Run starts the Bubble Tea program with the items and target variable set in the App struct

type Item

type Item string

Item represents a single item in the list

func (Item) FilterValue

func (i Item) FilterValue() string

FilterValue returns the string representation of the item

type ItemDelegate

type ItemDelegate struct{}

ItemDelegate is a custom delegate for rendering items in the list

func NewItemDelegate

func NewItemDelegate() ItemDelegate

NewItemDelegate creates a new empty instance of ItemDelegate

func (ItemDelegate) Height

func (d ItemDelegate) Height() int

Height defines the height of the item in the list

func (ItemDelegate) Render

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

Render is the main rendering function for the item delegate. It determines how the item should be displayed based on its index.

func (ItemDelegate) Spacing

func (d ItemDelegate) Spacing() int

Spacing defines the spacing between items in the list

func (ItemDelegate) Update

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

Update is a no-op for the item delegate

type ListStyles

type ListStyles struct {
	Styles list.Styles
}

ListStyles holds the styles for the list (ItemDelegade) component

type Model

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

Model controls the state of the TUI application

func NewModel

func NewModel(l list.Model, target string) Model

NewModel creates a new instance of the Model with the provided list and target variable

func (Model) Init

func (m Model) Init() tea.Cmd

Init is a no-op for the model

func (Model) Update

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

Update processes messages and updates the model state

func (Model) View

func (m Model) View() string

View defines what the model should display and how to terminate the application based on user actions.

type RenderingStyles

type RenderingStyles struct {
	Item           lipgloss.Style
	SelectedItem   lipgloss.Style
	SelectedResult lipgloss.Style
	QuitText       lipgloss.Style
	PlainText      lipgloss.Style
	TargetType     lipgloss.Style
}

RenderingStyles holds the styles for rendering different components

type StyleSet

type StyleSet struct {
	Rendering RenderingStyles
	List      ListStyles
}

StyleSet is just a container for all the styles

func NewStyleSet

func NewStyleSet() *StyleSet

NewStyleSet creates a new StyleSet with default styles

Jump to

Keyboard shortcuts

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