components

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinLeftPanelWidth  = 45
	MinRightPanelWidth = 40
)
View Source
const (
	// Slightly wider than the minimum width for
	// horizontal layout for test execution view
	TestViewMinRecommendedWidth  = 150
	TestViewMinRecommendedHeight = 40

	// Below this, show warning overlay
	TestViewAbsoluteMinWidth  = 60
	TestViewAbsoluteMinHeight = 25
)
View Source
const (
	ListViewMinRecommendedWidth  = 140
	ListViewMinRecommendedHeight = 20

	// Below this, show warning overlay
	ListViewAbsoluteMinWidth  = 55
	ListViewAbsoluteMinHeight = 15
)

Variables

This section is empty.

Functions

func Footer(width int, helpText string) string

func RenderScrollbar

func RenderScrollbar(height, totalLines, scrollOffset int) string

RenderScrollbar renders a vertical scrollbar given the visible height, total content lines, and current scroll offset.

func Title

func Title(width int, text string) string

Types

type ContentPanel

type ContentPanel struct {

	// Configuration
	EmptyLineAfterTitle bool
	// contains filtered or unexported fields
}

ContentPanel is a scrollable panel with text selection support

func NewContentPanel

func NewContentPanel() *ContentPanel

NewContentPanel creates a new content panel

func (*ContentPanel) ClearSelection

func (cp *ContentPanel) ClearSelection()

ClearSelection clears the current selection

func (*ContentPanel) CopyText

func (cp *ContentPanel) CopyText(text string) tea.Cmd

CopyText copies the given text to clipboard and shows the "[copied]" indicator. Returns a tea.Cmd to reset the indicator after a timeout.

func (*ContentPanel) GetRawContent

func (cp *ContentPanel) GetRawContent() string

GetRawContent returns the raw content without ANSI codes

func (*ContentPanel) GetSelectedText

func (cp *ContentPanel) GetSelectedText() string

GetSelectedText returns the currently selected text

func (*ContentPanel) GetViewportWidth

func (cp *ContentPanel) GetViewportWidth() int

GetViewportWidth returns the viewport width

func (*ContentPanel) GotoBottom

func (cp *ContentPanel) GotoBottom()

GotoBottom scrolls to the bottom

func (*ContentPanel) GotoTop

func (cp *ContentPanel) GotoTop()

GotoTop scrolls to the top

func (*ContentPanel) HalfPageDown

func (cp *ContentPanel) HalfPageDown()

HalfPageDown scrolls down by half a page

func (*ContentPanel) HalfPageUp

func (cp *ContentPanel) HalfPageUp()

HalfPageUp scrolls up by half a page

func (*ContentPanel) IsSelecting

func (cp *ContentPanel) IsSelecting() bool

IsSelecting returns true if the user is currently selecting text

func (*ContentPanel) ScrollDown

func (cp *ContentPanel) ScrollDown(n int)

ScrollDown scrolls down by n lines

func (*ContentPanel) ScrollUp

func (cp *ContentPanel) ScrollUp(n int)

ScrollUp scrolls up by n lines

func (*ContentPanel) SetContent

func (cp *ContentPanel) SetContent(content string)

SetContent sets the content to display

func (*ContentPanel) SetContentLines

func (cp *ContentPanel) SetContentLines(lines []string)

SetContentLines sets the content lines directly (useful for pre-processed content)

func (*ContentPanel) SetContentWithWrapping

func (cp *ContentPanel) SetContentWithWrapping(content string, wrapWidth int)

SetContentWithWrapping sets content and wraps it to the given width Uses SoftLineBreak markers so copying preserves original line structure

func (*ContentPanel) SetOffset

func (cp *ContentPanel) SetOffset(x, y int)

SetOffset sets the panel's position on screen (for mouse coordinate translation)

func (*ContentPanel) SetTitle

func (cp *ContentPanel) SetTitle(title string)

SetTitle sets the panel title

func (*ContentPanel) SetXOffset

func (cp *ContentPanel) SetXOffset(offset int)

SetXOffset sets the panel's X position on screen (for mouse coordinate translation)

func (*ContentPanel) SetYOffset

func (cp *ContentPanel) SetYOffset(offset int)

SetYOffset sets the panel's Y position on screen (for mouse coordinate translation)

func (*ContentPanel) Update

func (cp *ContentPanel) Update(msg tea.Msg) tea.Cmd

Update handles input messages (mouse and auto-scroll only)

func (*ContentPanel) UpdateContentLines

func (cp *ContentPanel) UpdateContentLines(lines []string)

UpdateContentLines updates content lines without clearing selection Use this when content changes but you want to preserve any active selection Lines may contain SoftLineBreak markers which will be stripped for display but preserved for copy operations

func (*ContentPanel) View

func (cp *ContentPanel) View(width, height int) string

View renders the panel with the given dimensions

type DetailsPanel

type DetailsPanel struct {
	*ContentPanel
}

DetailsPanel wraps ContentPanel for the list command

func NewDetailsPanel

func NewDetailsPanel() *DetailsPanel

NewDetailsPanel creates a new details panel

func (*DetailsPanel) CopyAllContent

func (dp *DetailsPanel) CopyAllContent() tea.Cmd

CopyAllContent copies all panel content to the clipboard

func (*DetailsPanel) SetSize

func (dp *DetailsPanel) SetSize(width, height int)

SetSize sets the panel dimensions

func (*DetailsPanel) Update

func (dp *DetailsPanel) Update(msg tea.Msg) tea.Cmd

Update handles input messages

func (*DetailsPanel) View

func (dp *DetailsPanel) View() string

View renders the panel (uses stored dimensions from SetSize)

type LogPanelComponent

type LogPanelComponent struct {
	*ContentPanel
	// contains filtered or unexported fields
}

LogPanelComponent wraps ContentPanel and adds log management

func NewLogPanelComponent

func NewLogPanelComponent() *LogPanelComponent

NewLogPanelComponent creates a new log panel

func (*LogPanelComponent) AddServiceLog

func (lp *LogPanelComponent) AddServiceLog(line string)

AddServiceLog adds a log line to service logs

func (*LogPanelComponent) AddTestLog

func (lp *LogPanelComponent) AddTestLog(testID, line string)

AddTestLog adds a log line to a specific test's logs

func (*LogPanelComponent) CopyAllLogs

func (lp *LogPanelComponent) CopyAllLogs() tea.Cmd

CopyAllLogs copies all currently visible logs to the clipboard

func (*LogPanelComponent) GetRawLogs

func (lp *LogPanelComponent) GetRawLogs() string

GetRawLogs returns the raw log content without ANSI codes

func (*LogPanelComponent) SetCurrentTest

func (lp *LogPanelComponent) SetCurrentTest(testID string)

SetCurrentTest sets the current test to display logs for

func (*LogPanelComponent) SetOffset

func (lp *LogPanelComponent) SetOffset(x, y int)

SetOffset sets the panel's position on screen (for mouse coordinate translation)

func (*LogPanelComponent) Update

func (lp *LogPanelComponent) Update(msg tea.Msg) tea.Cmd

Update handles input messages

func (*LogPanelComponent) View

func (lp *LogPanelComponent) View(width, height int) string

View renders the panel with the given dimensions

type PanelWidths

type PanelWidths struct {
	Left  int
	Right int
}

PanelWidths holds calculated widths for a two-panel layout

func CalculatePanelWidths

func CalculatePanelWidths(totalWidth, minLeft, minRight int) PanelWidths

CalculatePanelWidths computes optimal widths for horizontal layout. Uses 50/50 split when both halves can meet their minimums. Otherwise shrinks proportionally while respecting minimums.

type SelectionPos

type SelectionPos struct {
	Line int
	Col  int
}

SelectionPos represents a position in the content

type SelectorOption

type SelectorOption struct {
	ID    string
	Label string
}

SelectorOption represents a selectable item

func RunSelector

func RunSelector(prompt string, options []SelectorOption, currentID string) (*SelectorOption, error)

RunSelector runs an interactive selector and returns the selected option

type TerminalSizeWarning

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

TerminalSizeWarning handles the terminal size warning overlay

func NewListViewSizeWarning

func NewListViewSizeWarning() *TerminalSizeWarning

NewListViewSizeWarning creates a warning for list view

func NewTerminalSizeWarning

func NewTerminalSizeWarning(minWidth, minHeight, recommendedWidth, recommendedHeight int) *TerminalSizeWarning

func NewTestViewSizeWarning

func NewTestViewSizeWarning() *TerminalSizeWarning

NewTestExecutorSizeWarning creates a warning for test view

func (*TerminalSizeWarning) Dismiss

func (w *TerminalSizeWarning) Dismiss()

Dismiss marks the warning as dismissed

func (*TerminalSizeWarning) IsDismissed

func (w *TerminalSizeWarning) IsDismissed() bool

IsDismissed returns whether the warning has been dismissed

func (*TerminalSizeWarning) IsTooSmall

func (w *TerminalSizeWarning) IsTooSmall(width, height int) bool

IsTooSmall checks if the terminal size is below minimum

func (*TerminalSizeWarning) Reset

func (w *TerminalSizeWarning) Reset()

Reset resets the dismissed state (useful when window becomes large then small again)

func (*TerminalSizeWarning) ShouldShow

func (w *TerminalSizeWarning) ShouldShow(width, height int) bool

ShouldShow returns true if the warning should be displayed. Always returns false if TUSK_TUI_CI_MODE=1 to support CI testing.

func (*TerminalSizeWarning) View

func (w *TerminalSizeWarning) View(width, height int) string

View renders the warning overlay

type TestExecutionHeaderComponent

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

func NewTestExecutionHeaderComponent

func NewTestExecutionHeaderComponent(testCount int) *TestExecutionHeaderComponent

func (*TestExecutionHeaderComponent) SetCompleted

func (h *TestExecutionHeaderComponent) SetCompleted()

func (*TestExecutionHeaderComponent) SetInitialProgress

func (h *TestExecutionHeaderComponent) SetInitialProgress() tea.Cmd

func (*TestExecutionHeaderComponent) Update

func (h *TestExecutionHeaderComponent) Update(msg tea.Msg) tea.Cmd

func (*TestExecutionHeaderComponent) UpdateStats

func (h *TestExecutionHeaderComponent) UpdateStats(completed, passed, failed, running int) tea.Cmd

func (*TestExecutionHeaderComponent) View

func (h *TestExecutionHeaderComponent) View(width int) string

type TestTableComponent

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

func NewTestTableComponent

func NewTestTableComponent(tests []runner.Test) *TestTableComponent

func (*TestTableComponent) Cursor

func (tt *TestTableComponent) Cursor() int

func (*TestTableComponent) GetSelectedTest

func (tt *TestTableComponent) GetSelectedTest() *runner.Test

func (*TestTableComponent) GotoBottom

func (tt *TestTableComponent) GotoBottom()

func (*TestTableComponent) GotoTop

func (tt *TestTableComponent) GotoTop()

func (*TestTableComponent) HalfPageDown

func (tt *TestTableComponent) HalfPageDown()

HalfPageDown scrolls the viewport down by half a page, clamping cursor

func (*TestTableComponent) HalfPageUp

func (tt *TestTableComponent) HalfPageUp()

HalfPageUp scrolls the viewport up by half a page, clamping cursor

func (*TestTableComponent) Height

func (tt *TestTableComponent) Height() int

func (*TestTableComponent) IsServiceLogsSelected

func (tt *TestTableComponent) IsServiceLogsSelected() bool

func (*TestTableComponent) MoveDown

func (tt *TestTableComponent) MoveDown(n int)

MoveDown is an alias for SelectDown (for backwards compatibility)

func (*TestTableComponent) MoveUp

func (tt *TestTableComponent) MoveUp(n int)

MoveUp is an alias for SelectUp (for backwards compatibility)

func (*TestTableComponent) ScrollDown

func (tt *TestTableComponent) ScrollDown(n int)

ScrollDown scrolls the viewport down by n rows, clamping cursor to visible bounds

func (*TestTableComponent) ScrollUp

func (tt *TestTableComponent) ScrollUp(n int)

ScrollUp scrolls the viewport up by n rows, clamping cursor to visible bounds

func (*TestTableComponent) SelectDown

func (tt *TestTableComponent) SelectDown(n int)

SelectDown moves the selection down by n rows (updates details panel)

func (*TestTableComponent) SelectUp

func (tt *TestTableComponent) SelectUp(n int)

SelectUp moves the selection up by n rows (updates details panel)

func (*TestTableComponent) TotalRows

func (tt *TestTableComponent) TotalRows() int

func (*TestTableComponent) Update

func (tt *TestTableComponent) Update(msg tea.Msg) tea.Cmd

func (*TestTableComponent) UpdateTestResult

func (tt *TestTableComponent) UpdateTestResult(index int, result runner.TestResult, err error)

func (*TestTableComponent) View

func (tt *TestTableComponent) View(width, height int) string

func (*TestTableComponent) ViewportYOffset

func (tt *TestTableComponent) ViewportYOffset() int

ViewportYOffset returns the current viewport scroll offset

Jump to

Keyboard shortcuts

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