@xmachines/docs 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -13
- package/api/@xmachines/play/README.md +58 -63
- package/api/@xmachines/play/classes/NonNullableError.md +7 -7
- package/api/@xmachines/play/classes/PlayError.md +25 -27
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
- package/api/@xmachines/play-actor/README.md +72 -63
- package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
- package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
- package/api/@xmachines/play-dom/README.md +119 -85
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom-router/README.md +66 -49
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +63 -54
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +37 -28
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +94 -82
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +34 -29
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +40 -31
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +38 -34
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +66 -48
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +37 -17
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/README.md +71 -45
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +37 -35
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +65 -56
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +72 -70
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
- package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
- package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
- package/api/@xmachines/shared/README.md +11 -13
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/contributing/development.md +28 -0
- package/guides/inspector.md +1 -1
- package/package.json +1 -1
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
|
@@ -6,35 +6,38 @@
|
|
|
6
6
|
function buildRouteUrl(routeTemplate, context?): string;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/build-url.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/build-url.ts:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/routing/build-url.ts#L38)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Builds a complete URL from a route template and the context of the actor.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
then appends query params and hash
|
|
13
|
+
The function replaces each `:param` placeholder and each `:param?` placeholder
|
|
14
|
+
with a value of `context.params`. It then appends the query params and the hash
|
|
15
|
+
fragment.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
error
|
|
17
|
+
Every parameter value must be in `context.params`. The function reads no flat
|
|
18
|
+
context field, and this is deliberate: a placeholder with a spelling error
|
|
19
|
+
therefore gives a compile-time error, and it does not resolve to `undefined` in
|
|
20
|
+
silence.
|
|
19
21
|
|
|
20
22
|
## Parameters
|
|
21
23
|
|
|
22
|
-
| Parameter | Type | Description
|
|
23
|
-
| --------------- | ----------------------------------------------- |
|
|
24
|
-
| `routeTemplate` | `string` |
|
|
25
|
-
| `context` | [`RouteContext`](../interfaces/RouteContext.md) |
|
|
24
|
+
| Parameter | Type | Description |
|
|
25
|
+
| --------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `routeTemplate` | `string` | The template of the route path, for example `"/profile/:userId"` or `"/settings/:section?"`. |
|
|
27
|
+
| `context` | [`RouteContext`](../interfaces/RouteContext.md) | The context object of the actor. Each route parameter must be in `context.params`, because the function reads no flat context field. An absent `query` field builds a URL without a query, exactly like `query: {}`. |
|
|
26
28
|
|
|
27
29
|
## Returns
|
|
28
30
|
|
|
29
31
|
`string`
|
|
30
32
|
|
|
31
|
-
The
|
|
33
|
+
The complete URL string.
|
|
32
34
|
|
|
33
35
|
## Throws
|
|
34
36
|
|
|
35
|
-
When a **
|
|
36
|
-
|
|
37
|
-
when
|
|
37
|
+
When a **necessary** `:param` placeholder has no
|
|
38
|
+
value in the context. The function omits an optional parameter (`:param?`) in
|
|
39
|
+
silence when its value is absent. Import the class from
|
|
40
|
+
`@xmachines/play-xstate/errors`.
|
|
38
41
|
|
|
39
42
|
## Example
|
|
40
43
|
|
|
@@ -43,5 +46,5 @@ buildRouteUrl("/user/:id", { params: { id: "123" }, query: { tab: "profile" }, h
|
|
|
43
46
|
// → "/user/123?tab=profile#top"
|
|
44
47
|
|
|
45
48
|
buildRouteUrl("/settings/:section?", { params: {}, query: {} });
|
|
46
|
-
// → "/settings" (optional param
|
|
49
|
+
// → "/settings" (the optional param is absent, and there is no query string)
|
|
47
50
|
```
|
|
@@ -6,44 +6,46 @@
|
|
|
6
6
|
function composeGuards<TContext, TEvent>(guards): ComposedGuard;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/guards/compose.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/compose.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/guards/compose.ts#L100)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Composes the guards with the AND logic, through the and() helper of XState
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
the composition
|
|
15
|
-
type inference and machine
|
|
13
|
+
The function joins more than one guard predicate with the AND semantics: every
|
|
14
|
+
guard must pass, and the composition then succeeds. It uses the built-in `and()`
|
|
15
|
+
helper of XState. The type inference and the serialization of the machine are
|
|
16
|
+
therefore correct.
|
|
16
17
|
|
|
17
|
-
**Architectural
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
**Architectural context:** the function supports **Actor Authority (INV-01)**,
|
|
19
|
+
because it composes the guards of a state machine transition declaratively. A
|
|
20
|
+
guard enforces a rule of the business logic, and that rule decides if a
|
|
21
|
+
navigation or an action is valid.
|
|
20
22
|
|
|
21
23
|
## Type Parameters
|
|
22
24
|
|
|
23
|
-
| Type Parameter | Default type | Description
|
|
24
|
-
| -------------- | ------------ |
|
|
25
|
-
| `TContext` | `any` |
|
|
26
|
-
| `TEvent` | `any` |
|
|
25
|
+
| Type Parameter | Default type | Description |
|
|
26
|
+
| -------------- | ------------ | ------------------------------------- |
|
|
27
|
+
| `TContext` | `any` | The context type of the state machine |
|
|
28
|
+
| `TEvent` | `any` | The event type |
|
|
27
29
|
|
|
28
30
|
## Parameters
|
|
29
31
|
|
|
30
|
-
| Parameter | Type | Description
|
|
31
|
-
| --------- | --------------------------------------------------------------------- |
|
|
32
|
-
| `guards` | [`GuardArray`](../type-aliases/GuardArray.md)\<`TContext`, `TEvent`\> |
|
|
32
|
+
| Parameter | Type | Description |
|
|
33
|
+
| --------- | --------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
34
|
+
| `guards` | [`GuardArray`](../type-aliases/GuardArray.md)\<`TContext`, `TEvent`\> | The array of the guard predicates, or of the guard names as strings |
|
|
33
35
|
|
|
34
36
|
## Returns
|
|
35
37
|
|
|
36
38
|
[`ComposedGuard`](../type-aliases/ComposedGuard.md)
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
The and() guard composition of XState
|
|
39
41
|
|
|
40
42
|
## Throws
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
When the array of the guards is empty
|
|
43
45
|
|
|
44
46
|
## Examples
|
|
45
47
|
|
|
46
|
-
AND composition with named guards
|
|
48
|
+
An AND composition with named guards
|
|
47
49
|
|
|
48
50
|
```typescript
|
|
49
51
|
import { setup } from "xstate";
|
|
@@ -65,7 +67,7 @@ const machine = setup({
|
|
|
65
67
|
});
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
AND composition with inline predicates
|
|
70
|
+
An AND composition with inline predicates
|
|
69
71
|
|
|
70
72
|
```typescript
|
|
71
73
|
import { composeGuards } from "@xmachines/play-xstate";
|
|
@@ -75,10 +77,10 @@ guard: composeGuards([({ context }) => context.age >= 18, ({ context }) => conte
|
|
|
75
77
|
|
|
76
78
|
## See
|
|
77
79
|
|
|
78
|
-
- [composeGuardsOr](composeGuardsOr.md) for OR composition
|
|
79
|
-
- [negateGuard](negateGuard.md) for NOT logic
|
|
80
|
+
- [composeGuardsOr](composeGuardsOr.md) for the OR composition
|
|
81
|
+
- [negateGuard](negateGuard.md) for the NOT logic
|
|
80
82
|
|
|
81
83
|
## Deprecated
|
|
82
84
|
|
|
83
|
-
Use
|
|
84
|
-
compose with `setup()
|
|
85
|
+
Use the `and()`, `or()`, and `not()` combinators of XState directly. This helper
|
|
86
|
+
does not compose with a guard slot that `setup()` types, and the next major version removes it.
|
|
@@ -6,40 +6,40 @@
|
|
|
6
6
|
function composeGuardsOr<TContext, TEvent>(guards): ComposedGuard;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/guards/compose.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/compose.ts:159](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/guards/compose.ts#L159)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Composes the guards with the OR logic, through the or() helper of XState
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type inference.
|
|
13
|
+
The function joins more than one guard predicate with the OR semantics: one guard
|
|
14
|
+
must pass at least, and the composition then succeeds. It uses the built-in `or()`
|
|
15
|
+
helper of XState, and the type inference is therefore correct.
|
|
16
16
|
|
|
17
17
|
## Type Parameters
|
|
18
18
|
|
|
19
|
-
| Type Parameter | Default type | Description
|
|
20
|
-
| -------------- | ------------ |
|
|
21
|
-
| `TContext` | `any` |
|
|
22
|
-
| `TEvent` | `any` |
|
|
19
|
+
| Type Parameter | Default type | Description |
|
|
20
|
+
| -------------- | ------------ | ------------------------------------- |
|
|
21
|
+
| `TContext` | `any` | The context type of the state machine |
|
|
22
|
+
| `TEvent` | `any` | The event type |
|
|
23
23
|
|
|
24
24
|
## Parameters
|
|
25
25
|
|
|
26
|
-
| Parameter | Type | Description
|
|
27
|
-
| --------- | --------------------------------------------------------------------- |
|
|
28
|
-
| `guards` | [`GuardArray`](../type-aliases/GuardArray.md)\<`TContext`, `TEvent`\> |
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --------- | --------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
28
|
+
| `guards` | [`GuardArray`](../type-aliases/GuardArray.md)\<`TContext`, `TEvent`\> | The array of the guard predicates, or of the guard names |
|
|
29
29
|
|
|
30
30
|
## Returns
|
|
31
31
|
|
|
32
32
|
[`ComposedGuard`](../type-aliases/ComposedGuard.md)
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The or() guard composition of XState
|
|
35
35
|
|
|
36
36
|
## Throws
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
When the array of the guards is empty
|
|
39
39
|
|
|
40
40
|
## Example
|
|
41
41
|
|
|
42
|
-
OR composition with named guards
|
|
42
|
+
An OR composition with named guards
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
45
|
import { setup } from "xstate";
|
|
@@ -53,7 +53,7 @@ const machine = setup({
|
|
|
53
53
|
}).createMachine({
|
|
54
54
|
on: {
|
|
55
55
|
deleteResource: {
|
|
56
|
-
//
|
|
56
|
+
// One guard is sufficient
|
|
57
57
|
guard: composeGuardsOr(["isOwner", "isAdmin"]),
|
|
58
58
|
actions: "delete",
|
|
59
59
|
},
|
|
@@ -63,10 +63,10 @@ const machine = setup({
|
|
|
63
63
|
|
|
64
64
|
## See
|
|
65
65
|
|
|
66
|
-
- [composeGuards](composeGuards.md) for AND composition
|
|
67
|
-
- [negateGuard](negateGuard.md) for NOT logic
|
|
66
|
+
- [composeGuards](composeGuards.md) for the AND composition
|
|
67
|
+
- [negateGuard](negateGuard.md) for the NOT logic
|
|
68
68
|
|
|
69
69
|
## Deprecated
|
|
70
70
|
|
|
71
|
-
Use
|
|
72
|
-
compose with `setup()
|
|
71
|
+
Use the `and()`, `or()`, and `not()` combinators of XState directly. This helper
|
|
72
|
+
does not compose with a guard slot that `setup()` types, and the next major version removes it.
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
function contextFieldMatches<TContext>(fieldPath, expectedValue): Guard<TContext, PlayEvent>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/guards/helpers.ts:75](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/helpers.ts:75](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/guards/helpers.ts#L75)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tells you if a context field holds the expected value.
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
13
|
+
- The function accepts an explicit field path, with a dot between two segments, for example `"user.role"`
|
|
14
|
+
- It compares a primitive with a strict equality, and an object with a deep structural equality
|
|
15
|
+
- The order of the keys has no effect on the comparison of an object: `{a:1,b:2}` equals `{b:2,a:1}`
|
|
16
|
+
- It supports a Date, a RegExp, an instance of a class, a nested object, and an array, through `dequal/lite`
|
|
17
|
+
- It does NOT match a substring: `"a"` does not match `"active"`
|
|
18
18
|
|
|
19
|
-
For XState state
|
|
19
|
+
For a match of an XState state node, use the built-in `in:` guard syntax instead.
|
|
20
20
|
|
|
21
21
|
## Type Parameters
|
|
22
22
|
|
|
@@ -26,18 +26,18 @@ For XState state-node matching, use the built-in `in:` guard syntax instead.
|
|
|
26
26
|
|
|
27
27
|
## Parameters
|
|
28
28
|
|
|
29
|
-
| Parameter | Type | Description
|
|
30
|
-
| --------------- | --------- |
|
|
31
|
-
| `fieldPath` | `string` |
|
|
32
|
-
| `expectedValue` | `unknown` |
|
|
29
|
+
| Parameter | Type | Description |
|
|
30
|
+
| --------------- | --------- | ------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| `fieldPath` | `string` | The path to the context property, with a dot between two segments, for example "status" or "user.role" |
|
|
32
|
+
| `expectedValue` | `unknown` | The value for the comparison: a string, an object, a Date, and so on |
|
|
33
33
|
|
|
34
34
|
## Returns
|
|
35
35
|
|
|
36
36
|
[`Guard`](../type-aliases/Guard.md)\<`TContext`, [`PlayEvent`](../../play/type-aliases/PlayEvent.md)\>
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
The guard predicate. It tests the context field for the value
|
|
39
39
|
|
|
40
40
|
## Deprecated
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
This function is part of the guard utilities, and the next major version removes
|
|
43
|
+
them. Write a plain typed predicate instead.
|
|
@@ -6,36 +6,36 @@
|
|
|
6
6
|
function definePlayer<TMachine>(config): PlayerFactory<TMachine>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/define-player.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-xstate/src/define-player.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/define-player.ts#L61)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Creates a player factory from an XState machine
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
This factory function accepts an XState v5 machine. It returns a function that
|
|
14
|
+
makes [PlayerActor](../classes/PlayerActor.md) instances. One configuration can therefore make more
|
|
15
|
+
than one actor instance, and this helps with a test, with an application of
|
|
16
|
+
several instances, and with a render on the server.
|
|
17
17
|
|
|
18
18
|
## Type Parameters
|
|
19
19
|
|
|
20
|
-
| Type Parameter | Description
|
|
21
|
-
| ---------------------------------------------------------------------------------------------- |
|
|
22
|
-
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine
|
|
20
|
+
| Type Parameter | Description |
|
|
21
|
+
| ---------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
22
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The type of the XState v5 state machine |
|
|
23
23
|
|
|
24
24
|
## Parameters
|
|
25
25
|
|
|
26
|
-
| Parameter | Type | Description
|
|
27
|
-
| --------- | ------------------------------------------------------------- |
|
|
28
|
-
| `config` | [`PlayerConfig`](../interfaces/PlayerConfig.md)\<`TMachine`\> |
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --------- | ------------------------------------------------------------- | -------------------------------------- |
|
|
28
|
+
| `config` | [`PlayerConfig`](../interfaces/PlayerConfig.md)\<`TMachine`\> | The configuration object of the player |
|
|
29
29
|
|
|
30
30
|
## Returns
|
|
31
31
|
|
|
32
32
|
[`PlayerFactory`](../type-aliases/PlayerFactory.md)\<`TMachine`\>
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The factory function. It makes an actor instance, with an optional input context
|
|
35
35
|
|
|
36
36
|
## Examples
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
A basic player factory
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
41
41
|
import { setup } from "xstate";
|
|
@@ -54,19 +54,19 @@ const actor = createPlayer();
|
|
|
54
54
|
actor.start();
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
More than one actor instance from one factory
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
const createPlayer = definePlayer({ machine });
|
|
61
61
|
|
|
62
|
-
// Create
|
|
62
|
+
// Create an actor for each user
|
|
63
63
|
const alice = createPlayer({ userId: "alice" });
|
|
64
64
|
const bob = createPlayer({ userId: "bob" });
|
|
65
65
|
|
|
66
66
|
alice.start();
|
|
67
67
|
bob.start();
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// The two state machines are independent
|
|
70
70
|
console.log(alice.state.get() !== bob.state.get());
|
|
71
71
|
```
|
|
72
72
|
|
|
@@ -74,5 +74,5 @@ console.log(alice.state.get() !== bob.state.get());
|
|
|
74
74
|
|
|
75
75
|
- [Play RFC](../../../../rfc/play.md)
|
|
76
76
|
- [PlayerActor](../classes/PlayerActor.md) for the concrete actor implementation
|
|
77
|
-
- [PlayerConfig](../interfaces/PlayerConfig.md) for configuration options
|
|
78
|
-
- [PlayerFactory](../type-aliases/PlayerFactory.md) for factory function
|
|
77
|
+
- [PlayerConfig](../interfaces/PlayerConfig.md) for the configuration options
|
|
78
|
+
- [PlayerFactory](../type-aliases/PlayerFactory.md) for the signature of the factory function
|
|
@@ -6,34 +6,35 @@
|
|
|
6
6
|
function deriveRoute(stateMeta): string | null;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/derive-route.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/derive-route.ts:92](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/routing/derive-route.ts#L92)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Derives the route from the metadata of an XState state
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(`{ path: "/about" }`).
|
|
16
|
-
|
|
13
|
+
The function reads the URL template of the route from the `meta.route` field in
|
|
14
|
+
the metadata of the active state. It supports a string route (`"/about"`) and also
|
|
15
|
+
an object route with a path property (`{ path: "/about" }`). It returns null for a
|
|
16
|
+
state without route metadata, because not every state needs a route.
|
|
17
17
|
|
|
18
|
-
**Architectural
|
|
19
|
-
routing information from state machine
|
|
20
|
-
|
|
18
|
+
**Architectural context:** the function implements **Actor Authority (INV-01)**,
|
|
19
|
+
because it reads the routing information from the state machine definition, and
|
|
20
|
+
not from an external configuration. The current state of the Actor decides the
|
|
21
|
+
route, and no decision of the infrastructure decides it.
|
|
21
22
|
|
|
22
23
|
## Parameters
|
|
23
24
|
|
|
24
|
-
| Parameter | Type | Description
|
|
25
|
-
| ----------- | ------------------------------- |
|
|
26
|
-
| `stateMeta` | `Record`\<`string`, `unknown`\> |
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| ----------- | ------------------------------- | ------------------------------------------ |
|
|
27
|
+
| `stateMeta` | `Record`\<`string`, `unknown`\> | The state metadata from snapshot.getMeta() |
|
|
27
28
|
|
|
28
29
|
## Returns
|
|
29
30
|
|
|
30
31
|
`string` \| `null`
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
The template of the route path, which can hold a :param, or null when the function finds no route
|
|
33
34
|
|
|
34
35
|
## Examples
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
The basic read of a route
|
|
37
38
|
|
|
38
39
|
```typescript
|
|
39
40
|
import { deriveRoute } from "@xmachines/play-xstate";
|
|
@@ -56,7 +57,7 @@ const route = deriveRoute(meta);
|
|
|
56
57
|
console.log(route); // "/about"
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
A route with a parameter
|
|
60
61
|
|
|
61
62
|
```typescript
|
|
62
63
|
const machine = setup({}).createMachine({
|
|
@@ -71,10 +72,10 @@ const machine = setup({}).createMachine({
|
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
const route = deriveRoute(snapshot.getMeta());
|
|
74
|
-
console.log(route); // "/profile/:userId"
|
|
75
|
+
console.log(route); // "/profile/:userId" — the template, before the substitution
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
The object form of a route
|
|
78
79
|
|
|
79
80
|
```typescript
|
|
80
81
|
const machine = setup({}).createMachine({
|
|
@@ -95,15 +96,15 @@ console.log(route); // "/dashboard"
|
|
|
95
96
|
## See
|
|
96
97
|
|
|
97
98
|
- [Play RFC](../../../../rfc/play.md)
|
|
98
|
-
- [buildRouteUrl](buildRouteUrl.md) for
|
|
99
|
-
- [isAbsoluteRoute](isAbsoluteRoute.md) for
|
|
99
|
+
- [buildRouteUrl](buildRouteUrl.md) for the construction of a URL, with the substitution of each parameter
|
|
100
|
+
- [isAbsoluteRoute](isAbsoluteRoute.md) for the test of an absolute path
|
|
100
101
|
|
|
101
102
|
## Remarks
|
|
102
103
|
|
|
103
|
-
This function
|
|
104
|
-
|
|
105
|
-
function
|
|
104
|
+
This function reads the route definition from `meta.route`. A state with a
|
|
105
|
+
`route: {}` config has a route. [buildRouteUrl](buildRouteUrl.md) substitutes each parameter,
|
|
106
|
+
and this function does not: deriveRoute returns a template.
|
|
106
107
|
|
|
107
|
-
**
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
**A state without a route:** a state without a `meta.route` field gives `null`.
|
|
109
|
+
This is deliberate, because not every state needs a route. An intermediate loading
|
|
110
|
+
state and a substate, for example, often have no URL of their own.
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
function eventMatches<TEvent>(eventType): Guard<unknown, TEvent>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/guards/helpers.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/helpers.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/guards/helpers.ts#L52)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tells you if the type of the event is the expected type
|
|
12
12
|
|
|
13
13
|
## Type Parameters
|
|
14
14
|
|
|
@@ -18,15 +18,15 @@ Check if event type matches expected type
|
|
|
18
18
|
|
|
19
19
|
## Parameters
|
|
20
20
|
|
|
21
|
-
| Parameter | Type | Description
|
|
22
|
-
| ----------- | -------- |
|
|
23
|
-
| `eventType` | `string` |
|
|
21
|
+
| Parameter | Type | Description |
|
|
22
|
+
| ----------- | -------- | ----------------------- |
|
|
23
|
+
| `eventType` | `string` | The expected event type |
|
|
24
24
|
|
|
25
25
|
## Returns
|
|
26
26
|
|
|
27
27
|
[`Guard`](../type-aliases/Guard.md)\<`unknown`, `TEvent`\>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The guard predicate. It tests the event type
|
|
30
30
|
|
|
31
31
|
## Example
|
|
32
32
|
|
|
@@ -41,5 +41,5 @@ const machine = setup({
|
|
|
41
41
|
|
|
42
42
|
## Deprecated
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
This function is part of the guard utilities, and the next major version removes
|
|
45
|
+
them. Write a plain typed predicate instead.
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
function formatPlayRouteTransitions<T>(machineConfig): T;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:112](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L112)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Makes the play.route transitions from the declarative route configs
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
transitions that handle `play.route`
|
|
13
|
+
The function walks the machine states. It looks for each state with a `meta.route`
|
|
14
|
+
field, and it generates the transitions that handle a `play.route` event: each
|
|
15
|
+
transition matches event.to against a state ID.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
The internal formatRouteTransitions function of XState was the model for this
|
|
18
|
+
function (stateUtils.ts, line 391).
|
|
17
19
|
|
|
18
20
|
## Type Parameters
|
|
19
21
|
|
|
@@ -23,15 +25,15 @@ Inspired by XState's internal formatRouteTransitions (stateUtils.ts line 391).
|
|
|
23
25
|
|
|
24
26
|
## Parameters
|
|
25
27
|
|
|
26
|
-
| Parameter | Type | Description
|
|
27
|
-
| --------------- | ---- |
|
|
28
|
-
| `machineConfig` | `T` | XState machine config
|
|
28
|
+
| Parameter | Type | Description |
|
|
29
|
+
| --------------- | ---- | --------------------------------------------------------------------------------------- |
|
|
30
|
+
| `machineConfig` | `T` | The XState machine config, before `createMachine`. It must extend `RouteMachineConfig`. |
|
|
29
31
|
|
|
30
32
|
## Returns
|
|
31
33
|
|
|
32
34
|
`T`
|
|
33
35
|
|
|
34
|
-
The same machine config with
|
|
36
|
+
The same machine config, with the generated `play.route` handlers in it. The original type `T` stays.
|
|
35
37
|
|
|
36
38
|
## Example
|
|
37
39
|
|
|
@@ -47,8 +49,9 @@ const machineConfig = {
|
|
|
47
49
|
const machine = createMachine(formatPlayRouteTransitions(machineConfig));
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
The function generates the `play.route` handlers at the root level. Those
|
|
53
|
+
handlers:
|
|
51
54
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
+
- match event.to against a state ID, for example event.to === "#home"
|
|
56
|
+
- target the correct state
|
|
57
|
+
- assign the params and the query of the event to the context
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
function hasContext<TContext>(path): Guard<TContext, PlayEvent>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/guards/helpers.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/helpers.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-xstate/src/guards/helpers.ts#L24)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tells you if the context holds a value at the path, and that the value is truthy
|
|
12
12
|
|
|
13
13
|
## Type Parameters
|
|
14
14
|
|
|
@@ -18,15 +18,15 @@ Check if context has a truthy value at path
|
|
|
18
18
|
|
|
19
19
|
## Parameters
|
|
20
20
|
|
|
21
|
-
| Parameter | Type | Description
|
|
22
|
-
| --------- | -------- |
|
|
23
|
-
| `path` | `string` |
|
|
21
|
+
| Parameter | Type | Description |
|
|
22
|
+
| --------- | -------- | ----------------------------------------------------------------- |
|
|
23
|
+
| `path` | `string` | The path to the context property, with a dot between two segments |
|
|
24
24
|
|
|
25
25
|
## Returns
|
|
26
26
|
|
|
27
27
|
[`Guard`](../type-aliases/Guard.md)\<`TContext`, [`PlayEvent`](../../play/type-aliases/PlayEvent.md)\>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The guard predicate. It tests the property for a truthy value
|
|
30
30
|
|
|
31
31
|
## Example
|
|
32
32
|
|
|
@@ -41,5 +41,5 @@ const machine = setup({
|
|
|
41
41
|
|
|
42
42
|
## Deprecated
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
This function is part of the guard utilities, and the next major version removes
|
|
45
|
+
them. Write a plain typed predicate instead.
|