render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBorder     = '\ue0b0'
	DefaultBarBGColor = "#353533"
	DynamicWidth      = -1
)

Variables

View Source
var (
	TableHeaderStyle = lipgloss.NewStyle().
						Bold(true).
						BorderStyle(lipgloss.ThickBorder()).
						BorderForeground(lipgloss.Color("240")).
						BorderBottom(true)

	SelectedRowStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("#262626")).
						Background(lipgloss.Color("#ebbd34")).
						Bold(false)
)

Functions

func EntryIcon

func EntryIcon(e *structure.Entry) string

EntryIcon resolves an emoji icon for the provided Entry instance based on the file extension.

func NewProgressBar

func NewProgressBar(width int, full, empty rune) progress.Model

func NewStatusBar

func NewStatusBar(items []*BarItem, totalWidth int) string

NewStatusBar builds a new status bar based on the provided list of *BarItem instances. The total bar width is defined by the totalWidth parameter and all bar items will be fit in that width according to their parameters or evenly spread for the available width.

NOTE: This implementation does not guarantee that the manually defined element sizes will not exceed the totalWidth value.

func SetTeaProgram

func SetTeaProgram(tp *tea.Program)

Types

type BarItem

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

BarItem represents a single status bar item, including its string content, background color, and width. The width parameter is optional, and the default width equals the content width.

The width value -1 denotes that the item will take all available screen width minus the sum of all other elements' widths. If multiple items have a width value of -1, the resulting width will be spread equally between them.

func DefaultBarItem

func DefaultBarItem(content string) *BarItem

DefaultBarItem returns a new *BarItem instance with default values for background color and width.

func NewBarItem

func NewBarItem(content, bgColor string, width int) *BarItem

NewBarItem returns a new *BarItem instance based on the provided parameters. If the background color is an empty string, a default color will be assigned.

type ChangeLevelHandler

type ChangeLevelHandler func(e *structure.Entry, s State)

type Column

type Column struct {
	Title   string
	SortKey drive.SortKey
	Width   int
}

func (*Column) FmtName

func (c *Column) FmtName(sortState SortState) string

type DirModel

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

func NewDirModel

func NewDirModel(nav *Navigation) *DirModel

func (*DirModel) Init

func (dm *DirModel) Init() tea.Cmd

func (*DirModel) Update

func (dm *DirModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DirModel) View

func (dm *DirModel) View() string

type DriveModel

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

func NewDriveModel

func NewDriveModel(n *Navigation) *DriveModel

func (*DriveModel) Init

func (dm *DriveModel) Init() tea.Cmd

func (*DriveModel) Update

func (dm *DriveModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DriveModel) View

func (dm *DriveModel) View() string

type Mode

type Mode string
const (
	PENDING Mode = "PENDING"
	READY   Mode = "READY"
	INPUT   Mode = "INPUT"
)
type Navigation struct {
	// contains filtered or unexported fields
}

func NewNavigation

func NewNavigation(l *drive.List, t *structure.Tree) *Navigation
func (n *Navigation) DrivesList() *drive.List
func (n *Navigation) Entry() *structure.Entry
func (n *Navigation) Explore(path string) error
func (n *Navigation) LevelDown(path string, cursor int, clh ChangeLevelHandler) (chan struct{}, chan error)
func (n *Navigation) LevelUp(clh ChangeLevelHandler)
func (n *Navigation) Lock() bool
func (n *Navigation) Locked() bool
func (n *Navigation) ParentSize() int64
func (n *Navigation) State() State
func (n *Navigation) Unlock()

type SortState

type SortState struct {
	Key  drive.SortKey
	Desc bool
}

type State

type State int

State defines a custom type representing a current GUI state.

const (
	Drives State = iota
	Dirs
)

type ViewModel

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

func NewViewModel

func NewViewModel(n *Navigation) *ViewModel

func (*ViewModel) Init

func (vm *ViewModel) Init() tea.Cmd

func (*ViewModel) Update

func (vm *ViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ViewModel) View

func (vm *ViewModel) View() string

Jump to

Keyboard shortcuts

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