Documentation
¶
Overview ¶
Package gate demonstrates a one-shot pre-screen flow: a "gated" root screen that pushes a login form on first activation, receives the credentials when the form pops, and re-pushes the form on logout.
The form lives as a regular screen.Screen — it's only on the stack while the user is interacting with it, and is gone afterward. The trigger lives in the gate's OnEnter: it fires on initial push (with nil), on every return-from-child, and is the natural hook for "if I'm not authenticated yet, push the login screen now."
State machine, driven from the gate's OnEnter:
- First entry, no creds: push the login form.
- Login pops with creds: record them and rebuild the body.
- Login pops with nil (cancelled before authenticating): bubble the pop up so the user returns to whatever screen pushed the gate.
The same Push call can be re-issued at any point — e.g. on a "logout" keystroke or when a request returns 401 — to bring the form back without permanent stack residency.
Index ¶
- func New(t theme.Theme) screen.Screen
- type Screen
- func (s *Screen) Help() []key.Binding
- func (s *Screen) Init() tea.Cmd
- func (s *Screen) IsCapturingKeys() bool
- func (s *Screen) Layout() layout.Node
- func (s *Screen) OnEnter(result 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
}