common

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TabOffset = 10

Variables

View Source
var (
	Subtle     = lipgloss.AdaptiveColor{Light: "#D9DCCF", Dark: "#383838"}
	Highlight  = lipgloss.AdaptiveColor{Light: "#6d26fc", Dark: "#7D56F4"}
	Focused    = lipgloss.AdaptiveColor{Light: "#8378ab", Dark: "#bfb2eb"}
	Special    = lipgloss.AdaptiveColor{Light: "#43BF6D", Dark: "#73F59F"}
	Background = lipgloss.AdaptiveColor{Light: "#c5c6c7", Dark: "#333436"}

	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)

	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.NormalBorder(), true).
				BorderForeground(Highlight).
				Padding(1, 2).
				Margin(1).
				Width(30)
)

Style definitions.

View Source
var CommonHotkeys = Keys{
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "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"),
	),
}
View Source
var ListHotkeys = 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"),
	),
	Slash: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "filter"),
	),
	Confirm: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select"),
	),
	Escape: key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "cancel"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "toggle help"),
	),
}
View Source
var PickerHotkeys = 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"),
	),
	Confirm: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("↳", "select"),
	),
	Cancel: key.NewBinding(
		key.WithKeys("esc", "q"),
		key.WithHelp("esc/q", "cancel"),
	),
}

Functions

func ContainsKey

func ContainsKey(v string, a []string) string

func FocusedListKeyMap

func FocusedListKeyMap() blist.KeyMap

func FocusedPanelKeyMap

func FocusedPanelKeyMap() viewport.KeyMap

func HeaderView

func HeaderView(titleText string, width int, focusColor lipgloss.AdaptiveColor) string

func HelpStyle

func HelpStyle(width int) lipgloss.Style

func NewFocusedDelegate

func NewFocusedDelegate() blist.DefaultDelegate

func NewUnfocusedDelegate

func NewUnfocusedDelegate() blist.DefaultDelegate

func NewUnfocusedHighlightDelegate

func NewUnfocusedHighlightDelegate() blist.DefaultDelegate

func TruncateText

func TruncateText(text string, width int) string

func UnfocusedListKeyMap

func UnfocusedListKeyMap() blist.KeyMap

func UnfocusedPanelKeyMap

func UnfocusedPanelKeyMap() viewport.KeyMap

Types

type Keys

type Keys struct {
	Quit       key.Binding
	Confirm    key.Binding
	ModelLeft  key.Binding
	ModelRight key.Binding
	Help       key.Binding
}

type TbdModal

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

func NewTbdModal

func NewTbdModal(modelName string) TbdModal

func (*TbdModal) Close

func (m *TbdModal) Close()

func (TbdModal) Init

func (m TbdModal) Init() tea.Cmd

func (*TbdModal) Open

func (m *TbdModal) Open()

func (TbdModal) Update

func (m TbdModal) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TbdModal) View

func (m TbdModal) View() string

type WarnModal

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

Jump to

Keyboard shortcuts

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