yera.ui.navigation
Declare stable browser screens, placement, and contextual sidebars.
Screen definitions are shared by desktop and mobile renderers. Their tuple order defines canonical navigation order, while explicit mobile positions select and order the smaller mobile destination set.
Symbols
ScreenDefinition
Describe one stable top-level browser destination.
Fields
Stable identifier used by routes and active-state rendering.
User-facing navigation label.
Canonical destination URL.
Registered icon or template key used by navigation renderers.
Optional contextual sidebar associated with the screen.
Whether the destination can currently be opened.
Primary or utility placement in desktop navigation.
Position in the mobile menu, or None to omit the
destination from that menu.
Methods
ScreenDefinition.__init__
__init__(
key: str,
label: str,
href: str,
icon: str,
sidebar: SidebarDefinition | None = None,
availability: ScreenAvailability = 'available',
placement: NavigationPlacement = 'primary',
mobile_menu_order: int | None = None,
) → NoneScreenRegistry
Provide ordered iteration and immutable keyed lookup for UI screens.
Tuple order remains the canonical desktop order. Construction rejects
duplicate stable keys and builds an immutable lookup. Availability filtering
preserves tuple order, while mobile navigation uses explicit
mobile_menu_order values.
Fields
Screen definitions in canonical navigation order.
Methods
ScreenRegistry.__post_init__
__post_init__() → NoneBuild the immutable screen lookup and reject duplicate keys.
Raises
If two screens use the same stable key.
ScreenRegistry.__iter__
__iter__() → Iterator[ScreenDefinition]Iterate over screens in navigation order.
Returns
An iterator over the registered screens.
ScreenRegistry.__len__
__len__() → intReturn the number of registered screens.
Returns
The number of screens in the registry.
ScreenRegistry.__getitem__
__getitem__(
key: str,
) → ScreenDefinitionLook up a screen by its stable key.
Parameters
Stable screen identifier.
Returns
The matching screen definition.
ScreenRegistry.available
available() → tuple[ScreenDefinition, ...]Return screens that are currently available.
Returns
Available screens in navigation order.
ScreenRegistry.__init__
__init__(
screens: tuple[ScreenDefinition, ...],
) → NoneSidebarDefinition
Describe contextual sidebar content owned by a screen.
Fields
Stable sidebar context identifier.
HTMX endpoint that renders the sidebar fragment.
Whether the shell initially exposes the sidebar.
Methods
SidebarDefinition.__init__
__init__(
key: str,
endpoint: str,
default_open: bool = False,
) → None