@xmachines/docs 1.0.0-beta.25 → 1.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/@xmachines/play/classes/PlayError.md +10 -4
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play-actor/README.md +4 -0
- package/api/@xmachines/play-actor/classes/AbstractActor.md +49 -92
- package/api/@xmachines/play-actor/functions/typedSpec.md +57 -0
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +9 -18
- package/api/@xmachines/play-actor/interfaces/Routable.md +5 -21
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +6 -6
- package/api/@xmachines/play-actor/interfaces/Viewable.md +5 -6
- package/api/@xmachines/play-dom/README.md +24 -8
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +4 -4
- package/api/@xmachines/play-dom/functions/connectRenderer.md +1 -1
- package/api/@xmachines/play-dom/functions/defineRegistry.md +61 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +29 -12
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +62 -0
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/DefineRegistryOptions.md +25 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +18 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +13 -10
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +29 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +5 -5
- package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +53 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +16 -3
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +5 -2
- package/api/@xmachines/play-dom-router/README.md +10 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +18 -46
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +38 -0
- package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +16 -16
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +16 -16
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +114 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +50 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +6 -6
- package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-dom-router-demo/README.md +46 -51
- package/api/@xmachines/play-react/README.md +4 -4
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +31 -5
- package/api/@xmachines/play-react/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useBoundProp.md +2 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/functions/useStateBinding.md +2 -0
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-react/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react-router/README.md +5 -1
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +102 -25
- package/api/@xmachines/play-react-router/classes/RouteMap.md +17 -33
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +8 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +21 -11
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +7 -7
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +18 -8
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/README.md +42 -5
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +12 -19
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +100 -25
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromMachine.md +38 -0
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +45 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
- package/api/@xmachines/play-router/functions/extractRouteParams.md +46 -0
- package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
- package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteMap.md +4 -4
- package/api/@xmachines/play-router/interfaces/{BaseRouteMapping.md → RouteMapping.md} +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteNode.md +12 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +6 -0
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +8 -0
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +10 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +2 -0
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +4 -4
- package/api/@xmachines/play-solid/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/useStateBinding.md +2 -0
- package/api/@xmachines/play-solid/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid-router/README.md +2 -2
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +121 -46
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +15 -9
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +47 -92
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +19 -6
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +21 -18
- package/api/@xmachines/play-solid-router-demo/README.md +25 -28
- package/api/@xmachines/play-svelte/README.md +28 -0
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +9 -9
- package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +2 -0
- package/api/@xmachines/play-svelte/variables/PlayRenderer.md +2 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +1 -0
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +14 -1
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +23 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +6 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +20 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-svelte-spa-router-demo/README.md +119 -12
- package/api/@xmachines/play-sveltekit-router/README.md +2 -1
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +46 -24
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +14 -1
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +23 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +10 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +20 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router-demo/README.md +120 -12
- package/api/@xmachines/play-tanstack-react-router/README.md +5 -3
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +17 -33
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +93 -25
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +21 -11
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +18 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +13 -19
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +23 -29
- package/api/@xmachines/play-tanstack-solid-router/README.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +101 -36
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +15 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +13 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +23 -24
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +25 -26
- package/api/@xmachines/play-vue/README.md +4 -4
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/useStateBinding.md +2 -0
- package/api/@xmachines/play-vue/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +5 -5
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -3
- package/api/@xmachines/play-vue/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue-router/README.md +2 -2
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +18 -108
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +44 -104
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +127 -62
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +19 -7
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-vue-router-demo/README.md +47 -40
- package/api/@xmachines/play-xstate/README.md +15 -15
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +46 -30
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +20 -15
- package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +2 -2
- package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +14 -12
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +3 -7
- package/api/@xmachines/shared/functions/xmAliases.md +1 -1
- package/api/README.md +4 -4
- package/api/llms.txt +3 -3
- package/examples/README.md +50 -32
- package/examples/basic-state-machine.md +75 -31
- package/examples/form-validation.md +199 -127
- package/examples/multi-router-integration.md +312 -230
- package/examples/routing-patterns.md +243 -187
- package/examples/traffic-light.md +114 -65
- package/guides/README.md +29 -15
- package/guides/getting-started.md +224 -144
- package/guides/installation.md +153 -213
- package/package.json +2 -2
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +0 -38
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +0 -33
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayRouteEvent
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/types.ts:
|
|
5
|
+
Defined in: [play-router/src/types.ts:223](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L223)
|
|
6
6
|
|
|
7
7
|
Enhanced routing event with parameter and query support
|
|
8
8
|
|
|
@@ -30,7 +30,7 @@ Target state ID with # prefix (e.g., '#home', '#profile')
|
|
|
30
30
|
|
|
31
31
|
## Param
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Path-only route parameters extracted from the URL path (e.g., `{ userId: '123' }` from `/profile/123`). Query parameters are kept separate in `query`.
|
|
34
34
|
|
|
35
35
|
## Param
|
|
36
36
|
|
|
@@ -85,7 +85,7 @@ import type { PlayRouteEvent } from "@xmachines/play-router";
|
|
|
85
85
|
const event: PlayRouteEvent = {
|
|
86
86
|
type: "play.route",
|
|
87
87
|
to: "#settings",
|
|
88
|
-
params: { section: "profile" }, //
|
|
88
|
+
params: { section: "profile" }, // Path-only route parameter
|
|
89
89
|
query: { tab: "security" }, // Query-only
|
|
90
90
|
};
|
|
91
91
|
actor.send(event);
|
|
@@ -112,8 +112,8 @@ URLPatternResult for advanced use cases (debugging, pattern analysis).
|
|
|
112
112
|
|
|
113
113
|
| Property | Modifier | Type | Defined in |
|
|
114
114
|
| -------------------------------------- | ---------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
115
|
-
| <a id="property-match"></a> `match?` | `readonly` | `unknown` | [play-router/src/types.ts:
|
|
116
|
-
| <a id="property-params"></a> `params?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:
|
|
117
|
-
| <a id="property-query"></a> `query?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:
|
|
118
|
-
| <a id="property-to"></a> `to` | `readonly` | `string` | [play-router/src/types.ts:
|
|
119
|
-
| <a id="property-type"></a> `type` | `readonly` | `"play.route"` | [play-router/src/types.ts:
|
|
115
|
+
| <a id="property-match"></a> `match?` | `readonly` | `unknown` | [play-router/src/types.ts:228](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L228) |
|
|
116
|
+
| <a id="property-params"></a> `params?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:226](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L226) |
|
|
117
|
+
| <a id="property-query"></a> `query?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:227](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L227) |
|
|
118
|
+
| <a id="property-to"></a> `to` | `readonly` | `string` | [play-router/src/types.ts:225](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L225) |
|
|
119
|
+
| <a id="property-type"></a> `type` | `readonly` | `"play.route"` | [play-router/src/types.ts:224](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L224) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayRouterProviderProps\<TActor\>
|
|
4
4
|
|
|
5
|
-
Defined in: [play-react-router/src/play-router-provider.tsx:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [play-react-router/src/play-router-provider.tsx:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-react-router/src/play-router-provider.tsx#L10)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -12,9 +12,9 @@ Defined in: [play-react-router/src/play-router-provider.tsx:10](https://gitlab.c
|
|
|
12
12
|
|
|
13
13
|
## Properties
|
|
14
14
|
|
|
15
|
-
| Property | Type | Description
|
|
16
|
-
| ----------------------------------------- | ------------------------------------ |
|
|
17
|
-
| <a id="property-actor"></a> `actor` | `TActor` | -
|
|
18
|
-
| <a id="property-renderer"></a> `renderer` | (`actor`, `router`) => `ReactNode` | Renderer callback receives the same concrete actor type that was passed in.
|
|
19
|
-
| <a id="property-routemap"></a> `routeMap` | [`RouteMap`](../classes/RouteMap.md) |
|
|
20
|
-
| <a id="property-router"></a> `router` | `Router` |
|
|
15
|
+
| Property | Type | Description | Defined in |
|
|
16
|
+
| ----------------------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| <a id="property-actor"></a> `actor` | `TActor` | The actor to sync with React Router. Must be a stable reference — pass the same actor instance across renders. Creating the actor inline or re-creating it on every render will cause the bridge to disconnect and reconnect each time. | [play-react-router/src/play-router-provider.tsx:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-react-router/src/play-router-provider.tsx#L19) |
|
|
18
|
+
| <a id="property-renderer"></a> `renderer` | (`actor`, `router`) => `ReactNode` | Renderer callback receives the same concrete actor type that was passed in. | [play-react-router/src/play-router-provider.tsx:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-react-router/src/play-router-provider.tsx#L36) |
|
|
19
|
+
| <a id="property-routemap"></a> `routeMap` | [`RouteMap`](../classes/RouteMap.md) | Bidirectional route map for state ID ↔ URL path lookups. **Must be a stable reference.** The bridge is rebuilt whenever `routeMap` changes identity. If constructed inline (e.g. `createRouteMap(routeTree)` in JSX), a new object is produced on every render and the bridge reconnects every render. Memoize with `useMemo`: `const routeMap = useMemo(() => createRouteMap(routeTree), [routeTree]);` | [play-react-router/src/play-router-provider.tsx:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-react-router/src/play-router-provider.tsx#L34) |
|
|
20
|
+
| <a id="property-router"></a> `router` | `Router` | The React Router instance returned by `createBrowserRouter`. | [play-react-router/src/play-router-provider.tsx:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-react-router/src/play-router-provider.tsx#L21) |
|
|
@@ -2,16 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteMapping
|
|
4
4
|
|
|
5
|
-
Defined in: [play-
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L57)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A single state ID ↔ path mapping entry.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Both fields are `readonly` — mappings are immutable once passed to `BaseRouteMap`.
|
|
10
|
+
Adapter packages re-export a structurally compatible `RouteMapping` type under
|
|
11
|
+
their own name. This type is published from `@xmachines/play-router` as
|
|
12
|
+
`BaseRouteMapping` to avoid name collisions with those adapter-local types.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
const mapping: BaseRouteMapping = { stateId: "home", path: "/" };
|
|
18
|
+
const paramMapping: BaseRouteMapping = { stateId: "profile", path: "/profile/:userId" };
|
|
19
|
+
const optionalMapping: BaseRouteMapping = { stateId: "settings", path: "/settings/:section?" };
|
|
20
|
+
```
|
|
11
21
|
|
|
12
22
|
## Properties
|
|
13
23
|
|
|
14
|
-
| Property | Modifier | Type | Description
|
|
15
|
-
| --------------------------------------- | ---------- | -------- |
|
|
16
|
-
| <a id="property-path"></a> `path` | `readonly` | `string` |
|
|
17
|
-
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | State
|
|
24
|
+
| Property | Modifier | Type | Description | Defined in |
|
|
25
|
+
| --------------------------------------- | ---------- | -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| <a id="property-path"></a> `path` | `readonly` | `string` | URL path pattern (e.g., `"/"`, `"/profile/:userId"`, `"/settings/:section?"`) | [play-router/src/base-route-map.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L61) |
|
|
27
|
+
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | State machine state ID (e.g., `"home"`, `"#profile"`) | [play-router/src/base-route-map.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L59) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/types.ts:
|
|
5
|
+
Defined in: [play-router/src/types.ts:271](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L271)
|
|
6
6
|
|
|
7
7
|
RouterBridge interface for runtime infrastructure adapters
|
|
8
8
|
|
|
@@ -54,7 +54,7 @@ class TanStackRouterBridge implements RouterBridge {
|
|
|
54
54
|
connect(): void | Promise<void>;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Defined in: [play-router/src/types.ts:
|
|
57
|
+
Defined in: [play-router/src/types.ts:287](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L287)
|
|
58
58
|
|
|
59
59
|
Connect the router bridge to the Actor
|
|
60
60
|
|
|
@@ -83,7 +83,7 @@ await bridge.connect();
|
|
|
83
83
|
disconnect(): void | Promise<void>;
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Defined in: [play-router/src/types.ts:
|
|
86
|
+
Defined in: [play-router/src/types.ts:303](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L303)
|
|
87
87
|
|
|
88
88
|
Disconnect the router bridge from the Actor
|
|
89
89
|
|
|
@@ -239,9 +239,16 @@ import { extractMachineRoutes } from "@xmachines/play-router";
|
|
|
239
239
|
|
|
240
240
|
const tree = extractMachineRoutes(authMachine);
|
|
241
241
|
|
|
242
|
-
// Query routes
|
|
242
|
+
// Query routes — use fullPath for URL matching (path is the raw meta.route segment)
|
|
243
243
|
const loginRoute = tree.byStateId.get("login");
|
|
244
|
-
console.log(loginRoute?.
|
|
244
|
+
console.log(loginRoute?.fullPath); // "/login"
|
|
245
|
+
console.log(loginRoute?.path); // "/login" (same for absolute routes)
|
|
246
|
+
|
|
247
|
+
// For nested relative routes the distinction matters:
|
|
248
|
+
// meta.route: "overview" under "/dashboard" → path: "overview", fullPath: "/dashboard/overview"
|
|
249
|
+
const overviewRoute = tree.byStateId.get("overview");
|
|
250
|
+
console.log(overviewRoute?.path); // "overview" (raw segment — relative)
|
|
251
|
+
console.log(overviewRoute?.fullPath); // "/dashboard/overview" (resolved — use this)
|
|
245
252
|
|
|
246
253
|
const dashboardRoute = tree.byPath.get("/dashboard");
|
|
247
254
|
console.log(dashboardRoute?.id); // "dashboard"
|
|
@@ -286,6 +293,25 @@ const successors = getSuccessors(tree.graph!, "myMachine.home");
|
|
|
286
293
|
- `eventType: string` — event type triggering this transition
|
|
287
294
|
- `guardType?: string` — guard name/description (if transition is guarded)
|
|
288
295
|
|
|
296
|
+
### createRouteMapFromMachine() / createRouteMapFromTree()
|
|
297
|
+
|
|
298
|
+
Both build a `BaseRouteMap` using `node.fullPath` (absolute resolved paths) for browser URL matching.
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
// Single-call form — preferred for XState machines:
|
|
302
|
+
import { createRouteMapFromMachine } from "@xmachines/play-router";
|
|
303
|
+
const routeMap = createRouteMapFromMachine(machine);
|
|
304
|
+
|
|
305
|
+
// Two-step form — used by framework adapter packages:
|
|
306
|
+
import { extractMachineRoutes, createRouteMapFromTree } from "@xmachines/play-router";
|
|
307
|
+
const routeTree = extractMachineRoutes(machine);
|
|
308
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Both forms produce identical results. `createRouteMapFromTree` is exposed for framework adapters (React Router, TanStack Router) that need to hold the `RouteTree` separately for other purposes (e.g. graph queries).
|
|
312
|
+
|
|
313
|
+
**`node.path` vs `node.fullPath`:** Every `RouteNode` carries both fields. `path` is the raw `meta.route` segment as declared in the machine — it may be relative (e.g. `"overview"`). `fullPath` is the resolved absolute path (e.g. `"/dashboard/overview"`). Route maps always use `fullPath`. Only use `path` if you specifically need the declared segment.
|
|
314
|
+
|
|
289
315
|
### Query Utilities
|
|
290
316
|
|
|
291
317
|
```typescript
|
|
@@ -341,9 +367,9 @@ const machine = createMachine({
|
|
|
341
367
|
|
|
342
368
|
const tree = extractMachineRoutes(machine);
|
|
343
369
|
|
|
344
|
-
// Bidirectional mapping
|
|
370
|
+
// Bidirectional mapping — use fullPath for URLs; path is the raw meta.route segment
|
|
345
371
|
const profileById = tree.byStateId.get("profile");
|
|
346
|
-
console.log(profileById?.
|
|
372
|
+
console.log(profileById?.fullPath); // "/profile/:userId"
|
|
347
373
|
|
|
348
374
|
const profileByPath = findRouteByPath(tree, "/profile/user123");
|
|
349
375
|
console.log(profileByPath?.id); // "profile"
|
|
@@ -581,19 +607,21 @@ For a copy, see <https://opensource.org/licenses/MIT>.
|
|
|
581
607
|
|
|
582
608
|
## Interfaces
|
|
583
609
|
|
|
584
|
-
- [BaseRouteMapping](interfaces/BaseRouteMapping.md)
|
|
585
610
|
- [BuildPlayRouteEventOptions](interfaces/BuildPlayRouteEventOptions.md)
|
|
611
|
+
- [LocationLike](interfaces/LocationLike.md)
|
|
586
612
|
- [MachineEdgeData](interfaces/MachineEdgeData.md)
|
|
587
613
|
- [MachineNodeData](interfaces/MachineNodeData.md)
|
|
588
614
|
- [PlayRouteEvent](interfaces/PlayRouteEvent.md)
|
|
589
615
|
- [RouteInfo](interfaces/RouteInfo.md)
|
|
590
616
|
- [RouteMap](interfaces/RouteMap.md)
|
|
617
|
+
- [RouteMapping](interfaces/RouteMapping.md)
|
|
591
618
|
- [RouteMatch](interfaces/RouteMatch.md)
|
|
592
619
|
- [RouteNode](interfaces/RouteNode.md)
|
|
593
620
|
- [RouteObject](interfaces/RouteObject.md)
|
|
594
621
|
- [RouterBridge](interfaces/RouterBridge.md)
|
|
595
622
|
- [RouteTree](interfaces/RouteTree.md)
|
|
596
623
|
- [RouteWatcherHandle](interfaces/RouteWatcherHandle.md)
|
|
624
|
+
- [WindowLike](interfaces/WindowLike.md)
|
|
597
625
|
|
|
598
626
|
## Type Aliases
|
|
599
627
|
|
|
@@ -605,9 +633,12 @@ For a copy, see <https://opensource.org/licenses/MIT>.
|
|
|
605
633
|
- [buildPlayRouteEvent](functions/buildPlayRouteEvent.md)
|
|
606
634
|
- [buildRouteTree](functions/buildRouteTree.md)
|
|
607
635
|
- [createRouteMap](functions/createRouteMap.md)
|
|
636
|
+
- [createRouteMapFromMachine](functions/createRouteMapFromMachine.md)
|
|
637
|
+
- [createRouteMapFromTree](functions/createRouteMapFromTree.md)
|
|
608
638
|
- [detectDuplicateRoutes](functions/detectDuplicateRoutes.md)
|
|
609
639
|
- [extractMachineRoutes](functions/extractMachineRoutes.md)
|
|
610
640
|
- [extractQuery](functions/extractQuery.md)
|
|
641
|
+
- [extractRouteParams](functions/extractRouteParams.md)
|
|
611
642
|
- [findRouteById](functions/findRouteById.md)
|
|
612
643
|
- [findRouteByPath](functions/findRouteByPath.md)
|
|
613
644
|
- [getNavigableRoutes](functions/getNavigableRoutes.md)
|
|
@@ -619,3 +650,9 @@ For a copy, see <https://opensource.org/licenses/MIT>.
|
|
|
619
650
|
- [sanitizePathname](functions/sanitizePathname.md)
|
|
620
651
|
- [validateRouteFormat](functions/validateRouteFormat.md)
|
|
621
652
|
- [validateStateExists](functions/validateStateExists.md)
|
|
653
|
+
|
|
654
|
+
## References
|
|
655
|
+
|
|
656
|
+
### BaseRouteMapping
|
|
657
|
+
|
|
658
|
+
Renames and re-exports [RouteMapping](interfaces/RouteMapping.md)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: BaseRouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [base-route-map.ts:
|
|
5
|
+
Defined in: [base-route-map.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L100)
|
|
6
6
|
|
|
7
7
|
Shared bidirectional route map base class.
|
|
8
8
|
|
|
@@ -14,7 +14,8 @@ own and inherit the full public API from here.
|
|
|
14
14
|
- Static paths (no `:param`) → O(1) `Map` lookup
|
|
15
15
|
- Dynamic paths → O(k) bucket-indexed scan using `URLPattern`, where `k` is the number
|
|
16
16
|
of routes sharing the same first path segment
|
|
17
|
-
- Results are cached after the first match
|
|
17
|
+
- Results are cached after the first match in an LRU cache (default 500 entries,
|
|
18
|
+
configurable via the `cacheSize` constructor option)
|
|
18
19
|
|
|
19
20
|
**Pattern syntax** (`:param` / `:param?`):
|
|
20
21
|
|
|
@@ -41,25 +42,15 @@ map.getPathByStateId("profile"); // "/profile/:userId"
|
|
|
41
42
|
map.getPathByStateId("missing"); // null
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
## Extended by
|
|
45
|
-
|
|
46
|
-
- [`RouteMap`](../../play-react-router/classes/RouteMap.md)
|
|
47
|
-
- [`RouteMap`](../../play-solid-router/classes/RouteMap.md)
|
|
48
|
-
- [`RouteMap`](../../play-sveltekit-router/classes/RouteMap.md)
|
|
49
|
-
- [`RouteMap`](../../play-svelte-spa-router/classes/RouteMap.md)
|
|
50
|
-
- [`RouteMap`](../../play-tanstack-react-router/classes/RouteMap.md)
|
|
51
|
-
- [`RouteMap`](../../play-tanstack-solid-router/classes/RouteMap.md)
|
|
52
|
-
- [`VueBaseRouteMap`](../../play-vue-router/classes/VueBaseRouteMap.md)
|
|
53
|
-
|
|
54
45
|
## Constructors
|
|
55
46
|
|
|
56
47
|
### Constructor
|
|
57
48
|
|
|
58
49
|
```ts
|
|
59
|
-
new BaseRouteMap(mappings): BaseRouteMap;
|
|
50
|
+
new BaseRouteMap(mappings, options?): BaseRouteMap;
|
|
60
51
|
```
|
|
61
52
|
|
|
62
|
-
Defined in: [base-route-map.ts:
|
|
53
|
+
Defined in: [base-route-map.ts:125](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L125)
|
|
63
54
|
|
|
64
55
|
Build a route map from an array of state ID ↔ path mappings.
|
|
65
56
|
|
|
@@ -69,9 +60,11 @@ buckets for efficient candidate selection.
|
|
|
69
60
|
|
|
70
61
|
#### Parameters
|
|
71
62
|
|
|
72
|
-
| Parameter
|
|
73
|
-
|
|
|
74
|
-
| `mappings`
|
|
63
|
+
| Parameter | Type | Description |
|
|
64
|
+
| -------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
65
|
+
| `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] | Array of `{ stateId, path }` entries. Order determines priority when multiple patterns could match the same path. |
|
|
66
|
+
| `options` | \{ `cacheSize?`: `number`; \} | Optional configuration. `options.cacheSize`: Maximum number of resolved parameterized path lookups to cache. Defaults to `500`. Increase for applications with many unique parameterized URL values (e.g. user profile pages with thousands of distinct IDs). After eviction the path falls back to the O(k) bucket pattern scan — correct but slower. Minimum effective value is `1` (QuickLRU constraint). |
|
|
67
|
+
| `options.cacheSize?` | `number` | - |
|
|
75
68
|
|
|
76
69
|
#### Returns
|
|
77
70
|
|
|
@@ -85,7 +78,7 @@ buckets for efficient candidate selection.
|
|
|
85
78
|
getPathByStateId(stateId): string | null;
|
|
86
79
|
```
|
|
87
80
|
|
|
88
|
-
Defined in: [base-route-map.ts:
|
|
81
|
+
Defined in: [base-route-map.ts:209](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L209)
|
|
89
82
|
|
|
90
83
|
Look up the path pattern registered for a state ID.
|
|
91
84
|
|
|
@@ -116,7 +109,7 @@ map.getPathByStateId("missing"); // null
|
|
|
116
109
|
getStateIdByPath(path): string | null;
|
|
117
110
|
```
|
|
118
111
|
|
|
119
|
-
Defined in: [base-route-map.ts:
|
|
112
|
+
Defined in: [base-route-map.ts:174](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L174)
|
|
120
113
|
|
|
121
114
|
Resolve a URL path to its mapped state ID.
|
|
122
115
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Abstract Class: RouterBridgeBase
|
|
4
4
|
|
|
5
|
-
Defined in: [router-bridge-base.ts:
|
|
5
|
+
Defined in: [router-bridge-base.ts:84](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L84)
|
|
6
6
|
|
|
7
7
|
Abstract base class for all `@xmachines` router adapter bridges.
|
|
8
8
|
|
|
@@ -30,7 +30,7 @@ between frameworks.
|
|
|
30
30
|
new RouterBridgeBase(actor, routeMap): RouterBridgeBase;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [router-bridge-base.ts:
|
|
33
|
+
Defined in: [router-bridge-base.ts:98](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L98)
|
|
34
34
|
|
|
35
35
|
#### Parameters
|
|
36
36
|
|
|
@@ -49,15 +49,15 @@ Defined in: [router-bridge-base.ts:101](https://gitlab.com/xmachin-es/xmachines-
|
|
|
49
49
|
|
|
50
50
|
| Property | Modifier | Type | Default value | Description | Defined in |
|
|
51
51
|
| --------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
-
| <a id="property-actor"></a> `actor` | `readonly` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Routable`](../../play-actor/interfaces/Routable.md) | `undefined` | A `Routable` actor exposing `currentRoute` and `send`. | [router-bridge-base.ts:
|
|
53
|
-
| <a id="property-hasconnectedonce"></a> `hasConnectedOnce` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:
|
|
54
|
-
| <a id="property-isconnected"></a> `isConnected` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:
|
|
55
|
-
| <a id="property-isprocessingnavigation"></a> `isProcessingNavigation` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:
|
|
56
|
-
| <a id="property-lastsyncedpath"></a> `lastSyncedPath` | `protected` | `string` \| `null` | `null` | - | [router-bridge-base.ts:
|
|
57
|
-
| <a id="property-routemap"></a> `routeMap` | `readonly` | `object` | `undefined` | Bidirectional route map for `stateId ↔ path` resolution. Provide `getStateIdByPath` and `getPathByStateId`. Framework adapters typically wrap the result of `createRouteMap()` or an equivalent. | [router-bridge-base.ts:
|
|
58
|
-
| `routeMap.getPathByStateId` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:
|
|
59
|
-
| `routeMap.getStateIdByPath` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:
|
|
60
|
-
| <a id="property-routewatcher"></a> `routeWatcher` | `protected` | [`RouteWatcherHandle`](../interfaces/RouteWatcherHandle.md) \| `null` | `null` | - | [router-bridge-base.ts:
|
|
52
|
+
| <a id="property-actor"></a> `actor` | `readonly` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Routable`](../../play-actor/interfaces/Routable.md) | `undefined` | A `Routable` actor exposing `currentRoute` and `send`. | [router-bridge-base.ts:99](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L99) |
|
|
53
|
+
| <a id="property-hasconnectedonce"></a> `hasConnectedOnce` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:87](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L87) |
|
|
54
|
+
| <a id="property-isconnected"></a> `isConnected` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:86](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L86) |
|
|
55
|
+
| <a id="property-isprocessingnavigation"></a> `isProcessingNavigation` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:89](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L89) |
|
|
56
|
+
| <a id="property-lastsyncedpath"></a> `lastSyncedPath` | `protected` | `string` \| `null` | `null` | - | [router-bridge-base.ts:88](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L88) |
|
|
57
|
+
| <a id="property-routemap"></a> `routeMap` | `readonly` | `object` | `undefined` | Bidirectional route map for `stateId ↔ path` resolution. Provide `getStateIdByPath` and `getPathByStateId`. Framework adapters typically wrap the result of `createRouteMap()` or an equivalent. | [router-bridge-base.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L100) |
|
|
58
|
+
| `routeMap.getPathByStateId` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:102](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L102) |
|
|
59
|
+
| `routeMap.getStateIdByPath` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:101](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L101) |
|
|
60
|
+
| <a id="property-routewatcher"></a> `routeWatcher` | `protected` | [`RouteWatcherHandle`](../interfaces/RouteWatcherHandle.md) \| `null` | `null` | - | [router-bridge-base.ts:90](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L90) |
|
|
61
61
|
|
|
62
62
|
## Methods
|
|
63
63
|
|
|
@@ -67,7 +67,7 @@ Defined in: [router-bridge-base.ts:101](https://gitlab.com/xmachin-es/xmachines-
|
|
|
67
67
|
connect(): void;
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Defined in: [router-bridge-base.ts:
|
|
70
|
+
Defined in: [router-bridge-base.ts:126](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L126)
|
|
71
71
|
|
|
72
72
|
Connect the router bridge to the Actor.
|
|
73
73
|
|
|
@@ -99,7 +99,7 @@ Adapters that need custom initial-sync behavior should override
|
|
|
99
99
|
disconnect(): void;
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
Defined in: [router-bridge-base.ts:
|
|
102
|
+
Defined in: [router-bridge-base.ts:209](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L209)
|
|
103
103
|
|
|
104
104
|
Disconnect the router bridge from the Actor.
|
|
105
105
|
|
|
@@ -121,14 +121,14 @@ Stops signal watching and unregisters framework-specific router listener.
|
|
|
121
121
|
protected extractParams(pathname, stateId): Record<string, string>;
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
Defined in: [router-bridge-base.ts:
|
|
124
|
+
Defined in: [router-bridge-base.ts:318](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L318)
|
|
125
125
|
|
|
126
126
|
Extract path parameters from URL using the URLPattern API.
|
|
127
127
|
|
|
128
128
|
Accesses `globalThis.URLPattern` at runtime — no polyfill is imported by this
|
|
129
|
-
library. If `URLPattern` is unavailable
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
library. If `URLPattern` is unavailable and the matched route has parameterized
|
|
130
|
+
segments, a `URLPatternUnavailableError` is thrown — callers must provide a polyfill
|
|
131
|
+
for environments without native URLPattern support (Node.js < 24, older browsers).
|
|
132
132
|
|
|
133
133
|
#### Parameters
|
|
134
134
|
|
|
@@ -141,7 +141,11 @@ works, params will be empty).
|
|
|
141
141
|
|
|
142
142
|
`Record`\<`string`, `string`\>
|
|
143
143
|
|
|
144
|
-
Extracted path parameters, or empty object if
|
|
144
|
+
Extracted path parameters, or empty object if no match
|
|
145
|
+
|
|
146
|
+
#### Throws
|
|
147
|
+
|
|
148
|
+
When URLPattern is absent and the route is parameterized
|
|
145
149
|
|
|
146
150
|
---
|
|
147
151
|
|
|
@@ -151,7 +155,7 @@ Extracted path parameters, or empty object if URLPattern is unavailable or no ma
|
|
|
151
155
|
protected extractQuery(search): Record<string, string>;
|
|
152
156
|
```
|
|
153
157
|
|
|
154
|
-
Defined in: [router-bridge-base.ts:
|
|
158
|
+
Defined in: [router-bridge-base.ts:355](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L355)
|
|
155
159
|
|
|
156
160
|
Extract query parameters from URL search string.
|
|
157
161
|
|
|
@@ -175,7 +179,7 @@ Extracted query parameters or empty object
|
|
|
175
179
|
protected getInitialRouterPath(): string | null | undefined;
|
|
176
180
|
```
|
|
177
181
|
|
|
178
|
-
Defined in: [router-bridge-base.ts:
|
|
182
|
+
Defined in: [router-bridge-base.ts:412](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L412)
|
|
179
183
|
|
|
180
184
|
Return the router's current pathname at connect() time.
|
|
181
185
|
|
|
@@ -201,13 +205,39 @@ bridges that have not yet implemented this hook.
|
|
|
201
205
|
|
|
202
206
|
---
|
|
203
207
|
|
|
208
|
+
### getInitialRouterSearch()
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
protected getInitialRouterSearch(): string | undefined;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Defined in: [router-bridge-base.ts:429](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L429)
|
|
215
|
+
|
|
216
|
+
Return the router's current search string at connect() time.
|
|
217
|
+
|
|
218
|
+
Paired with `getInitialRouterPath()` — called once during connect() to pass
|
|
219
|
+
the initial URL query string to `syncActorFromRouter()`. If the router's current
|
|
220
|
+
URL has no search (or the subclass doesn't override this), returns `undefined`
|
|
221
|
+
and `syncActorFromRouter` will produce an empty `query: {}` in the event.
|
|
222
|
+
|
|
223
|
+
Subclasses that override `getInitialRouterPath()` and have a query string
|
|
224
|
+
available should also override this method.
|
|
225
|
+
|
|
226
|
+
#### Returns
|
|
227
|
+
|
|
228
|
+
`string` \| `undefined`
|
|
229
|
+
|
|
230
|
+
URL search string (e.g. `"?tab=security"`), or `undefined` if not available.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
204
234
|
### navigateRouter()
|
|
205
235
|
|
|
206
236
|
```ts
|
|
207
237
|
abstract protected navigateRouter(path): void;
|
|
208
238
|
```
|
|
209
239
|
|
|
210
|
-
Defined in: [router-bridge-base.ts:
|
|
240
|
+
Defined in: [router-bridge-base.ts:367](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L367)
|
|
211
241
|
|
|
212
242
|
Navigate the framework router to the given path.
|
|
213
243
|
|
|
@@ -226,13 +256,48 @@ Must trigger the framework router's navigation (e.g., router.navigate(path)).
|
|
|
226
256
|
|
|
227
257
|
---
|
|
228
258
|
|
|
259
|
+
### resolveNavigationPath()
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
protected resolveNavigationPath(route): string | null;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Defined in: [router-bridge-base.ts:340](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L340)
|
|
266
|
+
|
|
267
|
+
Resolve an actor route value to a concrete URL path for navigation.
|
|
268
|
+
|
|
269
|
+
Bridges that receive raw `actor.currentRoute` values in `navigateRouter`
|
|
270
|
+
can call this to normalize stateIds (with or without `#` prefix) to paths.
|
|
271
|
+
Returns `null` when navigation is not possible:
|
|
272
|
+
|
|
273
|
+
- unknown stateId with no route map entry
|
|
274
|
+
- parameterized pattern (e.g. `/profile/:id`) — no concrete values available
|
|
275
|
+
- non-path string that isn't a known stateId
|
|
276
|
+
|
|
277
|
+
Route maps may store stateIds with or without the `#` prefix; both forms
|
|
278
|
+
are tried automatically.
|
|
279
|
+
|
|
280
|
+
#### Parameters
|
|
281
|
+
|
|
282
|
+
| Parameter | Type | Description |
|
|
283
|
+
| --------- | -------- | -------------------------------------------------------------- |
|
|
284
|
+
| `route` | `string` | Raw actor route value (stateId, `#`-stateId, or concrete path) |
|
|
285
|
+
|
|
286
|
+
#### Returns
|
|
287
|
+
|
|
288
|
+
`string` \| `null`
|
|
289
|
+
|
|
290
|
+
Concrete URL path, or `null` if navigation should be skipped
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
229
294
|
### syncActorFromRouter()
|
|
230
295
|
|
|
231
296
|
```ts
|
|
232
297
|
protected syncActorFromRouter(pathname, search?): void;
|
|
233
298
|
```
|
|
234
299
|
|
|
235
|
-
Defined in: [router-bridge-base.ts:
|
|
300
|
+
Defined in: [router-bridge-base.ts:260](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L260)
|
|
236
301
|
|
|
237
302
|
Sync actor state when router location changes.
|
|
238
303
|
|
|
@@ -258,7 +323,7 @@ Prevents circular updates via isProcessingNavigation flag.
|
|
|
258
323
|
protected syncRouterFromActor(route): void;
|
|
259
324
|
```
|
|
260
325
|
|
|
261
|
-
Defined in: [router-bridge-base.ts:
|
|
326
|
+
Defined in: [router-bridge-base.ts:240](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L240)
|
|
262
327
|
|
|
263
328
|
Sync router location when actor route signal changes.
|
|
264
329
|
|
|
@@ -287,7 +352,7 @@ suppressed as circular echoes.
|
|
|
287
352
|
abstract protected unwatchRouterChanges(): void;
|
|
288
353
|
```
|
|
289
354
|
|
|
290
|
-
Defined in: [router-bridge-base.ts:
|
|
355
|
+
Defined in: [router-bridge-base.ts:392](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L392)
|
|
291
356
|
|
|
292
357
|
Stop watching for router location changes.
|
|
293
358
|
|
|
@@ -305,13 +370,23 @@ Called by disconnect(). Should clean up the framework-specific subscription.
|
|
|
305
370
|
abstract protected watchRouterChanges(): void;
|
|
306
371
|
```
|
|
307
372
|
|
|
308
|
-
Defined in: [router-bridge-base.ts:
|
|
373
|
+
Defined in: [router-bridge-base.ts:385](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-bridge-base.ts#L385)
|
|
309
374
|
|
|
310
375
|
Start watching for router location changes.
|
|
311
376
|
|
|
312
377
|
Called by connect(). Should set up the framework-specific subscription
|
|
313
378
|
for location changes and call syncActorFromRouter() on each change.
|
|
314
379
|
|
|
380
|
+
**Implementations that call `syncActorFromRouter`** get `sanitizePathname`
|
|
381
|
+
applied automatically — no extra work needed.
|
|
382
|
+
|
|
383
|
+
**Implementations that bypass `syncActorFromRouter`** (e.g. `VueRouterBridge`,
|
|
384
|
+
which builds the `play.route` event directly from `afterEach` params) MUST
|
|
385
|
+
apply `sanitizePathname(path)` manually before processing the path. Skipping
|
|
386
|
+
this allows oversized or malformed paths through without the length/content
|
|
387
|
+
guards that protect the route-map lookup. Import `sanitizePathname` from
|
|
388
|
+
`@xmachines/play-router`.
|
|
389
|
+
|
|
315
390
|
#### Returns
|
|
316
391
|
|
|
317
392
|
`void`
|
|
@@ -9,7 +9,7 @@ function buildPlayRouteEvent(options): {
|
|
|
9
9
|
} | null;
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Defined in: [router-sync.ts:
|
|
12
|
+
Defined in: [router-sync.ts:140](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/router-sync.ts#L140)
|
|
13
13
|
|
|
14
14
|
Build a normalized `play.route` event from raw router/browser input.
|
|
15
15
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function buildRouteTree(routes): RouteTree;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [build-tree.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [build-tree.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/build-tree.ts#L13)
|
|
10
10
|
|
|
11
11
|
Build hierarchical route tree from flat route list
|
|
12
12
|
|