Documentation ¶
Index ¶
- Variables
- func Back() tea.Msg
- func BackN(steps int) tea.Cmd
- func BackToHome() tea.Msg
- func CombinedKeyMap(first, second help.KeyMap) combinedKeyMap
- func Loaded() tea.Msg
- func Loading(message string) tea.Cmd
- func New(state State) *model
- func Notify(message string) tea.Cmd
- func NotifyWithDuration(message string, duration time.Duration) tea.Cmd
- func Viewport(title, content string, color lipgloss.Color) tea.Cmd
- type BackMsg
- type BackToHomeMsg
- type LoadingMsg
- type NoKeyMap
- type NotificationMsg
- type NotificationTimeoutMsg
- type NotificationWithDurationMsg
- type RestoredMsg
- type ShowViewportMsg
- type Size
- type State
- type Title
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CombinedKeyMap ¶
CombinedKeyMap is a convenience function to create a combined KeyMap that implements help.KeyMap, useful for concatenating them.
The resulting keybind is not ment to be be modified in-place.
func NotifyWithDuration ¶
NotifyWithDuration sends a notification with the given time.Duration.
Types ¶
type BackToHomeMsg ¶
type BackToHomeMsg struct{}
type LoadingMsg ¶
type LoadingMsg struct {
Message string
}
type NoKeyMap ¶
type NoKeyMap struct{}
NoKeyMap implements help.keyMap.
type NotificationMsg ¶
type NotificationMsg struct {
Message string
}
type NotificationTimeoutMsg ¶
type NotificationTimeoutMsg struct{}
type NotificationWithDurationMsg ¶
type NotificationWithDurationMsg struct { NotificationMsg Duration time.Duration }
type ShowViewportMsg ¶
type State ¶
type State interface { // Intermediate if the State should be saved to history. // // For example when loading states. Intermediate() bool // Backable if can back out of the State to previous states. // // For example when filtering a list, this can avoid to go back // to previous state and instead cancel the filtering. Backable() bool // KeyMap returns the State specific KeyMap. KeyMap() help.KeyMap // Title of the State, with optional Background and Foreground. Title() Title // Subtitle of the Sate, shown below the Title. Subtitle() string // Status of the State, shown to the right of the Title. Status() string // Resize the State's usable viewport. // // Gets called at least once after Init, as well as each time the State // is popped out of the history before Update. Resize(size Size) tea.Cmd // Init is the first function that will be called. It returns an optional // initial command. To not perform an initial command return nil. Init(ctx context.Context) tea.Cmd // Update is called when a message is received. Use it to inspect messages // and, in response, update the model and/or send a command. Update(ctx context.Context, msg tea.Msg) tea.Cmd // View renders the program's UI, which is just a string. The view is // rendered after every Update. View() string }
State is kind of an indirect wrapper interface of Model (wrapper of tea.Model).
State could be thought of as a "Window".
Click to show internal directories.
Click to hide internal directories.