@xmachines/docs 1.0.0-beta.26 → 1.0.0-beta.28
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 +4 -10
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -25
- package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
- package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +3 -3
- package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
- package/api/@xmachines/play-actor-shared/README.md +155 -0
- package/api/@xmachines/play-actor-shared/interfaces/AuthContext.md +14 -0
- package/api/@xmachines/play-actor-shared/type-aliases/AuthActor.md +27 -0
- package/api/@xmachines/play-actor-shared/type-aliases/AuthCatalog.md +16 -0
- package/api/@xmachines/play-actor-shared/type-aliases/AuthEvents.md +17 -0
- package/api/@xmachines/play-actor-shared/type-aliases/AuthInput.md +9 -0
- package/api/@xmachines/play-actor-shared/type-aliases/AuthSnapshot.md +11 -0
- package/api/@xmachines/play-actor-shared/type-aliases/CatalogProps.md +187 -0
- package/api/@xmachines/play-actor-shared/type-aliases/InferProps.md +17 -0
- package/api/@xmachines/play-actor-shared/variables/authCatalog.md +173 -0
- package/api/@xmachines/play-actor-shared/variables/authMachine.md +189 -0
- package/api/@xmachines/play-actor-shared/variables/authSetup.md +22 -0
- package/api/@xmachines/play-dom/README.md +74 -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-demo/README.md +145 -0
- package/api/@xmachines/play-dom-demo/functions/initShell.md +20 -0
- package/api/@xmachines/play-dom-demo/variables/About.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Contact.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Dashboard.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Home.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Login.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Navigation.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Overview.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Profile.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Settings.md +9 -0
- package/api/@xmachines/play-dom-demo/variables/Stats.md +9 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
- package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-dom-router-demo/README.md +56 -61
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -31
- package/api/@xmachines/play-react/functions/defineRegistry.md +0 -2
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useBoundProp.md +0 -2
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/functions/useStateBinding.md +0 -2
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +0 -2
- 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 +0 -2
- 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-demo/README.md +173 -0
- package/api/@xmachines/play-react-demo/functions/App.md +13 -0
- package/api/@xmachines/play-react-demo/functions/DebugPanel.md +20 -0
- package/api/@xmachines/play-react-demo/functions/HeaderNav.md +20 -0
- package/api/@xmachines/play-react-demo/functions/Shell.md +22 -0
- package/api/@xmachines/play-react-demo/variables/About.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Contact.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Dashboard.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Home.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Login.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Navigation.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Overview.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Profile.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Settings.md +9 -0
- package/api/@xmachines/play-react-demo/variables/Stats.md +9 -0
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +23 -23
- package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-react-router-demo/README.md +10 -10
- package/api/@xmachines/play-router/README.md +1 -1
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +4 -4
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +23 -23
- 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 +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
- 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 +1 -1
- 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 +3 -3
- 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 +6 -6
- 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/RouteMapping.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
- 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 +3 -3
- 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 +0 -6
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +0 -8
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +0 -10
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +0 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/functions/defineRegistry.md +0 -2
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/useStateBinding.md +0 -2
- package/api/@xmachines/play-solid/interfaces/ComponentContext.md +0 -2
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +0 -2
- 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-demo/README.md +159 -0
- package/api/@xmachines/play-solid-demo/functions/App.md +13 -0
- package/api/@xmachines/play-solid-demo/functions/DebugPanel.md +20 -0
- package/api/@xmachines/play-solid-demo/functions/HeaderNav.md +20 -0
- package/api/@xmachines/play-solid-demo/functions/Shell.md +22 -0
- package/api/@xmachines/play-solid-demo/variables/About.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Contact.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Dashboard.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Home.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Login.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Navigation.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Overview.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Profile.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Settings.md +9 -0
- package/api/@xmachines/play-solid-demo/variables/Stats.md +9 -0
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -23
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
- 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 +4 -4
- package/api/@xmachines/play-solid-router-demo/README.md +25 -28
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +0 -2
- package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +0 -2
- package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +0 -2
- package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +0 -2
- package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +0 -2
- package/api/@xmachines/play-svelte/variables/PlayRenderer.md +0 -2
- package/api/@xmachines/play-svelte-demo/README.md +127 -0
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- 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-tanstack-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +23 -23
- 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 +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- 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 +17 -3
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +23 -29
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- 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 +3 -3
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +25 -26
- 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 +0 -2
- package/api/@xmachines/play-vue/interfaces/ComponentContext.md +0 -2
- 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 +0 -2
- 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-demo/README.md +145 -0
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +24 -24
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
- 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 +48 -41
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +11 -25
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
- 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 +1 -1
- 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 +5 -5
- 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 +6 -2
- package/api/llms.txt +0 -3
- package/examples/README.md +48 -35
- 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 -189
- 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-svelte-spa-router-demo/README.md +0 -23
- package/api/@xmachines/play-sveltekit-router-demo/README.md +0 -23
|
@@ -1,324 +1,406 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
1
3
|
# Multi-Router Integration
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
How to integrate XMachines Play with the 8 router adapters shipped in this monorepo.
|
|
4
6
|
|
|
5
7
|
## Overview
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
XMachines provides router adapters for every major JavaScript framework. All adapters implement the same **Actor Authority** invariant — the state machine guards control navigation, and the router passively observes `actor.currentRoute`.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
2. **Vanilla Router** - JSX frameworks (Preact, Solid, Vue) with framework-agnostic router
|
|
11
|
-
3. **Pure Browser** - Manual integration for jQuery, Alpine, vanilla JS
|
|
12
|
-
4. **Svelte** - `@xmachines/play-svelte` with either SvelteKit or SPA router adapters
|
|
11
|
+
There are two integration patterns:
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
| Pattern | Used by | Key API |
|
|
14
|
+
| --------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------- |
|
|
15
|
+
| **Provider pattern** | React (TanStack, React Router), SolidJS (TanStack, SolidJS Router), Vue Router | `<PlayRouterProvider actor router routeMap renderer={...} />` |
|
|
16
|
+
| **`connectRouter` pattern** | Vanilla DOM, SvelteKit, Svelte SPA Router | `connectRouter({ actor, routeMap })` |
|
|
15
17
|
|
|
16
|
-
##
|
|
18
|
+
## Pattern 1: Provider Pattern
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Used by framework adapters that have a React/Solid/Vue provider context. The `PlayRouterProvider` owns the bridge lifecycle and calls a `renderer` prop with the current actor and router.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
### React + TanStack Router (`@xmachines/play-tanstack-react-router`)
|
|
21
23
|
|
|
22
24
|
```typescript
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
import { useEffect, useMemo } from "react";
|
|
26
|
+
import { createRouter, createRootRoute } from "@tanstack/react-router";
|
|
27
|
+
import { PlayRouterProvider, createRouteMapFromTree } from "@xmachines/play-tanstack-react-router";
|
|
28
|
+
import { extractMachineRoutes } from "@xmachines/play-router";
|
|
29
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
30
|
+
import { defineRegistry } from "@xmachines/play-react";
|
|
31
|
+
import { authMachine, authCatalog } from "@xmachines/play-actor-shared";
|
|
32
|
+
|
|
33
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
34
|
+
|
|
35
|
+
const { registry } = defineRegistry(authCatalog, {
|
|
36
|
+
components: { /* ...your components */ },
|
|
37
|
+
actions: { login: async () => {}, logout: async () => {}, /* ... */ },
|
|
38
|
+
});
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
function createAppRuntime() {
|
|
41
|
+
const actor = createPlayer();
|
|
42
|
+
actor.start();
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
45
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
46
|
+
const router = createRouter({ routeTree: createRootRoute(), defaultPreload: "intent" });
|
|
35
47
|
|
|
36
|
-
|
|
48
|
+
return { actor, routeMap, router };
|
|
49
|
+
}
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
export function App() {
|
|
52
|
+
const { actor, routeMap, router } = useMemo(createAppRuntime, []);
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
const routeTree = extractMachineRoutes(machine);
|
|
42
|
-
const routeMap = createRouteMapFromTree(routeTree);
|
|
43
|
-
const router = createRouter({ routeTree, history: createMemoryHistory() });
|
|
44
|
-
|
|
45
|
-
<PlayTanStackRouterProvider
|
|
46
|
-
actor={actor}
|
|
47
|
-
router={router}
|
|
48
|
-
routeMap={routeMap} // Explicit mapping
|
|
49
|
-
renderer={(actor) => <PlayRenderer actor={actor} components={components} />}
|
|
50
|
-
/>
|
|
51
|
-
```
|
|
54
|
+
useEffect(() => () => { actor.stop(); }, [actor]);
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
return (
|
|
57
|
+
<PlayRouterProvider
|
|
58
|
+
actor={actor}
|
|
59
|
+
router={router}
|
|
60
|
+
routeMap={routeMap}
|
|
61
|
+
renderer={(currentActor, currentRouter) => (
|
|
62
|
+
<Shell actor={currentActor} router={currentRouter} registry={registry} />
|
|
63
|
+
)}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
54
68
|
|
|
55
|
-
|
|
69
|
+
### React + React Router v7 (`@xmachines/play-react-router`)
|
|
56
70
|
|
|
57
71
|
```typescript
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</RouterProvider>
|
|
63
|
-
```
|
|
72
|
+
import { createBrowserRouter, RouterProvider } from "react-router";
|
|
73
|
+
import { PlayRouterProvider, createRouteMapFromTree } from "@xmachines/play-react-router";
|
|
74
|
+
import { extractMachineRoutes } from "@xmachines/play-router";
|
|
75
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
64
76
|
|
|
65
|
-
|
|
77
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
function createAppRuntime() {
|
|
80
|
+
const actor = createPlayer();
|
|
81
|
+
actor.start();
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
import {
|
|
72
|
-
connectRouter as connectSvelteKitRouter,
|
|
73
|
-
createRouteMap as createSvelteKitRouteMap,
|
|
74
|
-
} from "@xmachines/play-sveltekit-router";
|
|
75
|
-
import {
|
|
76
|
-
connectRouter as connectSvelteSpaRouter,
|
|
77
|
-
createRouteMap as createSvelteSpaRouteMap,
|
|
78
|
-
} from "@xmachines/play-svelte-spa-router";
|
|
79
|
-
```
|
|
83
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
84
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
// React Router requires route elements upfront — use a catch-all
|
|
87
|
+
let router!: ReturnType<typeof createBrowserRouter>;
|
|
88
|
+
function RoutedShell() {
|
|
89
|
+
return <Shell actor={actor} router={router} registry={registry} />;
|
|
90
|
+
}
|
|
91
|
+
router = createBrowserRouter([{ path: "*", element: <RoutedShell /> }]);
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
return { actor, routeMap, router };
|
|
94
|
+
}
|
|
86
95
|
|
|
87
|
-
|
|
88
|
-
const routeMap =
|
|
89
|
-
const disconnect = connectSvelteKitRouter({ actor, routeMap });
|
|
90
|
-
```
|
|
96
|
+
export default function App() {
|
|
97
|
+
const { actor, routeMap, router } = useMemo(createAppRuntime, []);
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
useEffect(() => () => { actor.stop(); }, [actor]);
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
return (
|
|
102
|
+
<PlayRouterProvider
|
|
103
|
+
actor={actor}
|
|
104
|
+
router={router}
|
|
105
|
+
routeMap={routeMap}
|
|
106
|
+
renderer={(currentActor, currentRouter) => (
|
|
107
|
+
<RouterProvider router={currentRouter} />
|
|
108
|
+
)}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
### SolidJS + SolidJS Router (`@xmachines/play-solid-router`)
|
|
97
115
|
|
|
98
116
|
```typescript
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// 1. Create actor
|
|
108
|
-
const createPlayer = definePlayer({ machine, catalog });
|
|
117
|
+
import { Router, Route } from "@solidjs/router";
|
|
118
|
+
import { onCleanup } from "solid-js";
|
|
119
|
+
import { PlayRouterProvider, createRouteMap } from "@xmachines/play-solid-router";
|
|
120
|
+
import { extractMachineRoutes, getRoutableRoutes } from "@xmachines/play-router";
|
|
121
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
122
|
+
|
|
123
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
109
124
|
const actor = createPlayer();
|
|
125
|
+
actor.start();
|
|
110
126
|
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const routeMap =
|
|
114
|
-
const router = createRouter({
|
|
115
|
-
routeTree,
|
|
116
|
-
history: createMemoryHistory()
|
|
117
|
-
});
|
|
127
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
128
|
+
const routes = getRoutableRoutes(routeTree);
|
|
129
|
+
const routeMap = createRouteMap(authMachine);
|
|
118
130
|
|
|
119
|
-
//
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</button>
|
|
127
|
-
</div>
|
|
128
|
-
),
|
|
129
|
-
AboutView: ({ send }) => (
|
|
130
|
-
<div>
|
|
131
|
-
<h1>About</h1>
|
|
132
|
-
<button onClick={() => send({ type: 'play.route', to: '/' })}>
|
|
133
|
-
Go to Home
|
|
134
|
-
</button>
|
|
135
|
-
</div>
|
|
136
|
-
)
|
|
137
|
-
};
|
|
131
|
+
// Layout rendered inside Router — has access to navigate/location/params hooks
|
|
132
|
+
const Layout = () => {
|
|
133
|
+
const navigate = useNavigate();
|
|
134
|
+
const location = useLocation();
|
|
135
|
+
const params = useParams();
|
|
136
|
+
|
|
137
|
+
onCleanup(() => { actor.stop(); });
|
|
138
138
|
|
|
139
|
-
// 4. Render with provider + renderer prop
|
|
140
|
-
function App() {
|
|
141
139
|
return (
|
|
142
|
-
<
|
|
140
|
+
<PlayRouterProvider
|
|
143
141
|
actor={actor}
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
routeMap={routeMap}
|
|
143
|
+
router={{ navigate, location, params }}
|
|
144
|
+
renderer={(currentActor, currentRouter) => (
|
|
145
|
+
<Shell actor={currentActor} router={currentRouter} registry={registry} />
|
|
146
|
+
)}
|
|
146
147
|
/>
|
|
147
148
|
);
|
|
148
|
-
}
|
|
149
|
+
};
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
export default function App() {
|
|
152
|
+
return (
|
|
153
|
+
<Router root={Layout}>
|
|
154
|
+
{routes.map((route) => (
|
|
155
|
+
<Route path={route.fullPath} component={() => <div />} />
|
|
156
|
+
))}
|
|
157
|
+
</Router>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
152
160
|
```
|
|
153
161
|
|
|
154
|
-
###
|
|
155
|
-
|
|
156
|
-
- Full React ecosystem support
|
|
157
|
-
- Type-safe routing with TanStack Router
|
|
158
|
-
- Browser history integration automatic
|
|
159
|
-
- Signal reactivity via `PlayRenderer`
|
|
160
|
-
|
|
161
|
-
## Mode 2: Vanilla Router (Preact, Solid, Vue)
|
|
162
|
-
|
|
163
|
-
Framework-agnostic router for JSX-based frameworks.
|
|
162
|
+
### SolidJS + TanStack Solid Router (`@xmachines/play-tanstack-solid-router`)
|
|
164
163
|
|
|
165
164
|
```typescript
|
|
166
|
-
import {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
} from
|
|
171
|
-
import {
|
|
172
|
-
createRouteMap,
|
|
173
|
-
extractMachineRoutes,
|
|
174
|
-
} from '@xmachines/play-router';
|
|
175
|
-
import { definePlayer } from '@xmachines/play-xstate';
|
|
165
|
+
import { createRouter, createRootRoute, createRoute, RouterProvider } from "@tanstack/solid-router";
|
|
166
|
+
import { onCleanup } from "solid-js";
|
|
167
|
+
import { PlayRouterProvider, createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
168
|
+
import { extractMachineRoutes, getRoutableRoutes } from "@xmachines/play-router";
|
|
169
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
176
170
|
|
|
177
|
-
|
|
178
|
-
const createPlayer = definePlayer({ machine, catalog });
|
|
171
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
179
172
|
const actor = createPlayer();
|
|
173
|
+
actor.start();
|
|
180
174
|
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
const routeMap = createRouteMap(
|
|
184
|
-
const history = createBrowserHistory({ window });
|
|
185
|
-
const router = createRouter({ routeTree, history });
|
|
175
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
176
|
+
const routes = getRoutableRoutes(routeTree);
|
|
177
|
+
const routeMap = createRouteMap(authMachine);
|
|
186
178
|
|
|
187
|
-
|
|
188
|
-
const disconnect = connectRouter({ actor, router, routeMap });
|
|
179
|
+
const rootRoute = createRootRoute({ component: Layout });
|
|
189
180
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
// Convert XMachines :param to TanStack $param format
|
|
182
|
+
const tanstackRoutes = routes.map((route) => {
|
|
183
|
+
const tanstackPath = route.fullPath.replace(/:(\w+)/g, "$$$1");
|
|
184
|
+
return createRoute({ getParentRoute: () => rootRoute, path: tanstackPath, component: () => <div /> });
|
|
193
185
|
});
|
|
194
186
|
|
|
195
|
-
|
|
196
|
-
// Preact:
|
|
197
|
-
import { h } from 'preact';
|
|
198
|
-
const view = actor.currentView.get();
|
|
199
|
-
render(h(components[view.component], viewProps), container);
|
|
187
|
+
const router = createRouter({ routeTree: rootRoute.addChildren(tanstackRoutes) });
|
|
200
188
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<Dynamic component={components[view.component]} {...viewProps} />
|
|
189
|
+
function Layout() {
|
|
190
|
+
onCleanup(() => { actor.stop(); });
|
|
204
191
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
192
|
+
return (
|
|
193
|
+
<PlayRouterProvider
|
|
194
|
+
actor={actor}
|
|
195
|
+
router={router}
|
|
196
|
+
routeMap={routeMap}
|
|
197
|
+
renderer={(currentActor, currentRouter) => (
|
|
198
|
+
<Shell actor={currentActor} router={currentRouter} registry={registry} />
|
|
199
|
+
)}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export default function App() {
|
|
205
|
+
return <RouterProvider router={router} />;
|
|
206
|
+
}
|
|
208
207
|
```
|
|
209
208
|
|
|
210
|
-
###
|
|
209
|
+
### Vue + Vue Router (`@xmachines/play-vue-router`)
|
|
210
|
+
|
|
211
|
+
```html
|
|
212
|
+
<!-- App.vue -->
|
|
213
|
+
<template>
|
|
214
|
+
<PlayRouterProvider
|
|
215
|
+
:actor="actor"
|
|
216
|
+
:route-map="routeMap"
|
|
217
|
+
:router="router"
|
|
218
|
+
:renderer="renderShell"
|
|
219
|
+
/>
|
|
220
|
+
</template>
|
|
221
|
+
|
|
222
|
+
<script setup lang="ts">
|
|
223
|
+
import { h, inject } from "vue";
|
|
224
|
+
import { createRouter, createWebHistory } from "vue-router";
|
|
225
|
+
import { PlayRouterProvider, createRouteMap } from "@xmachines/play-vue-router";
|
|
226
|
+
import { defineRegistry } from "@xmachines/play-vue";
|
|
227
|
+
import { authMachine, authCatalog } from "@xmachines/play-actor-shared";
|
|
228
|
+
|
|
229
|
+
const actor = inject("actor");
|
|
230
|
+
|
|
231
|
+
const routeMap = createRouteMap(authMachine);
|
|
232
|
+
|
|
233
|
+
const router = createRouter({
|
|
234
|
+
history: createWebHistory(),
|
|
235
|
+
routes: [
|
|
236
|
+
{
|
|
237
|
+
path: "/:pathMatch(.*)*",
|
|
238
|
+
name: "xmachines-play",
|
|
239
|
+
component: { render: () => h("div") },
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const { registry } = defineRegistry(authCatalog, {
|
|
245
|
+
components: {
|
|
246
|
+
/* ...your Vue SFC components */
|
|
247
|
+
},
|
|
248
|
+
actions: { login: async () => {}, logout: async () => {} /* ... */ },
|
|
249
|
+
});
|
|
211
250
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
251
|
+
const renderShell = (currentActor, currentRouter) =>
|
|
252
|
+
h(Shell, { actor: currentActor, router: currentRouter, registry });
|
|
253
|
+
</script>
|
|
254
|
+
```
|
|
216
255
|
|
|
217
|
-
##
|
|
256
|
+
## Pattern 2: `connectRouter` Pattern
|
|
218
257
|
|
|
219
|
-
|
|
258
|
+
Used by vanilla DOM and Svelte adapters. Call `connectRouter` directly after creating the actor — no provider component needed.
|
|
220
259
|
|
|
221
|
-
|
|
222
|
-
import { createBrowserHistory, createRouter, connectRouter } from "@xmachines/play-dom-router";
|
|
223
|
-
import { extractMachineRoutes, createRouteMap } from "@xmachines/play-router";
|
|
260
|
+
### Vanilla DOM (`@xmachines/play-dom-router`)
|
|
224
261
|
|
|
225
|
-
|
|
262
|
+
```typescript
|
|
263
|
+
import {
|
|
264
|
+
createBrowserHistory,
|
|
265
|
+
createRouter,
|
|
266
|
+
connectRouter,
|
|
267
|
+
createRouteMap,
|
|
268
|
+
} from "@xmachines/play-dom-router";
|
|
269
|
+
import { extractMachineRoutes } from "@xmachines/play-router";
|
|
270
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
271
|
+
import { connectRenderer, defineRegistry } from "@xmachines/play-dom";
|
|
272
|
+
import { authMachine, authCatalog } from "@xmachines/play-actor-shared";
|
|
273
|
+
|
|
274
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
226
275
|
const actor = createPlayer();
|
|
227
276
|
actor.start();
|
|
228
277
|
|
|
229
|
-
//
|
|
230
|
-
const routeTree = extractMachineRoutes(
|
|
231
|
-
const routeMap = createRouteMap(
|
|
278
|
+
// Router setup
|
|
279
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
280
|
+
const routeMap = createRouteMap(authMachine);
|
|
232
281
|
const history = createBrowserHistory({ window });
|
|
233
282
|
const router = createRouter({ routeTree, history });
|
|
234
283
|
|
|
235
|
-
//
|
|
284
|
+
// connectRouter handles bidirectional sync:
|
|
285
|
+
// - actor.currentRoute changes → browser URL updated
|
|
286
|
+
// - browser URL changes → play.route event sent to actor
|
|
236
287
|
const disconnect = connectRouter({ actor, router, routeMap });
|
|
237
288
|
|
|
238
|
-
//
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
289
|
+
// Renderer setup
|
|
290
|
+
const { registry } = defineRegistry(authCatalog, {
|
|
291
|
+
components: {
|
|
292
|
+
/* ...your DOM components */
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
const disconnectRenderer = connectRenderer({
|
|
296
|
+
actor,
|
|
297
|
+
registry,
|
|
298
|
+
container: document.getElementById("app")!,
|
|
245
299
|
});
|
|
246
|
-
watcher.watch(actor.currentView);
|
|
247
|
-
renderView(actor.currentView.get());
|
|
248
|
-
|
|
249
|
-
function renderView(view) {
|
|
250
|
-
// Vanilla JS rendering
|
|
251
|
-
if (view.component === "HomeView") {
|
|
252
|
-
document.getElementById("app").innerHTML = `
|
|
253
|
-
<h1>Home</h1>
|
|
254
|
-
<button onclick="navigateToAbout()">Go to About</button>
|
|
255
|
-
`;
|
|
256
|
-
} else if (view.component === "AboutView") {
|
|
257
|
-
document.getElementById("app").innerHTML = `
|
|
258
|
-
<h1>About</h1>
|
|
259
|
-
<button onclick="navigateToHome()">Go to Home</button>
|
|
260
|
-
`;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// 5. Manual event handlers
|
|
265
|
-
function navigateToAbout() {
|
|
266
|
-
actor.send({ type: "play.route", to: "/about" });
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function navigateToHome() {
|
|
270
|
-
actor.send({ type: "play.route", to: "/" });
|
|
271
|
-
}
|
|
272
300
|
|
|
273
|
-
//
|
|
301
|
+
// Cleanup
|
|
274
302
|
window.addEventListener("beforeunload", () => {
|
|
275
303
|
disconnect();
|
|
276
304
|
router.destroy();
|
|
277
|
-
|
|
305
|
+
disconnectRenderer();
|
|
306
|
+
actor.stop();
|
|
278
307
|
});
|
|
279
308
|
```
|
|
280
309
|
|
|
281
|
-
###
|
|
310
|
+
### SvelteKit (`@xmachines/play-sveltekit-router`)
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
// lib/router.ts
|
|
314
|
+
import { defineRegistry } from "@xmachines/play-svelte";
|
|
315
|
+
import { authCatalog, authMachine } from "@xmachines/play-actor-shared";
|
|
316
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
317
|
+
import { connectRouter, createRouteMap } from "@xmachines/play-sveltekit-router";
|
|
318
|
+
|
|
319
|
+
const createDemoPlayer = definePlayer({ machine: authMachine });
|
|
320
|
+
|
|
321
|
+
const { registry } = defineRegistry(authCatalog, {
|
|
322
|
+
components: {
|
|
323
|
+
/* ...your Svelte components */
|
|
324
|
+
},
|
|
325
|
+
actions: { login: async () => {}, logout: async () => {} /* ... */ },
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
export const actor = createDemoPlayer();
|
|
329
|
+
actor.start();
|
|
330
|
+
|
|
331
|
+
export const routeMap = createRouteMap(authMachine);
|
|
332
|
+
export const disconnectRouter = connectRouter({ actor, routeMap });
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
```html
|
|
336
|
+
<!-- App.svelte -->
|
|
337
|
+
<script lang="ts">
|
|
338
|
+
import Shell from "./Shell.svelte";
|
|
339
|
+
import { actor, registry } from "./lib/router.js";
|
|
340
|
+
</script>
|
|
341
|
+
|
|
342
|
+
<Shell {actor} {registry} />
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Svelte SPA Router (`@xmachines/play-svelte-spa-router`)
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
// lib/router.ts — identical pattern to SvelteKit, different import
|
|
349
|
+
import { connectRouter, createRouteMap } from "@xmachines/play-svelte-spa-router";
|
|
350
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
351
|
+
import { authMachine } from "@xmachines/play-actor-shared";
|
|
352
|
+
|
|
353
|
+
const createDemoPlayer = definePlayer({ machine: authMachine });
|
|
354
|
+
|
|
355
|
+
export const actor = createDemoPlayer();
|
|
356
|
+
actor.start();
|
|
357
|
+
|
|
358
|
+
export const routeMap = createRouteMap(authMachine);
|
|
359
|
+
export const disconnectRouter = connectRouter({ actor, routeMap });
|
|
360
|
+
```
|
|
282
361
|
|
|
283
|
-
|
|
284
|
-
- Maximum control and flexibility
|
|
285
|
-
- Works with jQuery, Alpine.js, HTMX, etc.
|
|
286
|
-
- Signals available via `actor.currentView.get()`
|
|
362
|
+
## Adapter Summary
|
|
287
363
|
|
|
288
|
-
|
|
364
|
+
| Package | Framework | Pattern | Key Import |
|
|
365
|
+
| --------------------------------------- | --------------------- | --------------- | ------------------------------------------------------------------------- |
|
|
366
|
+
| `@xmachines/play-dom-router` | Vanilla DOM | `connectRouter` | `connectRouter`, `createRouteMap`, `createBrowserHistory`, `createRouter` |
|
|
367
|
+
| `@xmachines/play-react-router` | React Router v7 | Provider | `PlayRouterProvider`, `createRouteMapFromTree` |
|
|
368
|
+
| `@xmachines/play-tanstack-react-router` | TanStack React Router | Provider | `PlayRouterProvider`, `createRouteMapFromTree` |
|
|
369
|
+
| `@xmachines/play-solid-router` | SolidJS Router | Provider | `PlayRouterProvider`, `createRouteMap` |
|
|
370
|
+
| `@xmachines/play-tanstack-solid-router` | TanStack Solid Router | Provider | `PlayRouterProvider`, `createRouteMap` |
|
|
371
|
+
| `@xmachines/play-vue-router` | Vue Router | Provider | `PlayRouterProvider`, `createRouteMap` |
|
|
372
|
+
| `@xmachines/play-sveltekit-router` | SvelteKit | `connectRouter` | `connectRouter`, `createRouteMap` |
|
|
373
|
+
| `@xmachines/play-svelte-spa-router` | Svelte SPA Router | `connectRouter` | `connectRouter`, `createRouteMap` |
|
|
289
374
|
|
|
290
|
-
|
|
375
|
+
## Renderer Packages
|
|
291
376
|
|
|
292
|
-
|
|
293
|
-
| ----------- | ---------------------------------- | ------------------------------------- | -------------------------- |
|
|
294
|
-
| Actor | `createPlayer()` | `createPlayer()` | `createPlayer()` |
|
|
295
|
-
| Router | `createRouter()` (TanStack) | `createRouter()` + `createRouteMap()` | `connectRouter()` |
|
|
296
|
-
| Integration | `<PlayTanStackRouterProvider>` | Manual via `onNavigate` callback | Manual + `window.popstate` |
|
|
297
|
-
| Rendering | `<PlayRenderer>` via renderer prop | Framework-specific (h, Dynamic, etc) | `innerHTML` or DOM API |
|
|
298
|
-
| Events | Component `onClick` → `send()` | Same | Same |
|
|
299
|
-
| Signals | Observed by `useSignalEffect` | Manual `actor.currentView.get()` | Same |
|
|
377
|
+
Each framework also has a companion renderer package for the view layer:
|
|
300
378
|
|
|
301
|
-
|
|
379
|
+
| Package | Framework | Key API |
|
|
380
|
+
| ------------------------ | ----------- | ----------------------------------- |
|
|
381
|
+
| `@xmachines/play-dom` | Vanilla DOM | `connectRenderer`, `defineRegistry` |
|
|
382
|
+
| `@xmachines/play-react` | React | `PlayRenderer`, `defineRegistry` |
|
|
383
|
+
| `@xmachines/play-solid` | SolidJS | `PlayRenderer`, `defineRegistry` |
|
|
384
|
+
| `@xmachines/play-vue` | Vue 3 | `PlayRenderer`, `defineRegistry` |
|
|
385
|
+
| `@xmachines/play-svelte` | Svelte 5 | `PlayRenderer`, `defineRegistry` |
|
|
302
386
|
|
|
303
387
|
## Architectural Invariants
|
|
304
388
|
|
|
305
|
-
All
|
|
389
|
+
All adapters preserve the 5 architectural invariants:
|
|
306
390
|
|
|
307
|
-
1. **Actor Authority (INV-01):**
|
|
391
|
+
1. **Actor Authority (INV-01):** Machine guards validate all navigation
|
|
308
392
|
2. **Strict Separation (INV-02):** Business logic (machine) has zero framework imports
|
|
309
|
-
3. **
|
|
393
|
+
3. **State-Driven Reset (INV-03):** Browser back/forward sends `play.route` events to actor
|
|
310
394
|
4. **Passive Infrastructure (INV-04):** Router observes actor, never decides
|
|
311
|
-
5. **
|
|
395
|
+
5. **Signal-Only Reactivity (INV-05):** TC39 Signals work identically in all adapters
|
|
312
396
|
|
|
313
397
|
## Next Steps
|
|
314
398
|
|
|
315
|
-
- **[Routing Patterns](./routing-patterns.md)**
|
|
316
|
-
- **[Examples Index](./README.md)**
|
|
399
|
+
- **[Routing Patterns](./routing-patterns.md)** — `meta.route`, `play.route`, `always` guards
|
|
400
|
+
- **[Examples Index](./README.md)** — Complete catalog of runnable demos
|
|
317
401
|
|
|
318
402
|
## Learn More
|
|
319
403
|
|
|
320
|
-
- [
|
|
321
|
-
- [play-
|
|
322
|
-
- [play-router README](../api/@xmachines/play-router/README.md)
|
|
323
|
-
- [play-dom-router README](../api/@xmachines/play-dom-router/README.md) - Vanilla DOM bindings (`createBrowserHistory`, `createRouter`, `connectRouter`)
|
|
324
|
-
- [Play RFC](../rfc/play.md) - Complete specification
|
|
404
|
+
- [Play RFC](../rfc/play.md) — Complete architectural specification
|
|
405
|
+
- [play-router README](../api/@xmachines/play-router/README.md) — Route extraction and route maps
|
|
406
|
+
- [play-dom-router README](../api/@xmachines/play-dom-router/README.md) — Vanilla DOM router adapter
|