list

package
v0.0.0-...-9012958 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultDelegate

type DefaultDelegate struct {
	Styles DefaultItemStyles
	// contains filtered or unexported fields
}

func NewDefaultDelegate

func NewDefaultDelegate() *DefaultDelegate

func (*DefaultDelegate) Height

func (d *DefaultDelegate) Height() int

func (*DefaultDelegate) Render

func (d *DefaultDelegate) Render(w io.Writer, m *Model, index int, item *hn.Story)

func (*DefaultDelegate) Spacing

func (d *DefaultDelegate) Spacing() int

func (*DefaultDelegate) Update

func (d *DefaultDelegate) Update(tea.Msg, *Model) tea.Cmd

type DefaultItemStyles

type DefaultItemStyles struct {
	NormalTitle lipgloss.Style
	NormalDesc  lipgloss.Style

	SelectedTitle lipgloss.Style
	SelectedDesc  lipgloss.Style

	MarkAsReadTitle lipgloss.Style
	MarkAsReadDesc  lipgloss.Style

	SelectedTitleAddToFavorites lipgloss.Style
	SelectedDescAddToFavorites  lipgloss.Style

	SelectedTitleRemoveFromFavorites lipgloss.Style
	SelectedDescRemoveFromFavorites  lipgloss.Style
}

func NewDefaultItemStyles

func NewDefaultItemStyles() (s DefaultItemStyles)

type ItemDelegate

type ItemDelegate interface {
	Render(w io.Writer, m *Model, index int, item *hn.Story)

	Height() int

	Spacing() int

	// Update is the update loop for items. All messages in the list's update
	// loop will pass through here except when the user is setting a filter.
	// Use this method to perform item-level updates appropriate to this
	// delegate.
	Update(msg tea.Msg, m *Model) tea.Cmd
}

ItemDelegate — if it also implements help.KeyMap, delegate-related help items will be added to the help view.

type Model

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

func New

func New(delegate ItemDelegate, config *settings.Config, cat *categories.Categories, favorites *favorites.Favorites, width, height int) *Model

func (*Model) CancelFetch

func (m *Model) CancelFetch() tea.Cmd

CancelFetch cancels an in-progress fetch and returns the resulting command. Returns nil if no fetch is active.

func (*Model) FetchStoriesForFirstCategory

func (m *Model) FetchStoriesForFirstCategory() tea.Cmd

func (*Model) Index

func (m *Model) Index() int

func (*Model) SelectedItem

func (m *Model) SelectedItem() *hn.Story

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

func (*Model) VisibleItems

func (m *Model) VisibleItems() []*hn.Story

type ViewState

type ViewState int
const (
	StateStartup ViewState = iota
	StateBrowsing
	StateFetching
	StateAddFavoritesPrompt
	StateRemoveFavoritesPrompt
	StateHelpScreen
	StateReaderView
	StateCommentView
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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