Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Navigation & Routing Nodes

Routing in Voce IR is modeled as a state machine where states are views and transitions are navigation events. The schema supports nested routes, guards for auth checks, data preloading, and sitemap generation.

RouteMap

Top-level routing configuration for a multi-route application. Referenced from VoceDocument.routes.

FieldTypeRequiredDescription
node_idstringyesUnique identifier
routes[RouteEntry]yesList of route definitions
not_found_routestringnoRoute name or path for 404 pages
default_transitionRouteTransitionConfignoDefault transition animation between routes
{
  "node_id": "app-routes",
  "routes": [
    { "path": "/", "name": "home", "view_root_id": "home-root" },
    { "path": "/about", "name": "about", "view_root_id": "about-root" }
  ],
  "not_found_route": "/404"
}

RouteEntry

Defines a single route mapping a URL path to a ViewRoot.

FieldTypeRequiredDescription
pathstringyesURL path pattern (e.g., “/products/:id”)
namestringnoRoute name for programmatic navigation
view_root_idstringyesViewRoot to render for this route
guardRouteGuardnoAccess control configuration
preload_data[string]noDataNode IDs to prefetch on navigation
transitionRouteTransitionConfignoTransition animation for this route
sitemap_priorityfloat32noSitemap priority 0.0-1.0 (default 0.5)
sitemap_change_freqChangeFrequencynoAlways, Hourly, Daily, Weekly, Monthly, Yearly, Never
sitemap_last_modifiedstringnoLast modification date (ISO 8601)
exclude_from_sitemapboolnoExclude from generated sitemap (default false)
children[RouteEntry]noNested child routes
{
  "path": "/dashboard",
  "name": "dashboard",
  "view_root_id": "dashboard-root",
  "guard": {
    "requires_auth": true,
    "required_roles": ["user"],
    "redirect_on_fail": "/login"
  },
  "preload_data": ["user-data", "dashboard-stats"],
  "sitemap_priority": 0.3,
  "exclude_from_sitemap": true
}

RouteGuard

Access control for a route. The compiler emits authentication and authorization checks before rendering.

FieldTypeRequiredDescription
requires_authboolnoWhether authentication is required (default false)
required_roles[string]noRoles the user must have to access the route
redirect_on_failstringnoPath to redirect to if guard fails
custom_guardstringnoReference to a ComputeNode for custom logic
{
  "requires_auth": true,
  "required_roles": ["admin"],
  "redirect_on_fail": "/login"
}

RouteTransitionConfig

Configures the animation played when navigating between routes.

FieldTypeRequiredDescription
transition_typeRouteTransitionTypenoNone, Crossfade, Slide, SharedElement, Custom
durationDurationnoTransition duration in ms
easingEasingnoTiming function
slide_directionSlideDirectionnoLeft, Right, Up, Down (for Slide type)
shared_elements[SharedElementPair]noPaired elements for SharedElement transitions
custom_sequence_idstringnoReference to a Sequence node (for Custom type)
reduced_motionReducedMotionnoAlternative for prefers-reduced-motion

SharedElementPair

FieldTypeRequiredDescription
transition_namestringyesIdentifier for the shared transition
source_node_idstringnoNode in the source route
target_node_idstringnoNode in the target route
{
  "transition_type": "Crossfade",
  "duration": { "ms": 200 },
  "easing": { "easing_type": "CubicBezier", "x1": 0.4, "y1": 0, "x2": 0.2, "y2": 1 },
  "reduced_motion": { "strategy": "Remove" }
}