Documentation
¶
Index ¶
- Constants
- func FilterYAMLs(m ListModel) tea.Cmd
- func LoadYAML(md *yamls.Document) tea.Cmd
- type Config
- type DocumentList
- type DocumentListConfig
- type DocumentListItem
- type FetchedYAMLMsg
- type FilterState
- type FilteredYAMLMsg
- type KeyBinds
- type KeyHandler
- type ListModel
- func (m *ListModel) AddYAMLs(yaml ...*yamls.Document)
- func (m *ListModel) ClearText() tea.Cmd
- func (m ListModel) FilterApplied() bool
- func (m ListModel) GetSelectedYAML() *yamls.Document
- func (m *ListModel) GoToEnd()
- func (m *ListModel) GoToStart()
- func (m ListModel) IsLoading() bool
- func (m *ListModel) MoveCursorDown()
- func (m *ListModel) MoveCursorUp()
- func (m *ListModel) MoveNextPage()
- func (m *ListModel) MovePrevPage()
- func (m *ListModel) OpenYAML(md *yamls.Document) tea.Cmd
- func (m *ListModel) ResetFiltering()
- func (m *ListModel) SetCursorToBottom()
- func (m *ListModel) SetCursorToTop()
- func (m *ListModel) SetFilterText(text string) tea.Cmd
- func (m *ListModel) SetHelpVisible(visible bool)
- func (m *ListModel) SetSize(width, height int)
- func (m *ListModel) StartFiltering() tea.Cmd
- func (m *ListModel) ToggleHelp()
- func (m ListModel) Update(msg tea.Msg) (ListModel, tea.Cmd)
- func (m ListModel) View() string
- type PaginationRenderer
- type Paginator
- type Section
- type SectionKey
- type ViewState
Constants ¶
const ( SectionDocuments = iota SectionFilter )
Variables ¶
This section is empty.
Functions ¶
func FilterYAMLs ¶
Types ¶
type Config ¶
type Config struct {
CommonModel *common.CommonModel
KeyBinds *KeyBinds
Compact bool
}
type DocumentList ¶ added in v0.18.0
type DocumentList struct {
// contains filtered or unexported fields
}
DocumentList handles rendering of document lists.
func NewDocumentList ¶ added in v0.18.0
func NewDocumentList(t *theme.Theme, indent int, compact bool) *DocumentList
NewDocumentList creates a new document list.
func (*DocumentList) GetItemHeight ¶ added in v0.18.0
func (dlr *DocumentList) GetItemHeight() int
func (*DocumentList) Render ¶ added in v0.18.0
func (dlr *DocumentList) Render(params DocumentListConfig) string
Render renders a list of documents with pagination and empty states.
type DocumentListConfig ¶ added in v0.18.0
type DocumentListConfig struct {
Paginator Paginator
FilterValue string
Documents []*yamls.Document
Cursor int
Width int
FilterState FilterState
SectionKey SectionKey
IsLoaded bool
}
DocumentListConfig contains all parameters needed to render a document list.
type DocumentListItem ¶ added in v0.18.0
type DocumentListItem struct {
Document *yamls.Document
Theme *theme.Theme
FilterValue string
Index int
Width int
MaxGroupWidth int // Maximum width of the group across all items.
MaxKindWidth int // Maximum width of the kind across all items.
MaxNameWidth int // Maximum width of the name across all items.
Cursor int
FilterState FilterState
VisibleYAMLsCount int
IsFilterSelected bool
Compact bool
}
DocumentListItem represents a single item in the list with its data and rendering capabilities.
func (*DocumentListItem) Render ¶ added in v0.18.0
func (li *DocumentListItem) Render(b *strings.Builder)
Render renders the list item to the provided string builder.
type FetchedYAMLMsg ¶
type FilterState ¶
type FilterState int
FilterState is the current filtering state in the file listing.
const ( Unfiltered FilterState = iota // No filter set. Filtering // User is actively setting a filter. FilterApplied // A filter is applied and user is not editing filter. )
type FilteredYAMLMsg ¶
type KeyBinds ¶
type KeyBinds struct {
Open *keys.KeyBind `json:"open,omitempty"`
Find *keys.KeyBind `json:"find,omitempty"`
Home *keys.KeyBind `json:"home,omitempty"`
End *keys.KeyBind `json:"end,omitempty"`
PageUp *keys.KeyBind `json:"pageUp,omitempty"`
PageDown *keys.KeyBind `json:"pageDown,omitempty"`
}
func (*KeyBinds) EnsureDefaults ¶
func (kb *KeyBinds) EnsureDefaults()
func (*KeyBinds) GetKeyBinds ¶
type KeyHandler ¶
type KeyHandler struct {
// contains filtered or unexported fields
}
KeyHandler provides key handling for list view.
func NewKeyHandler ¶
NewKeyHandler creates a new ListKeyHandler.
func (*KeyHandler) HandleDocumentBrowsing ¶
HandleDocumentBrowsing handles key events for document browsing in list view.
func (*KeyHandler) HandleFilteringMode ¶
HandleFilteringMode handles events when in filtering mode.
type ListModel ¶
type ListModel struct {
// The master set of yaml documents we're working with.
YAMLs []*yamls.Document
ViewState ViewState
FilterState FilterState
ShowHelp bool
// contains filtered or unexported fields
}
func (ListModel) FilterApplied ¶
func (ListModel) GetSelectedYAML ¶ added in v0.24.1
GetSelectedYAML returns the current selected yaml in the list.
func (*ListModel) GoToEnd ¶ added in v0.24.1
func (m *ListModel) GoToEnd()
GoToEnd goes to the last page and last item.
func (*ListModel) GoToStart ¶ added in v0.24.1
func (m *ListModel) GoToStart()
GoToStart goes to the first page and first item.
func (*ListModel) MoveCursorDown ¶ added in v0.24.1
func (m *ListModel) MoveCursorDown()
MoveCursorDown moves the cursor down in the list.
func (*ListModel) MoveCursorUp ¶ added in v0.24.1
func (m *ListModel) MoveCursorUp()
MoveCursorUp moves the cursor up in the list.
func (*ListModel) MoveNextPage ¶ added in v0.24.1
func (m *ListModel) MoveNextPage()
MoveNextPage moves to the next page.
func (*ListModel) MovePrevPage ¶ added in v0.24.1
func (m *ListModel) MovePrevPage()
MovePrevPage moves to the previous page.
func (*ListModel) OpenYAML ¶ added in v0.24.1
OpenYAML opens a yaml document in the pager. Note that this also alters the model.
func (*ListModel) ResetFiltering ¶
func (m *ListModel) ResetFiltering()
func (*ListModel) SetCursorToBottom ¶ added in v0.24.1
func (m *ListModel) SetCursorToBottom()
SetCursorToBottom sets the cursor to the bottom of the current page.
func (*ListModel) SetCursorToTop ¶ added in v0.24.1
func (m *ListModel) SetCursorToTop()
SetCursorToTop sets the cursor to the top of the current page.
func (*ListModel) SetFilterText ¶ added in v0.24.1
SetFilterText sets the filter text and updates the filter.
func (*ListModel) SetHelpVisible ¶ added in v0.24.1
SetHelpVisible sets help visibility.
func (*ListModel) StartFiltering ¶ added in v0.24.1
StartFiltering initializes the filtering mode.
func (*ListModel) ToggleHelp ¶ added in v0.24.1
func (m *ListModel) ToggleHelp()
type PaginationRenderer ¶
type PaginationRenderer struct {
// contains filtered or unexported fields
}
PaginationRenderer handles pagination display.
func NewPaginationRenderer ¶
func NewPaginationRenderer(t *theme.Theme, width int) *PaginationRenderer
NewPaginationRenderer creates a new pagination renderer.
func (*PaginationRenderer) RenderPagination ¶
func (pr *PaginationRenderer) RenderPagination(paginatorModel *paginator.Model, totalPages int) string
RenderPagination renders pagination controls.
type Paginator ¶ added in v0.18.0
Paginator represents the pagination interface needed for document rendering.