@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type PlayerFactory<TMachine> = (input?, options?) => PlayerActor<TMachine>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/types.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-xstate/src/types.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/types.ts#L57)
|
|
10
10
|
|
|
11
11
|
Factory function returned by definePlayer()
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type RouteMachineConfig = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:48](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:48](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L48)
|
|
10
10
|
|
|
11
11
|
Minimal structural constraint for machine configs accepted by
|
|
12
12
|
`formatPlayRouteTransitions`.
|
|
@@ -32,7 +32,7 @@ through the transform, so the return value remains directly usable by
|
|
|
32
32
|
optional context?: unknown;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
35
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L49)
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:4
|
|
|
42
42
|
optional on?: Record<string, unknown>;
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
45
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L51)
|
|
46
46
|
|
|
47
47
|
---
|
|
48
48
|
|
|
@@ -52,4 +52,4 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:5
|
|
|
52
52
|
optional states?: Record<string, unknown>;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
55
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L50)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type RouteStateNode = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L13)
|
|
10
10
|
|
|
11
11
|
Minimal structural shape of a single XState state node as read by
|
|
12
12
|
`formatPlayRouteTransitions` when crawling the machine config.
|
|
@@ -29,7 +29,7 @@ the index signature.
|
|
|
29
29
|
optional id?: string;
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
32
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L15)
|
|
33
33
|
|
|
34
34
|
Optional explicit state ID (e.g. `"home"`, `"settings"`). Used as the `#id` target in `play.route` events.
|
|
35
35
|
|
|
@@ -41,7 +41,7 @@ Optional explicit state ID (e.g. `"home"`, `"settings"`). Used as the `#id` targ
|
|
|
41
41
|
optional meta?: object;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
44
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L17)
|
|
45
45
|
|
|
46
46
|
State metadata — `meta.route` marks the state as routable.
|
|
47
47
|
|
|
@@ -61,6 +61,6 @@ URL path template (e.g. `"/profile/:username"`, `"/settings/:section?"`).
|
|
|
61
61
|
optional states?: Record<string, RouteStateNode>;
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
64
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L22)
|
|
65
65
|
|
|
66
66
|
Nested child states, recursively crawled for additional route declarations.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
# Function: defineXmVitestConfig()
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
function defineXmVitestConfig(importMetaUrl, overrides):
|
|
6
|
+
function defineXmVitestConfig(importMetaUrl, overrides): UserConfig;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [
|
|
9
|
+
Defined in: [index.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/shared/src/index.ts#L10)
|
|
10
10
|
|
|
11
11
|
Create a Vitest config with XMachines workspace defaults.
|
|
12
12
|
|
|
@@ -22,8 +22,4 @@ render it under `@xmachines/shared` instead of nested module pages.
|
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
| Name | Type | Defined in |
|
|
28
|
-
| ------ | ----- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
-
| `test` | `any` | [config/vitest.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/shared/config/vitest.ts#L82) |
|
|
25
|
+
`UserConfig`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmAliases(importMetaUrl): Record<string, string>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [
|
|
9
|
+
Defined in: [index.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/shared/src/index.ts#L20)
|
|
10
10
|
|
|
11
11
|
Build Vite/Vitest alias entries for all `@xmachines/*` workspace packages.
|
|
12
12
|
|
package/api/README.md
CHANGED
|
@@ -32,27 +32,31 @@ Generated API documentation for the XMachines JavaScript/TypeScript packages.
|
|
|
32
32
|
|
|
33
33
|
- [@xmachines/play](@xmachines/play/README.md)
|
|
34
34
|
- [@xmachines/play-actor](@xmachines/play-actor/README.md)
|
|
35
|
+
- [@xmachines/play-actor-shared](@xmachines/play-actor-shared/README.md)
|
|
35
36
|
- [@xmachines/play-dom](@xmachines/play-dom/README.md)
|
|
37
|
+
- [@xmachines/play-dom-demo](@xmachines/play-dom-demo/README.md)
|
|
36
38
|
- [@xmachines/play-dom-router](@xmachines/play-dom-router/README.md)
|
|
37
39
|
- [@xmachines/play-dom-router-demo](@xmachines/play-dom-router-demo/README.md)
|
|
38
40
|
- [@xmachines/play-react](@xmachines/play-react/README.md)
|
|
41
|
+
- [@xmachines/play-react-demo](@xmachines/play-react-demo/README.md)
|
|
39
42
|
- [@xmachines/play-react-router](@xmachines/play-react-router/README.md)
|
|
40
43
|
- [@xmachines/play-react-router-demo](@xmachines/play-react-router-demo/README.md)
|
|
41
44
|
- [@xmachines/play-router](@xmachines/play-router/README.md)
|
|
42
45
|
- [@xmachines/play-signals](@xmachines/play-signals/README.md)
|
|
43
46
|
- [@xmachines/play-solid](@xmachines/play-solid/README.md)
|
|
47
|
+
- [@xmachines/play-solid-demo](@xmachines/play-solid-demo/README.md)
|
|
44
48
|
- [@xmachines/play-solid-router](@xmachines/play-solid-router/README.md)
|
|
45
49
|
- [@xmachines/play-solid-router-demo](@xmachines/play-solid-router-demo/README.md)
|
|
46
50
|
- [@xmachines/play-svelte](@xmachines/play-svelte/README.md)
|
|
51
|
+
- [@xmachines/play-svelte-demo](@xmachines/play-svelte-demo/README.md)
|
|
47
52
|
- [@xmachines/play-svelte-spa-router](@xmachines/play-svelte-spa-router/README.md)
|
|
48
|
-
- [@xmachines/play-svelte-spa-router-demo](@xmachines/play-svelte-spa-router-demo/README.md)
|
|
49
53
|
- [@xmachines/play-sveltekit-router](@xmachines/play-sveltekit-router/README.md)
|
|
50
|
-
- [@xmachines/play-sveltekit-router-demo](@xmachines/play-sveltekit-router-demo/README.md)
|
|
51
54
|
- [@xmachines/play-tanstack-react-router](@xmachines/play-tanstack-react-router/README.md)
|
|
52
55
|
- [@xmachines/play-tanstack-react-router-demo](@xmachines/play-tanstack-react-router-demo/README.md)
|
|
53
56
|
- [@xmachines/play-tanstack-solid-router](@xmachines/play-tanstack-solid-router/README.md)
|
|
54
57
|
- [@xmachines/play-tanstack-solid-router-demo](@xmachines/play-tanstack-solid-router-demo/README.md)
|
|
55
58
|
- [@xmachines/play-vue](@xmachines/play-vue/README.md)
|
|
59
|
+
- [@xmachines/play-vue-demo](@xmachines/play-vue-demo/README.md)
|
|
56
60
|
- [@xmachines/play-vue-router](@xmachines/play-vue-router/README.md)
|
|
57
61
|
- [@xmachines/play-vue-router-demo](@xmachines/play-vue-router-demo/README.md)
|
|
58
62
|
- [@xmachines/play-xstate](@xmachines/play-xstate/README.md)
|
package/api/llms.txt
CHANGED
|
@@ -32,14 +32,11 @@
|
|
|
32
32
|
- [@xmachines/play-xstate](@xmachines/play-xstate/README.md): XState-backed player and actor integration
|
|
33
33
|
- [@xmachines/play-react](@xmachines/play-react/README.md): React renderer for Viewable actors
|
|
34
34
|
- [@xmachines/play-solid](@xmachines/play-solid/README.md): Solid renderer for Viewable actors
|
|
35
|
-
- [@xmachines/play-svelte](@xmachines/play-svelte/README.md): Svelte 5 renderer for Viewable actors
|
|
36
35
|
- [@xmachines/play-vue](@xmachines/play-vue/README.md): Vue renderer for Viewable actors
|
|
37
36
|
- [@xmachines/play-react-router](@xmachines/play-react-router/README.md): React Router bridge and provider for actor-driven navigation
|
|
38
37
|
- [@xmachines/play-tanstack-react-router](@xmachines/play-tanstack-react-router/README.md): TanStack React Router bridge and provider
|
|
39
38
|
- [@xmachines/play-solid-router](@xmachines/play-solid-router/README.md): Solid Router bridge and provider
|
|
40
39
|
- [@xmachines/play-tanstack-solid-router](@xmachines/play-tanstack-solid-router/README.md): TanStack Solid Router bridge and provider
|
|
41
|
-
- [@xmachines/play-sveltekit-router](@xmachines/play-sveltekit-router/README.md): SvelteKit router adapter for actor-driven navigation
|
|
42
|
-
- [@xmachines/play-svelte-spa-router](@xmachines/play-svelte-spa-router/README.md): Svelte SPA (hash) router adapter for actor-driven navigation
|
|
43
40
|
- [@xmachines/play-vue-router](@xmachines/play-vue-router/README.md): Vue Router bridge and provider
|
|
44
41
|
- [@xmachines/shared](@xmachines/shared/README.md): Shared TypeScript, oxlint, and formatting configuration
|
|
45
42
|
|
package/examples/README.md
CHANGED
|
@@ -1,81 +1,94 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
1
3
|
# XMachines Examples
|
|
2
4
|
|
|
3
|
-
Practical code examples demonstrating
|
|
5
|
+
Practical code examples demonstrating current XMachines Play patterns and use cases.
|
|
4
6
|
|
|
5
7
|
## Learning Path
|
|
6
8
|
|
|
7
9
|
### Level 1: Basic Concepts
|
|
8
10
|
|
|
9
|
-
Start with fundamental
|
|
11
|
+
Start with the fundamental machine + actor pattern:
|
|
10
12
|
|
|
11
|
-
- **[Basic State Machine](basic-state-machine.md)**
|
|
12
|
-
- **[Traffic Light](traffic-light.md)**
|
|
13
|
-
- **[Form Validation](form-validation.md)**
|
|
13
|
+
- **[Basic State Machine](basic-state-machine.md)** — `setup().createMachine()` + `definePlayer()` + TC39 Signals
|
|
14
|
+
- **[Traffic Light](traffic-light.md)** — Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
|
|
15
|
+
- **[Form Validation](form-validation.md)** — Typed context mutations with `setup.assign`, guards, and `$bindState`
|
|
14
16
|
|
|
15
17
|
### Level 2: Routing Patterns
|
|
16
18
|
|
|
17
19
|
Learn how state machines control navigation:
|
|
18
20
|
|
|
19
|
-
- **[Routing Patterns](routing-patterns.md)**
|
|
20
|
-
- **[Multi-Router Integration](multi-router-integration.md)**
|
|
21
|
+
- **[Routing Patterns](routing-patterns.md)** — `meta.route`, `play.route` events, `always` auth guards, and parameter routes
|
|
22
|
+
- **[Multi-Router Integration](multi-router-integration.md)** — All 8 router adapters: provider pattern vs `connectRouter` pattern
|
|
21
23
|
|
|
22
24
|
### Level 3: Full Applications
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Complete Examples
|
|
26
|
+
Complete working implementations of actor-authoritative routing with all architectural invariants enforced.
|
|
27
27
|
|
|
28
|
-
Complete
|
|
28
|
+
## Complete Demo Applications
|
|
29
29
|
|
|
30
30
|
### Framework-Agnostic Baseline
|
|
31
31
|
|
|
32
|
-
- **[Vanilla JavaScript Router Demo](../api/@xmachines/play-dom-router-demo/README.md)**
|
|
32
|
+
- **[Vanilla JavaScript Router Demo](../api/@xmachines/play-dom-router-demo/README.md)** — Pure browser integration: `connectRouter` + `connectRenderer` + DOM components. The lowest-level reference implementation.
|
|
33
33
|
|
|
34
34
|
### React Integrations
|
|
35
35
|
|
|
36
|
-
- **[TanStack React Router Demo](../api/@xmachines/play-tanstack-react-router-demo/README.md)**
|
|
37
|
-
- **[React Router Demo](../api/@xmachines/play-react-router-demo/README.md)**
|
|
36
|
+
- **[TanStack React Router Demo](../api/@xmachines/play-tanstack-react-router-demo/README.md)** — Canonical reference implementation with all 5 invariants, comprehensive routing, authentication guards, and browser tests.
|
|
37
|
+
- **[React Router Demo](../api/@xmachines/play-react-router-demo/README.md)** — React Router v7 data-router integration using a catch-all route and `ReactRouterBridge`.
|
|
38
38
|
|
|
39
39
|
### Vue Integration
|
|
40
40
|
|
|
41
|
-
- **[Vue Router Demo](../api/@xmachines/play-vue-router-demo/README.md)**
|
|
41
|
+
- **[Vue Router Demo](../api/@xmachines/play-vue-router-demo/README.md)** — Vue Composition API integration with `PlayRouterProvider` and the shared `authMachine`.
|
|
42
42
|
|
|
43
43
|
### Svelte Integrations
|
|
44
44
|
|
|
45
|
-
- **[SvelteKit Router Demo](../api/@xmachines/play-sveltekit-router-demo/README.md)**
|
|
46
|
-
- **[Svelte SPA Router Demo](../api/@xmachines/play-svelte-spa-router-demo/README.md)**
|
|
45
|
+
- **[SvelteKit Router Demo](../api/@xmachines/play-sveltekit-router-demo/README.md)** — SvelteKit-style routing with `connectRouter` + `afterNavigate`/`goto` and Svelte 5 runes.
|
|
46
|
+
- **[Svelte SPA Router Demo](../api/@xmachines/play-svelte-spa-router-demo/README.md)** — Hash-based SPA routing using `svelte-spa-router` with the same actor-authoritative flow.
|
|
47
47
|
|
|
48
|
-
###
|
|
48
|
+
### SolidJS Integrations
|
|
49
49
|
|
|
50
|
-
- **[Solid Router Demo](../api/@xmachines/play-solid-router-demo/README.md)**
|
|
51
|
-
- **[TanStack Solid Router Demo](../api/@xmachines/play-tanstack-solid-router-demo/README.md)**
|
|
50
|
+
- **[Solid Router Demo](../api/@xmachines/play-solid-router-demo/README.md)** — `@solidjs/router` integration with `PlayRouterProvider` and SolidJS fine-grained reactivity.
|
|
51
|
+
- **[TanStack Solid Router Demo](../api/@xmachines/play-tanstack-solid-router-demo/README.md)** — TanStack Router for Solid with dynamic route creation from the machine's route tree.
|
|
52
52
|
|
|
53
|
-
## Running Examples
|
|
53
|
+
## Running the Code Examples
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
**Node.js:**
|
|
55
|
+
The conceptual examples in this directory are TypeScript snippets. To run them:
|
|
58
56
|
|
|
59
57
|
```bash
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```
|
|
58
|
+
# Install dependencies (from the monorepo root)
|
|
59
|
+
npm install @xmachines/play-xstate @xmachines/play-actor @xmachines/play-signals xstate
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
# Run with tsx
|
|
62
|
+
npx tsx my-example.ts
|
|
63
|
+
```
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
To run a complete demo application, `cd` into the relevant package and start its dev server:
|
|
68
66
|
|
|
69
67
|
```bash
|
|
70
|
-
|
|
68
|
+
# Example: vanilla DOM router demo
|
|
69
|
+
cd packages/play-dom-router/examples/demo
|
|
70
|
+
npm install
|
|
71
|
+
npm run dev
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
## Key Packages
|
|
75
|
+
|
|
76
|
+
| Package | Role |
|
|
77
|
+
| ------------------------- | ----------------------------------------------------------- |
|
|
78
|
+
| `@xmachines/play-xstate` | `definePlayer`, `formatPlayRouteTransitions`, `PlayerActor` |
|
|
79
|
+
| `@xmachines/play-actor` | `AbstractActor`, `typedSpec` |
|
|
80
|
+
| `@xmachines/play-signals` | TC39 Signals polyfill, `watchSignal` |
|
|
81
|
+
| `@xmachines/play-router` | `extractMachineRoutes`, `getRoutableRoutes` |
|
|
82
|
+
| `@xmachines/play-dom` | `connectRenderer`, `defineRegistry` (vanilla) |
|
|
83
|
+
| `@xmachines/play-react` | `PlayRenderer`, `defineRegistry` (React) |
|
|
84
|
+
|
|
73
85
|
## Related Documentation
|
|
74
86
|
|
|
75
|
-
- **[Getting Started Guide](../guides/getting-started.md)**
|
|
76
|
-
- **[
|
|
87
|
+
- **[Getting Started Guide](../guides/getting-started.md)** — First steps with XMachines
|
|
88
|
+
- **[Installation Guide](../guides/installation.md)** — Package installation and TypeScript setup
|
|
89
|
+
- **[API Reference](../api/README.md)** — Generated API docs for all public packages
|
|
90
|
+
- **[Play RFC](../rfc/play.md)** — Complete architectural specification
|
|
77
91
|
|
|
78
92
|
---
|
|
79
93
|
|
|
80
|
-
**Contributing Examples:**
|
|
81
|
-
Have a useful example to share? See the repository contribution guidelines.
|
|
94
|
+
**Contributing Examples:** Have a useful example to share? See the repository contribution guidelines.
|
|
@@ -1,70 +1,114 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
1
3
|
# Basic State Machine
|
|
2
4
|
|
|
3
|
-
Learn how to
|
|
5
|
+
Learn how to define a simple toggle machine using the current XState v5 + XMachines `setup().createMachine()` + `definePlayer()` pattern.
|
|
4
6
|
|
|
5
7
|
## Use Case
|
|
6
8
|
|
|
7
|
-
This example demonstrates a toggle switch
|
|
9
|
+
This example demonstrates a toggle switch — the foundation for understanding state machines in XMachines. It is the simplest possible machine: two states, one event type, no router, no catalog.
|
|
8
10
|
|
|
9
11
|
## Complete Code
|
|
10
12
|
|
|
11
13
|
```typescript
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
import { setup } from "xstate";
|
|
15
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
16
|
+
|
|
17
|
+
// 1. Declare types for context, events, and input via setup()
|
|
18
|
+
const toggleSetup = setup({
|
|
19
|
+
types: {
|
|
20
|
+
context: {} as { toggleCount: number },
|
|
21
|
+
events: {} as { type: "toggle" },
|
|
22
|
+
input: {} as { toggleCount?: number } | undefined,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
19
25
|
|
|
20
|
-
// Create machine
|
|
21
|
-
const toggleMachine = createMachine
|
|
26
|
+
// 2. Create the machine using setup().createMachine()
|
|
27
|
+
const toggleMachine = toggleSetup.createMachine({
|
|
22
28
|
id: "toggle",
|
|
23
29
|
initial: "off",
|
|
30
|
+
context: ({ input }) => ({
|
|
31
|
+
toggleCount: input?.toggleCount ?? 0,
|
|
32
|
+
}),
|
|
24
33
|
states: {
|
|
25
34
|
off: {
|
|
26
35
|
on: {
|
|
27
|
-
|
|
36
|
+
toggle: {
|
|
37
|
+
target: "on",
|
|
38
|
+
actions: toggleSetup.assign({
|
|
39
|
+
toggleCount: ({ context }) => context.toggleCount + 1,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
28
42
|
},
|
|
29
43
|
},
|
|
30
44
|
on: {
|
|
31
45
|
on: {
|
|
32
|
-
|
|
46
|
+
toggle: {
|
|
47
|
+
target: "off",
|
|
48
|
+
actions: toggleSetup.assign({
|
|
49
|
+
toggleCount: ({ context }) => context.toggleCount + 1,
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
33
52
|
},
|
|
34
53
|
},
|
|
35
54
|
},
|
|
36
55
|
});
|
|
37
56
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
// 3. Create a player factory
|
|
58
|
+
const createPlayer = definePlayer({ machine: toggleMachine });
|
|
59
|
+
|
|
60
|
+
// 4. Create and start an actor
|
|
61
|
+
const actor = createPlayer();
|
|
62
|
+
actor.start();
|
|
63
|
+
|
|
64
|
+
// 5. Read initial state via getSnapshot()
|
|
65
|
+
console.log(actor.getSnapshot().value); // "off"
|
|
66
|
+
console.log(actor.getSnapshot().context.toggleCount); // 0
|
|
41
67
|
|
|
42
|
-
|
|
43
|
-
console.log(state); //
|
|
68
|
+
// 6. Read state via TC39 Signal
|
|
69
|
+
console.log(actor.state.get().value); // "off"
|
|
44
70
|
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
// 7. Send events
|
|
72
|
+
actor.send({ type: "toggle" });
|
|
73
|
+
console.log(actor.getSnapshot().value); // "on"
|
|
74
|
+
console.log(actor.getSnapshot().context.toggleCount); // 1
|
|
75
|
+
|
|
76
|
+
actor.send({ type: "toggle" });
|
|
77
|
+
console.log(actor.getSnapshot().value); // "off"
|
|
78
|
+
console.log(actor.getSnapshot().context.toggleCount); // 2
|
|
79
|
+
|
|
80
|
+
// 8. Cleanup
|
|
81
|
+
actor.stop();
|
|
47
82
|
```
|
|
48
83
|
|
|
49
84
|
## Code Explanation
|
|
50
85
|
|
|
51
|
-
1.
|
|
86
|
+
1. **`setup({ types })`** — Declares TypeScript types for `context`, `events`, and `input` before the machine is created. This is the XState v5 typed entry point. Never pass type parameters directly to `createMachine`.
|
|
87
|
+
|
|
88
|
+
2. **`toggleSetup.createMachine(...)`** — Creates the state machine. Using the scoped `toggleSetup.createMachine` (instead of the bare `createMachine` from xstate) ensures that guards and actions are type-checked against the declared types.
|
|
89
|
+
|
|
90
|
+
3. **`toggleSetup.assign(...)`** — Assigns context mutations using the typed setup's `assign` helper. This provides full inference from the declared context type — no manual type assertions needed.
|
|
91
|
+
|
|
92
|
+
4. **`definePlayer({ machine })`** — Wraps the machine in a factory. Calling `createPlayer()` returns a `PlayerActor` — XMachines' actor type that extends XState's actor with TC39 Signal reactivity and Play Architecture hooks.
|
|
93
|
+
|
|
94
|
+
5. **`actor.start()`** — Activates the machine. Always call `start()` before sending events.
|
|
52
95
|
|
|
53
|
-
|
|
96
|
+
6. **`actor.getSnapshot()`** — Returns the current XState snapshot synchronously. `.value` is the state name; `.context` is the typed context object.
|
|
54
97
|
|
|
55
|
-
|
|
98
|
+
7. **`actor.state.get()`** — TC39 Signal access to the current snapshot. Useful when wiring infrastructure that observes signals (renderers, router bridges). Equivalent to `actor.getSnapshot()` for one-time reads.
|
|
56
99
|
|
|
57
|
-
|
|
100
|
+
8. **Event types use dot-separated lowercase** — `"toggle"` not `"TOGGLE"`. This matches the XMachines convention used throughout the codebase (e.g. `"auth.login"`, `"auth.logout"`, `"play.route"`).
|
|
58
101
|
|
|
59
102
|
## Key Concepts
|
|
60
103
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
104
|
+
- **`setup({ types })`**: The XState v5 typed entry point. Declares context, event, and input shapes before machine creation.
|
|
105
|
+
- **`definePlayer({ machine })`**: Creates a factory function that returns `PlayerActor` instances.
|
|
106
|
+
- **`actor.state`**: A `Signal.State<Snapshot>` — TC39 Signals-based reactive handle on the machine snapshot.
|
|
107
|
+
- **`actor.getSnapshot()`**: Synchronous snapshot access — use for one-time reads and TypeScript-typed context inspection.
|
|
108
|
+
- **Typed `assign`**: Always call `setup.assign(...)` (not the bare `assign` from xstate) for context mutations.
|
|
65
109
|
|
|
66
110
|
## Next Steps
|
|
67
111
|
|
|
68
|
-
- **[Traffic Light Example](traffic-light.md)** -
|
|
69
|
-
- **[Form Validation Example](form-validation.md)**
|
|
70
|
-
- **[
|
|
112
|
+
- **[Traffic Light Example](traffic-light.md)** — Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
|
|
113
|
+
- **[Form Validation Example](form-validation.md)** — Typed context mutations with `setup.assign` and guards
|
|
114
|
+
- **[Routing Patterns](routing-patterns.md)** — Adding `meta.route` to states and using `play.route` events
|