@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
|
@@ -9,13 +9,14 @@ function buildPlayRouteEvent(options): {
|
|
|
9
9
|
} | null;
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Defined in: [router-sync.ts:
|
|
12
|
+
Defined in: [router-sync.ts:175](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L175)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Builds a normalized `play.route` event from the raw input of a router or of a
|
|
15
|
+
browser.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
`connectRouter()` of `@xmachines/play-dom-router` and `RouterBridgeBase` both use
|
|
18
|
+
this helper. Therefore a low-level adapter and a framework adapter clean each
|
|
19
|
+
pathname, match each route, and read each query in the same way.
|
|
19
20
|
|
|
20
21
|
## Parameters
|
|
21
22
|
|
|
@@ -6,32 +6,33 @@
|
|
|
6
6
|
function buildRouteTree(routes): RouteTree;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [build-tree.ts:
|
|
9
|
+
Defined in: [build-tree.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/build-tree.ts#L22)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Builds the hierarchical route tree from the flat list of the routes
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
The function makes a nested tree, and it keeps the parent-child relation of the
|
|
14
|
+
states. An absolute route becomes a route of the top level, and a relative route
|
|
15
|
+
goes below its parent. The function also makes the maps of both directions, for
|
|
16
|
+
the lookup between a state ID and a path.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
the same
|
|
21
|
-
|
|
18
|
+
The detection of a duplicate runs here, after the function resolved each relative
|
|
19
|
+
route against the complete path of its parent. Therefore two relative routes with
|
|
20
|
+
the same raw string below two different parents are valid, and two different raw
|
|
21
|
+
strings that resolve to the same complete path are not: those two overwrite each
|
|
22
|
+
other in `byPath` in silence.
|
|
22
23
|
|
|
23
24
|
## Parameters
|
|
24
25
|
|
|
25
|
-
| Parameter | Type | Description
|
|
26
|
-
| --------- | ------------------------------------------- |
|
|
27
|
-
| `routes` | [`RouteInfo`](../interfaces/RouteInfo.md)[] |
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --------- | ------------------------------------------- | ----------------------------------------------------------- |
|
|
28
|
+
| `routes` | [`RouteInfo`](../interfaces/RouteInfo.md)[] | The flat list of the RouteInfo objects, from the extraction |
|
|
28
29
|
|
|
29
30
|
## Returns
|
|
30
31
|
|
|
31
32
|
[`RouteTree`](../interfaces/RouteTree.md)
|
|
32
33
|
|
|
33
|
-
RouteTree with root, byStateId map, and byPath map
|
|
34
|
+
The RouteTree, with its root, its byStateId map, and its byPath map
|
|
34
35
|
|
|
35
36
|
## Throws
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
When two states resolve to the same complete path
|
|
@@ -6,27 +6,28 @@
|
|
|
6
6
|
function createRouteMap(machine, options?): RouteMap;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [create-route-map.ts:
|
|
9
|
+
Defined in: [create-route-map.ts:47](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/create-route-map.ts#L47)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Creates a `RouteMap` from an XState state machine.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
The function reads every state with a route, which means each state with a
|
|
14
|
+
`meta.route` field. It then builds the lookup structure between a path and a
|
|
15
|
+
stateId, for both directions. A subclass of `RouterBridgeBase` uses the map: it
|
|
16
|
+
converts each change of the browser URL into a `play.route` actor event, and each
|
|
17
|
+
actor route into a URL.
|
|
17
18
|
|
|
18
19
|
## Parameters
|
|
19
20
|
|
|
20
|
-
| Parameter | Type | Description
|
|
21
|
-
| ---------- | ------------------------------------------------------------------------- |
|
|
22
|
-
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine with `meta.route`
|
|
23
|
-
| `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) |
|
|
21
|
+
| Parameter | Type | Description |
|
|
22
|
+
| ---------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The XState v5 state machine, with a `meta.route` annotation on each state with a route. |
|
|
24
|
+
| `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) | The optional configuration. Give `{ cacheSize }` to change the default size of the LRU cache of the parameterized path lookups. |
|
|
24
25
|
|
|
25
26
|
## Returns
|
|
26
27
|
|
|
27
28
|
[`RouteMap`](../classes/RouteMap.md)
|
|
28
29
|
|
|
29
|
-
A `RouteMap` for
|
|
30
|
+
A `RouteMap` for each adapter on `RouterBridgeBase`.
|
|
30
31
|
|
|
31
32
|
## Example
|
|
32
33
|
|
|
@@ -6,41 +6,41 @@
|
|
|
6
6
|
function createRouteMapFromTree(routeTree, options?): RouteMap;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [create-route-map-from-tree.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [create-route-map-from-tree.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/create-route-map-from-tree.ts#L33)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Creates a `RouteMap` from the node structure of a `RouteTree`.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
`
|
|
15
|
-
`createRouteMap()` directly.
|
|
13
|
+
A framework router adapter uses this function when it gives a `RouteTree` from
|
|
14
|
+
`extractMachineRoutes()`, and not when it calls `createRouteMap()` directly.
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
`node.fullPath` is always the
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
The function walks every node, and it collects the pairs
|
|
17
|
+
`{ stateId: node.id, path: node.fullPath }`. `node.fullPath` is always the
|
|
18
|
+
absolute resolved path, for example `"/dashboard/overview"`, and `RouteMap` needs
|
|
19
|
+
that path for the match of a browser URL. `createRouteMap(machine)` behaves in the
|
|
20
|
+
same way, because it also uses `node.fullPath`.
|
|
21
21
|
|
|
22
22
|
## Parameters
|
|
23
23
|
|
|
24
|
-
| Parameter | Type | Description
|
|
25
|
-
| ----------- | ----------------------------------------------------- |
|
|
26
|
-
| `routeTree` | [`RouteTree`](../interfaces/RouteTree.md) | A `RouteTree
|
|
27
|
-
| `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) |
|
|
24
|
+
| Parameter | Type | Description |
|
|
25
|
+
| ----------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `routeTree` | [`RouteTree`](../interfaces/RouteTree.md) | A `RouteTree`, as `extractMachineRoutes()` returns it. |
|
|
27
|
+
| `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) | The optional configuration, for example `{ cacheSize }` to change the size of the LRU cache. |
|
|
28
28
|
|
|
29
29
|
## Returns
|
|
30
30
|
|
|
31
31
|
[`RouteMap`](../classes/RouteMap.md)
|
|
32
32
|
|
|
33
|
-
A `RouteMap` for
|
|
33
|
+
A `RouteMap` for each adapter on `RouterBridgeBase`.
|
|
34
34
|
|
|
35
35
|
## Example
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
//
|
|
38
|
+
// The preferred form — one call for an XState machine:
|
|
39
39
|
import { createRouteMap } from "@xmachines/play-router";
|
|
40
|
-
const routeMap = createRouteMap(machine); // takes AnyStateMachine
|
|
40
|
+
const routeMap = createRouteMap(machine); // it takes an AnyStateMachine
|
|
41
41
|
|
|
42
|
-
//
|
|
42
|
+
// The two-step form, for a framework adapter that works with a route tree:
|
|
43
43
|
import { extractMachineRoutes, createRouteMapFromTree } from "@xmachines/play-router";
|
|
44
44
|
const routeTree = extractMachineRoutes(machine);
|
|
45
|
-
const routeMap = createRouteMapFromTree(routeTree); // uses node.fullPath
|
|
45
|
+
const routeMap = createRouteMapFromTree(routeTree); // it uses node.fullPath, which is absolute
|
|
46
46
|
```
|
|
@@ -6,29 +6,30 @@
|
|
|
6
6
|
function detectDuplicateRoutes(routes): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [validate-routes.ts:
|
|
9
|
+
Defined in: [validate-routes.ts:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/validate-routes.ts#L70)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Finds each duplicate route path
|
|
12
12
|
|
|
13
|
-
THROWS ERROR when
|
|
13
|
+
The function THROWS AN ERROR when more than one state holds the same RESOLVED
|
|
14
|
+
complete path.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
strings: two relative `"settings"` routes
|
|
18
|
-
|
|
19
|
-
route
|
|
20
|
-
|
|
16
|
+
The detection works on the resolved complete paths, after `buildRouteTree` put the
|
|
17
|
+
path of each parent before its relative routes. It does not work on the raw route
|
|
18
|
+
strings: two relative `"settings"` routes below two different parents resolve to
|
|
19
|
+
two different complete paths, and they are valid; a relative route and an absolute
|
|
20
|
+
route that resolve to the same URL are a real collision, and the function refuses
|
|
21
|
+
them. `buildRouteTree` calls this function when the complete paths are known.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
direct URL
|
|
25
|
-
conditional
|
|
23
|
+
The reason: a routing on the URL requires one state for each URL. Two states at
|
|
24
|
+
the same path make the browser navigation ambiguous, for the BACK button and for a
|
|
25
|
+
direct URL. Use a different path for each state, or use one state with a
|
|
26
|
+
conditional render.
|
|
26
27
|
|
|
27
28
|
## Parameters
|
|
28
29
|
|
|
29
|
-
| Parameter | Type | Description
|
|
30
|
-
| --------- | ----------------------------------------------------------- |
|
|
31
|
-
| `routes` | [`ResolvedRoutePath`](../interfaces/ResolvedRoutePath.md)[] |
|
|
30
|
+
| Parameter | Type | Description |
|
|
31
|
+
| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
32
|
+
| `routes` | [`ResolvedRoutePath`](../interfaces/ResolvedRoutePath.md)[] | The array of the route entries with their resolved complete paths, for example the `RouteNode` objects |
|
|
32
33
|
|
|
33
34
|
## Returns
|
|
34
35
|
|
|
@@ -36,4 +37,4 @@ conditional rendering.
|
|
|
36
37
|
|
|
37
38
|
## Throws
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
When the function finds two resolved route paths that are equal
|
|
@@ -6,23 +6,24 @@
|
|
|
6
6
|
function extractMachineRoutes(machine): RouteTree;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [extract-routes.ts:
|
|
9
|
+
Defined in: [extract-routes.ts:92](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/extract-routes.ts#L92)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Reads the complete route tree from the graph of a state machine
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
then walks graph nodes
|
|
15
|
-
|
|
16
|
-
RouteTree for
|
|
13
|
+
The function converts the XState machine into a Graph of @statelyai/graph, with
|
|
14
|
+
machineToGraph(). It then walks the graph nodes: it reads the route metadata of
|
|
15
|
+
each node, it checks each route reference, and it builds a hierarchical RouteTree.
|
|
16
|
+
The RouteTree of the return value also holds the graph, for a later query that
|
|
17
|
+
needs the transitions.
|
|
17
18
|
|
|
18
19
|
## Parameters
|
|
19
20
|
|
|
20
|
-
| Parameter | Type | Description
|
|
21
|
-
| --------- | ------------------------------------------------------------------------- |
|
|
22
|
-
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine |
|
|
21
|
+
| Parameter | Type | Description |
|
|
22
|
+
| --------- | ------------------------------------------------------------------------- | --------------------------- |
|
|
23
|
+
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The XState v5 state machine |
|
|
23
24
|
|
|
24
25
|
## Returns
|
|
25
26
|
|
|
26
27
|
[`RouteTree`](../interfaces/RouteTree.md)
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
The route tree, with its root, its byStateId map, its byPath map, and its graph
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
function extractQuery(search): Record<string, string>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [router-sync.ts:
|
|
9
|
+
Defined in: [router-sync.ts:155](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L155)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Parses a URL search string into the plain object that a `play.route` event
|
|
12
|
+
needs.
|
|
13
13
|
|
|
14
14
|
## Parameters
|
|
15
15
|
|
|
@@ -6,40 +6,43 @@
|
|
|
6
6
|
function extractRouteParams(pathname, pattern): Record<string, string>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [router-sync.ts:
|
|
9
|
+
Defined in: [router-sync.ts:117](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L117)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Reads the named path parameters of a URL, with the URLPattern API.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
For
|
|
13
|
+
The function takes the string of the pattern directly. Use it when you know the
|
|
14
|
+
pattern already. For a read through the lookup of a state ID, see
|
|
15
|
+
`RouterBridgeBase.extractParams`.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
The object of the return holds no undefined value. Such a value comes from an
|
|
18
|
+
optional segment without a match, for example `/settings` against
|
|
19
|
+
`/settings/:section?`.
|
|
18
20
|
|
|
19
|
-
The
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
The function normalizes the pattern with the rules of the match in `RouteMap`: a
|
|
22
|
+
name with a hyphen, such as `:cat-id`, becomes `:cat_id` for URLPattern. It then
|
|
23
|
+
maps each group name back to the original param name. Therefore `/docs/123`
|
|
24
|
+
against `/docs/:cat-id` gives `{ "cat-id": "123" }`.
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
router
|
|
26
|
+
The function decodes each percent sequence of a value (`john%20doe` → `john doe`),
|
|
27
|
+
as a framework router does, for example vue-router. It keeps a malformed sequence
|
|
28
|
+
raw.
|
|
26
29
|
|
|
27
30
|
## Parameters
|
|
28
31
|
|
|
29
|
-
| Parameter | Type | Description
|
|
30
|
-
| ---------- | -------- |
|
|
31
|
-
| `pathname` | `string` | The concrete URL pathname
|
|
32
|
-
| `pattern` | `string` | The URL pattern
|
|
32
|
+
| Parameter | Type | Description |
|
|
33
|
+
| ---------- | -------- | ----------------------------------------------------------------- |
|
|
34
|
+
| `pathname` | `string` | The concrete URL pathname, for example `/profile/alice` |
|
|
35
|
+
| `pattern` | `string` | The template of the URL pattern, for example `/profile/:username` |
|
|
33
36
|
|
|
34
37
|
## Returns
|
|
35
38
|
|
|
36
39
|
`Record`\<`string`, `string`\>
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
The record of the parameter values of the read, or `{}` for a static pattern.
|
|
39
42
|
|
|
40
43
|
## Throws
|
|
41
44
|
|
|
42
|
-
When `URLPattern` is absent and the pattern
|
|
45
|
+
When `URLPattern` is absent and the pattern holds a parameter.
|
|
43
46
|
|
|
44
47
|
## Example
|
|
45
48
|
|
|
@@ -50,5 +53,5 @@ extractRouteParams("/profile/alice", "/profile/:username");
|
|
|
50
53
|
// → { username: "alice" }
|
|
51
54
|
|
|
52
55
|
extractRouteParams("/settings", "/settings/:section?");
|
|
53
|
-
// → {}
|
|
56
|
+
// → {} — the optional param is absent, and the object holds it not
|
|
54
57
|
```
|
|
@@ -6,25 +6,26 @@
|
|
|
6
6
|
function findRouteById(tree, id): RouteNode | undefined;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [find-route.ts:
|
|
9
|
+
Defined in: [find-route.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/find-route.ts#L59)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Finds a route node by its state ID
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The function looks the route node up by the ID property of the state. It gives you
|
|
14
|
+
the URL path of a state ID, for the update of the browser URL after a `play.route`
|
|
15
|
+
transition.
|
|
15
16
|
|
|
16
17
|
## Parameters
|
|
17
18
|
|
|
18
|
-
| Parameter | Type | Description
|
|
19
|
-
| --------- | ----------------------------------------- |
|
|
20
|
-
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) |
|
|
21
|
-
| `id` | `string` |
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| --------- | ----------------------------------------- | ----------------------------------------------------------- |
|
|
21
|
+
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) | The route tree, from extractMachineRoutes |
|
|
22
|
+
| `id` | `string` | The state ID, for example 'dashboard' or 'settings.profile' |
|
|
22
23
|
|
|
23
24
|
## Returns
|
|
24
25
|
|
|
25
26
|
[`RouteNode`](../interfaces/RouteNode.md) \| `undefined`
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
The route node, or undefined when the function finds none
|
|
28
29
|
|
|
29
30
|
## Example
|
|
30
31
|
|
|
@@ -6,30 +6,32 @@
|
|
|
6
6
|
function findRouteByPath(tree, path): RouteNode | undefined;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [find-route.ts:
|
|
9
|
+
Defined in: [find-route.ts:86](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/find-route.ts#L86)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Finds a route node by its URL path
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
URL for
|
|
13
|
+
The function looks the route node up by the URL path. It gives you the state ID of
|
|
14
|
+
a browser URL, for the `play.route` event of a navigation.
|
|
15
15
|
|
|
16
|
-
When
|
|
17
|
-
prefers
|
|
16
|
+
When more than one state holds the same path, for example the root and a second
|
|
17
|
+
state both at "/", the function prefers a node with a route, which means a node
|
|
18
|
+
with a `meta.route` field, over a node without one.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
The function also matches a pattern of a dynamic route, for example
|
|
21
|
+
'/settings/:section?'.
|
|
20
22
|
|
|
21
23
|
## Parameters
|
|
22
24
|
|
|
23
|
-
| Parameter | Type | Description
|
|
24
|
-
| --------- | ----------------------------------------- |
|
|
25
|
-
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) |
|
|
26
|
-
| `path` | `string` | URL path
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| --------- | ----------------------------------------- | ------------------------------------------------------------- |
|
|
27
|
+
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) | The route tree, from extractMachineRoutes |
|
|
28
|
+
| `path` | `string` | The URL path, for example '/dashboard' or '/settings/profile' |
|
|
27
29
|
|
|
28
30
|
## Returns
|
|
29
31
|
|
|
30
32
|
[`RouteNode`](../interfaces/RouteNode.md) \| `undefined`
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
The route node, or undefined when the function finds none
|
|
33
35
|
|
|
34
36
|
## Example
|
|
35
37
|
|
|
@@ -6,25 +6,25 @@
|
|
|
6
6
|
function getNavigableRoutes(tree, stateId): RouteNode[];
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [query.ts:41](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [query.ts:41](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/query.ts#L41)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns every route of a navigation from the given state
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The function returns the child routes of the state. A later version also returns
|
|
14
|
+
the sibling routes of a transition.
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
17
17
|
|
|
18
|
-
| Parameter | Type | Description
|
|
19
|
-
| --------- | ----------------------------------------- |
|
|
20
|
-
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) |
|
|
21
|
-
| `stateId` | `string` |
|
|
18
|
+
| Parameter | Type | Description |
|
|
19
|
+
| --------- | ----------------------------------------- | ------------------------------------------- |
|
|
20
|
+
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) | The route tree, from extractMachineRoutes() |
|
|
21
|
+
| `stateId` | `string` | The ID of the current state |
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
25
|
[`RouteNode`](../interfaces/RouteNode.md)[]
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The array of the route nodes that the state can reach
|
|
28
28
|
|
|
29
29
|
## Example
|
|
30
30
|
|
|
@@ -6,25 +6,25 @@
|
|
|
6
6
|
function getRoutableRoutes(tree): RouteNode[];
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [query.ts:
|
|
9
|
+
Defined in: [query.ts:106](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/query.ts#L106)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns every route of the tree that has a route, in one flat array
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
The function returns each route with a `meta.route` field. It returns no state
|
|
14
|
+
without a route, and no synthetic root node. Use it to generate a router
|
|
15
|
+
configuration in a framework adapter dynamically.
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
| Parameter | Type | Description
|
|
20
|
-
| --------- | ----------------------------------------- |
|
|
21
|
-
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) |
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| --------- | ----------------------------------------- | ------------------------------------------- |
|
|
21
|
+
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) | The route tree, from extractMachineRoutes() |
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
25
|
[`RouteNode`](../interfaces/RouteNode.md)[]
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The array of the route nodes with a route, with their path and their stateId
|
|
28
28
|
|
|
29
29
|
## Example
|
|
30
30
|
|
|
@@ -6,31 +6,32 @@
|
|
|
6
6
|
function getTransitionReachableRoutes(graph, stateId): string[];
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [query.ts:
|
|
9
|
+
Defined in: [query.ts:158](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/query.ts#L158)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns the routes that a transition from the current state can reach
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
The function uses the successor algorithm of @statelyai/graph. It finds every
|
|
14
|
+
state of a direct transition edge from the given state, then it keeps the states
|
|
15
|
+
with a route.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`tree.byPath
|
|
20
|
-
resolves
|
|
17
|
+
The values of the return are the RAW `meta.route` strings of the machine. The
|
|
18
|
+
function does NOT resolve a relative route, for example `"detail"`, to a complete
|
|
19
|
+
path, and such a value is therefore no key of `tree.byPath`. For a resolved
|
|
20
|
+
`RouteNode`, use `getNavigableRoutes`: that function resolves each state that the
|
|
21
|
+
transition reaches through `tree.byStateId`.
|
|
21
22
|
|
|
22
23
|
## Parameters
|
|
23
24
|
|
|
24
|
-
| Parameter | Type | Description
|
|
25
|
-
| --------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
-
| `graph` | `Graph`\<[`MachineNodeData`](../interfaces/MachineNodeData.md), [`MachineEdgeData`](../interfaces/MachineEdgeData.md)\> |
|
|
27
|
-
| `stateId` | `string` |
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
27
|
+
| `graph` | `Graph`\<[`MachineNodeData`](../interfaces/MachineNodeData.md), [`MachineEdgeData`](../interfaces/MachineEdgeData.md)\> | The machine graph, from RouteTree.graph |
|
|
28
|
+
| `stateId` | `string` | The ID of the current state, for example "test.home" |
|
|
28
29
|
|
|
29
30
|
## Returns
|
|
30
31
|
|
|
31
32
|
`string`[]
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
The array of the raw route strings that a transition can reach
|
|
34
35
|
|
|
35
36
|
## Example
|
|
36
37
|
|
|
@@ -38,6 +39,6 @@ Array of raw route strings reachable via transitions
|
|
|
38
39
|
const tree = extractMachineRoutes(machine);
|
|
39
40
|
if (tree.graph) {
|
|
40
41
|
const reachable = getTransitionReachableRoutes(tree.graph, "auth.loggedIn");
|
|
41
|
-
// ['/dashboard', '/settings'] — routes
|
|
42
|
+
// ['/dashboard', '/settings'] — the routes that a transition can reach
|
|
42
43
|
}
|
|
43
44
|
```
|