@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,13 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# Abstract Class: AbstractActor\<TLogic, TEvent\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:197](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L197)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The abstract base class of an actor of the Play Architecture.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
It observes the state through the signals, and it works with the tools of the
|
|
10
|
+
XState ecosystem, such as the devtools and the inspection. It also exposes the
|
|
11
|
+
reactive signals of the communication with the infrastructure layer.
|
|
12
|
+
|
|
13
|
+
**A subclass IS the actor.** Give the logic _and_ its options to
|
|
14
|
+
`super(logic, options)`, then observe `this`. A separate actor beside this
|
|
15
|
+
instance leaves this instance as an empty second actor. Every inherited member
|
|
16
|
+
then answers from that empty actor, until you forward each one: `system`,
|
|
17
|
+
`sessionId`, `clock`, the internal `_send` that receives the traffic of
|
|
18
|
+
`sendTo()`, and each member that a later XState version adds.
|
|
12
19
|
|
|
13
20
|
## Extends
|
|
14
21
|
|
|
@@ -20,10 +27,10 @@ Infrastructure layer communication.
|
|
|
20
27
|
|
|
21
28
|
## Type Parameters
|
|
22
29
|
|
|
23
|
-
| Type Parameter | Default type | Description
|
|
24
|
-
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
25
|
-
| `TLogic` _extends_ [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | XState actor logic
|
|
26
|
-
| `TEvent` _extends_ [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject) | [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject) |
|
|
30
|
+
| Type Parameter | Default type | Description |
|
|
31
|
+
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
32
|
+
| `TLogic` _extends_ [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | The type of the XState actor logic |
|
|
33
|
+
| `TEvent` _extends_ [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject) | [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject) | The constraint of the event type. The default is EventObject |
|
|
27
34
|
|
|
28
35
|
## Constructors
|
|
29
36
|
|
|
@@ -57,20 +64,19 @@ Actor<TLogic>.constructor
|
|
|
57
64
|
|
|
58
65
|
## Properties
|
|
59
66
|
|
|
60
|
-
| Property
|
|
61
|
-
|
|
|
62
|
-
| <a id="property-_parent"></a> `_parent?`
|
|
63
|
-
| <a id="property-clock"></a> `clock`
|
|
64
|
-
| <a id="property-id"></a> `id`
|
|
65
|
-
| <a id="property-logic"></a> `logic`
|
|
66
|
-
| <a id="property-options"></a> `options`
|
|
67
|
-
| <a id="property-ref"></a> `ref`
|
|
68
|
-
| <a id="property-
|
|
69
|
-
| <a id="property-
|
|
70
|
-
| <a id="property-
|
|
71
|
-
| <a id="property-
|
|
72
|
-
| <a id="property-
|
|
73
|
-
| <a id="property-trigger"></a> `trigger` | `public` | `ActorTrigger`\<`SendableEventFromLogic`\<`TLogic`\>\> | - | `Actor.trigger` | - |
|
|
67
|
+
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
68
|
+
| ------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| <a id="property-_parent"></a> `_parent?` | `public` | [`AnyActorRef`](https://www.jsdocs.io/package/xstate#AnyActorRef) | - | `Actor._parent` | - |
|
|
70
|
+
| <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. | `Actor.clock` | - |
|
|
71
|
+
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent. | `Actor.id` | - |
|
|
72
|
+
| <a id="property-logic"></a> `logic` | `public` | `TLogic` | - | `Actor.logic` | - |
|
|
73
|
+
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\> | - | `Actor.options` | - |
|
|
74
|
+
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TLogic`\>, [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TLogic`\>, [`EmittedFrom`](https://www.jsdocs.io/package/xstate#EmittedFrom)\<`TLogic`\>\> | - | `Actor.ref` | - |
|
|
75
|
+
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | `Actor.sessionId` | - |
|
|
76
|
+
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | `Actor.src` | - |
|
|
77
|
+
| <a id="property-state"></a> `state` | `abstract` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`unknown`\> | 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. | - | [packages/play-actor/src/abstract-actor.ts:207](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L207) |
|
|
78
|
+
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs. | `Actor.system` | - |
|
|
79
|
+
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | `Actor.systemId` | - |
|
|
74
80
|
|
|
75
81
|
## Methods
|
|
76
82
|
|
|
@@ -152,7 +158,7 @@ When an actor receives an event, its internal state may change. An actor
|
|
|
152
158
|
may emit a snapshot when a state transition occurs.
|
|
153
159
|
|
|
154
160
|
Note that some actors, such as callback actors generated with
|
|
155
|
-
`
|
|
161
|
+
`fromCallback`, will not emit snapshots.
|
|
156
162
|
|
|
157
163
|
#### See
|
|
158
164
|
|
|
@@ -177,9 +183,9 @@ Defined in: `xstate`
|
|
|
177
183
|
|
|
178
184
|
#### Type Parameters
|
|
179
185
|
|
|
180
|
-
| Type Parameter
|
|
181
|
-
|
|
|
182
|
-
| `TType` _extends_ `
|
|
186
|
+
| Type Parameter |
|
|
187
|
+
| ----------------------- |
|
|
188
|
+
| `TType` _extends_ `any` |
|
|
183
189
|
|
|
184
190
|
#### Parameters
|
|
185
191
|
|
|
@@ -239,11 +245,20 @@ Actor.select;
|
|
|
239
245
|
abstract send(event): void;
|
|
240
246
|
```
|
|
241
247
|
|
|
242
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:
|
|
248
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:223](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L223)
|
|
249
|
+
|
|
250
|
+
Sends an event to the Actor.
|
|
243
251
|
|
|
244
|
-
|
|
252
|
+
The constraint is TEvent, which gives the type safety of a concrete
|
|
253
|
+
implementation.
|
|
245
254
|
|
|
246
|
-
|
|
255
|
+
A note for an implementation that wraps `send`, to check the event or to notify a
|
|
256
|
+
hook around it: this declaration is abstract for one reason only, to narrow the
|
|
257
|
+
event type, and TypeScript forbids a `super` call to an abstract member. Reach
|
|
258
|
+
the implementation of XState with `Actor.prototype.send.call(this, event)`
|
|
259
|
+
instead. A concrete declaration permits `super.send()`, but it also forces an
|
|
260
|
+
`override` modifier in every subclass that exists now, and that is a breaking
|
|
261
|
+
change for an adapter outside this repository.
|
|
247
262
|
|
|
248
263
|
#### Parameters
|
|
249
264
|
|
|
@@ -6,35 +6,36 @@
|
|
|
6
6
|
function attachRenderErrorHandler<TRegistry>(registry, handler): TRegistry;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-actor/src/provider-guards.ts:
|
|
9
|
+
Defined in: [packages/play-actor/src/provider-guards.ts:68](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/provider-guards.ts#L68)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Copies a component registry, and puts an `onRenderError` handler into the copy.
|
|
12
12
|
|
|
13
|
-
The
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
The function defines the handler as an own property of the copy. That property is
|
|
14
|
+
not enumerable, and it is configurable (D-19 gives one convention of the
|
|
15
|
+
injection for every framework renderer). The handler therefore replaces each
|
|
16
|
+
handler of the `defineRegistry` level, and it does not appear in an enumeration of
|
|
17
|
+
the component entries of the registry.
|
|
17
18
|
|
|
18
|
-
The
|
|
19
|
-
that
|
|
20
|
-
`
|
|
21
|
-
providers
|
|
19
|
+
The function never changes the registry of the caller: it returns a shallow copy.
|
|
20
|
+
Therefore a caller that needs a handler for each instance, such as an
|
|
21
|
+
`onRenderError` prop of `ActorProvider`, can share one result of `defineRegistry`
|
|
22
|
+
between the providers in a safe way.
|
|
22
23
|
|
|
23
24
|
## Type Parameters
|
|
24
25
|
|
|
25
|
-
| Type Parameter | Description
|
|
26
|
-
| ------------------------------ |
|
|
27
|
-
| `TRegistry` _extends_ `object` | The
|
|
26
|
+
| Type Parameter | Description |
|
|
27
|
+
| ------------------------------ | --------------------------------------------- |
|
|
28
|
+
| `TRegistry` _extends_ `object` | The component registry type of the framework. |
|
|
28
29
|
|
|
29
30
|
## Parameters
|
|
30
31
|
|
|
31
|
-
| Parameter | Type | Description
|
|
32
|
-
| ---------- | ------------------------------------------------------------------------- |
|
|
33
|
-
| `registry` | `TRegistry` | The component registry from `defineRegistry().registry`.
|
|
34
|
-
| `handler` | [`RenderErrorHandler`](../../play-dom/type-aliases/RenderErrorHandler.md) |
|
|
32
|
+
| Parameter | Type | Description |
|
|
33
|
+
| ---------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `registry` | `TRegistry` | The component registry from `defineRegistry().registry`. |
|
|
35
|
+
| `handler` | [`RenderErrorHandler`](../../play-dom/type-aliases/RenderErrorHandler.md) | The renderer calls it with `(error, componentName)` when a catalog component throws during a render. |
|
|
35
36
|
|
|
36
37
|
## Returns
|
|
37
38
|
|
|
38
39
|
`TRegistry`
|
|
39
40
|
|
|
40
|
-
A shallow
|
|
41
|
+
A shallow copy of `registry`, with `onRenderError` on it.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / composePlayState
|
|
2
|
+
|
|
3
|
+
# Function: composePlayState()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function composePlayState(authoredState, slice): Record<string, unknown> | undefined;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/context-projection.ts:228](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/context-projection.ts#L228)
|
|
10
|
+
|
|
11
|
+
Composes the effective state of a view: the authored `spec.state` and the
|
|
12
|
+
`/context` slice.
|
|
13
|
+
|
|
14
|
+
When the authored state declares the reserved key already, the function skips the
|
|
15
|
+
projection, the authored state wins, and the code writes a warning in
|
|
16
|
+
development. No spec that exists now therefore fails.
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| --------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `authoredState` | `Record`\<`string`, `unknown`\> \| `undefined` | The raw `meta.view.state` value. It can be anything, and the caller or toAtomState cleans it. |
|
|
23
|
+
| `slice` | `Record`\<`string`, `unknown`\> \| `undefined` | The context of the machine, as one complete value. |
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
`Record`\<`string`, `unknown`\> \| `undefined`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / createViewStoreLifecycle
|
|
2
|
+
|
|
3
|
+
# Function: createViewStoreLifecycle()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function createViewStoreLifecycle(createStore): ViewStoreLifecycle;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/view-store-lifecycle.ts:94](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/view-store-lifecycle.ts#L94)
|
|
10
|
+
|
|
11
|
+
Creates a coordinator of the lifecycle.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Description |
|
|
16
|
+
| ------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `createStore` | (`seed`) => `StateStore` | The store factory of the framework. It receives the seed that is safe for the prototype (`toAtomState(view.state)`), and the composed state carries /context already. |
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[`ViewStoreLifecycle`](../interfaces/ViewStoreLifecycle.md)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / guardContextWrites
|
|
2
|
+
|
|
3
|
+
# Function: guardContextWrites()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function guardContextWrites(store): StateStore;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/context-projection.ts:151](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/context-projection.ts#L151)
|
|
10
|
+
|
|
11
|
+
Wraps a StateStore, and the wrapper refuses each write under `/context`.
|
|
12
|
+
|
|
13
|
+
A provider applies it to the store that it gives to the bindings and to the
|
|
14
|
+
action handlers (`$bindState`, `setState`, and a chained `set`). The provider
|
|
15
|
+
keeps the store without the wrapper, and it refreshes the projection through that
|
|
16
|
+
store. The subtree is therefore read-only to the spec, and not to the machinery.
|
|
17
|
+
|
|
18
|
+
A write with a value that is **identical** to the current value passes in
|
|
19
|
+
silence. A handler in the style of `setState` reads the complete snapshot,
|
|
20
|
+
changes it, and writes the whole object back. The `context` key that goes through
|
|
21
|
+
that round trip without a change is no attempt of a mutation. Only a write that
|
|
22
|
+
changes the subtree throws.
|
|
23
|
+
|
|
24
|
+
Each read passes through without a change. The wrapper delegates every member
|
|
25
|
+
explicitly, and it does not use a spread: a store from a consumer can be an
|
|
26
|
+
instance of a class, and the methods of that instance are on the prototype. Those
|
|
27
|
+
methods do not survive `{ ...store }`, and the first render then fails with
|
|
28
|
+
`store.getSnapshot is not a function`. The code builds the wrapper one time for
|
|
29
|
+
each resolved store. Therefore the identity of the delegating `getSnapshot` and
|
|
30
|
+
of the delegating `subscribe` stays stable for a consumer in the style of
|
|
31
|
+
`useSyncExternalStore`.
|
|
32
|
+
|
|
33
|
+
## Parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type | Description |
|
|
36
|
+
| --------- | ------------ | ---------------------------- |
|
|
37
|
+
| `store` | `StateStore` | The store below the wrapper. |
|
|
38
|
+
|
|
39
|
+
## Returns
|
|
40
|
+
|
|
41
|
+
`StateStore`
|
|
42
|
+
|
|
43
|
+
A store with a guard on `set` and on `update`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / refreshContextSubtree
|
|
2
|
+
|
|
3
|
+
# Function: refreshContextSubtree()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function refreshContextSubtree(store, view): void;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/context-projection.ts:210](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/context-projection.ts#L210)
|
|
10
|
+
|
|
11
|
+
Refreshes the `/context` subtree of a live store from the composed state of a
|
|
12
|
+
derived view. An emission with the same `viewKey` means that only the projection
|
|
13
|
+
changed. The function therefore replaces the complete subtree, and it never
|
|
14
|
+
merges it field by field, because `update` cannot delete a key. Every ephemeral
|
|
15
|
+
value at the root level stays. The function does nothing when the view carries no
|
|
16
|
+
slice, or when the store holds the slice already.
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| ------------- | -------------------------- | -------------------------------------------------------------- |
|
|
22
|
+
| `store` | `StateStore` | The store WITHOUT the guard. A provider refreshes through it. |
|
|
23
|
+
| `view` | \{ `state?`: `unknown`; \} | The derived view. Its `state.context` field carries the slice. |
|
|
24
|
+
| `view.state?` | `unknown` | - |
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
`void`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / reuseComposedState
|
|
2
|
+
|
|
3
|
+
# Function: reuseComposedState()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function reuseComposedState(prev, next): PlaySpec | null;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/context-projection.ts:92](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/context-projection.ts#L92)
|
|
10
|
+
|
|
11
|
+
Reuses the composed `state` of the previous emission, or the complete previous
|
|
12
|
+
spec, when the value of the projection did not change.
|
|
13
|
+
|
|
14
|
+
`deriveCurrentView` composes `state: { ...meta.view.state, context: slice }` new
|
|
15
|
+
on each call, and the XState function `assign` makes a new context object on
|
|
16
|
+
every event. Without this reuse, every event therefore presents a new `state`
|
|
17
|
+
reference, and the `Object.is` test of each field in the emit gate emits the view
|
|
18
|
+
again and remounts it, without an end. The function compares the slices field by
|
|
19
|
+
field ([shallowEqualExcept](shallowEqualExcept.md)), because the XState function `assign` makes a
|
|
20
|
+
new context object for each event, and a test of the identity of the whole object
|
|
21
|
+
therefore reports a change every time. The authored fields come from the static
|
|
22
|
+
`meta.view.state` through a spread. Therefore their references are stable for an
|
|
23
|
+
unchanged `viewKey`, and a plain `Object.is` test is correct for them.
|
|
24
|
+
|
|
25
|
+
The function returns one of three values, in this order of preference:
|
|
26
|
+
|
|
27
|
+
- `prev` itself, when nothing observable changed. The emit gate then stops at the
|
|
28
|
+
identity of the reference, and it walks no element;
|
|
29
|
+
- `{ ...next, state: prev.state }`, when the value of the state did not change
|
|
30
|
+
but another top-level field is different;
|
|
31
|
+
- `next`, when something changed.
|
|
32
|
+
|
|
33
|
+
## Parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type |
|
|
36
|
+
| --------- | ------------------------------------------------- |
|
|
37
|
+
| `prev` | [`PlaySpec`](../interfaces/PlaySpec.md) \| `null` |
|
|
38
|
+
| `next` | [`PlaySpec`](../interfaces/PlaySpec.md) \| `null` |
|
|
39
|
+
|
|
40
|
+
## Returns
|
|
41
|
+
|
|
42
|
+
[`PlaySpec`](../interfaces/PlaySpec.md) \| `null`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-actor](../README.md) / shallowEqualExcept
|
|
2
|
+
|
|
3
|
+
# Function: shallowEqualExcept()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function shallowEqualExcept(a, b, except?): boolean;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-actor/src/context-projection.ts:58](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/context-projection.ts#L58)
|
|
10
|
+
|
|
11
|
+
The shallow equality of the own keys, with `Object.is`. It can ignore one key on
|
|
12
|
+
both sides.
|
|
13
|
+
|
|
14
|
+
This is the one comparison rule behind every decision of the emission dedup: the
|
|
15
|
+
equality of a slice, and also the emit gate of the player, which compares the
|
|
16
|
+
spec fields in `viewSpecsEquivalent` and reuses the composed state in
|
|
17
|
+
[reuseComposedState](reuseComposedState.md).
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type |
|
|
22
|
+
| --------- | -------- |
|
|
23
|
+
| `a` | `object` |
|
|
24
|
+
| `b` | `object` |
|
|
25
|
+
| `except?` | `string` |
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`boolean`
|
|
@@ -6,28 +6,30 @@
|
|
|
6
6
|
function toAtomState(state): Record<string, unknown>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-actor/src/provider-guards.ts:
|
|
9
|
+
Defined in: [packages/play-actor/src/provider-guards.ts:39](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/provider-guards.ts#L39)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Converts the `state` field of a spec into a plain object for `createAtom`, in a safe way.
|
|
12
12
|
|
|
13
|
-
`spec.state`
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
its
|
|
13
|
+
`spec.state` has the type `unknown` in `PlaySpec`. At run time it is `null`,
|
|
14
|
+
`undefined`, a primitive, or a plain object, and this depends on the value that
|
|
15
|
+
the author of the machine put in the view spec. `createAtom` requires a plain
|
|
16
|
+
object as its first value, because every other value makes a broken store at run
|
|
17
|
+
time.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
and
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
The function accepts a plain object only, which means that its prototype is
|
|
20
|
+
`Object.prototype` or `null`, and it returns that object without a change. Every
|
|
21
|
+
other value becomes a new `{}`: `null`, `undefined`, a primitive, an array, an
|
|
22
|
+
instance of a class, and a built-in object such as a Date, a Map, or a Set. A
|
|
23
|
+
broken store therefore never appears at run time.
|
|
22
24
|
|
|
23
25
|
## Parameters
|
|
24
26
|
|
|
25
|
-
| Parameter | Type | Description
|
|
26
|
-
| --------- | --------- |
|
|
27
|
-
| `state` | `unknown` | The raw `spec.state` value
|
|
27
|
+
| Parameter | Type | Description |
|
|
28
|
+
| --------- | --------- | ------------------------------------------- |
|
|
29
|
+
| `state` | `unknown` | The raw `spec.state` value of a `PlaySpec`. |
|
|
28
30
|
|
|
29
31
|
## Returns
|
|
30
32
|
|
|
31
33
|
`Record`\<`string`, `unknown`\>
|
|
32
34
|
|
|
33
|
-
`state` itself when it is a plain object,
|
|
35
|
+
`state` itself when it is a plain object. In every other case, a new empty object.
|
|
@@ -3,32 +3,32 @@
|
|
|
3
3
|
# Function: typedSpec()
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
function typedSpec
|
|
6
|
+
function typedSpec(spec): PlaySpec;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:
|
|
9
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:91](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L91)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
autocomplete at the definition site.
|
|
11
|
+
The identity helper gives a view spec literal the type `PlaySpec` at the
|
|
12
|
+
definition site. The compiler therefore checks the spec, and the IDE completes it.
|
|
14
13
|
|
|
15
|
-
XState
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
The XState `meta` field has the type `Record<string, unknown>`. TypeScript
|
|
15
|
+
therefore infers no spec shape from the context. `typedSpec(...)` is the
|
|
16
|
+
mechanism that starts the check where you write the spec. The parameter holds no
|
|
17
|
+
`viewKey`: the derivation stamps that field, and it overwrites a value from an
|
|
18
|
+
author without a notice. Therefore the compiler refuses a `viewKey` here.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
The check of an excess property works on an inline object literal only. For a
|
|
21
|
+
spec in a variable, or for a spec from a spread, write `satisfies PlaySpec` at
|
|
22
|
+
the literal instead.
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| Type Parameter |
|
|
24
|
-
| ----------------------------- |
|
|
25
|
-
| `TContext` _extends_ `object` |
|
|
24
|
+
At run time this function does nothing: it returns the spec object without a
|
|
25
|
+
change.
|
|
26
26
|
|
|
27
27
|
## Parameters
|
|
28
28
|
|
|
29
|
-
| Parameter | Type
|
|
30
|
-
| --------- |
|
|
31
|
-
| `spec` | `Omit`\<[`PlaySpec`](../interfaces/PlaySpec.md), `"
|
|
29
|
+
| Parameter | Type |
|
|
30
|
+
| --------- | -------------------------------------------------------------- |
|
|
31
|
+
| `spec` | `Omit`\<[`PlaySpec`](../interfaces/PlaySpec.md), `"viewKey"`\> |
|
|
32
32
|
|
|
33
33
|
## Returns
|
|
34
34
|
|
|
@@ -37,18 +37,16 @@ At runtime this is a no-op — the spec object is returned unchanged.
|
|
|
37
37
|
## Example
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
interface DashboardCtx {
|
|
41
|
-
username: string;
|
|
42
|
-
params: Record<string, string>;
|
|
43
|
-
query: Record<string, string>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
40
|
meta: {
|
|
47
|
-
view: typedSpec
|
|
41
|
+
view: typedSpec({
|
|
48
42
|
root: "root",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
elements: {
|
|
44
|
+
root: {
|
|
45
|
+
type: "Dashboard",
|
|
46
|
+
props: { username: { $state: "/context/username" } },
|
|
47
|
+
children: [],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
52
50
|
}),
|
|
53
51
|
}
|
|
54
52
|
```
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: BaseActorProviderProps\<TRegistry\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:159](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L159)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`DefineRegistryResult` type
|
|
10
|
-
`@xmachines/json-render-core
|
|
7
|
+
The framework-agnostic base props. Every `ActorProvider` implementation shares
|
|
8
|
+
them: React, Vue, Solid, and Svelte. `TRegistry` holds the
|
|
9
|
+
`DefineRegistryResult` type of the framework. `RenderErrorHandler` comes from
|
|
10
|
+
`@xmachines/json-render-core`, and a second generic parameter is therefore not
|
|
11
|
+
necessary.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Each framework package extends this interface with its `fallback` field, its
|
|
14
|
+
`onError` field, and its `children` field.
|
|
13
15
|
|
|
14
16
|
## Example
|
|
15
17
|
|
|
@@ -32,15 +34,15 @@ interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult
|
|
|
32
34
|
|
|
33
35
|
## Type Parameters
|
|
34
36
|
|
|
35
|
-
| Type Parameter | Description
|
|
36
|
-
| ------------------------------ |
|
|
37
|
-
| `TRegistry` _extends_ `object` | The
|
|
37
|
+
| Type Parameter | Description |
|
|
38
|
+
| ------------------------------ | ------------------------------------------------- |
|
|
39
|
+
| `TRegistry` _extends_ `object` | The `DefineRegistryResult` type of the framework. |
|
|
38
40
|
|
|
39
41
|
## Properties
|
|
40
42
|
|
|
41
|
-
| Property | Type | Description
|
|
42
|
-
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
-
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](Viewable.md) |
|
|
44
|
-
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../../play-dom/type-aliases/RenderErrorHandler.md) |
|
|
45
|
-
| <a id="property-registryresult"></a> `registryResult` | `TRegistry` |
|
|
46
|
-
| <a id="property-store"></a> `store?` | `StateStore` |
|
|
43
|
+
| Property | Type | Description | Defined in |
|
|
44
|
+
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](Viewable.md) | The actor instance with the currentView signal. It requires the Viewable capability. | [packages/play-actor/src/abstract-actor.ts:163](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L163) |
|
|
46
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../../play-dom/type-aliases/RenderErrorHandler.md) | The provider calls it when one catalog component throws during a render. This handler replaces every onRenderError of defineRegistry. | [packages/play-actor/src/abstract-actor.ts:177](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L177) |
|
|
47
|
+
| <a id="property-registryresult"></a> `registryResult` | `TRegistry` | The complete result of defineRegistry(). It holds the component registry and the factory of the action handlers. | [packages/play-actor/src/abstract-actor.ts:165](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L165) |
|
|
48
|
+
| <a id="property-store"></a> `store?` | `StateStore` | The optional external StateStore, which is the controlled mode. With this option, the provider ignores spec.state, and this store is the single source of truth. Without it, the provider makes a new @xstate/store atom for each view transition, with the values of spec.state. | [packages/play-actor/src/abstract-actor.ts:172](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L172) |
|