components

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrightenColor

func BrightenColor(color lipgloss.Color, percent float64) lipgloss.Color

func CalcWidthHeight

func CalcWidthHeight(w, h int) (int, int)

func ComponentId

func ComponentId(comp *config.Component) string

func GetBorderStyle

func GetBorderStyle(borderStyles *config.BorderStyleConfig) (normal lipgloss.Style, focused lipgloss.Style, border lipgloss.Border)

func GetColor

func GetColor(configColor string, defaultColor lipgloss.Color) lipgloss.Color

func GetFlex

func GetFlex(flex int) int

func HexToAnsi256 added in v1.1.0

func HexToAnsi256(hex string, fallback byte) byte

HexToAnsi256 maps a hex color string to the closest ANSI-256 palette index (0-255), suitable for libraries like asciigraph that don't accept truecolor. Returns the supplied fallback when parsing fails.

func PaletteColor added in v1.1.0

func PaletteColor(styles *config.StyleConfig, role string, fallback lipgloss.Color) lipgloss.Color

PaletteColor returns the lipgloss.Color for a named role, falling back to `fallback` when the role is unset or the active style has no palette.

func PaletteHex added in v1.1.0

func PaletteHex(styles *config.StyleConfig, role, fallback string) string

PaletteHex returns the raw hex string for a named role, or fallback if unset.

func WrapContent

func WrapContent(content string, width int) string

Types

type ChartComponent

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

func (ChartComponent) ActionActive added in v1.1.0

func (b ChartComponent) ActionActive() bool

func (ChartComponent) ActionLoading added in v1.1.0

func (b ChartComponent) ActionLoading() bool

func (*ChartComponent) ApplyActionResult added in v1.1.0

func (c *ChartComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*ChartComponent) BeginAction added in v1.1.0

func (c *ChartComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (ChartComponent) Bindings added in v1.1.0

func (b ChartComponent) Bindings() []config.Binding

func (ChartComponent) Config

func (b ChartComponent) Config() *config.Component

func (ChartComponent) GetAddInput

func (b ChartComponent) GetAddInput() string

func (*ChartComponent) HandleAddMode

func (c *ChartComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (ChartComponent) ID

func (b ChartComponent) ID() string

func (ChartComponent) Init

func (b ChartComponent) Init() tea.Cmd

func (ChartComponent) IsFocusable

func (b ChartComponent) IsFocusable() bool

func (*ChartComponent) ResetAction added in v1.1.0

func (c *ChartComponent) ResetAction() (Component, tea.Cmd)

func (*ChartComponent) SetContent

func (c *ChartComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (ChartComponent) SupportsAdd

func (b ChartComponent) SupportsAdd() bool

func (ChartComponent) SupportsRefresh

func (b ChartComponent) SupportsRefresh() bool

func (ChartComponent) Type

func (b ChartComponent) Type() string

func (*ChartComponent) Update

func (c *ChartComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*ChartComponent) View

func (c *ChartComponent) View(w, h int, focused bool) string

type Component

type Component interface {
	ID() string
	Type() string
	IsFocusable() bool
	SupportsAdd() bool
	GetAddInput() string
	SupportsRefresh() bool
	Config() *config.Component

	Bindings() []config.Binding
	ActionActive() bool
	ActionLoading() bool

	BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)
	ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)
	ResetAction() (Component, tea.Cmd)

	Init() tea.Cmd
	View(w, h int, focused bool) string
	Update(msg tea.Msg) (Component, tea.Cmd)
	SetContent(result data.FetchOutput) (Component, tea.Cmd)
	HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)
}

func NewComponent

func NewComponent(cfg *config.Component, styles *config.StyleConfig) Component

type HistogramComponent

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

func (HistogramComponent) ActionActive added in v1.1.0

func (b HistogramComponent) ActionActive() bool

func (HistogramComponent) ActionLoading added in v1.1.0

func (b HistogramComponent) ActionLoading() bool

func (*HistogramComponent) ApplyActionResult added in v1.1.0

func (c *HistogramComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*HistogramComponent) BeginAction added in v1.1.0

func (c *HistogramComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (HistogramComponent) Bindings added in v1.1.0

func (b HistogramComponent) Bindings() []config.Binding

func (HistogramComponent) Config

func (b HistogramComponent) Config() *config.Component

func (HistogramComponent) GetAddInput

func (b HistogramComponent) GetAddInput() string

func (*HistogramComponent) HandleAddMode

func (c *HistogramComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (HistogramComponent) ID

func (b HistogramComponent) ID() string

func (HistogramComponent) Init

func (b HistogramComponent) Init() tea.Cmd

func (HistogramComponent) IsFocusable

func (b HistogramComponent) IsFocusable() bool

func (*HistogramComponent) ResetAction added in v1.1.0

func (c *HistogramComponent) ResetAction() (Component, tea.Cmd)

func (*HistogramComponent) SetContent

func (c *HistogramComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (HistogramComponent) SupportsAdd

func (b HistogramComponent) SupportsAdd() bool

func (HistogramComponent) SupportsRefresh

func (b HistogramComponent) SupportsRefresh() bool

func (HistogramComponent) Type

func (b HistogramComponent) Type() string

func (*HistogramComponent) Update

func (c *HistogramComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*HistogramComponent) View

func (c *HistogramComponent) View(w, h int, focused bool) string

type ListComponent

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

func (ListComponent) ActionActive added in v1.1.0

func (b ListComponent) ActionActive() bool

func (ListComponent) ActionLoading added in v1.1.0

func (b ListComponent) ActionLoading() bool

func (*ListComponent) ApplyActionResult added in v1.1.0

func (c *ListComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*ListComponent) BeginAction added in v1.1.0

func (c *ListComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (ListComponent) Bindings added in v1.1.0

func (b ListComponent) Bindings() []config.Binding

func (ListComponent) Config

func (b ListComponent) Config() *config.Component

func (ListComponent) GetAddInput

func (b ListComponent) GetAddInput() string

func (*ListComponent) HandleAddMode

func (c *ListComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (ListComponent) ID

func (b ListComponent) ID() string

func (ListComponent) Init

func (b ListComponent) Init() tea.Cmd

func (ListComponent) IsFocusable

func (b ListComponent) IsFocusable() bool

func (*ListComponent) ResetAction added in v1.1.0

func (c *ListComponent) ResetAction() (Component, tea.Cmd)

func (*ListComponent) SetContent

func (c *ListComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (ListComponent) SupportsAdd

func (b ListComponent) SupportsAdd() bool

func (ListComponent) SupportsRefresh

func (b ListComponent) SupportsRefresh() bool

func (ListComponent) Type

func (b ListComponent) Type() string

func (*ListComponent) Update

func (c *ListComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*ListComponent) View

func (c *ListComponent) View(w, h int, focused bool) string

type ListItem

type ListItem struct {
	Val string
}

func (ListItem) Description

func (i ListItem) Description() string

func (ListItem) FilterValue

func (i ListItem) FilterValue() string

func (ListItem) Title

func (i ListItem) Title() string

type TableComponent

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

func (TableComponent) ActionActive added in v1.1.0

func (b TableComponent) ActionActive() bool

func (TableComponent) ActionLoading added in v1.1.0

func (b TableComponent) ActionLoading() bool

func (*TableComponent) ApplyActionResult added in v1.1.0

func (c *TableComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*TableComponent) BeginAction added in v1.1.0

func (c *TableComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (TableComponent) Bindings added in v1.1.0

func (b TableComponent) Bindings() []config.Binding

func (TableComponent) Config

func (b TableComponent) Config() *config.Component

func (TableComponent) GetAddInput

func (b TableComponent) GetAddInput() string

func (*TableComponent) HandleAddMode

func (c *TableComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (TableComponent) ID

func (b TableComponent) ID() string

func (TableComponent) Init

func (b TableComponent) Init() tea.Cmd

func (TableComponent) IsFocusable

func (b TableComponent) IsFocusable() bool

func (*TableComponent) ResetAction added in v1.1.0

func (c *TableComponent) ResetAction() (Component, tea.Cmd)

func (*TableComponent) SetContent

func (c *TableComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (TableComponent) SupportsAdd

func (b TableComponent) SupportsAdd() bool

func (TableComponent) SupportsRefresh

func (b TableComponent) SupportsRefresh() bool

func (TableComponent) Type

func (b TableComponent) Type() string

func (*TableComponent) Update

func (c *TableComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*TableComponent) View

func (c *TableComponent) View(w, h int, focused bool) string

type TextComponent

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

func (TextComponent) ActionActive added in v1.1.0

func (b TextComponent) ActionActive() bool

func (TextComponent) ActionLoading added in v1.1.0

func (b TextComponent) ActionLoading() bool

func (*TextComponent) ApplyActionResult added in v1.1.0

func (c *TextComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*TextComponent) BeginAction added in v1.1.0

func (c *TextComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (TextComponent) Bindings added in v1.1.0

func (b TextComponent) Bindings() []config.Binding

func (TextComponent) Config

func (b TextComponent) Config() *config.Component

func (TextComponent) GetAddInput

func (b TextComponent) GetAddInput() string

func (*TextComponent) HandleAddMode

func (c *TextComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (TextComponent) ID

func (b TextComponent) ID() string

func (TextComponent) Init

func (b TextComponent) Init() tea.Cmd

func (TextComponent) IsFocusable

func (b TextComponent) IsFocusable() bool

func (*TextComponent) ResetAction added in v1.1.0

func (c *TextComponent) ResetAction() (Component, tea.Cmd)

func (*TextComponent) SetContent

func (c *TextComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (TextComponent) SupportsAdd

func (b TextComponent) SupportsAdd() bool

func (TextComponent) SupportsRefresh

func (b TextComponent) SupportsRefresh() bool

func (TextComponent) Type

func (b TextComponent) Type() string

func (*TextComponent) Update

func (c *TextComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*TextComponent) View

func (c *TextComponent) View(w, h int, focused bool) string

type TodoComponent

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

func (TodoComponent) ActionActive added in v1.1.0

func (b TodoComponent) ActionActive() bool

func (TodoComponent) ActionLoading added in v1.1.0

func (b TodoComponent) ActionLoading() bool

func (*TodoComponent) ApplyActionResult added in v1.1.0

func (c *TodoComponent) ApplyActionResult(pendingID, out, outputAs string) (Component, tea.Cmd)

func (*TodoComponent) BeginAction added in v1.1.0

func (c *TodoComponent) BeginAction(label, outputAs, pendingID string) (Component, tea.Cmd)

func (TodoComponent) Bindings added in v1.1.0

func (b TodoComponent) Bindings() []config.Binding

func (TodoComponent) Config

func (b TodoComponent) Config() *config.Component

func (*TodoComponent) GetAddInput

func (c *TodoComponent) GetAddInput() string

func (*TodoComponent) HandleAddMode

func (c *TodoComponent) HandleAddMode(msg tea.KeyMsg) (Component, bool, tea.Cmd)

func (TodoComponent) ID

func (b TodoComponent) ID() string

func (TodoComponent) Init

func (b TodoComponent) Init() tea.Cmd

func (TodoComponent) IsFocusable

func (b TodoComponent) IsFocusable() bool

func (*TodoComponent) ResetAction added in v1.1.0

func (c *TodoComponent) ResetAction() (Component, tea.Cmd)

func (*TodoComponent) SetContent

func (c *TodoComponent) SetContent(result data.FetchOutput) (Component, tea.Cmd)

func (*TodoComponent) SupportsAdd

func (c *TodoComponent) SupportsAdd() bool

func (TodoComponent) SupportsRefresh

func (b TodoComponent) SupportsRefresh() bool

func (TodoComponent) Type

func (b TodoComponent) Type() string

func (*TodoComponent) Update

func (c *TodoComponent) Update(msg tea.Msg) (Component, tea.Cmd)

func (*TodoComponent) View

func (c *TodoComponent) View(w, h int, focused bool) string

type TodoFetchOutput

type TodoFetchOutput struct {
	Err       error
	TodoItems []*data.TodoOutput
}

func (*TodoFetchOutput) Error

func (t *TodoFetchOutput) Error() error

func (*TodoFetchOutput) Items

func (t *TodoFetchOutput) Items() []*data.TodoOutput

func (*TodoFetchOutput) Output

func (t *TodoFetchOutput) Output() string

type TodoListItem

type TodoListItem struct {
	*data.TodoOutput
	Index int
	// contains filtered or unexported fields
}

func (TodoListItem) Description

func (i TodoListItem) Description() string

func (TodoListItem) FilterValue

func (i TodoListItem) FilterValue() string

func (TodoListItem) Title

func (i TodoListItem) Title() string

Jump to

Keyboard shortcuts

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