@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,14 +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
|
+
|
|
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
|
+
```
|
|
8
21
|
|
|
9
22
|
## Properties
|
|
10
23
|
|
|
11
|
-
| Property
|
|
12
|
-
|
|
|
13
|
-
| <a id="property-
|
|
14
|
-
| <a id="property-
|
|
15
|
-
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | XMachines state ID (e.g., '#home', '#profile') | [play-vue-router/src/types.ts:12](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.25/packages/play-vue-router/src/types.ts#L12) |
|
|
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
|
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
type RoutableActor = AbstractActor<AnyActorLogic> & Routable & Viewable;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-vue-router/src/play-router-provider.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [play-vue-router/src/play-router-provider.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-vue-router/src/play-router-provider.ts#L10)
|
|
10
10
|
|
|
11
11
|
Minimum actor shape accepted by PlayRouterProvider.
|
|
@@ -64,7 +64,7 @@ const PlayRouterProvider: DefineComponent<
|
|
|
64
64
|
>;
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Defined in: [play-vue-router/src/play-router-provider.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
67
|
+
Defined in: [play-vue-router/src/play-router-provider.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-vue-router/src/play-router-provider.ts#L19)
|
|
68
68
|
|
|
69
69
|
PlayRouterProvider — Vue convenience wrapper for VueRouterBridge.
|
|
70
70
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# Vue Router Demo
|
|
4
4
|
|
|
5
|
-
Vue Router integration
|
|
5
|
+
Vue Router integration demo for the XMachines Play architecture using Vue Composition API.
|
|
6
6
|
|
|
7
7
|
## What This Demonstrates
|
|
8
8
|
|
|
9
9
|
- Shared auth machine reused without framework-specific business logic
|
|
10
|
-
- `
|
|
10
|
+
- `PlayRouterProvider` renderer-based integration with Vue Router
|
|
11
11
|
- Shell-driven rendering via `PlayRenderer` with actor-authoritative navigation
|
|
12
12
|
- Vue Composition API mapping to TC39 Signals lifecycle
|
|
13
13
|
- Non-browser invariant tests plus browser E2E coverage
|
|
@@ -21,22 +21,22 @@ npm install
|
|
|
21
21
|
npm run dev -w packages/play-vue-router/examples/demo
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Then open `http://localhost:3001`.
|
|
25
25
|
|
|
26
26
|
## Step-by-Step Code Flow
|
|
27
27
|
|
|
28
28
|
Use this order to understand how the demo is wired:
|
|
29
29
|
|
|
30
|
-
1. `src/main.ts`
|
|
31
|
-
2. `src/router.ts` installs
|
|
32
|
-
3. `src/App.vue`
|
|
33
|
-
4.
|
|
34
|
-
5. `
|
|
30
|
+
1. `src/main.ts` calls `definePlayer({ machine: authMachine })`, starts the actor, creates the Vue app, provides the actor, installs Vue Router, and mounts.
|
|
31
|
+
2. `src/router.ts` installs a single catch-all route; `PlayRenderer` selects the actual view from actor state.
|
|
32
|
+
3. `src/App.vue` calls `createRouteMap(authMachine)` and renders `<PlayRouterProvider>` with the actor, route map, router instance, and a `renderShell` renderer function.
|
|
33
|
+
4. The renderer function creates the shared `Shell` component with actor, router, and registry as props.
|
|
34
|
+
5. `PlayRouterProvider` waits for `router.isReady()` so direct URL loads are handled correctly.
|
|
35
35
|
6. Browser tests in `test/browser/` validate startup and auth route transitions.
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
38
|
// src/main.ts (shape)
|
|
39
|
-
const createPlayer = definePlayer({ machine: authMachine
|
|
39
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
40
40
|
const actor = createPlayer();
|
|
41
41
|
actor.start();
|
|
42
42
|
|
|
@@ -51,13 +51,24 @@ app.mount("#app");
|
|
|
51
51
|
export const routes = [{ path: "/:pathMatch(.*)*", name: "xmachines-play", component: RouteHost }];
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
```
|
|
55
|
-
|
|
54
|
+
```vue
|
|
55
|
+
<!-- src/App.vue (shape) -->
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
const actor = inject<AuthActor>("actor")!;
|
|
58
|
+
const routeMap = createRouteMap(authMachine);
|
|
59
|
+
|
|
56
60
|
const renderShell = (currentActor, currentRouter) =>
|
|
57
|
-
h(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
h(SharedShell, { actor: currentActor, router: currentRouter, registry });
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<PlayRouterProvider
|
|
66
|
+
:actor="actor"
|
|
67
|
+
:route-map="routeMap"
|
|
68
|
+
:router="router"
|
|
69
|
+
:renderer="renderShell"
|
|
70
|
+
/>
|
|
71
|
+
</template>
|
|
61
72
|
```
|
|
62
73
|
|
|
63
74
|
```vue
|
|
@@ -70,26 +81,23 @@ const login = () => actor.send({ type: "auth.login", username: "demo" });
|
|
|
70
81
|
|
|
71
82
|
## Key Files
|
|
72
83
|
|
|
73
|
-
- `src/main.ts` - actor creation/start and app mount
|
|
84
|
+
- `src/main.ts` - actor creation/start and Vue app mount with actor injection
|
|
74
85
|
- `src/router.ts` - single catch-all route record
|
|
75
|
-
- `src/App.vue` -
|
|
76
|
-
- `src/Shell.vue` - actor-driven demo shell with nav, renderer, and debug panel
|
|
77
|
-
- `src/components/` - route and page view components
|
|
78
|
-
- `test/browser/startup.browser.test.ts` - startup check for home + login link rendering
|
|
79
|
-
- `test/browser/auth-flow.browser.test.ts` - login -> dashboard -> profile -> logout browser flow
|
|
86
|
+
- `src/App.vue` - `createRouteMap`, `PlayRouterProvider` wiring, and renderer composition
|
|
80
87
|
- `test/reactivity.test.ts` - reactive integration assertions
|
|
88
|
+
- `test/browser/shared-demo.browser.test.ts` - browser startup and full auth flow coverage
|
|
81
89
|
|
|
82
90
|
## State Machine & Architecture Details
|
|
83
91
|
|
|
84
92
|
The demo utilizes XMachines architectural invariants:
|
|
85
93
|
|
|
86
|
-
1. **Actor Authority:** When a user navigates to a protected route via a link, Vue Router updates the location. The `
|
|
94
|
+
1. **Actor Authority:** When a user navigates to a protected route via a link, Vue Router updates the location. The `PlayRouterProvider` intercepts this, translates it to a `play.route` event, and sends it to the actor. The actor evaluates guards (e.g. `isAuthenticated`) and transitions.
|
|
87
95
|
2. **Passive Infrastructure:** The router does not execute Vue route guards for business logic. The actor dictates whether navigation is permitted. The Vue application only renders the state.
|
|
88
96
|
3. **Signal-Only Reactivity:** The bridge leverages Vue's `watch` and `triggerRef` internally to react precisely when signals update, without polluting the Vue component tree with reactive refs that hold business state.
|
|
89
97
|
|
|
90
98
|
## Watcher Lifecycle and Cleanup Contract
|
|
91
99
|
|
|
92
|
-
This demo
|
|
100
|
+
This demo follows the canonical watcher lifecycle:
|
|
93
101
|
|
|
94
102
|
1. `notify`
|
|
95
103
|
2. `queueMicrotask`
|
|
@@ -97,7 +105,7 @@ This demo uses the canonical watcher lifecycle:
|
|
|
97
105
|
4. Read actor signals and sync Vue-local render state
|
|
98
106
|
5. Re-arm with `watch()`/`watch(...signals)`
|
|
99
107
|
|
|
100
|
-
Notifications are one-shot, so re-arm is required. Teardown is explicit: provider/bridge cleanup must flow through `disconnect` and watcher `unwatch`, not GC-only assumptions. The `
|
|
108
|
+
Notifications are one-shot, so re-arm is required. Teardown is explicit: provider/bridge cleanup must flow through `disconnect` and watcher `unwatch`, not GC-only assumptions. The `PlayRouterProvider` wires this seamlessly into the component's `onUnmounted` hook.
|
|
101
109
|
|
|
102
110
|
## Adapter Boundaries
|
|
103
111
|
|
|
@@ -105,29 +113,28 @@ Vue Router integration remains passive infrastructure. `RouterBridgeBase` owns s
|
|
|
105
113
|
|
|
106
114
|
## Available Scripts
|
|
107
115
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
npm run
|
|
113
|
-
npm run
|
|
114
|
-
|
|
116
|
+
These commands are defined in `package.json`:
|
|
117
|
+
|
|
118
|
+
| Command | Description |
|
|
119
|
+
| ---------------------------------------------------------------- | -------------------------------- |
|
|
120
|
+
| `npm run dev -w packages/play-vue-router/examples/demo` | Start Vite dev server |
|
|
121
|
+
| `npm run build -w packages/play-vue-router/examples/demo` | Build production bundle |
|
|
122
|
+
| `npm run preview -w packages/play-vue-router/examples/demo` | Preview built bundle |
|
|
123
|
+
| `npm run test -w packages/play-vue-router/examples/demo` | Run Vitest test suite |
|
|
124
|
+
| `npm run test:browser -w packages/play-vue-router/examples/demo` | Run browser-focused Vitest suite |
|
|
115
125
|
|
|
116
126
|
## Verification
|
|
117
127
|
|
|
118
|
-
Use these checks
|
|
128
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
119
129
|
|
|
120
130
|
```bash
|
|
121
|
-
npm run test
|
|
122
|
-
npm run test:browser
|
|
131
|
+
npm run test -w packages/play-vue-router/examples/demo
|
|
132
|
+
npm run test:browser -w packages/play-vue-router/examples/demo
|
|
123
133
|
```
|
|
124
134
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
1. Start with `npm run dev`.
|
|
128
|
-
2. Open `http://localhost:5173`.
|
|
129
|
-
3. Confirm login/logout transitions update both view and URL, and that accessing protected routes while logged out redirects properly.
|
|
135
|
+
Expected result: reactivity integration tests and the browser shared-demo suite both pass, confirming login/logout transitions update both view and URL correctly.
|
|
130
136
|
|
|
131
137
|
## Learn More
|
|
132
138
|
|
|
133
|
-
-
|
|
139
|
+
- [Vue Router package README](../play-vue-router/README.md)
|
|
140
|
+
- [Vue package README](../play-vue/README.md)
|
|
@@ -40,8 +40,8 @@ const machine = setup({
|
|
|
40
40
|
types: {
|
|
41
41
|
context: {} as {
|
|
42
42
|
isAuthenticated: boolean;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
params: Record<string, string>;
|
|
44
|
+
query: Record<string, string>;
|
|
45
45
|
},
|
|
46
46
|
events: {} as
|
|
47
47
|
| { type: "play.route"; to: string; params?: Record<string, string> }
|
|
@@ -52,7 +52,7 @@ const machine = setup({
|
|
|
52
52
|
formatPlayRouteTransitions({
|
|
53
53
|
id: "app",
|
|
54
54
|
initial: "login",
|
|
55
|
-
context: { isAuthenticated: false,
|
|
55
|
+
context: { isAuthenticated: false, params: {}, query: {} },
|
|
56
56
|
states: {
|
|
57
57
|
login: {
|
|
58
58
|
id: "login",
|
|
@@ -180,8 +180,8 @@ Concrete actor implementing Play signal protocol:
|
|
|
180
180
|
**Signal Properties:**
|
|
181
181
|
|
|
182
182
|
- `state: Signal.State<AnyMachineSnapshot>` — Reactive snapshot of current state
|
|
183
|
-
- `currentRoute: Signal.Computed<string | null>` — Derived URL from the current state's `meta.route` and `context.
|
|
184
|
-
- `currentView: Signal.State<ViewMetadata | null>` — Current view spec (updated on every state transition). The spec is automatically enriched with `context.
|
|
183
|
+
- `currentRoute: Signal.Computed<string | null>` — Derived URL from the current state's `meta.route` and `context.params`. Returns `null` when no route metadata is present or a required route parameter is missing from context.
|
|
184
|
+
- `currentView: Signal.State<ViewMetadata | null>` — Current view spec (updated on every state transition). The spec is automatically enriched with `context.params` (URL params) and any `contextProps`-allowlisted context fields before being emitted (see [Prop Enrichment from Routing and Context](#prop-enrichment-from-routing-and-context)).
|
|
185
185
|
|
|
186
186
|
**Lifecycle ordering:**
|
|
187
187
|
|
|
@@ -207,7 +207,7 @@ Concrete actor implementing Play signal protocol:
|
|
|
207
207
|
**View derivation and route-param enrichment:**
|
|
208
208
|
|
|
209
209
|
- `currentView` emits a fresh `ViewMetadata` object on every transition so TC39 Signal equality checks always detect changes (including re-entries to the same state with different params).
|
|
210
|
-
- `context.
|
|
210
|
+
- `context.params` and `contextProps`-allowlisted context fields are merged into spec element props — see [Prop Enrichment from Routing and Context](#prop-enrichment-from-routing-and-context).
|
|
211
211
|
|
|
212
212
|
**Example:**
|
|
213
213
|
|
|
@@ -316,8 +316,8 @@ const machine = setup({
|
|
|
316
316
|
types: {
|
|
317
317
|
context: {} as {
|
|
318
318
|
isAuthenticated: boolean;
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
params: Record<string, string>;
|
|
320
|
+
query: Record<string, string>;
|
|
321
321
|
},
|
|
322
322
|
events: {} as
|
|
323
323
|
| { type: "play.route"; to: string; params?: Record<string, string> }
|
|
@@ -474,7 +474,7 @@ spec: {
|
|
|
474
474
|
}
|
|
475
475
|
// After play.route to /settings/profile:
|
|
476
476
|
// Component receives: { section: "profile", username: "alice", theme: "dark" }
|
|
477
|
-
// section → from
|
|
477
|
+
// section → from context.params (URL)
|
|
478
478
|
// username → from contextProps (context)
|
|
479
479
|
// theme → from spec (explicit value, untouched)
|
|
480
480
|
```
|
|
@@ -526,11 +526,11 @@ it to be filled in automatically.
|
|
|
526
526
|
|
|
527
527
|
### Merge priority (highest → lowest)
|
|
528
528
|
|
|
529
|
-
| Source
|
|
530
|
-
|
|
|
531
|
-
| Explicit non-`undefined` spec prop
|
|
532
|
-
| URL route param (`context.
|
|
533
|
-
| `contextProps` field
|
|
529
|
+
| Source | When it applies | Wins over |
|
|
530
|
+
| ---------------------------------- | -------------------------------- | ------------------------- |
|
|
531
|
+
| Explicit non-`undefined` spec prop | Always | Everything |
|
|
532
|
+
| URL route param (`context.params`) | State has a `:param` URL segment | `contextProps` values |
|
|
533
|
+
| `contextProps` field | Listed in `spec.contextProps` | Nothing (lowest priority) |
|
|
534
534
|
|
|
535
535
|
### URL route parameters
|
|
536
536
|
|
|
@@ -580,7 +580,7 @@ If both a route param and a `contextProps` field share the same key, the route p
|
|
|
580
580
|
|
|
581
581
|
```typescript
|
|
582
582
|
// context.username = "alice" (logged-in user)
|
|
583
|
-
// play.route to /profile/demo →
|
|
583
|
+
// play.route to /profile/demo → context.params.username = "demo"
|
|
584
584
|
// contextProps: ["username"], props: { username: undefined }
|
|
585
585
|
// Component receives: { username: "demo" } ← route param wins
|
|
586
586
|
```
|