@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-tanstack-react-router/src/play-router-provider.tsx:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [play-tanstack-react-router/src/play-router-provider.tsx:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L30)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ Defined in: [play-tanstack-react-router/src/play-router-provider.tsx:30](https:/
|
|
|
14
14
|
|
|
15
15
|
| Property | Type | Description | Defined in |
|
|
16
16
|
| ----------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
-
| <a id="property-actor"></a> `actor` | `TActor` | - | [play-tanstack-react-router/src/play-router-provider.tsx:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
18
|
-
| <a id="property-renderer"></a> `renderer` | (`actor`, `router`) => `ReactNode` | Renderer callback receives the same concrete actor type that was passed in. | [play-tanstack-react-router/src/play-router-provider.tsx:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
19
|
-
| <a id="property-routemap"></a> `routeMap` | [`RouteMap`](../classes/RouteMap.md) | - | [play-tanstack-react-router/src/play-router-provider.tsx:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
20
|
-
| <a id="property-router"></a> `router` | [`TanStackRouterLike`](../type-aliases/TanStackRouterLike.md) | - | [play-tanstack-react-router/src/play-router-provider.tsx:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
17
|
+
| <a id="property-actor"></a> `actor` | `TActor` | - | [play-tanstack-react-router/src/play-router-provider.tsx:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L34) |
|
|
18
|
+
| <a id="property-renderer"></a> `renderer` | (`actor`, `router`) => `ReactNode` | Renderer callback receives the same concrete actor type that was passed in. | [play-tanstack-react-router/src/play-router-provider.tsx:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L38) |
|
|
19
|
+
| <a id="property-routemap"></a> `routeMap` | [`RouteMap`](../classes/RouteMap.md) | - | [play-tanstack-react-router/src/play-router-provider.tsx:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L36) |
|
|
20
|
+
| <a id="property-router"></a> `router` | [`TanStackRouterLike`](../type-aliases/TanStackRouterLike.md) | - | [play-tanstack-react-router/src/play-router-provider.tsx:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L35) |
|
|
@@ -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: RouteNavigateEvent
|
|
4
4
|
|
|
5
|
-
Defined in: [play-tanstack-react-router/src/types.ts:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [play-tanstack-react-router/src/types.ts:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/types.ts#L21)
|
|
6
6
|
|
|
7
7
|
Event sent to actor when browser navigates.
|
|
8
8
|
|
|
@@ -22,5 +22,5 @@ actor.send({ type: "route.navigate", path: "/dashboard" });
|
|
|
22
22
|
|
|
23
23
|
| Property | Modifier | Type | Description | Defined in |
|
|
24
24
|
| --------------------------------- | ---------- | ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| <a id="property-path"></a> `path` | `readonly` | `string` | Target route path (may include parameters, e.g., /posts/123) | [play-tanstack-react-router/src/types.ts:25](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
26
|
-
| <a id="property-type"></a> `type` | `readonly` | `"route.navigate"` | Event type discriminant (extends XState event pattern) | [play-tanstack-react-router/src/types.ts:23](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
25
|
+
| <a id="property-path"></a> `path` | `readonly` | `string` | Target route path (may include parameters, e.g., /posts/123) | [play-tanstack-react-router/src/types.ts:25](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/types.ts#L25) |
|
|
26
|
+
| <a id="property-type"></a> `type` | `readonly` | `"route.navigate"` | Event type discriminant (extends XState event pattern) | [play-tanstack-react-router/src/types.ts:23](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/types.ts#L23) |
|
|
@@ -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
|
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
type TanStackRouterInstance = ConstructorParameters<typeof TanStackReactRouterBridge>[0];
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-tanstack-react-router/src/play-router-provider.tsx:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [play-tanstack-react-router/src/play-router-provider.tsx:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/play-router-provider.tsx#L28)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type TanStackRouterLike = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:42](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:42](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/tanstack-router-bridge.ts#L42)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:42](https:
|
|
|
16
16
|
history: object;
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:45](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
19
|
+
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:45](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/tanstack-router-bridge.ts#L45)
|
|
20
20
|
|
|
21
21
|
#### location
|
|
22
22
|
|
|
@@ -24,7 +24,9 @@ Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:45](https:
|
|
|
24
24
|
location: object;
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Current location —
|
|
27
|
+
Current location — populated from `window.location` when `createRouter()` runs,
|
|
28
|
+
before `router.load()`. Always available in the browser.
|
|
29
|
+
`router.state.location` is only populated after `router.load()` and may be stale.
|
|
28
30
|
|
|
29
31
|
##### location.pathname
|
|
30
32
|
|
|
@@ -54,29 +56,21 @@ subscribe(handler): () => void;
|
|
|
54
56
|
|
|
55
57
|
() => `void`
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
## Methods
|
|
58
60
|
|
|
59
|
-
###
|
|
61
|
+
### load()?
|
|
60
62
|
|
|
61
63
|
```ts
|
|
62
|
-
optional
|
|
64
|
+
optional load(): void | Promise<void>;
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:44](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
66
|
-
|
|
67
|
-
#### location?
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
optional location?: object;
|
|
71
|
-
```
|
|
67
|
+
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:44](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/tanstack-router-bridge.ts#L44)
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
#### Returns
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
optional pathname?: string;
|
|
77
|
-
```
|
|
71
|
+
`void` \| `Promise`\<`void`\>
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
---
|
|
80
74
|
|
|
81
75
|
### navigate()
|
|
82
76
|
|
|
@@ -84,7 +78,7 @@ optional pathname?: string;
|
|
|
84
78
|
navigate(args): void;
|
|
85
79
|
```
|
|
86
80
|
|
|
87
|
-
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
81
|
+
Defined in: [play-tanstack-react-router/src/tanstack-router-bridge.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-tanstack-react-router/src/tanstack-router-bridge.ts#L43)
|
|
88
82
|
|
|
89
83
|
#### Parameters
|
|
90
84
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# TanStack React Router Demo
|
|
4
4
|
|
|
5
|
-
React + TanStack Router
|
|
5
|
+
React + TanStack Router integration demo for the XMachines Play architecture with actor-authoritative routing.
|
|
6
6
|
|
|
7
7
|
## What This Demonstrates
|
|
8
8
|
|
|
@@ -13,25 +13,25 @@ React + TanStack Router demonstration of Play's actor-authoritative routing and
|
|
|
13
13
|
|
|
14
14
|
## Running the Demo
|
|
15
15
|
|
|
16
|
-
From
|
|
16
|
+
From the repository root:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
npm install
|
|
20
|
-
npm run dev
|
|
20
|
+
npm run dev -w packages/play-tanstack-react-router/examples/demo
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Then open `http://localhost:3000`.
|
|
24
24
|
|
|
25
25
|
## Step-by-Step Code Flow
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Use this order to understand the implementation:
|
|
28
28
|
|
|
29
29
|
1. `src/main.tsx` mounts `<App />`.
|
|
30
30
|
2. `src/App.tsx` calls `useMemo(createAppRuntime, [])` to create the actor from shared machine + catalog and start it once per mounted app.
|
|
31
31
|
3. `createAppRuntime()` memoizes `routeMap` from `extractMachineRoutes(authMachine)` + `createRouteMapFromTree(routeTree)`.
|
|
32
32
|
4. `createAppRuntime()` also memoizes the TanStack router, then `PlayRouterProvider` bridges it to the actor and renders `Shell` via `renderer(actor, router)`.
|
|
33
33
|
5. `Shell` renders `PlayRenderer`, header/nav, and debug panel from actor state.
|
|
34
|
-
6. Tests in `test/` and `test/browser
|
|
34
|
+
6. Tests in `test/` and `test/browser/` validate invariant and runtime behavior.
|
|
35
35
|
|
|
36
36
|
```tsx
|
|
37
37
|
// src/App.tsx (shape)
|
|
@@ -65,8 +65,6 @@ return (
|
|
|
65
65
|
<button onClick={() => actor.send({ type: "auth.login", username })}>Login</button>
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Shared business logic comes from the common demo machine/catalog module (`authMachine` and `catalog`), so routing decisions remain machine-driven and framework-independent.
|
|
69
|
-
|
|
70
68
|
## Key Files
|
|
71
69
|
|
|
72
70
|
- `src/main.tsx` - React entry point that mounts `<App />`
|
|
@@ -74,8 +72,9 @@ Shared business logic comes from the common demo machine/catalog module (`authMa
|
|
|
74
72
|
- `src/components/` - UI components that send actor events and render state-driven views
|
|
75
73
|
- `test/actor-authority.test.ts` - actor authority and guarded navigation behavior
|
|
76
74
|
- `test/strict-separation.test.ts` - machine/view infrastructure separation contracts
|
|
77
|
-
- `test/browser
|
|
78
|
-
- `test/browser
|
|
75
|
+
- `test/browser/shared-demo.browser.test.tsx` - canonical browser auth flow
|
|
76
|
+
- `test/browser/auth-flow.browser.test.tsx` - extended browser auth flow checks
|
|
77
|
+
- `test/browser/back-forward-sync.browser.test.tsx` - URL sync and history behavior
|
|
79
78
|
|
|
80
79
|
## State Machine & Architecture Details
|
|
81
80
|
|
|
@@ -103,34 +102,29 @@ The TanStack React adapter wraps TanStack's `router.navigate({ to })` and `route
|
|
|
103
102
|
|
|
104
103
|
## Available Scripts
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
npm run
|
|
111
|
-
npm run
|
|
112
|
-
npm run
|
|
113
|
-
npm run test
|
|
114
|
-
npm run test:
|
|
115
|
-
```
|
|
105
|
+
These commands are defined in `package.json`:
|
|
106
|
+
|
|
107
|
+
| Command | Description |
|
|
108
|
+
| --------------------------------------------------------------------------- | -------------------------------- |
|
|
109
|
+
| `npm run dev -w packages/play-tanstack-react-router/examples/demo` | Start Vite dev server |
|
|
110
|
+
| `npm run build -w packages/play-tanstack-react-router/examples/demo` | Build production bundle |
|
|
111
|
+
| `npm run preview -w packages/play-tanstack-react-router/examples/demo` | Preview built bundle |
|
|
112
|
+
| `npm run test -w packages/play-tanstack-react-router/examples/demo` | Run Vitest test suite |
|
|
113
|
+
| `npm run test:browser -w packages/play-tanstack-react-router/examples/demo` | Run browser-focused Vitest suite |
|
|
116
114
|
|
|
117
115
|
## Verification
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
120
118
|
|
|
121
119
|
```bash
|
|
122
|
-
npm run test
|
|
123
|
-
npm run test:browser
|
|
120
|
+
npm run test -w packages/play-tanstack-react-router/examples/demo
|
|
121
|
+
npm run test:browser -w packages/play-tanstack-react-router/examples/demo
|
|
124
122
|
```
|
|
125
123
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
1. Run `npm run dev` and open `http://localhost:3000`.
|
|
129
|
-
2. Attempt protected navigation while logged out and confirm guard-driven behavior.
|
|
130
|
-
3. Log in, then confirm route and view updates stay in sync.
|
|
124
|
+
Expected result: invariant test suite and the browser shared-demo suite both pass, confirming actor authority, route sync, and guard-driven redirection.
|
|
131
125
|
|
|
132
126
|
## Learn More
|
|
133
127
|
|
|
134
128
|
- [TanStack React Router package README](../play-tanstack-react-router/README.md)
|
|
135
|
-
- [
|
|
129
|
+
- [React package README](../play-react/README.md)
|
|
136
130
|
- [TanStack Solid Router demo README](../play-tanstack-solid-router-demo/README.md)
|
|
@@ -108,7 +108,7 @@ class SolidRouterBridge {
|
|
|
108
108
|
|
|
109
109
|
**Methods:**
|
|
110
110
|
|
|
111
|
-
- `connect()` - Start bidirectional synchronization.
|
|
111
|
+
- `connect()` - Start bidirectional synchronization. Both pathname and query string from `router.history.location` are forwarded to the actor on first connect.
|
|
112
112
|
- `disconnect()` - Stop synchronization and cleanup bridge resources.
|
|
113
113
|
- `dispose()` - Alias of `disconnect()`.
|
|
114
114
|
|
|
@@ -116,7 +116,7 @@ class SolidRouterBridge {
|
|
|
116
116
|
|
|
117
117
|
- Uses `RouterBridgeBase` TC39 watcher lifecycle for actor→router synchronization
|
|
118
118
|
- Updates TanStack Router via `router.navigate({ to: path })` when actor state changes
|
|
119
|
-
- Uses `router.subscribe` to watch history navigation events
|
|
119
|
+
- Uses `router.history.subscribe` to watch history navigation events (covers PUSH, POP, BACK, FORWARD — works without `<RouterProvider>` mounted)
|
|
120
120
|
- Sends `play.route` events to actor when user navigates
|
|
121
121
|
|
|
122
122
|
### `PlayTanStackRouterProvider`
|
|
@@ -219,12 +219,12 @@ The `RouterBridgeBase` architecture prevents infinite loops between router and a
|
|
|
219
219
|
|
|
220
220
|
## Comparison with @solidjs/router Adapter
|
|
221
221
|
|
|
222
|
-
| Aspect | @solidjs/router Adapter | @tanstack/solid-router Adapter
|
|
223
|
-
| ----------------- | -------------------------------- |
|
|
224
|
-
| **Router API** | `navigate(path)` | `router.navigate({ to })`
|
|
225
|
-
| **Setup Context** | Must be _inside_ Router context | Can wrap Router instance
|
|
226
|
-
| **State Source** | Uses Solid hooks (`useLocation`) | Subscribes to `router` directly
|
|
227
|
-
| **Reacting** | `createEffect` on location | `router.subscribe` callback
|
|
222
|
+
| Aspect | @solidjs/router Adapter | @tanstack/solid-router Adapter |
|
|
223
|
+
| ----------------- | -------------------------------- | ----------------------------------- |
|
|
224
|
+
| **Router API** | `navigate(path)` | `router.navigate({ to })` |
|
|
225
|
+
| **Setup Context** | Must be _inside_ Router context | Can wrap Router instance |
|
|
226
|
+
| **State Source** | Uses Solid hooks (`useLocation`) | Subscribes to `router` directly |
|
|
227
|
+
| **Reacting** | `createEffect` on location | `router.history.subscribe` callback |
|
|
228
228
|
|
|
229
229
|
## Architecture
|
|
230
230
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: RouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [play-
|
|
5
|
+
Defined in: [play-router/src/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,19 +42,15 @@ map.getPathByStateId("profile"); // "/profile/:userId"
|
|
|
41
42
|
map.getPathByStateId("missing"); // null
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
## Extends
|
|
45
|
-
|
|
46
|
-
- [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md)
|
|
47
|
-
|
|
48
45
|
## Constructors
|
|
49
46
|
|
|
50
47
|
### Constructor
|
|
51
48
|
|
|
52
49
|
```ts
|
|
53
|
-
new RouteMap(mappings):
|
|
50
|
+
new RouteMap(mappings, options?): BaseRouteMap;
|
|
54
51
|
```
|
|
55
52
|
|
|
56
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
53
|
+
Defined in: [play-router/src/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)
|
|
57
54
|
|
|
58
55
|
Build a route map from an array of state ID ↔ path mappings.
|
|
59
56
|
|
|
@@ -63,17 +60,15 @@ buckets for efficient candidate selection.
|
|
|
63
60
|
|
|
64
61
|
#### Parameters
|
|
65
62
|
|
|
66
|
-
| Parameter
|
|
67
|
-
|
|
|
68
|
-
| `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` | - |
|
|
69
68
|
|
|
70
69
|
#### Returns
|
|
71
70
|
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
#### Inherited from
|
|
75
|
-
|
|
76
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`constructor`](../../play-router/classes/BaseRouteMap.md#constructor)
|
|
71
|
+
`BaseRouteMap`
|
|
77
72
|
|
|
78
73
|
## Methods
|
|
79
74
|
|
|
@@ -83,7 +78,7 @@ buckets for efficient candidate selection.
|
|
|
83
78
|
getPathByStateId(stateId): string | null;
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
81
|
+
Defined in: [play-router/src/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)
|
|
87
82
|
|
|
88
83
|
Look up the path pattern registered for a state ID.
|
|
89
84
|
|
|
@@ -106,10 +101,6 @@ map.getPathByStateId("profile"); // "/profile/:userId"
|
|
|
106
101
|
map.getPathByStateId("missing"); // null
|
|
107
102
|
```
|
|
108
103
|
|
|
109
|
-
#### Inherited from
|
|
110
|
-
|
|
111
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getPathByStateId`](../../play-router/classes/BaseRouteMap.md#getpathbystateid)
|
|
112
|
-
|
|
113
104
|
---
|
|
114
105
|
|
|
115
106
|
### getStateIdByPath()
|
|
@@ -118,7 +109,7 @@ map.getPathByStateId("missing"); // null
|
|
|
118
109
|
getStateIdByPath(path): string | null;
|
|
119
110
|
```
|
|
120
111
|
|
|
121
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
112
|
+
Defined in: [play-router/src/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)
|
|
122
113
|
|
|
123
114
|
Resolve a URL path to its mapped state ID.
|
|
124
115
|
|
|
@@ -144,7 +135,3 @@ The mapped state ID, or `null` if no route matches
|
|
|
144
135
|
map.getStateIdByPath("/profile/123"); // "profile"
|
|
145
136
|
map.getStateIdByPath("/unknown"); // null
|
|
146
137
|
```
|
|
147
|
-
|
|
148
|
-
#### Inherited from
|
|
149
|
-
|
|
150
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getStateIdByPath`](../../play-router/classes/BaseRouteMap.md#getstateidbypath)
|