@xmachines/docs 2.0.0 → 2.1.0
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/README.md +11 -13
- package/api/@xmachines/play/README.md +58 -63
- package/api/@xmachines/play/classes/NonNullableError.md +7 -7
- package/api/@xmachines/play/classes/PlayError.md +25 -27
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
- package/api/@xmachines/play-actor/README.md +72 -63
- package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
- package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
- package/api/@xmachines/play-dom/README.md +119 -85
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom-router/README.md +66 -49
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +63 -54
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +37 -28
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +94 -82
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +34 -29
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +40 -31
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +38 -34
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +66 -48
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +37 -17
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/README.md +71 -45
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +37 -35
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +65 -56
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +72 -70
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
- package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
- package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
- package/api/@xmachines/shared/README.md +11 -13
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/contributing/development.md +28 -0
- package/guides/inspector.md +1 -1
- package/package.json +1 -1
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# @xmachines/play-xstate
|
|
4
4
|
|
|
5
|
-
> XState v5 adapter for the XMachines Play Architecture
|
|
5
|
+
> XState v5 adapter for the XMachines Play Architecture. It binds a state machine to the actor base, with signal-driven reactivity and a router integration.
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [ monorepo.
|
|
7
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-xstate)
|
|
10
8
|
|
|
11
9
|
---
|
|
12
10
|
|
|
@@ -16,7 +14,7 @@ Part of the [XMachines Play](../../README.md) monorepo.
|
|
|
16
14
|
pnpm add @xmachines/play-xstate xstate
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
`xstate ^5.31.0` is a peer dependency
|
|
17
|
+
`xstate ^5.31.0` is a peer dependency. Install it with this package.
|
|
20
18
|
|
|
21
19
|
---
|
|
22
20
|
|
|
@@ -30,7 +28,7 @@ import { definePlayer } from "@xmachines/play-xstate";
|
|
|
30
28
|
const machine = setup({}).createMachine({
|
|
31
29
|
initial: "idle",
|
|
32
30
|
states: {
|
|
33
|
-
idle: { meta: { route: "/" } },
|
|
31
|
+
idle: { meta: { route: "/" }, on: { activate: "active" } },
|
|
34
32
|
active: { meta: { route: "/active" } },
|
|
35
33
|
},
|
|
36
34
|
});
|
|
@@ -58,7 +56,7 @@ actor.stop();
|
|
|
58
56
|
|
|
59
57
|
### `definePlayer(config)`
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
This function creates a `PlayerFactory` from an XState v5 machine. One configuration can therefore make more than one independent actor instance. This helps with a multi-user application, with SSR, and with a test.
|
|
62
60
|
|
|
63
61
|
```typescript
|
|
64
62
|
import { setup } from "xstate";
|
|
@@ -94,9 +92,9 @@ const bob = createPlayer({ userId: "bob" });
|
|
|
94
92
|
|
|
95
93
|
#### `PlayerFactory` signature
|
|
96
94
|
|
|
97
|
-
`input`
|
|
98
|
-
cannot be `undefined
|
|
99
|
-
|
|
95
|
+
The `input` argument follows the rule of `createActor` in XState. If the input type of a
|
|
96
|
+
machine cannot be `undefined`, the first argument of the factory is necessary. An absent
|
|
97
|
+
input is then a compile error, not an actor that stops in an error status.
|
|
100
98
|
|
|
101
99
|
```typescript
|
|
102
100
|
type PlayerFactory<TMachine> =
|
|
@@ -123,35 +121,35 @@ restored.start();
|
|
|
123
121
|
console.log(restored.currentRoute.get()); // same route as when saved
|
|
124
122
|
```
|
|
125
123
|
|
|
126
|
-
> **Note:**
|
|
127
|
-
>
|
|
128
|
-
> with invoked or spawned
|
|
124
|
+
> **Note:** persist the state with `getPersistedSnapshot()`, not with
|
|
125
|
+
> `getSnapshot()`. `createActor` accepts that form only, and it is the only form
|
|
126
|
+
> that restores a machine with an invoked child or a spawned child.
|
|
129
127
|
|
|
130
128
|
---
|
|
131
129
|
|
|
132
130
|
### `PlayerActor<TMachine>`
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
This concrete actor class is an XState v5 actor that also exposes reactive TC39 Signals. It implements both the `Routable` interface and the `Viewable` interface from `@xmachines/play-actor`.
|
|
135
133
|
|
|
136
134
|
#### Signals
|
|
137
135
|
|
|
138
|
-
| Signal | Type | Description
|
|
139
|
-
| -------------- | -------------------------------------- |
|
|
140
|
-
| `state` | `Signal.State<SnapshotFrom<TMachine>>` |
|
|
141
|
-
| `currentRoute` | `Signal.Computed<string \| null>` |
|
|
142
|
-
| `currentView` | `Signal.State<PlaySpec \| null>` |
|
|
143
|
-
| `initialRoute` | `readonly string \| null` |
|
|
136
|
+
| Signal | Type | Description |
|
|
137
|
+
| -------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
138
|
+
| `state` | `Signal.State<SnapshotFrom<TMachine>>` | The current XState snapshot. The actor updates it on every active transition |
|
|
139
|
+
| `currentRoute` | `Signal.Computed<string \| null>` | The URL that comes from the `meta.route` template of the active state and from the context |
|
|
140
|
+
| `currentView` | `Signal.State<PlaySpec \| null>` | The view spec from the `meta.view` metadata of the active state, with the context params added |
|
|
141
|
+
| `initialRoute` | `readonly string \| null` | The route of the initial state of the machine. The constructor fixes it, and a router bridge uses it to detect a deep link or a restore |
|
|
144
142
|
|
|
145
143
|
#### Methods
|
|
146
144
|
|
|
147
|
-
| Method | Description
|
|
148
|
-
| --------------- |
|
|
149
|
-
| `start()` |
|
|
150
|
-
| `stop()` |
|
|
151
|
-
| `send(event)` |
|
|
152
|
-
| `can(event)` | Returns `true`
|
|
153
|
-
| `getSnapshot()` | Returns the current XState snapshot
|
|
154
|
-
| `dispose()` |
|
|
145
|
+
| Method | Description |
|
|
146
|
+
| --------------- | ------------------------------------------------------------------------- |
|
|
147
|
+
| `start()` | Starts the actor and calls the `onStart` hook |
|
|
148
|
+
| `stop()` | Stops the actor, cleans up the subscriptions, and calls the `onStop` hook |
|
|
149
|
+
| `send(event)` | Sends a typed event to the machine and calls the `onTransition` hook |
|
|
150
|
+
| `can(event)` | Returns `true` when the current state accepts the given event |
|
|
151
|
+
| `getSnapshot()` | Returns the current XState snapshot |
|
|
152
|
+
| `dispose()` | The alias of `stop()` |
|
|
155
153
|
|
|
156
154
|
#### Signal usage example
|
|
157
155
|
|
|
@@ -172,11 +170,12 @@ actor.start();
|
|
|
172
170
|
|
|
173
171
|
### Guard utilities
|
|
174
172
|
|
|
175
|
-
> **Deprecated:**
|
|
176
|
-
> combinators
|
|
177
|
-
>
|
|
173
|
+
> **Deprecated:** these guard helpers wrap the `and()`, `or()`, and `not()`
|
|
174
|
+
> combinators of XState, but they do not compose with a guard slot that
|
|
175
|
+
> `setup()` types. Use the combinators of XState directly. The next major
|
|
176
|
+
> version removes this module.
|
|
178
177
|
|
|
179
|
-
|
|
178
|
+
These composable guard helpers wrap the `and()`, `or()`, and `not()` functions of XState. Use them in a machine `setup({ guards })` definition.
|
|
180
179
|
|
|
181
180
|
```typescript
|
|
182
181
|
import { setup } from "xstate";
|
|
@@ -200,9 +199,9 @@ const machine = setup({
|
|
|
200
199
|
guard: composeGuards(["isLoggedIn", "hasAdminRole"]),
|
|
201
200
|
target: "adminPanel",
|
|
202
201
|
},
|
|
203
|
-
|
|
204
|
-
guard: negateGuard("
|
|
205
|
-
target: "
|
|
202
|
+
accessLogin: {
|
|
203
|
+
guard: negateGuard("isLoggedIn"),
|
|
204
|
+
target: "login",
|
|
206
205
|
},
|
|
207
206
|
},
|
|
208
207
|
// ...
|
|
@@ -213,11 +212,11 @@ const machine = setup({
|
|
|
213
212
|
|
|
214
213
|
### Routing utilities
|
|
215
214
|
|
|
216
|
-
|
|
215
|
+
These helper functions configure the routes of an XState machine declaratively.
|
|
217
216
|
|
|
218
217
|
#### `formatPlayRouteTransitions(machineConfig)`
|
|
219
218
|
|
|
220
|
-
|
|
219
|
+
This function reads each machine state that has a `meta.route` field. It then generates the `play.route` event handlers at the root level. You therefore write no repetitive routing transition.
|
|
221
220
|
|
|
222
221
|
```typescript
|
|
223
222
|
import { setup } from "xstate";
|
|
@@ -242,23 +241,23 @@ const config = formatPlayRouteTransitions({
|
|
|
242
241
|
const machine = setup({}).createMachine(config);
|
|
243
242
|
```
|
|
244
243
|
|
|
245
|
-
> **Note:**
|
|
244
|
+
> **Note:** every state with a `meta.route` field must also have an explicit `id` field. A state without an `id` field throws `MissingStateIdError` when you define the machine.
|
|
246
245
|
|
|
247
246
|
#### Other routing exports
|
|
248
247
|
|
|
249
|
-
| Export | Description
|
|
250
|
-
| ---------------------------------- |
|
|
251
|
-
| `deriveRoute(meta)` |
|
|
252
|
-
| `isAbsoluteRoute(route)` | Returns `true`
|
|
253
|
-
| `buildRouteUrl(template, context)` |
|
|
248
|
+
| Export | Description |
|
|
249
|
+
| ---------------------------------- | --------------------------------------------------------------------------- |
|
|
250
|
+
| `deriveRoute(meta)` | Reads the route template string from the metadata object of a state |
|
|
251
|
+
| `isAbsoluteRoute(route)` | Returns `true` when the route string is an absolute URL path |
|
|
252
|
+
| `buildRouteUrl(template, context)` | Replaces each `:param` placeholder of a route template with a context value |
|
|
254
253
|
|
|
255
254
|
---
|
|
256
255
|
|
|
257
256
|
## Inspection
|
|
258
257
|
|
|
259
|
-
`options.inspect`
|
|
260
|
-
inspection tool
|
|
261
|
-
|
|
258
|
+
The factory gives `options.inspect` to `createActor` of XState without a change.
|
|
259
|
+
Therefore every XState inspection tool works with a `PlayerActor`, and this
|
|
260
|
+
includes [`@statelyai/inspect`](https://stately.ai/docs/inspector):
|
|
262
261
|
|
|
263
262
|
```typescript
|
|
264
263
|
import { createBrowserInspector } from "@statelyai/inspect";
|
|
@@ -267,25 +266,27 @@ const { inspect } = createBrowserInspector();
|
|
|
267
266
|
const createPlayer = definePlayer({ machine, options: { inspect } });
|
|
268
267
|
```
|
|
269
268
|
|
|
270
|
-
Three
|
|
269
|
+
Three points are important:
|
|
271
270
|
|
|
272
|
-
-
|
|
273
|
-
reports to the same observer.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
271
|
+
- **`inspect` is an option of the factory, not of one instance.** Every actor of a
|
|
272
|
+
factory reports to the same observer. Separate the actors by root:
|
|
273
|
+
`event.rootId === actor.sessionId` covers the complete tree of an actor, with its
|
|
274
|
+
children.
|
|
275
|
+
- **`inspect` is the only path that sees the construction.** `actor.system.inspect(fn)`
|
|
276
|
+
attaches later, and it sees only the events after that moment. It therefore misses the
|
|
277
|
+
`@xstate.actor` registration, and an inspector needs that registration to draw the
|
|
278
|
+
machine.
|
|
279
|
+
- **A `PlayerActor` is the actor.** Its own events carry `actorRef === playerActor`, so
|
|
280
|
+
you can recognize a player by its identity. Note one point: `@xstate.actor` fires from
|
|
281
|
+
inside the constructor, and `state`, `currentRoute`, `currentView`, and `initialRoute`
|
|
282
|
+
do not exist yet. A read of one of them there throws.
|
|
282
283
|
|
|
283
|
-
For an inspector
|
|
284
|
-
function: `inspect: (event) => currentInspector?.(event)`.
|
|
284
|
+
For an inspector that you create after the factory, such as a dev-tools switch, give the
|
|
285
|
+
factory a function that forwards each event: `inspect: (event) => currentInspector?.(event)`.
|
|
285
286
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
The [inspector guide](../../../guides/inspector.md) gives the complete procedure: a late
|
|
288
|
+
attachment with a replay, a WebSocket inspection without a browser, and the points to
|
|
289
|
+
consider in production.
|
|
289
290
|
|
|
290
291
|
---
|
|
291
292
|
|
|
@@ -312,7 +313,7 @@ import type {
|
|
|
312
313
|
|
|
313
314
|
## Error Classes
|
|
314
315
|
|
|
315
|
-
|
|
316
|
+
The `@xmachines/play-xstate/errors` subpath exports the error classes. The main bundle therefore stays small.
|
|
316
317
|
|
|
317
318
|
```typescript
|
|
318
319
|
import {
|
|
@@ -327,7 +328,7 @@ import {
|
|
|
327
328
|
} from "@xmachines/play-xstate/errors";
|
|
328
329
|
```
|
|
329
330
|
|
|
330
|
-
|
|
331
|
+
Every error class extends `PlayError` from `@xmachines/play`. Each class also carries typed detail fields, such as `param`, `template`, and `combinator`. Your code therefore reads the details of an error, and it does not parse the message.
|
|
331
332
|
|
|
332
333
|
---
|
|
333
334
|
|
|
@@ -341,7 +342,7 @@ pnpm --filter @xmachines/play-xstate test
|
|
|
341
342
|
pnpm --filter @xmachines/play-xstate run test:watch
|
|
342
343
|
```
|
|
343
344
|
|
|
344
|
-
|
|
345
|
+
The tests use [Vitest](https://vitest.dev/). They are in `packages/play-xstate/test/`.
|
|
345
346
|
|
|
346
347
|
---
|
|
347
348
|
|
|
@@ -349,13 +350,14 @@ Tests use [Vitest](https://vitest.dev/) and live in `packages/play-xstate/test/`
|
|
|
349
350
|
|
|
350
351
|
MIT — see [LICENSE](LICENSE) for details.
|
|
351
352
|
|
|
352
|
-
@xmachines/play-xstate - XState v5 adapter
|
|
353
|
+
@xmachines/play-xstate - the XState v5 adapter of the Play Architecture
|
|
353
354
|
|
|
354
|
-
|
|
355
|
-
actor base with signal lifecycle and DevTools
|
|
355
|
+
This package gives you the definePlayer() API. That function binds an XState state
|
|
356
|
+
machine to the actor base, with the signal lifecycle and the DevTools
|
|
357
|
+
integration.
|
|
356
358
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
+
The Play RFC gives this package as the adapter of the logic layer. It converts a
|
|
360
|
+
declarative machine definition into a live actor with a signal-driven
|
|
359
361
|
reactivity.
|
|
360
362
|
|
|
361
363
|
## Classes
|