Documentation
¶
Overview ¶
Package modals demonstrates the three weights of feedback a screen can give, on one list of operations, so the difference between them is visible side by side rather than across two demos:
app.Info passive. A successful op puts one line in the statusbar
and the next keypress wipes it (rule 20).
pkg/confirm a gate. A destructive op asks first, and the cancel side
starts highlighted (rule 22).
pkg/alert an acknowledgement. A failure the user must see and
dismiss before continuing (rule 23).
Enter runs the highlighted op. "Force push main" goes through both modals in sequence — confirm the destructive thing, then acknowledge that it was rejected — which is the shape real tooling ends up in.
Both modals resolve by message (confirm.ConfirmedMsg / CancelledMsg, alert.DismissedMsg) posted as tea.Cmds; this screen owns show/hide state, gates IsCapturingKeys while either is up, and overlays them in a ZStack. Note the two hosting shapes: the confirm modal is a fixed size inside layout.Center, while the autosizing alert centers itself and needs no Center wrapper.
Index ¶
- func New(t theme.Theme) screen.Screen
- type Screen
- func (s *Screen) Help() []key.Binding
- func (s *Screen) HelpSections() []help.Section
- func (s *Screen) Init() tea.Cmd
- func (s *Screen) IsCapturingKeys() bool
- func (s *Screen) Layout() layout.Node
- func (s *Screen) OnEnter(any) tea.Cmd
- func (s *Screen) SetTheme(t theme.Theme)
- func (s *Screen) Title() string
- func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
func (*Screen) HelpSections ¶
HelpSections reflects the active context: while a modal is up its keys are the only ones that do anything, so they are the only ones listed.