@xmachines/docs 2.0.0-alpha.1 → 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 +16 -17
- package/api/@xmachines/play/README.md +58 -66
- package/api/@xmachines/play/classes/NonNullableError.md +14 -14
- package/api/@xmachines/play/classes/PlayError.md +32 -34
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +28 -27
- package/api/@xmachines/play-actor/README.md +114 -50
- package/api/@xmachines/play-actor/classes/AbstractActor.md +45 -30
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +27 -0
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +21 -0
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +43 -0
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +28 -0
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +42 -0
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +29 -0
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +25 -27
- 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 -15
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +11 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +6 -6
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +50 -0
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +15 -0
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +15 -0
- package/api/@xmachines/play-dom/README.md +123 -86
- 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/functions/createValidationRegistry.md +22 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +9 -8
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +16 -16
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +2 -0
- package/api/@xmachines/play-dom/interfaces/FieldValidationState.md +16 -0
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +17 -17
- package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +2 -0
- package/api/@xmachines/play-dom/interfaces/ValidationRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +10 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom/variables/schema.md +35 -45
- package/api/@xmachines/play-dom-router/README.md +68 -51
- 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 +21 -20
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +41 -35
- 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 +65 -55
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useFieldValidation.md +31 -0
- 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/ComponentContext.md +9 -8
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
- 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 +38 -31
- 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 +41 -35
- 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 +99 -95
- 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 +6 -6
- package/api/@xmachines/play-router/interfaces/LocationLike.md +11 -11
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -9
- 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 +41 -35
- 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 +5 -5
- 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 +39 -34
- 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 +45 -30
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +41 -35
- 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 +60 -33
- 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 +43 -52
- 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 +41 -35
- 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 +43 -39
- 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 +11 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +41 -35
- 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 +67 -49
- 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 +41 -35
- 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 +38 -16
- 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 +76 -50
- 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 +41 -35
- 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 +39 -39
- 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/useFieldValidation.md +31 -0
- 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 +4 -4
- 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 +66 -57
- 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 +41 -35
- 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 +129 -138
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +148 -114
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -23
- package/api/@xmachines/play-xstate/functions/composeGuards.md +34 -33
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +27 -22
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +19 -14
- 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 +12 -7
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +17 -48
- package/api/@xmachines/play-xstate/functions/hasContext.md +12 -9
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +26 -20
- 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 -11
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +9 -25
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +13 -11
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +8 -5
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +11 -15
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -19
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -26
- package/api/@xmachines/shared/README.md +12 -14
- 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 +12 -7
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +9 -4
- 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 +6 -6
- package/contributing/architecture.md +27 -28
- package/contributing/configuration.md +10 -10
- package/contributing/deployment.md +51 -30
- package/contributing/development.md +90 -21
- package/contributing/testing.md +36 -14
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
- package/examples/README.md +4 -1
- package/examples/basic-state-machine.md +24 -24
- package/examples/form-validation.md +110 -121
- package/examples/multi-router-integration.md +0 -2
- package/examples/routing-patterns.md +60 -94
- package/examples/traffic-light.md +57 -48
- package/guides/README.md +6 -2
- package/guides/actor-model.md +1 -1
- package/guides/getting-started.md +89 -90
- package/guides/inspector.md +197 -0
- package/guides/state-machines.md +55 -69
- package/package.json +10 -7
- package/rfc/play.md +15 -6
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
- package/api/@xmachines/play-xstate/functions/createRoutedMachine.md +0 -87
- package/api/@xmachines/play-xstate/type-aliases/PlayRoutePayload.md +0 -30
- package/api/@xmachines/play-xstate/type-aliases/SetupLike.md +0 -33
- package/api/@xmachines/play-xstate/type-aliases/WithOptional.md +0 -31
- package/api/@xmachines/play-xstate/variables/emptyEventSchema.md +0 -37
- package/api/@xmachines/play-xstate/variables/playMetaSchema.md +0 -40
- package/api/@xmachines/play-xstate/variables/playRouteEventSchema.md +0 -9
|
@@ -2,27 +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
|
-
|
|
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.
|
|
13
16
|
|
|
14
|
-
**Capabilities:**
|
|
15
|
-
[@xmachines/play-actor!
|
|
16
|
-
|
|
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.
|
|
17
21
|
|
|
18
|
-
**Architectural
|
|
19
|
-
XState machine
|
|
20
|
-
the actor
|
|
21
|
-
|
|
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.
|
|
22
27
|
|
|
23
28
|
## Examples
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
The creation of an actor, and its lifecycle
|
|
26
31
|
|
|
27
32
|
```typescript
|
|
28
33
|
import { setup } from "xstate";
|
|
@@ -32,7 +37,14 @@ const machine = setup({}).createMachine({
|
|
|
32
37
|
initial: "idle",
|
|
33
38
|
states: {
|
|
34
39
|
idle: {
|
|
35
|
-
meta: {
|
|
40
|
+
meta: {
|
|
41
|
+
route: "/",
|
|
42
|
+
// A view spec needs `root` and `elements`. Every other shape derives null.
|
|
43
|
+
view: {
|
|
44
|
+
root: "home",
|
|
45
|
+
elements: { home: { type: "HomePage", props: {}, children: [] } },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
36
48
|
},
|
|
37
49
|
},
|
|
38
50
|
});
|
|
@@ -41,12 +53,12 @@ const createPlayer = definePlayer({ machine });
|
|
|
41
53
|
const actor = createPlayer();
|
|
42
54
|
actor.start();
|
|
43
55
|
|
|
44
|
-
// Observe signals
|
|
56
|
+
// Observe the signals
|
|
45
57
|
console.log(actor.currentRoute.get()); // '/'
|
|
46
|
-
console.log(actor.currentView.get()); //
|
|
58
|
+
console.log(actor.currentView.get()?.root); // 'home'
|
|
47
59
|
```
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
The signal lifecycle with a watcher
|
|
50
62
|
|
|
51
63
|
```typescript
|
|
52
64
|
import { Signal } from "@xmachines/play-signals";
|
|
@@ -60,26 +72,28 @@ const watcher = new Signal.subtle.Watcher(() => {
|
|
|
60
72
|
|
|
61
73
|
watcher.watch(actor.state);
|
|
62
74
|
actor.send({ type: "play.route", to: "#about" });
|
|
63
|
-
//
|
|
75
|
+
// The watcher schedules its own notification in a microtask
|
|
64
76
|
```
|
|
65
77
|
|
|
66
78
|
## See
|
|
67
79
|
|
|
68
80
|
- [Play RFC](../../../../rfc/play.md)
|
|
69
|
-
- [definePlayer](../functions/definePlayer.md) for
|
|
70
|
-
- [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md) for signal protocol
|
|
71
|
-
- [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) for routing capability
|
|
72
|
-
- [@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
|
|
73
85
|
|
|
74
86
|
## Remarks
|
|
75
87
|
|
|
76
|
-
**
|
|
77
|
-
|
|
78
|
-
`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.
|
|
79
92
|
|
|
80
|
-
**
|
|
81
|
-
`Signal.
|
|
82
|
-
|
|
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.
|
|
83
97
|
|
|
84
98
|
## Extends
|
|
85
99
|
|
|
@@ -87,9 +101,9 @@ cached and updated at state entry, not computed on every read.
|
|
|
87
101
|
|
|
88
102
|
## Type Parameters
|
|
89
103
|
|
|
90
|
-
| Type Parameter | Description
|
|
91
|
-
| ---------------------------------------------------------------------------------------------- |
|
|
92
|
-
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState
|
|
104
|
+
| Type Parameter | Description |
|
|
105
|
+
| ---------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
106
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The type of the XState v5 state machine |
|
|
93
107
|
|
|
94
108
|
## Implements
|
|
95
109
|
|
|
@@ -108,16 +122,16 @@ new PlayerActor<TMachine>(
|
|
|
108
122
|
restoredSnapshot?): PlayerActor<TMachine>;
|
|
109
123
|
```
|
|
110
124
|
|
|
111
|
-
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)
|
|
112
126
|
|
|
113
127
|
#### Parameters
|
|
114
128
|
|
|
115
|
-
| Parameter | Type
|
|
116
|
-
| ------------------- |
|
|
117
|
-
| `machine` | `TMachine`
|
|
118
|
-
| `options` | [`PlayerOptions`](../interfaces/PlayerOptions.md)\<`TMachine`\>
|
|
119
|
-
| `input?` | [`InputFrom`](https://www.jsdocs.io/package/xstate#InputFrom)\<`TMachine`\>
|
|
120
|
-
| `restoredSnapshot?` | [`
|
|
129
|
+
| Parameter | Type |
|
|
130
|
+
| ------------------- | --------------------------------------------------------------------------- |
|
|
131
|
+
| `machine` | `TMachine` |
|
|
132
|
+
| `options` | [`PlayerOptions`](../interfaces/PlayerOptions.md)\<`TMachine`\> |
|
|
133
|
+
| `input?` | [`InputFrom`](https://www.jsdocs.io/package/xstate#InputFrom)\<`TMachine`\> |
|
|
134
|
+
| `restoredSnapshot?` | [`Snapshot`](https://www.jsdocs.io/package/xstate#Snapshot)\<`unknown`\> |
|
|
121
135
|
|
|
122
136
|
#### Returns
|
|
123
137
|
|
|
@@ -129,23 +143,22 @@ Defined in: [packages/play-xstate/src/player-actor.ts:459](https://gitlab.com/xm
|
|
|
129
143
|
|
|
130
144
|
## Properties
|
|
131
145
|
|
|
132
|
-
| Property | Modifier | Type
|
|
133
|
-
| ------------------------------------------------- | ---------- |
|
|
134
|
-
| <a id="property-_parent"></a> `_parent?` | `public` | `
|
|
135
|
-
| <a id="property-clock"></a> `clock` | `public` | [`Clock`](https://www.jsdocs.io/package/xstate#Clock)
|
|
136
|
-
| <a id="property-currentroute"></a> `currentRoute` | `public` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\>
|
|
137
|
-
| <a id="property-currentview"></a> `currentView` | `
|
|
138
|
-
| <a id="property-id"></a> `id` | `public` | `string`
|
|
139
|
-
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null`
|
|
140
|
-
| <a id="property-logic"></a> `logic` | `public` | [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic)
|
|
141
|
-
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\>
|
|
142
|
-
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<`any`, `any`,
|
|
143
|
-
| <a id="property-
|
|
144
|
-
| <a id="property-
|
|
145
|
-
| <a id="property-
|
|
146
|
-
| <a id="property-
|
|
147
|
-
| <a id="property-
|
|
148
|
-
| <a id="property-trigger"></a> `trigger` | `public` | `ActorTrigger`\<`SendableEventFromLogic`\<`TLogic`\>\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`trigger`](../../play-actor/classes/AbstractActor.md#property-trigger) | - |
|
|
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) | - |
|
|
149
162
|
|
|
150
163
|
## Methods
|
|
151
164
|
|
|
@@ -173,12 +186,12 @@ Defined in: `xstate`
|
|
|
173
186
|
can(event): boolean;
|
|
174
187
|
```
|
|
175
188
|
|
|
176
|
-
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)
|
|
177
190
|
|
|
178
|
-
|
|
191
|
+
Tells you if the current state of the actor accepts the given event.
|
|
179
192
|
|
|
180
|
-
|
|
181
|
-
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.
|
|
182
195
|
|
|
183
196
|
#### Parameters
|
|
184
197
|
|
|
@@ -198,36 +211,44 @@ if (actor.can({ type: "auth.logout" })) { ... }
|
|
|
198
211
|
|
|
199
212
|
---
|
|
200
213
|
|
|
201
|
-
### dispose()
|
|
214
|
+
### ~~dispose()~~
|
|
202
215
|
|
|
203
216
|
```ts
|
|
204
217
|
dispose(): void;
|
|
205
218
|
```
|
|
206
219
|
|
|
207
|
-
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)
|
|
208
221
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Per CONTEXT.md: "Both .dispose() convenience method and manual machine.stop()"
|
|
222
|
+
The dispose method, for the cleanup. It is the alias of [stop](#stop).
|
|
212
223
|
|
|
213
224
|
#### Returns
|
|
214
225
|
|
|
215
226
|
`void`
|
|
216
227
|
|
|
228
|
+
#### Deprecated
|
|
229
|
+
|
|
230
|
+
Use [stop](#stop). Will be removed in the next major.
|
|
231
|
+
|
|
217
232
|
---
|
|
218
233
|
|
|
219
234
|
### getPersistedSnapshot()
|
|
220
235
|
|
|
221
236
|
```ts
|
|
222
|
-
getPersistedSnapshot(): Snapshot<unknown>;
|
|
237
|
+
getPersistedSnapshot(options?): Snapshot<unknown>;
|
|
223
238
|
```
|
|
224
239
|
|
|
225
|
-
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)
|
|
226
241
|
|
|
227
|
-
|
|
242
|
+
Returns the persisted snapshot of this actor.
|
|
228
243
|
|
|
229
|
-
|
|
230
|
-
`restore.snapshot` option.
|
|
244
|
+
Use it to serialize the state, and to restore it later with the
|
|
245
|
+
`restore.snapshot` option of the factory.
|
|
246
|
+
|
|
247
|
+
#### Parameters
|
|
248
|
+
|
|
249
|
+
| Parameter | Type |
|
|
250
|
+
| ---------- | --------- |
|
|
251
|
+
| `options?` | `unknown` |
|
|
231
252
|
|
|
232
253
|
#### Returns
|
|
233
254
|
|
|
@@ -245,9 +266,9 @@ Suitable for serialization and later restoration via the factory's
|
|
|
245
266
|
getSnapshot(): SnapshotFrom<TMachine>;
|
|
246
267
|
```
|
|
247
268
|
|
|
248
|
-
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)
|
|
249
270
|
|
|
250
|
-
|
|
271
|
+
Returns the current snapshot
|
|
251
272
|
|
|
252
273
|
#### Returns
|
|
253
274
|
|
|
@@ -265,28 +286,28 @@ Get current snapshot
|
|
|
265
286
|
on<TType>(type, handler): Subscription;
|
|
266
287
|
```
|
|
267
288
|
|
|
268
|
-
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)
|
|
269
290
|
|
|
270
|
-
|
|
291
|
+
Listens for the events that this actor emits with the `emit` action.
|
|
271
292
|
|
|
272
293
|
#### Type Parameters
|
|
273
294
|
|
|
274
|
-
| Type Parameter
|
|
275
|
-
|
|
|
276
|
-
| `TType` _extends_ `
|
|
295
|
+
| Type Parameter |
|
|
296
|
+
| ----------------------- |
|
|
297
|
+
| `TType` _extends_ `any` |
|
|
277
298
|
|
|
278
299
|
#### Parameters
|
|
279
300
|
|
|
280
|
-
| Parameter | Type | Description
|
|
281
|
-
| --------- | --------------------- |
|
|
282
|
-
| `type` | `TType` |
|
|
283
|
-
| `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. |
|
|
284
305
|
|
|
285
306
|
#### Returns
|
|
286
307
|
|
|
287
308
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
288
309
|
|
|
289
|
-
|
|
310
|
+
The subscription, with an `unsubscribe()` method.
|
|
290
311
|
|
|
291
312
|
#### Overrides
|
|
292
313
|
|
|
@@ -331,18 +352,19 @@ Defined in: `xstate`
|
|
|
331
352
|
send(event): void;
|
|
332
353
|
```
|
|
333
354
|
|
|
334
|
-
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)
|
|
335
356
|
|
|
336
|
-
|
|
357
|
+
Sends an event to this actor.
|
|
337
358
|
|
|
338
|
-
The
|
|
339
|
-
|
|
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.
|
|
340
362
|
|
|
341
363
|
#### Parameters
|
|
342
364
|
|
|
343
|
-
| Parameter | Type | Description
|
|
344
|
-
| --------- | ------------------------------------------------------------------------------------- |
|
|
345
|
-
| `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. |
|
|
346
368
|
|
|
347
369
|
#### Returns
|
|
348
370
|
|
|
@@ -350,16 +372,17 @@ Pass any event from the machine's event union — domain events, routing events,
|
|
|
350
372
|
|
|
351
373
|
#### Throws
|
|
352
374
|
|
|
353
|
-
When `event` is not a plain object
|
|
354
|
-
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`.
|
|
355
378
|
|
|
356
379
|
#### Example
|
|
357
380
|
|
|
358
381
|
```typescript
|
|
359
|
-
//
|
|
382
|
+
// A domain event, with the type of the event union of the machine
|
|
360
383
|
actor.send({ type: "auth.login", userId: "123" });
|
|
361
384
|
|
|
362
|
-
//
|
|
385
|
+
// A routing event
|
|
363
386
|
actor.send({ type: "play.route", to: "#home" });
|
|
364
387
|
```
|
|
365
388
|
|
|
@@ -375,11 +398,15 @@ actor.send({ type: "play.route", to: "#home" });
|
|
|
375
398
|
start(): this;
|
|
376
399
|
```
|
|
377
400
|
|
|
378
|
-
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)
|
|
379
402
|
|
|
380
|
-
|
|
403
|
+
Starts the actor.
|
|
381
404
|
|
|
382
|
-
|
|
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.
|
|
383
410
|
|
|
384
411
|
#### Returns
|
|
385
412
|
|
|
@@ -397,9 +424,16 @@ Per RESEARCH.md Pitfall 1: Always call start() after creation
|
|
|
397
424
|
stop(): this;
|
|
398
425
|
```
|
|
399
426
|
|
|
400
|
-
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)
|
|
428
|
+
|
|
429
|
+
Stops the actor and cleans up.
|
|
401
430
|
|
|
402
|
-
|
|
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.
|
|
403
437
|
|
|
404
438
|
#### Returns
|
|
405
439
|
|
|
@@ -419,23 +453,23 @@ Stop the actor and cleanup
|
|
|
419
453
|
subscribe(observer): Subscription;
|
|
420
454
|
```
|
|
421
455
|
|
|
422
|
-
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)
|
|
423
457
|
|
|
424
|
-
|
|
458
|
+
Subscribes to the snapshot updates of this actor.
|
|
425
459
|
|
|
426
|
-
|
|
460
|
+
The method accepts an observer object, exactly like `Actor.subscribe` of XState.
|
|
427
461
|
|
|
428
462
|
##### Parameters
|
|
429
463
|
|
|
430
|
-
| Parameter | Type | Description
|
|
431
|
-
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
432
|
-
| `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. |
|
|
433
467
|
|
|
434
468
|
##### Returns
|
|
435
469
|
|
|
436
470
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
437
471
|
|
|
438
|
-
|
|
472
|
+
The subscription, with an `unsubscribe()` method.
|
|
439
473
|
|
|
440
474
|
##### Overrides
|
|
441
475
|
|
|
@@ -450,25 +484,25 @@ subscribe(
|
|
|
450
484
|
completeListener?): Subscription;
|
|
451
485
|
```
|
|
452
486
|
|
|
453
|
-
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)
|
|
454
488
|
|
|
455
|
-
|
|
489
|
+
Subscribes to the snapshot updates of this actor.
|
|
456
490
|
|
|
457
|
-
|
|
491
|
+
The method accepts listener functions, exactly like `Actor.subscribe` of XState.
|
|
458
492
|
|
|
459
493
|
##### Parameters
|
|
460
494
|
|
|
461
|
-
| Parameter | Type | Description
|
|
462
|
-
| ------------------- | ---------------------- |
|
|
463
|
-
| `nextListener?` | (`snapshot`) => `void` |
|
|
464
|
-
| `errorListener?` | (`error`) => `void` |
|
|
465
|
-
| `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. |
|
|
466
500
|
|
|
467
501
|
##### Returns
|
|
468
502
|
|
|
469
503
|
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
470
504
|
|
|
471
|
-
|
|
505
|
+
The subscription, with an `unsubscribe()` method.
|
|
472
506
|
|
|
473
507
|
##### Overrides
|
|
474
508
|
|