Documentation
¶
Overview ¶
Package panes draws the desktop app's sidebars' panes (docs/specs/ui.md#sidebars-and-panes, plan 0009): Files, Search, Backlinks, Outgoing links, Tags, All properties, Outline and Tasks. They read notesd through their Env and ask the window to act through Actions.
Index ¶
Constants ¶
const ( SortAlphabetical = "alphabetical" SortAlphabeticalReverse = "alphabeticalReverse" SortModified = "byModifiedTime" SortModifiedReverse = "byModifiedTimeReverse" )
The Files pane's sort orders, by Obsidian's names.
const SearchDelay = 250 * time.Millisecond
SearchDelay is how long after the last change the pane searches.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API interface {
Search(ctx context.Context, p *api.NoteSearchParams) ([]api.SearchHit, error)
List(ctx context.Context, p *api.NoteListParams) ([]api.NoteEntry, error)
Backlinks(ctx context.Context, p *api.NoteBacklinksParams) ([]api.Backlink, error)
Links(ctx context.Context, p *api.NoteLinksParams) ([]api.Link, error)
Read(ctx context.Context, p *api.NoteReadParams) (*api.Note, error)
Tags(ctx context.Context, p *api.NoteTagsParams) ([]api.TagCount, error)
Properties(ctx context.Context, p *api.NotePropertiesParams) ([]api.PropertyCount, error)
Tasks(ctx context.Context, p *api.NoteTasksParams) ([]api.TaskEntry, error)
}
API is what the panes read of notesd; api.NoteClient has it.
type Actions ¶
type Actions struct {
Open func(path, where string)
OpenAtLine func(path string, line int, where string)
OpenOrCreate func(target, where string)
SearchFor func(query string)
JumpToLine func(line int) // in the active note
Report func(error)
}
Actions are what the panes ask of the window. where is a workspace.Here, NewTab, ToRight or Below.
type Backlinks ¶
type Backlinks struct {
Env *Env
// contains filtered or unexported fields
}
Backlinks is the Backlinks pane: linked and unlinked mentions of the active file.
type Env ¶
type Env struct {
Loop notes.Env
API func() API
Vault int64
Catalog *catalog.Catalog
Actions Actions
// Active is the active tab's file, "" for none; ActiveText its text
// as the editor holds it, ok false when it is not open as a note.
Active func() string
ActiveText func() (string, bool)
// Where turns the modifiers of a click into where it opens.
Where func(mods ui.Modifiers) string
}
Env is what every pane shares.
type FileActions ¶
type FileActions struct {
NewNote func(folder string)
NewFolder func(parent string)
Rename func(path, name string, folder bool)
Move func(path, toFolder string, folder bool)
MoveTo func(path string, folder bool) // asks where
Delete func(path string, folder bool)
CopyPath func(path string)
OpenDefault func(path string)
History func(path string)
}
FileActions are what the Files pane asks of the window.
type Files ¶
type Files struct {
Env *Env
Store *workspace.Store
Actions FileActions
// ShowUnsupported is the Show unsupported files preference.
ShowUnsupported bool
// contains filtered or unexported fields
}
Files is the Files pane (docs/specs/ui.md#files-pane-batch-2): a vault's folders and files on frostui's source list, which builds only the rows in view.
type Mention ¶
type Mention struct {
Path, Title string
Lines []MentionLine
}
Mention is a note that links to the active note, or mentions it.
func LinkedGroups ¶
LinkedGroups groups backlinks by their source, in notesd's order.
type MentionLine ¶
type MentionLine struct {
Line int
Parts []api.SnippetPart
}
MentionLine is where one mention is; Line is 0 for an unlinked one.
type Node ¶
type Node struct {
Path string
// Name is a folder's name, or a file's name without its extension.
Name string
// Extension is a file's, in lower case.
Extension string
// Type is a file's type; "folder" for a folder.
Type string
Children []string // a folder's children, sorted; nil for a file
// contains filtered or unexported fields
}
Node is a folder or file of the Files pane.
type Outgoing ¶
type Outgoing struct {
Env *Env
// contains filtered or unexported fields
}
Outgoing is the Outgoing links pane.
type Outline ¶
type Outline struct {
Env *Env
// CurrentLine is the caret's line, from 1, to mark its heading.
CurrentLine func() int
// contains filtered or unexported fields
}
Outline is the Outline pane: the active note's headings, nested.
type Properties ¶
Properties is the All properties pane.
func (*Properties) Types ¶
func (p *Properties) Types() map[string]string
Types are the vault's property types, by key, for the properties panel.
type Search ¶
Search is the Search pane (docs/specs/ui.md#search-pane-batch-2).
type TagNode ¶
type TagNode struct {
Name string // the tag's last segment, as first spelled
Tag string // the whole tag, without '#'
Count int64 // the notes with the tag, plus its children's
Children []*TagNode
}
TagNode is a tag and the tags nested under it.
type Tasks ¶
type Tasks struct {
Env *Env
// contains filtered or unexported fields
}
Tasks is the Tasks pane: the vault's open tasks, by note.