FocusManagerInterface
Ordered-id rotation for "which thing has keyboard focus right now", shared by both TUI runtimes. {@see \Milpa\Live\Tui\FocusManager} is the one implementation; putting it behind this contract lets {@see \Milpa\Live\Tui\RetainedTuiLoop} reuse it instead of reimplementing the same modulo-wrapped rotation math ad hoc against a bare string.
FocusManagerInterface::currentId()
abstract public function currentId(): ?stringThe id currently holding focus, or null when nothing does.
Returns
The currently focused id, or `null` if {@see ids()} is empty.
FocusManagerInterface::focus()
abstract public function focus(string $id): voidExplicitly focuses `$id`. MUST be a no-op — not an error — if `$id` is not among {@see ids()}, leaving the current focus unchanged.
Parameters
| Name | Type | Description |
|---|---|---|
| $id | string |
FocusManagerInterface::next()
abstract public function next(): ?stringAdvances focus to the next id, wrapping around to the first id after the last.
Returns
The newly focused id, or `null` if {@see ids()} is empty.
FocusManagerInterface::previous()
abstract public function previous(): ?stringMoves focus to the previous id, wrapping around to the last id before the first.
Returns
The newly focused id, or `null` if {@see ids()} is empty.
FocusManagerInterface::ids()
abstract public function ids(): arrayThe full ordered list of ids this manager rotates focus through.