ui

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PageSetupID      = "setup_page"
	PageMainID       = "main_page"
	PageLogID        = "log_page"
	PageLoadingID    = "loading_page"
	PageManageModsID = "manage_mods"
	PageHistoryID    = "history_page"
	PageResultID     = "result_page"
	PageTestID       = "test_page"
)

Page IDs are constants used by the NavigationManager to identify pages. They are defined here in the high-level 'ui' package.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionPrompt

type ActionPrompt struct {
	Input  string
	Action string
}

type AppInterface

type AppInterface interface {
	// --- UI methods & Managers ---
	QueueUpdateDraw(f func()) *tview.Application
	Stop()
	Navigation() *NavigationManager
	Dialogs() *DialogManager
	Layout() *LayoutManager
	GetLogger() *logging.Logger
	GetFocus() tview.Primitive
	SetFocus(tview.Primitive)

	// --- Core Logic ---
	StartLoadingProcess(modsPath string, quiltSupport, neoForgeSupport bool)
	GetViewModel() BisectionViewModel
	GetStateManager() *mods.StateManager // StateManager is still needed for detailed mod info.

	// --- Actions ---
	Step()
	Undo() bool
	ResetSearch()
	ContinueSearch()
	Reconcile(callback func())
}

AppInterface defines methods the UI layer needs to access from the main App struct. It acts as a facade for UI components to interact with the application's core.

type BisectionViewModel

type BisectionViewModel struct {
	IsReady            bool
	IsComplete         bool
	IsVerificationStep bool
	StepCount          int
	Iteration          int
	Round              int
	EstimatedMaxTests  int
	LastTestResult     imcs.TestResult
	LastFoundElement   string
	AllModIDs          []string
	AllConflictSets    []sets.Set
	CurrentConflictSet sets.Set
	CandidateSet       sets.Set
	ClearedSet         sets.Set
	PendingAdditions   sets.Set
	CurrentTestPlan    *imcs.TestPlan
	ExecutionLog       []imcs.CompletedTest
	QuiltSupport       bool
	NeoForgeSupport    bool
}

BisectionViewModel provides a snapshot of the current bisection state, tailored for UI consumption. It decouples the UI from the underlying engine's implementation.

type DialogManager

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

func NewDialogManager

func NewDialogManager(app AppInterface) *DialogManager

func (*DialogManager) ShowErrorDialog

func (m *DialogManager) ShowErrorDialog(title, message string, err error, onDismiss func())

ShowErrorDialog displays a modal dialog with an error message.

func (*DialogManager) ShowInfoDialog

func (m *DialogManager) ShowInfoDialog(title, message, details string, onDismiss func())

ShowInfoDialog displays a modal dialog with a neutral informational message.

func (*DialogManager) ShowQuestionDialog

func (m *DialogManager) ShowQuestionDialog(title, question, details string, onYes func(), onNo func())

func (*DialogManager) ShowQuitDialog

func (m *DialogManager) ShowQuitDialog()

ShowQuitDialog displays a confirmation dialog before quitting.

type FocusChainEntry

type FocusChainEntry struct {
	Primitive    tview.Primitive
	AncestryPath []tview.Primitive
}

FocusChainEntry holds a primitive and its complete ancestry path from the root.

type FocusManager

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

FocusManager handles cycling focus between a dynamic set of primitives.

func NewFocusManager

func NewFocusManager(app AppInterface) *FocusManager

NewFocusManager creates a new focus manager.

func (*FocusManager) Cycle

func (fm *FocusManager) Cycle(root tview.Primitive, forward bool) bool

Cycle moves the focus to the next or previous primitive in the focus chain.

type Focusable

type Focusable interface {
	// GetFocusablePrimitives returns a slice of the immediate child primitives
	// that can receive focus.
	GetFocusablePrimitives() []tview.Primitive
}

Focusable is an interface for any primitive that contains child elements which can be focused. It's used by the FocusManager to build a dynamic focus chain.

type LayoutManager

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

LayoutManager handles the overall visual structure of the application.

func NewLayoutManager

func NewLayoutManager(app AppInterface, ctx context.Context) *LayoutManager

NewLayoutManager creates and initializes the UI layout manager.

func (*LayoutManager) Pages

func (lm *LayoutManager) Pages() *tview.Pages

Pages returns the tview.Pages container for content.

func (*LayoutManager) RootPrimitive

func (lm *LayoutManager) RootPrimitive() tview.Primitive

RootPrimitive returns the main primitive that should be set as the application's root.

func (*LayoutManager) SetErrorCounters

func (lm *LayoutManager) SetErrorCounters(warnCount, errorCount int)

SetErrorCounters updates the error and warning counters.

func (*LayoutManager) SetFooter

func (lm *LayoutManager) SetFooter(prompts []ActionPrompt)

SetFooter updates the action hints flexbox.

func (*LayoutManager) SetHeader

func (lm *LayoutManager) SetHeader(p *tview.TextView)

SetHeader updates the status bar

func (*LayoutManager) SetStatusText

func (lm *LayoutManager) SetStatusText(text string)

type ModalPage

type ModalPage struct {
	*widgets.RichModal
}

ModalPage is a simple wrapper around a tview.Modal to conform to the Page interface.

func NewModalPage

func NewModalPage(modal *widgets.RichModal) *ModalPage

NewModalPage creates a new ModalPage.

func (*ModalPage) GetActionPrompts

func (p *ModalPage) GetActionPrompts() []ActionPrompt

GetActionPrompts returns an empty map as modals have their own buttons.

func (*ModalPage) GetStatusPrimitive

func (p *ModalPage) GetStatusPrimitive() *tview.TextView

GetStatusPrimitive returns the tview.Primitive that displays the page's status

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

NavigationManager handles page state and transitions using a hybrid model of persistent "workspace" pages and transient "modal" overlays.

func NewNavigationManager

func NewNavigationManager(app AppInterface, pages *tview.Pages) *NavigationManager

NewNavigationManager creates a new manager for page navigation.

func (n *NavigationManager) CloseModal()

CloseModal removes the top-most modal page.

func (n *NavigationManager) GetCurrentPage(includeModal bool) Page

GetCurrentPage returns the Page interface of the front-most primitive.

func (n *NavigationManager) GetCurrentPageID(includeModal bool) string

GetCurrentPageID returns the page id of the front-most primitive.

func (n *NavigationManager) GoBack()

GoBack navigates to the previous page in the history stack.

func (n *NavigationManager) Register(pageID string, page Page)

Register adds a persistent page to the manager. These pages are created once and switched to by their ID.

func (n *NavigationManager) ShowModal(pageID string, page Page)

ShowModal displays a transient page (like a dialog) over the current view.

func (n *NavigationManager) SwitchTo(pageID string)

SwitchTo changes the main visible page to the one specified by pageID. It also manages the navigation history for the GoBack() function.

type Page

type Page interface {
	tview.Primitive
	GetActionPrompts() []ActionPrompt
	GetStatusPrimitive() *tview.TextView
}

Page is the interface that all UI pages must implement.

type PageActivator

type PageActivator interface {
	OnPageActivated()
}

PageActivator defines an interface for pages that need to perform an action when they become the active page.

type SearchStateObserver

type SearchStateObserver interface {
	// RefreshSearchState is called to update the page with the latest searcher data.
	RefreshSearchState()
}

SearchStateObserver defines an interface for pages that need to be updated when the conflict searcher's state changes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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