Documentation
¶
Index ¶
- func SpinnerFrameCount() uint32
- type BaseContext
- func (self *BaseContext) AddKeybindingsFn(fn types.KeybindingsFn)
- func (self *BaseContext) AddOnFocusFn(fn func(types.OnFocusOpts))
- func (self *BaseContext) AddOnFocusLostFn(fn func(types.OnFocusLostOpts))
- func (self *BaseContext) ApplyFocusStyle()
- func (self *BaseContext) GetKey() types.ContextKey
- func (self *BaseContext) GetKeybindings() []*types.Binding
- func (self *BaseContext) GetKind() types.ContextKind
- func (self *BaseContext) GetView() *gocui.View
- func (self *BaseContext) GetViewName() string
- func (self *BaseContext) IsFocusable() bool
- func (self *BaseContext) IsFocused() bool
- func (self *BaseContext) OnBlur()
- func (self *BaseContext) OnFocus()
- func (self *BaseContext) SetFocused(f bool)
- func (self *BaseContext) SetView(v *gocui.View)
- func (self *BaseContext) Title() string
- type BaseContextOpts
- type DetailsContext
- func (d *DetailsContext) Draw(dim boxlayout.Dimensions) error
- func (d *DetailsContext) HandleTabClick(tabIndex int) error
- func (d *DetailsContext) ID() string
- func (d *DetailsContext) LoadActionNeededData()
- func (d *DetailsContext) NextTab()
- func (d *DetailsContext) PrevTab()
- func (d *DetailsContext) ScrollDownByWheel()
- func (d *DetailsContext) ScrollUpByWheel()
- func (d *DetailsContext) SetActionNeededMigrations(migrations []prisma.Migration)
- func (d *DetailsContext) SetContent(content string)
- func (d *DetailsContext) SetModalCallbacks(hasActiveModal func() bool, onPanelClick func(string))
- func (d *DetailsContext) UpdateFromMigration(migration *prisma.Migration, tabName string)
- type DetailsContextOpts
- type MigrationsContext
- func (m *MigrationsContext) Draw(dim boxlayout.Dimensions) error
- func (m *MigrationsContext) GetCategory() prisma.MigrationCategory
- func (m *MigrationsContext) GetCurrentTabName() string
- func (m *MigrationsContext) GetSelectedMigration() *prisma.Migration
- func (m *MigrationsContext) HandleListClick(y int) error
- func (m *MigrationsContext) HandleTabClick(tabIndex int) error
- func (m *MigrationsContext) ID() string
- func (m *MigrationsContext) IsDBConnected() bool
- func (m *MigrationsContext) NextTab()
- func (m *MigrationsContext) PrevTab()
- func (m *MigrationsContext) Refresh()
- func (m *MigrationsContext) ScrollDownByWheel()
- func (m *MigrationsContext) ScrollToBottom()
- func (m *MigrationsContext) ScrollToTop()
- func (m *MigrationsContext) ScrollUpByWheel()
- func (m *MigrationsContext) SelectNext()
- func (m *MigrationsContext) SelectPrev()
- func (m *MigrationsContext) SetModalCallbacks(hasActiveModal func() bool, onPanelClick func(string))
- func (m *MigrationsContext) SetOnSelectionChanged(cb func(*prisma.Migration, string))
- type MigrationsContextOpts
- type OutputContext
- func (o *OutputContext) AppendOutput(text string)
- func (o *OutputContext) Draw(dim boxlayout.Dimensions) error
- func (o *OutputContext) ID() string
- func (o *OutputContext) LogAction(action string, details ...string)
- func (o *OutputContext) LogActionRed(action string, details ...string)
- func (o *OutputContext) ScrollDownByWheel()
- func (o *OutputContext) ScrollUpByWheel()
- func (o *OutputContext) SetSubtitle(subtitle string)
- type OutputContextOpts
- type ScrollableTrait
- func (self *ScrollableTrait) AdjustScroll()
- func (self *ScrollableTrait) GetOriginY() int
- func (self *ScrollableTrait) ScrollDown()
- func (self *ScrollableTrait) ScrollDownByWheel()
- func (self *ScrollableTrait) ScrollToBottom()
- func (self *ScrollableTrait) ScrollToTop()
- func (self *ScrollableTrait) ScrollUp()
- func (self *ScrollableTrait) ScrollUpByWheel()
- func (self *ScrollableTrait) SetOriginY(y int)
- func (self *ScrollableTrait) SetView(v *gocui.View)
- type SimpleContext
- type StatusBarConfig
- type StatusBarContext
- type StatusBarContextOpts
- type StatusBarState
- type TabbedTrait
- func (self *TabbedTrait) GetCurrentTab() string
- func (self *TabbedTrait) GetCurrentTabIdx() int
- func (self *TabbedTrait) GetTabs() []string
- func (self *TabbedTrait) NextTab()
- func (self *TabbedTrait) PrevTab()
- func (self *TabbedTrait) ResetTabOriginYAt(idx int)
- func (self *TabbedTrait) RestoreTabOriginY() int
- func (self *TabbedTrait) SaveTabOriginY(originY int)
- func (self *TabbedTrait) SetCurrentTabIdx(idx int)
- func (self *TabbedTrait) SetTabs(tabs []string)
- type WorkspaceContext
- type WorkspaceContextOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SpinnerFrameCount ¶
func SpinnerFrameCount() uint32
SpinnerFrameCount returns the number of spinner animation frames.
Types ¶
type BaseContext ¶
type BaseContext struct {
// contains filtered or unexported fields
}
func NewBaseContext ¶
func NewBaseContext(opts BaseContextOpts) *BaseContext
func (*BaseContext) AddKeybindingsFn ¶
func (self *BaseContext) AddKeybindingsFn(fn types.KeybindingsFn)
AddKeybindingsFn registers a function that provides keybindings for this context. Controllers call this to attach their bindings.
func (*BaseContext) AddOnFocusFn ¶
func (self *BaseContext) AddOnFocusFn(fn func(types.OnFocusOpts))
AddOnFocusFn registers a lifecycle hook called when this context gains focus.
func (*BaseContext) AddOnFocusLostFn ¶
func (self *BaseContext) AddOnFocusLostFn(fn func(types.OnFocusLostOpts))
AddOnFocusLostFn registers a lifecycle hook called when this context loses focus.
func (*BaseContext) ApplyFocusStyle ¶ added in v0.3.1
func (self *BaseContext) ApplyFocusStyle()
ApplyFocusStyle sets the view's frame and title colours based on the current focus state. Safe to call when the view is nil.
func (*BaseContext) GetKey ¶
func (self *BaseContext) GetKey() types.ContextKey
func (*BaseContext) GetKeybindings ¶
func (self *BaseContext) GetKeybindings() []*types.Binding
GetKeybindings collects all registered keybindings. Later-registered functions take precedence (appended in reverse order).
func (*BaseContext) GetKind ¶
func (self *BaseContext) GetKind() types.ContextKind
func (*BaseContext) GetView ¶
func (self *BaseContext) GetView() *gocui.View
func (*BaseContext) GetViewName ¶
func (self *BaseContext) GetViewName() string
func (*BaseContext) IsFocusable ¶
func (self *BaseContext) IsFocusable() bool
func (*BaseContext) IsFocused ¶ added in v0.3.1
func (self *BaseContext) IsFocused() bool
IsFocused returns whether this context currently has focus.
func (*BaseContext) OnBlur ¶ added in v0.3.1
func (self *BaseContext) OnBlur()
OnBlur marks this context as unfocused and applies the primary style.
func (*BaseContext) OnFocus ¶ added in v0.3.1
func (self *BaseContext) OnFocus()
OnFocus marks this context as focused and applies the focused style.
func (*BaseContext) SetFocused ¶ added in v0.3.1
func (self *BaseContext) SetFocused(f bool)
SetFocused sets the focus state directly (without applying styles).
func (*BaseContext) SetView ¶
func (self *BaseContext) SetView(v *gocui.View)
func (*BaseContext) Title ¶
func (self *BaseContext) Title() string
type BaseContextOpts ¶
type BaseContextOpts struct {
Key types.ContextKey
Kind types.ContextKind
ViewName string
View *gocui.View
Focusable bool
Title string
}
type DetailsContext ¶
type DetailsContext struct {
*SimpleContext
*ScrollableTrait
*TabbedTrait
// contains filtered or unexported fields
}
DetailsContext is the context-based replacement for DetailsPanel. It displays migration details and action-needed information with tabbed navigation.
func NewDetailsContext ¶
func NewDetailsContext(opts DetailsContextOpts) *DetailsContext
NewDetailsContext creates a new DetailsContext.
func (*DetailsContext) Draw ¶
func (d *DetailsContext) Draw(dim boxlayout.Dimensions) error
Draw renders the details panel (implements Panel interface from app package).
func (*DetailsContext) HandleTabClick ¶
func (d *DetailsContext) HandleTabClick(tabIndex int) error
handleTabClick handles mouse click on tab bar.
func (*DetailsContext) ID ¶
func (d *DetailsContext) ID() string
ID returns the view identifier (implements Panel interface from app package).
func (*DetailsContext) LoadActionNeededData ¶
func (d *DetailsContext) LoadActionNeededData()
LoadActionNeededData loads action-needed data using the internal migrations list and validates schema.
func (*DetailsContext) NextTab ¶
func (d *DetailsContext) NextTab()
NextTab switches to the next tab with scroll state save/restore.
func (*DetailsContext) PrevTab ¶
func (d *DetailsContext) PrevTab()
PrevTab switches to the previous tab with scroll state save/restore.
func (*DetailsContext) ScrollDownByWheel ¶
func (d *DetailsContext) ScrollDownByWheel()
ScrollDownByWheel scrolls down by wheel increment (delegates to ScrollableTrait).
func (*DetailsContext) ScrollUpByWheel ¶
func (d *DetailsContext) ScrollUpByWheel()
ScrollUpByWheel scrolls up by wheel increment (delegates to ScrollableTrait).
func (*DetailsContext) SetActionNeededMigrations ¶
func (d *DetailsContext) SetActionNeededMigrations(migrations []prisma.Migration)
SetActionNeededMigrations receives migration data from outside (App will call this). This replaces the old pattern of directly accessing MigrationsPanel.
func (*DetailsContext) SetContent ¶
func (d *DetailsContext) SetContent(content string)
SetContent sets the content text directly.
func (*DetailsContext) SetModalCallbacks ¶
func (d *DetailsContext) SetModalCallbacks(hasActiveModal func() bool, onPanelClick func(string))
SetModalCallbacks sets callbacks that replace the direct App reference.
func (*DetailsContext) UpdateFromMigration ¶
func (d *DetailsContext) UpdateFromMigration(migration *prisma.Migration, tabName string)
UpdateFromMigration updates the details panel with migration information.
type DetailsContextOpts ¶
type DetailsContextOpts struct {
Gui *gocui.Gui
Tr *i18n.TranslationSet
ViewName string
}
DetailsContextOpts holds the options for creating a DetailsContext.
type MigrationsContext ¶
type MigrationsContext struct {
*SimpleContext
*ScrollableTrait
*TabbedTrait
// contains filtered or unexported fields
}
MigrationsContext manages the migrations list with tabs (Local, Pending, DB-Only).
func NewMigrationsContext ¶
func NewMigrationsContext(opts MigrationsContextOpts) *MigrationsContext
func (*MigrationsContext) Draw ¶
func (m *MigrationsContext) Draw(dim boxlayout.Dimensions) error
Draw renders the migrations panel (Panel interface compatibility).
func (*MigrationsContext) GetCategory ¶
func (m *MigrationsContext) GetCategory() prisma.MigrationCategory
GetCategory exposes the full migration category for external use.
func (*MigrationsContext) GetCurrentTabName ¶
func (m *MigrationsContext) GetCurrentTabName() string
GetCurrentTabName returns the name of the active tab.
func (*MigrationsContext) GetSelectedMigration ¶
func (m *MigrationsContext) GetSelectedMigration() *prisma.Migration
GetSelectedMigration returns the currently selected migration, or nil.
func (*MigrationsContext) HandleListClick ¶
func (m *MigrationsContext) HandleListClick(y int) error
HandleListClick handles mouse click on a list item.
func (*MigrationsContext) HandleTabClick ¶
func (m *MigrationsContext) HandleTabClick(tabIndex int) error
HandleTabClick handles mouse click on a tab.
func (*MigrationsContext) ID ¶
func (m *MigrationsContext) ID() string
ID returns the view identifier (Panel interface compatibility).
func (*MigrationsContext) IsDBConnected ¶
func (m *MigrationsContext) IsDBConnected() bool
IsDBConnected returns whether the database connection is active.
func (*MigrationsContext) NextTab ¶
func (m *MigrationsContext) NextTab()
NextTab switches to the next tab, saving and restoring per-tab state.
func (*MigrationsContext) PrevTab ¶
func (m *MigrationsContext) PrevTab()
PrevTab switches to the previous tab, saving and restoring per-tab state.
func (*MigrationsContext) Refresh ¶
func (m *MigrationsContext) Refresh()
Refresh reloads all migration data, preserving current tab and selection where possible.
func (*MigrationsContext) ScrollDownByWheel ¶
func (m *MigrationsContext) ScrollDownByWheel()
ScrollDownByWheel scrolls the view down by 2 lines (mouse wheel).
func (*MigrationsContext) ScrollToBottom ¶
func (m *MigrationsContext) ScrollToBottom()
ScrollToBottom scrolls to the bottom of the list and selects the last item.
func (*MigrationsContext) ScrollToTop ¶
func (m *MigrationsContext) ScrollToTop()
ScrollToTop scrolls to the top of the list and selects the first item.
func (*MigrationsContext) ScrollUpByWheel ¶
func (m *MigrationsContext) ScrollUpByWheel()
ScrollUpByWheel scrolls the view up by 2 lines (mouse wheel).
func (*MigrationsContext) SelectNext ¶
func (m *MigrationsContext) SelectNext()
SelectNext moves the selection down by one.
func (*MigrationsContext) SelectPrev ¶
func (m *MigrationsContext) SelectPrev()
SelectPrev moves the selection up by one.
func (*MigrationsContext) SetModalCallbacks ¶
func (m *MigrationsContext) SetModalCallbacks(hasActiveModal func() bool, onPanelClick func(string))
SetModalCallbacks registers callbacks for modal and panel-click checks (replaces the old SetApp coupling).
func (*MigrationsContext) SetOnSelectionChanged ¶
func (m *MigrationsContext) SetOnSelectionChanged(cb func(*prisma.Migration, string))
SetOnSelectionChanged registers a callback invoked whenever the selected migration changes (replaces the old SetDetailsPanel coupling).
type MigrationsContextOpts ¶
type MigrationsContextOpts struct {
Gui *gocui.Gui
Tr *i18n.TranslationSet
ViewName string
}
type OutputContext ¶
type OutputContext struct {
*SimpleContext
*ScrollableTrait
// contains filtered or unexported fields
}
func NewOutputContext ¶
func NewOutputContext(opts OutputContextOpts) *OutputContext
func (*OutputContext) AppendOutput ¶
func (o *OutputContext) AppendOutput(text string)
AppendOutput appends text to the output buffer and flags auto-scroll
func (*OutputContext) Draw ¶
func (o *OutputContext) Draw(dim boxlayout.Dimensions) error
Draw renders the output panel (implements Panel interface from app package)
func (*OutputContext) ID ¶
func (o *OutputContext) ID() string
ID returns the view identifier (implements Panel interface from app package)
func (*OutputContext) LogAction ¶
func (o *OutputContext) LogAction(action string, details ...string)
LogAction logs an action with timestamp and optional details
func (*OutputContext) LogActionRed ¶
func (o *OutputContext) LogActionRed(action string, details ...string)
LogActionRed logs an action in red (for errors/warnings)
func (*OutputContext) ScrollDownByWheel ¶
func (o *OutputContext) ScrollDownByWheel()
ScrollDownByWheel scrolls down by wheel increment (delegates to ScrollableTrait)
func (*OutputContext) ScrollUpByWheel ¶
func (o *OutputContext) ScrollUpByWheel()
ScrollUpByWheel scrolls up by wheel increment (delegates to ScrollableTrait) This method is provided for backward compatibility with existing callers that pass no arguments (the old OutputPanel signature).
func (*OutputContext) SetSubtitle ¶
func (o *OutputContext) SetSubtitle(subtitle string)
SetSubtitle sets the custom subtitle for the panel
type OutputContextOpts ¶
type OutputContextOpts struct {
Gui *gocui.Gui
Tr *i18n.TranslationSet
ViewName string
}
type ScrollableTrait ¶
type ScrollableTrait struct {
// contains filtered or unexported fields
}
ScrollableTrait provides shared vertical scroll logic. It tracks originY manually and applies it to the gocui view, replicating the exact behaviour used across all existing panels.
func (*ScrollableTrait) AdjustScroll ¶
func (self *ScrollableTrait) AdjustScroll()
AdjustScroll clamps originY to valid bounds and applies it to the view. Call this during render after content has been written to the view.
func (*ScrollableTrait) GetOriginY ¶
func (self *ScrollableTrait) GetOriginY() int
GetOriginY returns the current scroll offset.
func (*ScrollableTrait) ScrollDown ¶
func (self *ScrollableTrait) ScrollDown()
ScrollDown scrolls the view down by 1 line, clamping to the maximum scrollable position.
func (*ScrollableTrait) ScrollDownByWheel ¶
func (self *ScrollableTrait) ScrollDownByWheel()
ScrollDownByWheel scrolls the view down by the wheel increment, clamping to the maximum scrollable position.
func (*ScrollableTrait) ScrollToBottom ¶
func (self *ScrollableTrait) ScrollToBottom()
ScrollToBottom scrolls to the very bottom.
func (*ScrollableTrait) ScrollToTop ¶
func (self *ScrollableTrait) ScrollToTop()
ScrollToTop scrolls to the very top.
func (*ScrollableTrait) ScrollUp ¶
func (self *ScrollableTrait) ScrollUp()
ScrollUp scrolls the view up by 1 line.
func (*ScrollableTrait) ScrollUpByWheel ¶
func (self *ScrollableTrait) ScrollUpByWheel()
ScrollUpByWheel scrolls the view up by the wheel increment.
func (*ScrollableTrait) SetOriginY ¶
func (self *ScrollableTrait) SetOriginY(y int)
SetOriginY sets the scroll offset directly (e.g. when restoring tab state).
func (*ScrollableTrait) SetView ¶
func (self *ScrollableTrait) SetView(v *gocui.View)
SetView assigns (or reassigns) the underlying gocui view.
type SimpleContext ¶
type SimpleContext struct {
*BaseContext
// contains filtered or unexported fields
}
func NewSimpleContext ¶
func NewSimpleContext(baseContext *BaseContext) *SimpleContext
func (*SimpleContext) HandleFocus ¶
func (self *SimpleContext) HandleFocus(opts types.OnFocusOpts)
HandleFocus is called when this context gains focus. It invokes all registered onFocusFns in order.
func (*SimpleContext) HandleFocusLost ¶
func (self *SimpleContext) HandleFocusLost(opts types.OnFocusLostOpts)
HandleFocusLost is called when this context loses focus. It invokes all registered onFocusLostFns in order.
func (*SimpleContext) HandleRender ¶
func (self *SimpleContext) HandleRender()
HandleRender is called when the context needs to re-render its content.
func (*SimpleContext) SetOnRenderFn ¶
func (self *SimpleContext) SetOnRenderFn(fn func())
SetOnRenderFn sets the function called during HandleRender.
type StatusBarConfig ¶
StatusBarConfig holds static configuration for the status bar display.
type StatusBarContext ¶
type StatusBarContext struct {
*BaseContext
// contains filtered or unexported fields
}
func NewStatusBarContext ¶
func NewStatusBarContext(opts StatusBarContextOpts) *StatusBarContext
func (*StatusBarContext) Draw ¶
func (s *StatusBarContext) Draw(dim boxlayout.Dimensions) error
Draw renders the status bar (implements Panel interface from app package)
func (*StatusBarContext) ID ¶
func (s *StatusBarContext) ID() string
ID returns the view identifier (implements Panel interface from app package)
func (*StatusBarContext) OnBlur ¶
func (s *StatusBarContext) OnBlur()
OnBlur is a no-op for the status bar (not focusable)
func (*StatusBarContext) OnFocus ¶
func (s *StatusBarContext) OnFocus()
OnFocus is a no-op for the status bar (not focusable)
type StatusBarContextOpts ¶
type StatusBarContextOpts struct {
Gui *gocui.Gui
Tr *i18n.TranslationSet
ViewName string
State StatusBarState
Config StatusBarConfig
}
type StatusBarState ¶
type StatusBarState struct {
IsCommandRunning func() bool
GetSpinnerFrame func() uint32
IsStudioRunning func() bool
GetCommandName func() string
}
StatusBarState provides callbacks for accessing App state without direct dependency.
type TabbedTrait ¶
type TabbedTrait struct {
// contains filtered or unexported fields
}
TabbedTrait provides shared tab management with per-tab scroll position saving. It replicates the exact tab origin save/restore pattern used in MigrationsPanel and DetailsPanel.
func NewTabbedTrait ¶
func NewTabbedTrait(tabs []string) TabbedTrait
NewTabbedTrait creates a TabbedTrait with the given initial tabs.
func (*TabbedTrait) GetCurrentTab ¶
func (self *TabbedTrait) GetCurrentTab() string
GetCurrentTab returns the name of the active tab, or an empty string if there are no tabs.
func (*TabbedTrait) GetCurrentTabIdx ¶
func (self *TabbedTrait) GetCurrentTabIdx() int
GetCurrentTabIdx returns the zero-based index of the active tab.
func (*TabbedTrait) GetTabs ¶
func (self *TabbedTrait) GetTabs() []string
GetTabs returns the current tab names.
func (*TabbedTrait) NextTab ¶
func (self *TabbedTrait) NextTab()
NextTab advances to the next tab, wrapping around. The caller must call SaveTabOriginY before and RestoreTabOriginY after.
func (*TabbedTrait) PrevTab ¶
func (self *TabbedTrait) PrevTab()
PrevTab moves to the previous tab, wrapping around. The caller must call SaveTabOriginY before and RestoreTabOriginY after.
func (*TabbedTrait) ResetTabOriginYAt ¶
func (self *TabbedTrait) ResetTabOriginYAt(idx int)
ResetTabOriginYAt resets the saved scroll position for the tab at the given index.
func (*TabbedTrait) RestoreTabOriginY ¶
func (self *TabbedTrait) RestoreTabOriginY() int
RestoreTabOriginY returns the saved scroll position for the current tab. Returns 0 if no position was previously saved. Call this after switching tabs.
func (*TabbedTrait) SaveTabOriginY ¶
func (self *TabbedTrait) SaveTabOriginY(originY int)
SaveTabOriginY saves the given scroll position for the current tab. Call this before switching tabs.
func (*TabbedTrait) SetCurrentTabIdx ¶
func (self *TabbedTrait) SetCurrentTabIdx(idx int)
SetCurrentTabIdx sets the active tab index directly.
func (*TabbedTrait) SetTabs ¶
func (self *TabbedTrait) SetTabs(tabs []string)
SetTabs replaces the tab list. If the current index is out of bounds after the change, it resets to 0.
type WorkspaceContext ¶
type WorkspaceContext struct {
*SimpleContext
*ScrollableTrait
// contains filtered or unexported fields
}
func NewWorkspaceContext ¶
func NewWorkspaceContext(opts WorkspaceContextOpts) *WorkspaceContext
func (*WorkspaceContext) Draw ¶
func (w *WorkspaceContext) Draw(dim boxlayout.Dimensions) error
Draw renders the workspace panel (implements Panel interface from app package)
func (*WorkspaceContext) ID ¶
func (w *WorkspaceContext) ID() string
ID returns the view identifier (implements Panel interface from app package)
func (*WorkspaceContext) Refresh ¶
func (w *WorkspaceContext) Refresh()
Refresh reloads all workspace information
func (*WorkspaceContext) ScrollDownByWheel ¶
func (w *WorkspaceContext) ScrollDownByWheel()
ScrollDownByWheel scrolls down by wheel increment (delegates to ScrollableTrait)
func (*WorkspaceContext) ScrollUpByWheel ¶
func (w *WorkspaceContext) ScrollUpByWheel()
ScrollUpByWheel scrolls up by wheel increment (delegates to ScrollableTrait)
type WorkspaceContextOpts ¶
type WorkspaceContextOpts struct {
Gui *gocui.Gui
Tr *i18n.TranslationSet
ViewName string
}