Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsKey(v string, a []string) string
- func DumpToLog(msg ...any)
- func FocusedListKeyMap() blist.KeyMap
- func FocusedPanelKeyMap() viewport.KeyMap
- func FocusedTextAreaKeyMap() textarea.KeyMap
- func HeaderView(titleText string, width int, focusColor lipgloss.AdaptiveColor) string
- func HelpStyle(width int) lipgloss.Style
- func NewFocusedDelegate() blist.DefaultDelegate
- func NewUnfocusedDelegate() blist.DefaultDelegate
- func NewUnfocusedHighlightDelegate() blist.DefaultDelegate
- func PrintToLog(format string, a ...any)
- func TruncateText(text string, width int) string
- func UnfocusedListKeyMap() blist.KeyMap
- func UnfocusedPanelKeyMap() viewport.KeyMap
- func UnfocusedTextAreaKeyMap() textarea.KeyMap
- type Edit
- type EditType
- type Editor
- type HelpModel
- type HelpStyles
- type HelpType
- type Keys
- type PickerItemSelected
- type PickerKind
- type PickerModel
- type PickerOpenMsg
- type PopupClose
- type PopupFailMsg
- type PopupModel
- type PopupMsg
- type SaveCloseAndResetMsg
- type SaveFailMsg
- type SaveModel
- type SaveModelMsg
- type SaveNoChangeMsg
- type SaveStartMsg
- type SaveSuccessMsg
- type TbdModal
Constants ¶
View Source
const ( TabOffset = 10 DefaultWidth = 200 DefaultHeight = 60 )
Variables ¶
View Source
var ( ShortHelpList = []key.Binding{ ListKeys.Select, ListKeys.Up, ListKeys.Down, ListKeys.Filter, ListKeys.Help, } FullHelpListOneLine = []key.Binding{ ListKeys.Select, ListKeys.Up, ListKeys.Down, ListKeys.Filter, ListKeys.Cancel, ListKeys.Help, } FullHelpList = [][]key.Binding{ {ListKeys.Select}, {ListKeys.Up}, {ListKeys.Down}, {ListKeys.Filter}, {ListKeys.Cancel}, {ListKeys.Help}, } )
View Source
var ( ShortHelpPicker = []key.Binding{ PickerKeys.Up, PickerKeys.Down, PickerKeys.Select, PickerKeys.Cancel, } FullHelpPickerOneLine = []key.Binding{ PickerKeys.Up, PickerKeys.Down, PickerKeys.Select, PickerKeys.Cancel, } FullHelpPicker = [][]key.Binding{ {PickerKeys.Up}, {PickerKeys.Down}, {PickerKeys.Select}, {PickerKeys.Cancel}, } )
View Source
var ( ShortHelpEditing = []key.Binding{ EditKeys.Confirm, EditKeys.NewLine, EditKeys.DeleteWord, EditKeys.Cancel, } FullHelpEditingOneLine = []key.Binding{ EditKeys.Confirm, EditKeys.NewLine, EditKeys.DeleteWord, EditKeys.Cancel, } FullHelpEditing = [][]key.Binding{ {EditKeys.Confirm}, {EditKeys.NewLine}, {EditKeys.DeleteWord}, {EditKeys.Cancel}, } )
View Source
var ( Subtle = lipgloss.AdaptiveColor{Light: "#D9DCCF", Dark: "#383838"} Highlight = lipgloss.AdaptiveColor{Light: "#6d26fc", Dark: "#7D56F4"} Highlight2 = lipgloss.AdaptiveColor{Light: "#8f58fc", Dark: "#8f6ef0"} Focused = lipgloss.AdaptiveColor{Light: "#8378ab", Dark: "#bfb2eb"} Special = lipgloss.AdaptiveColor{Light: "#43BF6D", Dark: "#73F59F"} Background = lipgloss.AdaptiveColor{Light: "#c5c6c7", Dark: "#333436"} Warning = lipgloss.AdaptiveColor{Light: "#FFA100", Dark: "#F9A431"} HelpKey = lipgloss.AdaptiveColor{Light: "#909090", Dark: "#626262"} HelpDesc = lipgloss.AdaptiveColor{Light: "#B2B2B2", Dark: "#4A4A4A"} HelpSep = lipgloss.AdaptiveColor{Light: "#DDDADA", Dark: "#3C3C3C"} ActiveHelpKey = Highlight2 ActiveHelpDesc = Highlight ActiveHelpSep = Highlight ActiveTabBorder = lipgloss.Border{ Top: "─", Bottom: " ", Left: "│", Right: "│", TopLeft: "╭", TopRight: "╮", BottomLeft: "┘", BottomRight: "└", } TabBorder = lipgloss.Border{ Top: "─", Bottom: "─", Left: "│", Right: "│", TopLeft: "╭", TopRight: "╮", BottomLeft: "┴", BottomRight: "┴", } Tab = lipgloss.NewStyle(). Border(TabBorder, true). BorderForeground(Highlight). Padding(0, 1) ActiveTab = Tab.Border(ActiveTabBorder, true) TabGap = Tab. BorderTop(false). BorderLeft(false). BorderRight(false) LabelStyle = lipgloss.NewStyle(). Margin(1). Foreground(Highlight) DialogBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder(), true). BorderForeground(Highlight) PanelStyle = lipgloss.NewStyle(). Padding(0, 1). Margin(0, 1). Border(lipgloss.RoundedBorder(), false, true, true, true). BorderForeground(Highlight) PanelTitleStyle = func() lipgloss.Style { b := lipgloss.RoundedBorder() b.Right = "├" return lipgloss.NewStyle().BorderStyle(b).Padding(0, 1).BorderForeground(Highlight).Height(1) }() HighlightedBorderStyle = lipgloss.NewStyle().Foreground(Highlight) OverlayStyle = lipgloss.NewStyle(). Border(lipgloss.DoubleBorder(), true). BorderForeground(Focused). Padding(1, 1) OverlayWarnStyle = lipgloss.NewStyle(). Border(lipgloss.DoubleBorder(), true). BorderForeground(Warning). Padding(1, 1) BoxStyle = lipgloss.NewStyle(). Border(lipgloss.NormalBorder(), true). BorderForeground(Highlight). Padding(1, 2). Margin(1). Width(30) // Help KeyStyle = lipgloss.NewStyle().Foreground(HelpKey) DescStyle = lipgloss.NewStyle().Foreground(HelpDesc) SepStyle = lipgloss.NewStyle().Foreground(HelpSep) ActiveKeyStyle = lipgloss.NewStyle().Foreground(ActiveHelpKey) ActiveDescStyle = lipgloss.NewStyle().Foreground(ActiveHelpDesc) ActiveSepStyle = lipgloss.NewStyle().Foreground(ActiveHelpSep) )
Style definitions.
View Source
var CommonKeys = Keys{ Quit: key.NewBinding( key.WithKeys("ctrl+c"), key.WithHelp("ctrl+c", "quit"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "toggle help"), ), ModelRight: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "model right"), ), ModelLeft: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "model left"), ), NavigateModels: key.NewBinding( key.WithKeys("tab", "shift+tab"), key.WithHelp("tab/shift+tab", "switch models"), ), Navigation: key.NewBinding( key.WithKeys("left", "h", "right", "l"), key.WithHelp("←/h, →/l", "navigation"), ), NavigateLeft: key.NewBinding( key.WithKeys("left", "h"), key.WithHelp("←/h", "navigate left"), ), NavigateRight: key.NewBinding( key.WithKeys("right", "l"), key.WithHelp("→/l", "navigate right"), ), Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("↳", "confirm"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("↳", "select"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), Edit: key.NewBinding( key.WithKeys("e"), key.WithHelp("e", "edit"), ), Save: key.NewBinding( key.WithKeys("ctrl+s"), key.WithHelp("ctrl+s", "save"), ), }
View Source
var DumpFile *os.File
View Source
var EditKeys = editorKeys{ Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "confirm"), ), NewLine: key.NewBinding( key.WithKeys("ctrl+e"), key.WithHelp("ctrl+e", "new line"), ), DeleteWord: key.NewBinding( key.WithKeys("alt+backspace"), key.WithHelp("alt+backspace", "delete word"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), }
View Source
var ListKeys = listKeys{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "move up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "move down"), ), Filter: key.NewBinding( key.WithKeys("/"), key.WithHelp("/", "filter"), ), Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("↳", "confirm"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("↳", "select"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "toggle help"), ), }
View Source
var PickerKeys = pickerKeys{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "move up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "move down"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("↳", "select"), ), Cancel: key.NewBinding( key.WithKeys("esc", "q"), key.WithHelp("esc/q", "cancel"), ), }
Functions ¶
func ContainsKey ¶
func FocusedListKeyMap ¶
func FocusedPanelKeyMap ¶
func FocusedTextAreaKeyMap ¶ added in v0.8.0
func HeaderView ¶
func HeaderView(titleText string, width int, focusColor lipgloss.AdaptiveColor) string
func NewFocusedDelegate ¶
func NewFocusedDelegate() blist.DefaultDelegate
func NewUnfocusedDelegate ¶
func NewUnfocusedDelegate() blist.DefaultDelegate
func NewUnfocusedHighlightDelegate ¶
func NewUnfocusedHighlightDelegate() blist.DefaultDelegate
func PrintToLog ¶ added in v0.8.0
func TruncateText ¶
func UnfocusedListKeyMap ¶
func UnfocusedPanelKeyMap ¶
func UnfocusedTextAreaKeyMap ¶ added in v0.8.0
Types ¶
type Editor ¶ added in v0.8.0
func (*Editor) AddUpdateEdit ¶ added in v0.8.0
func (*Editor) ResetEditor ¶ added in v0.8.0
func (e *Editor) ResetEditor()
ResetEditor resets the editor - runs after data is saved
type HelpModel ¶ added in v0.8.0
type HelpModel struct { Width int ShowAll bool // if true, render the "full" help menu OneLine bool ShortHelp []key.Binding FullHelpOneLine []key.Binding FullHelp [][]key.Binding ShortSeparator string FullSeparator string // The symbol we use in the short help when help items have been truncated // due to width. Periods of ellipsis by default. Ellipsis string Styles HelpStyles }
HelpModel contains the state of the help view.
func NewHelpModel ¶ added in v0.8.0
New creates a new help view with some useful defaults.
func (HelpModel) FullHelpView ¶ added in v0.8.0
FullHelpView renders help columns from a slice of key binding slices. Each top level slice entry renders into a column.
func (HelpModel) SingleLineHelpView ¶ added in v0.8.0
SingleLineHelpView renders a single line help view from a slice of keybindings. If the line is longer than the maximum width it will be gracefully truncated, showing only as many help items as possible.
type HelpStyles ¶ added in v0.8.0
type HelpStyles struct { Ellipsis lipgloss.Style // Styling for the short help ShortKey lipgloss.Style ShortDesc lipgloss.Style ShortSeparator lipgloss.Style // Styling for the full help FullKey lipgloss.Style FullDesc lipgloss.Style FullSeparator lipgloss.Style }
Styles is a set of available style definitions for the Help bubble.
func NewStyles ¶ added in v0.8.0
func NewStyles(active bool) HelpStyles
type PickerItemSelected ¶ added in v0.8.0
type PickerItemSelected struct { Selected int From PickerKind }
type PickerKind ¶ added in v0.8.0
type PickerKind string
type PickerModel ¶ added in v0.8.0
type PickerModel struct { Open bool // contains filtered or unexported fields }
func NewPickerModel ¶ added in v0.8.0
func NewPickerModel(title string, kind PickerKind, items []string, initSelected int) PickerModel
func (PickerModel) Init ¶ added in v0.8.0
func (m PickerModel) Init() tea.Cmd
func (PickerModel) View ¶ added in v0.8.0
func (m PickerModel) View() string
type PickerOpenMsg ¶ added in v0.8.0
type PickerOpenMsg struct {
Kind PickerKind
}
type PopupClose ¶ added in v0.8.0
type PopupClose struct{}
type PopupFailMsg ¶ added in v0.8.0
type PopupFailMsg struct {
Err error
}
type PopupModel ¶ added in v0.8.0
func NewPopupModel ¶ added in v0.8.0
func NewPopupModel(title, content string, helpKeys []key.Binding) PopupModel
func (PopupModel) Init ¶ added in v0.8.0
func (m PopupModel) Init() tea.Cmd
func (*PopupModel) UpdateText ¶ added in v0.8.0
func (m *PopupModel) UpdateText(title, content, warning string)
func (PopupModel) View ¶ added in v0.8.0
func (m PopupModel) View() string
type SaveCloseAndResetMsg ¶ added in v0.8.0
type SaveCloseAndResetMsg struct{}
type SaveFailMsg ¶ added in v0.8.0
type SaveFailMsg struct {
Err error
}
type SaveModel ¶ added in v0.8.0
type SaveModel struct { Open bool Save bool FilePath string Title string Content string Warning string RenderedDuringQuit bool Help HelpModel }
func NewSaveModel ¶ added in v0.8.0
type SaveModelMsg ¶ added in v0.8.0
type SaveModelMsg struct {
InQuitWorkflow bool
}
type SaveNoChangeMsg ¶ added in v0.8.0
type SaveNoChangeMsg struct{}
type SaveStartMsg ¶ added in v0.8.0
type SaveStartMsg struct{}
type SaveSuccessMsg ¶ added in v0.8.0
type SaveSuccessMsg struct{}
type TbdModal ¶
type TbdModal struct {
// contains filtered or unexported fields
}
func NewTbdModal ¶
Click to show internal directories.
Click to hide internal directories.