builders

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package builders provides UI component builders for WhaleTUI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDetailsView

func CreateDetailsView(
	title, details string,
	actions map[rune]string,
	onAction func(rune),
	onBack func(),
) *tview.Flex

CreateDetailsView is an exported function for backward compatibility

func CreateInspectDetailsView

func CreateInspectDetailsView(
	title string,
	inspectData map[string]any,
	actions map[rune]string,
	onAction func(rune),
	onBack func(),
) *tview.Flex

CreateInspectDetailsView is an exported function for backward compatibility

func CreateInspectView

func CreateInspectView(title string) (*tview.TextView, *tview.Flex)

CreateInspectView is an exported function for backward compatibility

func FormatTime

func FormatTime(t time.Time) string

FormatTime formats a time.Time to a human-readable string

Types

type ComponentBuilder

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

ComponentBuilder provides methods to create consistent UI components

func NewComponentBuilder

func NewComponentBuilder() *ComponentBuilder

NewComponentBuilder creates a new component builder

func NewComponentBuilderWithTheme

func NewComponentBuilderWithTheme(themeManager *config.ThemeManager) *ComponentBuilder

NewComponentBuilderWithTheme creates a new component builder with theme support

func (*ComponentBuilder) CreateBorderedTextView

func (cb *ComponentBuilder) CreateBorderedTextView(
	text, title string,
	color tcell.Color,
) *tview.TextView

CreateBorderedTextView creates a bordered text view with consistent styling

func (*ComponentBuilder) CreateButton

func (cb *ComponentBuilder) CreateButton(text string, onSelected func()) *tview.Button

CreateButton creates a button with consistent styling

func (*ComponentBuilder) CreateFlex

func (cb *ComponentBuilder) CreateFlex(direction int) *tview.Flex

CreateFlex creates a flex container with consistent styling

func (*ComponentBuilder) CreateInputField

func (cb *ComponentBuilder) CreateInputField(label string) *tview.InputField

CreateInputField creates an input field with consistent styling

func (*ComponentBuilder) CreateTable

func (cb *ComponentBuilder) CreateTable() *tview.Table

CreateTable creates a table with consistent styling

func (*ComponentBuilder) CreateTextView

func (cb *ComponentBuilder) CreateTextView(
	text string,
	align int,
	color tcell.Color,
) *tview.TextView

CreateTextView creates a text view with consistent styling

type DetailsViewBuilder

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

DetailsViewBuilder creates details views with consistent styling

func NewDetailsViewBuilder

func NewDetailsViewBuilder() *DetailsViewBuilder

NewDetailsViewBuilder creates a new details view builder

func (*DetailsViewBuilder) CreateDetailsView

func (dvb *DetailsViewBuilder) CreateDetailsView(
	title, details string,
	actions map[rune]string,
	onAction func(rune),
	onBack func(),
) *tview.Flex

CreateDetailsView creates a details view that can be displayed inline

type TableBuilder

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

TableBuilder provides methods to create and configure tables

func NewTableBuilder

func NewTableBuilder() *TableBuilder

NewTableBuilder creates a new table builder

func (*TableBuilder) CreateTable

func (tb *TableBuilder) CreateTable() *tview.Table

CreateTable creates a new table with consistent styling

func (*TableBuilder) SetupHeaders

func (tb *TableBuilder) SetupHeaders(table *tview.Table, headers []string)

SetupHeaders sets up table headers with consistent styling

func (*TableBuilder) SetupHeadersWithConfig added in v0.4.0

func (tb *TableBuilder) SetupHeadersWithConfig(
	table *tview.Table,
	headers []string,
	columnTypes []string,
	formatter *utils.TableFormatter,
)

SetupHeadersWithConfig sets up table headers with column configuration

func (*TableBuilder) SetupHeadersWithConfigForView added in v0.4.0

func (tb *TableBuilder) SetupHeadersWithConfigForView(
	table *tview.Table,
	headers []string,
	columnTypes []string,
	formatter *utils.TableFormatter,
	viewName string,
)

SetupHeadersWithConfigForView sets up table headers with view-specific column configuration

func (*TableBuilder) SetupHeadersWithConfigForViewWithTerminalSize added in v0.4.0

func (tb *TableBuilder) SetupHeadersWithConfigForViewWithTerminalSize(
	table *tview.Table,
	headers []string,
	columnTypes []string,
	formatter *utils.TableFormatter,
	viewName string,
	terminalWidth int,
)

SetupHeadersWithConfigForViewWithTerminalSize sets up table headers with view-specific column configuration with a given terminal width for percentage-based width calculations

func (*TableBuilder) SetupRow

func (tb *TableBuilder) SetupRow(
	table *tview.Table,
	row int,
	cells []string,
	textColor tcell.Color,
)

SetupRow sets up a table row with consistent styling

func (*TableBuilder) SetupRowWithAlignment added in v0.4.0

func (tb *TableBuilder) SetupRowWithAlignment(
	table *tview.Table,
	row int,
	cells []string,
	columnTypes []string,
	textColor tcell.Color,
	formatter *utils.TableFormatter,
)

SetupRowWithAlignment sets up a table row with alignment based on column types

func (*TableBuilder) SetupRowWithLimits added in v0.3.0

func (tb *TableBuilder) SetupRowWithLimits(
	table *tview.Table,
	row int,
	cells []string,
	columnTypes []string,
	textColor tcell.Color,
	formatter *utils.TableFormatter,
)

SetupRowWithLimits sets up a table row with character limits and alignment applied

func (*TableBuilder) SetupRowWithLimitsForView added in v0.4.0

func (tb *TableBuilder) SetupRowWithLimitsForView(
	table *tview.Table,
	row int,
	cells []string,
	columnTypes []string,
	textColor tcell.Color,
	formatter *utils.TableFormatter,
	viewName string,
)

SetupRowWithLimitsForView sets up a table row with view-specific character limits and alignment applied

func (*TableBuilder) SetupRowWithLimitsForViewWithTerminalSize added in v0.4.0

func (tb *TableBuilder) SetupRowWithLimitsForViewWithTerminalSize(
	table *tview.Table,
	row int,
	cells []string,
	columnTypes []string,
	textColor tcell.Color,
	formatter *utils.TableFormatter,
	viewName string,
	terminalWidth int,
)

SetupRowWithLimitsForViewWithTerminalSize sets up a table row with view-specific character limits and alignment applied with a given terminal width for percentage-based width calculations

type ViewBuilder

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

ViewBuilder provides methods to create views

func NewViewBuilder

func NewViewBuilder() *ViewBuilder

NewViewBuilder creates a new view builder

func (*ViewBuilder) CreateView

func (vb *ViewBuilder) CreateView() *tview.Flex

CreateView creates a new view with consistent setup

Jump to

Keyboard shortcuts

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