Raxol.Core.KeyboardNavigator.NavigatorServer (Raxol v2.0.1)
View SourceBaseManager implementation for keyboard navigation in Raxol terminal UI applications.
This server provides a pure functional approach to keyboard navigation, eliminating Process dictionary usage and implementing proper OTP patterns.
Features
- Tab-based keyboard navigation between focusable elements
- Arrow key navigation for spatial layouts
- Vim-style navigation support (h,j,k,l)
- Custom navigation paths between components
- Group-based navigation
- Spatial navigation for grid layouts
- Configurable key bindings
- Supervised state management with fault tolerance
State Structure
The server maintains state with the following structure:
%{
config: %{
next_key: :tab,
previous_key: :tab, # with shift modifier
activate_keys: [:enter, :space],
dismiss_key: :escape,
arrow_navigation: true,
vim_keys: false,
group_navigation: true,
spatial_navigation: false,
tab_navigation: true
},
spatial_map: %{component_id => position_data},
navigation_paths: %{from_id => %{direction => to_id}},
focus_stack: [], # Navigation history for back navigation
groups: %{group_name => [component_ids]}
}
Summary
Functions
Returns a specification to start this module under a supervisor.
Configures keyboard navigation behavior.
Defines an explicit navigation path between components.
Gets the current configuration.
Gets navigation paths.
Gets the spatial map.
Gets the current state (for debugging/testing).
Handles keyboard events for navigation. This is typically called by the EventManager.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Initializes the keyboard navigator. Registers event handlers for keyboard navigation.
Pops and returns to the previous focus.
Pushes current focus to the stack (for back navigation).
Registers a component's position for spatial navigation.
Registers a component to a navigation group.
Resets to initial state.
Unregisters a component from a navigation group.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Configures keyboard navigation behavior.
Gets the current configuration.
Gets the spatial map.
Gets the current state (for debugging/testing).
Handles keyboard events for navigation. This is typically called by the EventManager.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Pops and returns to the previous focus.
Pushes current focus to the stack (for back navigation).
Registers a component's position for spatial navigation.
Registers a component to a navigation group.
Resets to initial state.
Unregisters a component from a navigation group.