Documentation
¶
Index ¶
- Constants
- Variables
- func AdjustOrigin(v *gocui.View, originY *int)
- func Black(text string) string
- func Blink(text string) string
- func Blue(text string) string
- func Bold(text string) string
- func ColorToGocuiAttr(c Color) int
- func Colorize(text string, color Color) string
- func CopyToClipboard(text string) error
- func Cyan(text string) string
- func Dim(text string) string
- func Gray(text string) string
- func Green(text string) string
- func Italic(text string) string
- func Magenta(text string) string
- func Orange(text string) string
- func Red(text string) string
- func Reverse(text string) string
- func StrikeThru(text string) string
- func Stylize(text string, style Style) string
- func Underline(text string) string
- func White(text string) string
- func WrapText(text string, maxWidth int, padding string) []string
- func Yellow(text string) string
- type App
- func (a *App) CloseModal()
- func (a *App) CopyMigrationInfo()
- func (a *App) DeleteMigration()
- func (a *App) FocusNext()
- func (a *App) FocusPrevious()
- func (a *App) Generate()
- func (a *App) GetCurrentPanel() Panel
- func (a *App) GetGui() *gocui.Gui
- func (a *App) HandlePanelClick(viewID string)
- func (a *App) HasActiveModal() bool
- func (a *App) MigrateDeploy()
- func (a *App) MigrateDev()
- func (a *App) MigrateResolve()
- func (a *App) OpenModal(modal Modal)
- func (a *App) RefreshAll(onComplete ...func()) bool
- func (a *App) RegisterKeybindings() error
- func (a *App) RegisterMouseBindings()
- func (a *App) RegisterPanel(panel Panel)
- func (a *App) Run() error
- func (a *App) SchemaDiffMigration()
- func (a *App) StatusBarState() context.StatusBarState
- func (a *App) Studio()
- type AppConfig
- type BaseModal
- func (b *BaseModal) CalculateDimensions(widthRatio float64, minWidth int) (width int)
- func (b *BaseModal) CenterBox(width, height int) (x0, y0, x1, y1 int)
- func (b *BaseModal) ID() string
- func (b *BaseModal) OnClose()
- func (b *BaseModal) SetStyle(style MessageModalStyle)
- func (b *BaseModal) SetupView(name string, x0, y0, x1, y1 int, zIndex byte, title, footer string) (*gocui.View, bool, error)
- func (b *BaseModal) Style() MessageModalStyle
- type BasePanel
- type Color
- type ConfirmModal
- type InputModal
- func (m *InputModal) Draw(dim boxlayout.Dimensions) error
- func (m *InputModal) HandleKey(key any, mod gocui.Modifier) error
- func (m *InputModal) OnClose()
- func (m *InputModal) OnValidationFail(callback func(string)) *InputModal
- func (m *InputModal) WithRequired(required bool) *InputModal
- func (m *InputModal) WithStyle(style MessageModalStyle) *InputModal
- func (m *InputModal) WithSubtitle(subtitle string) *InputModal
- type ListModal
- type ListModalItem
- type MessageModal
- type MessageModalStyle
- type Modal
- type Panel
- type Style
Constants ¶
const ( ViewWorkspace = "workspace" ViewMigrations = "migrations" ViewDetails = "details" ViewOutputs = "outputs" ViewStatusbar = "statusbar" )
View identifiers
Variables ¶
var ( PrimaryFrameColor = gocui.ColorWhite FocusedFrameColor = gocui.ColorGreen PrimaryTitleColor = gocui.ColorWhite | gocui.AttrNone FocusedTitleColor = gocui.ColorGreen | gocui.AttrBold // Tab styling FocusedActiveTabColor = gocui.ColorGreen | gocui.AttrBold // Active tab when panel is focused PrimaryActiveTabColor = gocui.ColorGreen | gocui.AttrNone // Active tab when panel is not focused // List selection color SelectionBgColor = gocui.ColorBlue )
Frame and title styling
Functions ¶
func AdjustOrigin ¶
AdjustOrigin adjusts the origin to ensure it's within valid bounds Call this after content is rendered but before SetOrigin
func ColorToGocuiAttr ¶ added in v0.3.0
ColorToGocuiAttr converts a Color to a gocui color attribute value. Exported so it can be used by any code that needs this conversion.
func CopyToClipboard ¶
CopyToClipboard copies text to the system clipboard
Types ¶
type App ¶
type App struct {
Common *common.Common
Tr *i18n.TranslationSet
// contains filtered or unexported fields
}
func (*App) CloseModal ¶
func (a *App) CloseModal()
CloseModal closes the active modal and restores focus
func (*App) CopyMigrationInfo ¶
func (a *App) CopyMigrationInfo()
CopyMigrationInfo copies migration info to clipboard
func (*App) DeleteMigration ¶
func (a *App) DeleteMigration()
DeleteMigration deletes a pending migration
func (*App) FocusPrevious ¶
func (a *App) FocusPrevious()
func (*App) Generate ¶
func (a *App) Generate()
Generate runs prisma generate and shows result in modal
func (*App) GetCurrentPanel ¶
GetCurrentPanel returns the currently focused panel
func (*App) HandlePanelClick ¶ added in v0.3.0
HandlePanelClick is the public wrapper for panel-click focus switching. It is used as a callback by contexts that manage their own mouse events.
func (*App) HasActiveModal ¶
HasActiveModal returns true if a modal is currently active
func (*App) MigrateDeploy ¶
func (a *App) MigrateDeploy()
MigrateDeploy runs npx prisma migrate deploy
func (*App) MigrateDev ¶
func (a *App) MigrateDev()
MigrateDev opens a list modal to choose migration type
func (*App) MigrateResolve ¶
func (a *App) MigrateResolve()
MigrateResolve resolves a failed migration
func (*App) RefreshAll ¶
RefreshAll refreshes all panels asynchronously
func (*App) RegisterKeybindings ¶
func (*App) RegisterMouseBindings ¶
func (a *App) RegisterMouseBindings()
RegisterMouseBindings registers mouse click handlers for all panels
func (*App) RegisterPanel ¶
func (*App) SchemaDiffMigration ¶
func (a *App) SchemaDiffMigration()
SchemaDiffMigration performs schema diff-based migration with validation checks
func (*App) StatusBarState ¶ added in v0.3.0
func (a *App) StatusBarState() context.StatusBarState
StatusBarState returns callbacks for the StatusBarContext to access App state.
type BaseModal ¶ added in v0.3.0
type BaseModal struct {
// contains filtered or unexported fields
}
BaseModal provides common infrastructure shared by all modal types
func NewBaseModal ¶ added in v0.3.0
NewBaseModal creates a new BaseModal with default style
func (*BaseModal) CalculateDimensions ¶ added in v0.3.0
CalculateDimensions computes centered coordinates for a modal view. widthRatio is the fraction of screen width (e.g., 4.0/7.0). heightContent is the number of content lines (borders added by caller). minWidth is the minimum width for the modal.
func (*BaseModal) CenterBox ¶ added in v0.3.0
CenterBox returns centered screen coordinates for a box of the given width and height.
func (*BaseModal) OnClose ¶ added in v0.3.0
func (b *BaseModal) OnClose()
OnClose deletes the modal's primary view
func (*BaseModal) SetStyle ¶ added in v0.3.0
func (b *BaseModal) SetStyle(style MessageModalStyle)
SetStyle sets the modal style (used by embedding structs' WithStyle methods)
func (*BaseModal) SetupView ¶ added in v0.3.0
func (b *BaseModal) SetupView(name string, x0, y0, x1, y1 int, zIndex byte, title, footer string) (*gocui.View, bool, error)
SetupView creates (or retrieves) a gocui view and applies common frame settings. It handles the "unknown view" error from SetView, applies frame runes, title, footer, and style colours. Returns the view and whether it was newly created.
func (*BaseModal) Style ¶ added in v0.3.0
func (b *BaseModal) Style() MessageModalStyle
Style returns the current modal style
type ConfirmModal ¶
type ConfirmModal struct {
*BaseModal
// contains filtered or unexported fields
}
ConfirmModal displays a confirmation dialog with Yes/No options
func NewConfirmModal ¶
func NewConfirmModal(g *gocui.Gui, tr *i18n.TranslationSet, title string, message string, onYes func(), onNo func()) *ConfirmModal
NewConfirmModal creates a new confirmation modal
func (*ConfirmModal) Draw ¶
func (m *ConfirmModal) Draw(dim boxlayout.Dimensions) error
Draw renders the modal
func (*ConfirmModal) HandleKey ¶
func (m *ConfirmModal) HandleKey(key any, mod gocui.Modifier) error
HandleKey handles keyboard input
func (*ConfirmModal) OnClose ¶
func (m *ConfirmModal) OnClose()
OnClose is called when the modal is closed
func (*ConfirmModal) WithStyle ¶
func (m *ConfirmModal) WithStyle(style MessageModalStyle) *ConfirmModal
WithStyle sets the modal style
type InputModal ¶
type InputModal struct {
*BaseModal
// contains filtered or unexported fields
}
InputModal displays an input field for user text entry
func NewInputModal ¶
func NewInputModal(g *gocui.Gui, tr *i18n.TranslationSet, title string, onSubmit func(string), onCancel func()) *InputModal
NewInputModal creates a new input modal
func (*InputModal) Draw ¶
func (m *InputModal) Draw(dim boxlayout.Dimensions) error
Draw renders the input modal
func (*InputModal) HandleKey ¶
func (m *InputModal) HandleKey(key any, mod gocui.Modifier) error
HandleKey handles keyboard input
func (*InputModal) OnClose ¶
func (m *InputModal) OnClose()
OnClose is called when the modal is closed
func (*InputModal) OnValidationFail ¶
func (m *InputModal) OnValidationFail(callback func(string)) *InputModal
OnValidationFail sets the callback for validation failures
func (*InputModal) WithRequired ¶
func (m *InputModal) WithRequired(required bool) *InputModal
WithRequired sets whether the input is required (non-empty)
func (*InputModal) WithStyle ¶
func (m *InputModal) WithStyle(style MessageModalStyle) *InputModal
WithStyle sets the modal style
func (*InputModal) WithSubtitle ¶
func (m *InputModal) WithSubtitle(subtitle string) *InputModal
WithSubtitle sets the modal subtitle
type ListModal ¶
type ListModal struct {
*BaseModal
// contains filtered or unexported fields
}
ListModal displays a list of items with descriptions
func NewListModal ¶
func NewListModal(g *gocui.Gui, tr *i18n.TranslationSet, title string, items []ListModalItem, onCancel func()) *ListModal
NewListModal creates a new list modal
func (*ListModal) Draw ¶
func (m *ListModal) Draw(dim boxlayout.Dimensions) error
Draw renders the list modal with two views (list on top, description on bottom)
func (*ListModal) OnClose ¶
func (m *ListModal) OnClose()
OnClose is called when the modal is closed
func (*ListModal) WithStyle ¶
func (m *ListModal) WithStyle(style MessageModalStyle) *ListModal
WithStyle sets the modal style
type ListModalItem ¶
type ListModalItem struct {
Label string // Display text in the list
Description string // Description shown in the bottom view
OnSelect func() error // Callback when item is selected with Enter
}
ListModalItem represents a selectable item in the list modal
type MessageModal ¶
type MessageModal struct {
*BaseModal
// contains filtered or unexported fields
}
MessageModal displays a message with title and content
func NewMessageModal ¶
func NewMessageModal(g *gocui.Gui, tr *i18n.TranslationSet, title string, lines ...string) *MessageModal
NewMessageModal creates a new message modal
func (*MessageModal) Draw ¶
func (m *MessageModal) Draw(dim boxlayout.Dimensions) error
Draw renders the modal
func (*MessageModal) HandleKey ¶
func (m *MessageModal) HandleKey(key any, mod gocui.Modifier) error
HandleKey handles keyboard input
func (*MessageModal) OnClose ¶
func (m *MessageModal) OnClose()
OnClose is called when the modal is closed
func (*MessageModal) WithStyle ¶
func (m *MessageModal) WithStyle(style MessageModalStyle) *MessageModal
WithStyle sets the modal style
type MessageModalStyle ¶
type MessageModalStyle struct {
TitleColor Color // Color for title (default: ColorDefault)
BorderColor Color // Color for border (default: ColorDefault)
}
MessageModalStyle holds styling options for the modal
type Modal ¶
type Modal interface {
ID() string
Draw(dim boxlayout.Dimensions) error
HandleKey(key any, mod gocui.Modifier) error
OnClose()
}
Modal represents a modal dialog