@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,29 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayerActor\<TMachine\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
5
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:202](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L202)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The concrete XState actor. It implements the signal protocol of the Play Architecture
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
XState
|
|
14
|
-
|
|
9
|
+
The class extends [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md), and therefore the
|
|
10
|
+
`Actor` class of XState. It gives you the XState v5 integration, and it keeps the
|
|
11
|
+
compatibility with the ecosystem, such as the XState inspection and the devtools.
|
|
12
|
+
The constructor of the base class receives the machine. Therefore a `PlayerActor`
|
|
13
|
+
**is** the XState actor, and it is no wrapper around one: every member of the
|
|
14
|
+
XState `Actor` class works on the state of this instance, and this class adds the
|
|
15
|
+
reactive state on the TC39 Signals for the observation by the infrastructure.
|
|
15
16
|
|
|
16
|
-
**Capabilities:**
|
|
17
|
-
[@xmachines/play-actor!
|
|
18
|
-
|
|
17
|
+
**Capabilities:** the class implements both the
|
|
18
|
+
[@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) interface and the
|
|
19
|
+
[@xmachines/play-actor!Viewable](../../play-actor/interfaces/Viewable.md) interface. It therefore supports the
|
|
20
|
+
routing and the view rendering.
|
|
19
21
|
|
|
20
|
-
**Architectural
|
|
21
|
-
XState machine
|
|
22
|
-
the actor
|
|
23
|
-
|
|
22
|
+
**Architectural context:** the class implements **Actor Authority (INV-01)**,
|
|
23
|
+
because the guards of the XState machine control every decision of the
|
|
24
|
+
navigation. The infrastructure observes the signals of the actor (`state`,
|
|
25
|
+
`currentRoute`, and `currentView`), but it changes no state directly: every
|
|
26
|
+
change goes through the event handlers of the state machine.
|
|
24
27
|
|
|
25
28
|
## Examples
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
The creation of an actor, and its lifecycle
|
|
28
31
|
|
|
29
32
|
```typescript
|
|
30
33
|
import { setup } from "xstate";
|
|
@@ -36,7 +39,7 @@ const machine = setup({}).createMachine({
|
|
|
36
39
|
idle: {
|
|
37
40
|
meta: {
|
|
38
41
|
route: "/",
|
|
39
|
-
// A view spec needs `root` and `elements
|
|
42
|
+
// A view spec needs `root` and `elements`. Every other shape derives null.
|
|
40
43
|
view: {
|
|
41
44
|
root: "home",
|
|
42
45
|
elements: { home: { type: "HomePage", props: {}, children: [] } },
|
|
@@ -50,12 +53,12 @@ const createPlayer = definePlayer({ machine });
|
|
|
50
53
|
const actor = createPlayer();
|
|
51
54
|
actor.start();
|
|
52
55
|
|
|
53
|
-
// Observe signals
|
|
56
|
+
// Observe the signals
|
|
54
57
|
console.log(actor.currentRoute.get()); // '/'
|
|
55
58
|
console.log(actor.currentView.get()?.root); // 'home'
|
|
56
59
|
```
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
The signal lifecycle with a watcher
|
|
59
62
|
|
|
60
63
|
```typescript
|
|
61
64
|
import { Signal } from "@xmachines/play-signals";
|
|
@@ -69,26 +72,28 @@ const watcher = new Signal.subtle.Watcher(() => {
|
|
|
69
72
|
|
|
70
73
|
watcher.watch(actor.state);
|
|
71
74
|
actor.send({ type: "play.route", to: "#about" });
|
|
72
|
-
//
|
|
75
|
+
// The watcher schedules its own notification in a microtask
|
|
73
76
|
```
|
|
74
77
|
|
|
75
78
|
## See
|
|
76
79
|
|
|
77
80
|
- [Play RFC](../../../../rfc/play.md)
|
|
78
|
-
- [definePlayer](../functions/definePlayer.md) for
|
|
79
|
-
- [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md) for signal protocol
|
|
80
|
-
- [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) for routing capability
|
|
81
|
-
- [@xmachines/play-actor!Viewable](../../play-actor/interfaces/Viewable.md) for view rendering capability
|
|
81
|
+
- [definePlayer](../functions/definePlayer.md) for the creation through a factory
|
|
82
|
+
- [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md) for the signal protocol
|
|
83
|
+
- [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) for the routing capability
|
|
84
|
+
- [@xmachines/play-actor!Viewable](../../play-actor/interfaces/Viewable.md) for the view rendering capability
|
|
82
85
|
|
|
83
86
|
## Remarks
|
|
84
87
|
|
|
85
|
-
**
|
|
86
|
-
|
|
87
|
-
`meta.route
|
|
88
|
+
**The routing:** this actor supports the `route: {}` config pattern of XState and
|
|
89
|
+
also a `play.route` event with parameters. The `deriveRoute()` function reads
|
|
90
|
+
`meta.route`, which is the Stately pattern, for a URL template, and it substitutes
|
|
91
|
+
each parameter.
|
|
88
92
|
|
|
89
|
-
**
|
|
90
|
-
`Signal.
|
|
91
|
-
|
|
93
|
+
**The pattern of the view signal:** the `currentView` signal is a direct
|
|
94
|
+
`Signal.State`, and not a `Signal.Computed`. The propagation to a watcher in
|
|
95
|
+
PlayRenderer is therefore correct. The class derives each view at the entry of a
|
|
96
|
+
state and keeps it, and it computes no view on a read.
|
|
92
97
|
|
|
93
98
|
## Extends
|
|
94
99
|
|
|
@@ -96,9 +101,9 @@ cached and updated at state entry, not computed on every read.
|
|
|
96
101
|
|
|
97
102
|
## Type Parameters
|
|
98
103
|
|
|
99
|
-
| Type Parameter | Description
|
|
100
|
-
| ---------------------------------------------------------------------------------------------- |
|
|
101
|
-
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine
|
|
104
|
+
| Type Parameter | Description |
|
|
105
|
+
| ---------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
106
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The type of the XState v5 state machine |
|
|
102
107
|
|
|
103
108
|
## Implements
|
|
104
109
|
|
|
@@ -117,7 +122,7 @@ new PlayerActor<TMachine>(
|
|
|
117
122
|
restoredSnapshot?): PlayerActor<TMachine>;
|
|
118
123
|
```
|
|
119
124
|
|
|
120
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
125
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:360](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L360)
|
|
121
126
|
|
|
122
127
|
#### Parameters
|
|
123
128
|
|
|
@@ -138,22 +143,22 @@ Defined in: [packages/play-xstate/src/player-actor.ts:342](https://gitlab.com/xm
|
|
|
138
143
|
|
|
139
144
|
## Properties
|
|
140
145
|
|
|
141
|
-
| Property | Modifier | Type | Description
|
|
142
|
-
| ------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
-
| <a id="property-_parent"></a> `_parent?` | `public` | [`AnyActorRef`](https://www.jsdocs.io/package/xstate#AnyActorRef) | -
|
|
144
|
-
| <a id="property-clock"></a> `clock` | `public` | [`Clock`](https://www.jsdocs.io/package/xstate#Clock) | The clock that is responsible for setting and clearing timeouts, such as delayed events and transitions.
|
|
145
|
-
| <a id="property-currentroute"></a> `currentRoute` | `public` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | A TC39 `Signal.Computed
|
|
146
|
-
| <a id="property-currentview"></a> `currentView` | `readonly` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`PlaySpec`](../../play-actor/interfaces/PlaySpec.md) \| `null`\> |
|
|
147
|
-
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent.
|
|
148
|
-
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null` | The route
|
|
149
|
-
| <a id="property-logic"></a> `logic` | `public` | [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | -
|
|
150
|
-
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\> | -
|
|
151
|
-
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<`any`, `any`, `any`\> | -
|
|
152
|
-
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation.
|
|
153
|
-
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | -
|
|
154
|
-
| <a id="property-state"></a> `state` | `public` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`ReturnType`\<`TMachine`\[`"transition"`\]\>\> |
|
|
155
|
-
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs.
|
|
156
|
-
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | -
|
|
146
|
+
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|
|
147
|
+
| ------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
148
|
+
| <a id="property-_parent"></a> `_parent?` | `public` | [`AnyActorRef`](https://www.jsdocs.io/package/xstate#AnyActorRef) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`_parent`](../../play-actor/classes/AbstractActor.md#property-_parent) | - |
|
|
149
|
+
| <a id="property-clock"></a> `clock` | `public` | [`Clock`](https://www.jsdocs.io/package/xstate#Clock) | The clock that is responsible for setting and clearing timeouts, such as delayed events and transitions. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`clock`](../../play-actor/classes/AbstractActor.md#property-clock) | - |
|
|
150
|
+
| <a id="property-currentroute"></a> `currentRoute` | `public` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | A TC39 `Signal.Computed`. It derives the current URL path from the `meta.route` template of the active machine state and from the context of the actor. It returns `null` when the current state has no `meta.route` field, and also when it cannot resolve the complete route template. A necessary `:param` that the context does not hold is caught inside the signal, and a `MissingRouteParamError` therefore never leaves `get()`: that condition is temporary during a transition, and the signal computes the value again on the next snapshot. **Example** `// It returns "/profile/alice" when context.params.userId === "alice", // and null while the param is still absent. const route = actor.currentRoute.get();` | - | - | [packages/play-xstate/src/player-actor.ts:304](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L304) |
|
|
151
|
+
| <a id="property-currentview"></a> `currentView` | `readonly` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`PlaySpec`](../../play-actor/interfaces/PlaySpec.md) \| `null`\> | The reactive signal of the current view spec. The signal derives the spec from the `meta.view` metadata of the active state. It emits a **new object reference** on each real change of the view on the screen: the view of a different state, or a change of a param or of the context that changes the resolved spec. A re-entry with `reenter: true` and new params also changes the spec. A snapshot that changes no view on the screen, such as an assign of the context alone, keeps the previous reference. A provider below the signal therefore mounts the UI again not on every event. The `PlaySpec` of the emission carries the context of the machine in its composed `state` field, under the read-only `/context` subtree. A spec therefore reads the context, and also each URL param, through the ordinary state grammar (`{ $state: "/context/params/section" }`). The context-projection module of `@xmachines/play-actor` holds the complete contract. The signal returns `null` when the current state has no `meta.view` metadata. Two states can declare two separate `meta.view` literals with an identical structure. A transition between those two states then emits two different references, and a provider mounts the UI again. Move the shared literal into one `typedSpec` constant, and the identity then removes the duplicate. **Example** `const view = actor.currentView.get(); if (view) { console.log(view.root); // for example "root" console.log(view.elements); // the Spec elements of @xmachines/json-render-core }` | - | - | [packages/play-xstate/src/player-actor.ts:358](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L358) |
|
|
152
|
+
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`id`](../../play-actor/classes/AbstractActor.md#property-id) | - |
|
|
153
|
+
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null` | The route of the initial state of the machine. The constructor fixes it, and it never changes, also when the code restores the actor from a snapshot. A router bridge compares it with the browser URL, and it therefore separates a deep link (a URL that is not the initial one → the router wins) from a restore (the initial URL, and the actor at a different route from the restore → the actor wins). `deriveInitialRoute` derives the value statically from the machine definition, with the pure `initialTransition` helper of XState: the chain of the initial states and their `meta.route` templates are fixed at the moment of the machine definition, and the substitution of a `:param` uses the real initial context of the machine for the `input` of this actor. The code makes no second actor, and a snapshot of a restore changes the value never: it is always the **default** initial route of the machine. | - | - | [packages/play-xstate/src/player-actor.ts:323](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L323) |
|
|
154
|
+
| <a id="property-logic"></a> `logic` | `public` | [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`logic`](../../play-actor/classes/AbstractActor.md#property-logic) | - |
|
|
155
|
+
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`options`](../../play-actor/classes/AbstractActor.md#property-options) | - |
|
|
156
|
+
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<`any`, `any`, `any`\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`ref`](../../play-actor/classes/AbstractActor.md#property-ref) | - |
|
|
157
|
+
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`sessionId`](../../play-actor/classes/AbstractActor.md#property-sessionid) | - |
|
|
158
|
+
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`src`](../../play-actor/classes/AbstractActor.md#property-src) | - |
|
|
159
|
+
| <a id="property-state"></a> `state` | `public` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`ReturnType`\<`TMachine`\[`"transition"`\]\>\> | The reactive snapshot of the current actor state. The infrastructure observes this signal, and it reacts to each state change. It therefore holds no coupling to the internal state machine of the actor. | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`state`](../../play-actor/classes/AbstractActor.md#property-state) | - | [packages/play-xstate/src/player-actor.ts:263](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L263) |
|
|
160
|
+
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`system`](../../play-actor/classes/AbstractActor.md#property-system) | - |
|
|
161
|
+
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`systemId`](../../play-actor/classes/AbstractActor.md#property-systemid) | - |
|
|
157
162
|
|
|
158
163
|
## Methods
|
|
159
164
|
|
|
@@ -181,12 +186,12 @@ Defined in: `xstate`
|
|
|
181
186
|
can(event): boolean;
|
|
182
187
|
```
|
|
183
188
|
|
|
184
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
189
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:276](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L276)
|
|
185
190
|
|
|
186
|
-
|
|
191
|
+
Tells you if the current state of the actor accepts the given event.
|
|
187
192
|
|
|
188
|
-
|
|
189
|
-
compile error.
|
|
193
|
+
The type is the event union of the machine. An unknown event type is therefore a
|
|
194
|
+
compile error. The method evaluates the event against the snapshot signal.
|
|
190
195
|
|
|
191
196
|
#### Parameters
|
|
192
197
|
|
|
@@ -206,20 +211,24 @@ if (actor.can({ type: "auth.logout" })) { ... }
|
|
|
206
211
|
|
|
207
212
|
---
|
|
208
213
|
|
|
209
|
-
### dispose()
|
|
214
|
+
### ~~dispose()~~
|
|
210
215
|
|
|
211
216
|
```ts
|
|
212
217
|
dispose(): void;
|
|
213
218
|
```
|
|
214
219
|
|
|
215
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
220
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:751](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L751)
|
|
216
221
|
|
|
217
|
-
|
|
222
|
+
The dispose method, for the cleanup. It is the alias of [stop](#stop).
|
|
218
223
|
|
|
219
224
|
#### Returns
|
|
220
225
|
|
|
221
226
|
`void`
|
|
222
227
|
|
|
228
|
+
#### Deprecated
|
|
229
|
+
|
|
230
|
+
Use [stop](#stop). Will be removed in the next major.
|
|
231
|
+
|
|
223
232
|
---
|
|
224
233
|
|
|
225
234
|
### getPersistedSnapshot()
|
|
@@ -228,12 +237,12 @@ Convenience dispose method for cleanup — an alias for [stop](#stop).
|
|
|
228
237
|
getPersistedSnapshot(options?): Snapshot<unknown>;
|
|
229
238
|
```
|
|
230
239
|
|
|
231
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
240
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:696](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L696)
|
|
232
241
|
|
|
233
|
-
|
|
242
|
+
Returns the persisted snapshot of this actor.
|
|
234
243
|
|
|
235
|
-
|
|
236
|
-
`restore.snapshot` option.
|
|
244
|
+
Use it to serialize the state, and to restore it later with the
|
|
245
|
+
`restore.snapshot` option of the factory.
|
|
237
246
|
|
|
238
247
|
#### Parameters
|
|
239
248
|
|
|
@@ -257,9 +266,9 @@ Suitable for serialization and later restoration via the factory's
|
|
|
257
266
|
getSnapshot(): SnapshotFrom<TMachine>;
|
|
258
267
|
```
|
|
259
268
|
|
|
260
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
269
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:595](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L595)
|
|
261
270
|
|
|
262
|
-
|
|
271
|
+
Returns the current snapshot
|
|
263
272
|
|
|
264
273
|
#### Returns
|
|
265
274
|
|
|
@@ -277,9 +286,9 @@ Get current snapshot
|
|
|
277
286
|
on<TType>(type, handler): Subscription;
|
|
278
287
|
```
|
|
279
288
|
|
|
280
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
289
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:681](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L681)
|
|
281
290
|
|
|
282
|
-
|
|
291
|
+
Listens for the events that this actor emits with the `emit` action.
|
|
283
292
|
|
|
284
293
|
#### Type Parameters
|
|
285
294
|
|
|
@@ -289,16 +298,16 @@ Listen for events this actor emits via the `emit` action.
|
|
|
289
298
|
|
|
290
299
|
#### Parameters
|
|
291
300
|
|
|
292
|
-
| Parameter | Type | Description
|
|
293
|
-
| --------- | --------------------- |
|
|
294
|
-
| `type` | `TType` |
|
|
295
|
-
| `handler` | (`emitted`) => `void` |
|
|
301
|
+
| Parameter | Type | Description |
|
|
302
|
+
| --------- | --------------------- | ---------------------------------------------------------------------- |
|
|
303
|
+
| `type` | `TType` | The type of the emitted event to listen for, or `"*"` for every event. |
|
|
304
|
+
| `handler` | (`emitted`) => `void` | The actor calls it with each emitted event that matches. |
|
|
296
305
|
|
|
297
306
|
#### Returns
|
|
298
307
|
|
|
299
308
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
300
309
|
|
|
301
|
-
|
|
310
|
+
The subscription, with an `unsubscribe()` method.
|
|
302
311
|
|
|
303
312
|
#### Overrides
|
|
304
313
|
|
|
@@ -343,18 +352,19 @@ Defined in: `xstate`
|
|
|
343
352
|
send(event): void;
|
|
344
353
|
```
|
|
345
354
|
|
|
346
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
355
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:556](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L556)
|
|
347
356
|
|
|
348
|
-
|
|
357
|
+
Sends an event to this actor.
|
|
349
358
|
|
|
350
|
-
The
|
|
351
|
-
|
|
359
|
+
The guards of the state machine of the actor decide if the event causes a
|
|
360
|
+
transition. Give any event of the event union of the machine: a domain event, a
|
|
361
|
+
routing event, and so on.
|
|
352
362
|
|
|
353
363
|
#### Parameters
|
|
354
364
|
|
|
355
|
-
| Parameter | Type | Description
|
|
356
|
-
| --------- | ------------------------------------------------------------------------------------- |
|
|
357
|
-
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> | An event
|
|
365
|
+
| Parameter | Type | Description |
|
|
366
|
+
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
367
|
+
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> | An event of the `EventFromLogic<TMachine>` union of the machine. |
|
|
358
368
|
|
|
359
369
|
#### Returns
|
|
360
370
|
|
|
@@ -362,16 +372,17 @@ Pass any event from the machine's event union — domain events, routing events,
|
|
|
362
372
|
|
|
363
373
|
#### Throws
|
|
364
374
|
|
|
365
|
-
When `event` is not a plain object
|
|
366
|
-
a string, number
|
|
375
|
+
When `event` is not a plain object, for example
|
|
376
|
+
`null`, `undefined`, a string, or a number. Import the class from
|
|
377
|
+
`@xmachines/play-xstate/errors`.
|
|
367
378
|
|
|
368
379
|
#### Example
|
|
369
380
|
|
|
370
381
|
```typescript
|
|
371
|
-
//
|
|
382
|
+
// A domain event, with the type of the event union of the machine
|
|
372
383
|
actor.send({ type: "auth.login", userId: "123" });
|
|
373
384
|
|
|
374
|
-
//
|
|
385
|
+
// A routing event
|
|
375
386
|
actor.send({ type: "play.route", to: "#home" });
|
|
376
387
|
```
|
|
377
388
|
|
|
@@ -387,15 +398,15 @@ actor.send({ type: "play.route", to: "#home" });
|
|
|
387
398
|
start(): this;
|
|
388
399
|
```
|
|
389
400
|
|
|
390
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
401
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:482](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L482)
|
|
391
402
|
|
|
392
|
-
|
|
403
|
+
Starts the actor.
|
|
393
404
|
|
|
394
|
-
|
|
395
|
-
running
|
|
396
|
-
`start()`
|
|
397
|
-
while
|
|
398
|
-
|
|
405
|
+
The method fires `onStart` on each real start, which is every transition from
|
|
406
|
+
"not running" to "running". A start after a stop is such a transition, and XState
|
|
407
|
+
permits it: its own `start()` stops only while the actor RUNS already. A second
|
|
408
|
+
call while the actor runs fires no hook. Therefore a defensive double mount runs
|
|
409
|
+
the side effects of `onStart` one time for one real start.
|
|
399
410
|
|
|
400
411
|
#### Returns
|
|
401
412
|
|
|
@@ -413,16 +424,16 @@ re-run `onStart` side effects for one actual start.
|
|
|
413
424
|
stop(): this;
|
|
414
425
|
```
|
|
415
426
|
|
|
416
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
427
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:512](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L512)
|
|
417
428
|
|
|
418
|
-
|
|
429
|
+
Stops the actor and cleans up.
|
|
419
430
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
against
|
|
424
|
-
actor for
|
|
425
|
-
`onStart` again.
|
|
431
|
+
The method fires `onStop` only when the actor ran. This matches XState, where a
|
|
432
|
+
stop of an actor that never started, or of an actor that stopped already, does
|
|
433
|
+
nothing and tears nothing down. Therefore the paired cleanup runs never two
|
|
434
|
+
times, and it runs never against a resource that `onStart` did not take. A stop
|
|
435
|
+
does not close the actor for ever: a later `start()` is a new lifecycle, and it
|
|
436
|
+
fires `onStart` again.
|
|
426
437
|
|
|
427
438
|
#### Returns
|
|
428
439
|
|
|
@@ -442,23 +453,23 @@ actor for good: a later `start()` is a fresh lifecycle and fires
|
|
|
442
453
|
subscribe(observer): Subscription;
|
|
443
454
|
```
|
|
444
455
|
|
|
445
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
456
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:618](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L618)
|
|
446
457
|
|
|
447
|
-
|
|
458
|
+
Subscribes to the snapshot updates of this actor.
|
|
448
459
|
|
|
449
|
-
|
|
460
|
+
The method accepts an observer object, exactly like `Actor.subscribe` of XState.
|
|
450
461
|
|
|
451
462
|
##### Parameters
|
|
452
463
|
|
|
453
|
-
| Parameter | Type | Description
|
|
454
|
-
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
455
|
-
| `observer` | [`Observer`](https://www.jsdocs.io/package/xstate#Observer)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>\> |
|
|
464
|
+
| Parameter | Type | Description |
|
|
465
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
|
466
|
+
| `observer` | [`Observer`](https://www.jsdocs.io/package/xstate#Observer)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>\> | The observer, with a `next`, an `error`, and a `complete` handler. |
|
|
456
467
|
|
|
457
468
|
##### Returns
|
|
458
469
|
|
|
459
470
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
460
471
|
|
|
461
|
-
|
|
472
|
+
The subscription, with an `unsubscribe()` method.
|
|
462
473
|
|
|
463
474
|
##### Overrides
|
|
464
475
|
|
|
@@ -473,25 +484,25 @@ subscribe(
|
|
|
473
484
|
completeListener?): Subscription;
|
|
474
485
|
```
|
|
475
486
|
|
|
476
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:
|
|
487
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:629](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/player-actor.ts#L629)
|
|
477
488
|
|
|
478
|
-
|
|
489
|
+
Subscribes to the snapshot updates of this actor.
|
|
479
490
|
|
|
480
|
-
|
|
491
|
+
The method accepts listener functions, exactly like `Actor.subscribe` of XState.
|
|
481
492
|
|
|
482
493
|
##### Parameters
|
|
483
494
|
|
|
484
|
-
| Parameter | Type | Description
|
|
485
|
-
| ------------------- | ---------------------- |
|
|
486
|
-
| `nextListener?` | (`snapshot`) => `void` |
|
|
487
|
-
| `errorListener?` | (`error`) => `void` |
|
|
488
|
-
| `completeListener?` | () => `void` |
|
|
495
|
+
| Parameter | Type | Description |
|
|
496
|
+
| ------------------- | ---------------------- | -------------------------------------------------------------------------------- |
|
|
497
|
+
| `nextListener?` | (`snapshot`) => `void` | The listener function of each snapshot. |
|
|
498
|
+
| `errorListener?` | (`error`) => `void` | The actor calls it on an error. |
|
|
499
|
+
| `completeListener?` | () => `void` | The actor calls it when it completes, which means that it reaches a final state. |
|
|
489
500
|
|
|
490
501
|
##### Returns
|
|
491
502
|
|
|
492
503
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
493
504
|
|
|
494
|
-
|
|
505
|
+
The subscription, with an `unsubscribe()` method.
|
|
495
506
|
|
|
496
507
|
##### Overrides
|
|
497
508
|
|