@xmachines/docs 2.0.0-alpha.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -17
- package/api/@xmachines/play/README.md +58 -66
- package/api/@xmachines/play/classes/NonNullableError.md +14 -14
- package/api/@xmachines/play/classes/PlayError.md +32 -34
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +28 -27
- package/api/@xmachines/play-actor/README.md +114 -50
- package/api/@xmachines/play-actor/classes/AbstractActor.md +45 -30
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +27 -0
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +21 -0
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +43 -0
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +28 -0
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +42 -0
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +29 -0
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +25 -27
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -15
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +11 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +6 -6
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +50 -0
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +15 -0
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +15 -0
- package/api/@xmachines/play-dom/README.md +123 -86
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/functions/createValidationRegistry.md +22 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +9 -8
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +16 -16
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +2 -0
- package/api/@xmachines/play-dom/interfaces/FieldValidationState.md +16 -0
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +17 -17
- package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +2 -0
- package/api/@xmachines/play-dom/interfaces/ValidationRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +10 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom/variables/schema.md +35 -45
- package/api/@xmachines/play-dom-router/README.md +68 -51
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +21 -20
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +65 -55
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useFieldValidation.md +31 -0
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +9 -8
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +38 -31
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +99 -95
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +6 -6
- package/api/@xmachines/play-router/interfaces/LocationLike.md +11 -11
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -9
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +39 -34
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +45 -30
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +60 -33
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +43 -52
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +43 -39
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +11 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +67 -49
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +38 -16
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/README.md +76 -50
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +39 -39
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/useFieldValidation.md +31 -0
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +66 -57
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +129 -138
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +148 -114
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -23
- package/api/@xmachines/play-xstate/functions/composeGuards.md +34 -33
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +27 -22
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +19 -14
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +12 -7
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +17 -48
- package/api/@xmachines/play-xstate/functions/hasContext.md +12 -9
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +26 -20
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -11
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +9 -25
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +13 -11
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +8 -5
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +11 -15
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -19
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -26
- package/api/@xmachines/shared/README.md +12 -14
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +12 -7
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +9 -4
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +6 -6
- package/contributing/architecture.md +27 -28
- package/contributing/configuration.md +10 -10
- package/contributing/deployment.md +51 -30
- package/contributing/development.md +90 -21
- package/contributing/testing.md +36 -14
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
- package/examples/README.md +4 -1
- package/examples/basic-state-machine.md +24 -24
- package/examples/form-validation.md +110 -121
- package/examples/multi-router-integration.md +0 -2
- package/examples/routing-patterns.md +60 -94
- package/examples/traffic-light.md +57 -48
- package/guides/README.md +6 -2
- package/guides/actor-model.md +1 -1
- package/guides/getting-started.md +89 -90
- package/guides/inspector.md +197 -0
- package/guides/state-machines.md +55 -69
- package/package.json +10 -7
- package/rfc/play.md +15 -6
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
- package/api/@xmachines/play-xstate/functions/createRoutedMachine.md +0 -87
- package/api/@xmachines/play-xstate/type-aliases/PlayRoutePayload.md +0 -30
- package/api/@xmachines/play-xstate/type-aliases/SetupLike.md +0 -33
- package/api/@xmachines/play-xstate/type-aliases/WithOptional.md +0 -31
- package/api/@xmachines/play-xstate/variables/emptyEventSchema.md +0 -37
- package/api/@xmachines/play-xstate/variables/playMetaSchema.md +0 -40
- package/api/@xmachines/play-xstate/variables/playRouteEventSchema.md +0 -9
|
@@ -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
|
```
|
|
@@ -6,26 +6,27 @@
|
|
|
6
6
|
function isRouteReachable(graph, fromStateId, toStateId): boolean;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [query.ts:
|
|
9
|
+
Defined in: [query.ts:186](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/query.ts#L186)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tells you if a transition from the current state can reach a route
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The function uses the path search of @statelyai/graph. It decides if a chain of
|
|
14
|
+
transition edges is present from the state of the origin to the state of the
|
|
15
|
+
target.
|
|
15
16
|
|
|
16
17
|
## Parameters
|
|
17
18
|
|
|
18
|
-
| Parameter | Type | Description
|
|
19
|
-
| ------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
-
| `graph` | `Graph`\<[`MachineNodeData`](../interfaces/MachineNodeData.md), [`MachineEdgeData`](../interfaces/MachineEdgeData.md)\> |
|
|
21
|
-
| `fromStateId` | `string` |
|
|
22
|
-
| `toStateId` | `string` |
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
21
|
+
| `graph` | `Graph`\<[`MachineNodeData`](../interfaces/MachineNodeData.md), [`MachineEdgeData`](../interfaces/MachineEdgeData.md)\> | The machine graph, from RouteTree.graph |
|
|
22
|
+
| `fromStateId` | `string` | The ID of the state of the origin |
|
|
23
|
+
| `toStateId` | `string` | The ID of the state of the target |
|
|
23
24
|
|
|
24
25
|
## Returns
|
|
25
26
|
|
|
26
27
|
`boolean`
|
|
27
28
|
|
|
28
|
-
true
|
|
29
|
+
true when a transition path is present. In every other case, false
|
|
29
30
|
|
|
30
31
|
## Example
|
|
31
32
|
|
|
@@ -33,6 +34,6 @@ true if a transition path exists, false otherwise
|
|
|
33
34
|
const tree = extractMachineRoutes(machine);
|
|
34
35
|
if (tree.graph) {
|
|
35
36
|
const canReach = isRouteReachable(tree.graph, "auth.login", "auth.dashboard");
|
|
36
|
-
// true
|
|
37
|
+
// it is true when a transition path from login to dashboard is present
|
|
37
38
|
}
|
|
38
39
|
```
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function machineToGraph(machine): MachineGraph;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [machine-to-graph.ts:
|
|
9
|
+
Defined in: [machine-to-graph.ts:73](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/machine-to-graph.ts#L73)
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
function routeExists(tree, path): boolean;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [query.ts:
|
|
9
|
+
Defined in: [query.ts:128](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/query.ts#L128)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tells you if a route path is in the tree
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The function tests if the path has a state with a `meta.route` field.
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
| Parameter | Type | Description
|
|
18
|
-
| --------- | ----------------------------------------- |
|
|
19
|
-
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) |
|
|
20
|
-
| `path` | `string` |
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --------- | ----------------------------------------- | ---------------------------------------------------------- |
|
|
19
|
+
| `tree` | [`RouteTree`](../interfaces/RouteTree.md) | The route tree, from extractMachineRoutes() |
|
|
20
|
+
| `path` | `string` | The complete route path, for example '/dashboard/settings' |
|
|
21
21
|
|
|
22
22
|
## Returns
|
|
23
23
|
|
|
24
24
|
`boolean`
|
|
25
25
|
|
|
26
|
-
true
|
|
26
|
+
true when the tree holds the path. In every other case, false
|
|
@@ -6,29 +6,31 @@
|
|
|
6
6
|
function sanitizePathname(pathname): string | null;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [router-sync.ts:
|
|
9
|
+
Defined in: [router-sync.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L74)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Normalizes a pathname before a lookup in the route map.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The function removes a query fragment and a hash fragment, it joins each duplicate
|
|
14
|
+
slash into one, and it refuses a path of an improbable length, because such a path
|
|
15
|
+
must never enter the route resolution.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
It returns `null` for a path of more than 2048 characters, which is malformed or
|
|
18
|
+
hostile input. An adapter that passes around
|
|
19
|
+
`RouterBridgeBase.syncActorFromRouter()`, for example `VueRouterBridge`, must call
|
|
20
|
+
this function itself, and it must return at once on a `null` value. That adapter
|
|
21
|
+
then gives the same guarantee of the defense in depth as the shared base class.
|
|
20
22
|
|
|
21
23
|
## Parameters
|
|
22
24
|
|
|
23
|
-
| Parameter | Type | Description
|
|
24
|
-
| ---------- | -------- |
|
|
25
|
-
| `pathname` | `string` |
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| ---------- | -------- | -------------------------------------------------------- |
|
|
27
|
+
| `pathname` | `string` | The raw path string of a navigation event of the router. |
|
|
26
28
|
|
|
27
29
|
## Returns
|
|
28
30
|
|
|
29
31
|
`string` \| `null`
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
The normalized path string, or `null` when the path is malformed or too long.
|
|
32
34
|
|
|
33
35
|
## Example
|
|
34
36
|
|
|
@@ -36,5 +38,5 @@ Normalized path string, or `null` if the path is malformed/too long.
|
|
|
36
38
|
import { sanitizePathname } from "@xmachines/play-router";
|
|
37
39
|
|
|
38
40
|
const clean = sanitizePathname(to.path);
|
|
39
|
-
if (clean === null) return; //
|
|
41
|
+
if (clean === null) return; // refuse a malformed path
|
|
40
42
|
```
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
function validateRouteFormat(routePath, stateId): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [validate-routes.ts:27](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [validate-routes.ts:27](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/validate-routes.ts#L27)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Checks the format of a route path
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
and relative
|
|
15
|
-
|
|
13
|
+
The function requires a string that is not empty. It accepts an absolute path
|
|
14
|
+
("/foo") and also a relative path ("foo" or "child/nested"). A relative route
|
|
15
|
+
receives the path prefix of its parent state during the construction of the tree.
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
| Parameter | Type | Description
|
|
20
|
-
| ----------- | -------- |
|
|
21
|
-
| `routePath` | `string` |
|
|
22
|
-
| `stateId` | `string` |
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ----------- | -------- | -------------------------------------------------- |
|
|
21
|
+
| `routePath` | `string` | The route path to check: absolute or relative |
|
|
22
|
+
| `stateId` | `string` | The identifier of the state, for the error message |
|
|
23
23
|
|
|
24
24
|
## Returns
|
|
25
25
|
|
|
@@ -27,4 +27,4 @@ inherit their parent state's path prefix when the tree is built.
|
|
|
27
27
|
|
|
28
28
|
## Throws
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
When the route path is empty
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
function validateStateExists(stateId, stateIds): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [validate-routes.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [validate-routes.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/validate-routes.ts#L43)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Checks that the set of the state IDs holds a state
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The function requires each state ID of a reference in the machine graph. This
|
|
14
|
+
check at the build time therefore stops a broken route reference.
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
17
17
|
|
|
18
|
-
| Parameter | Type | Description
|
|
19
|
-
| ---------- | ----------------- |
|
|
20
|
-
| `stateId` | `string` |
|
|
21
|
-
| `stateIds` | `Set`\<`string`\> |
|
|
18
|
+
| Parameter | Type | Description |
|
|
19
|
+
| ---------- | ----------------- | ---------------------------------------------------- |
|
|
20
|
+
| `stateId` | `string` | The identifier of the state to check |
|
|
21
|
+
| `stateIds` | `Set`\<`string`\> | The set of every known state ID of the machine graph |
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
@@ -26,4 +26,4 @@ Build-time validation prevents broken route references.
|
|
|
26
26
|
|
|
27
27
|
## Throws
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
When the set does not hold the state ID
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: BuildPlayRouteEventOptions
|
|
4
4
|
|
|
5
|
-
Defined in: [router-sync.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
5
|
+
Defined in: [router-sync.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L17)
|
|
6
6
|
|
|
7
7
|
## Properties
|
|
8
8
|
|
|
9
|
-
| Property | Type | Defined in
|
|
10
|
-
| ----------------------------------------- | ------------------------------------------------------ |
|
|
11
|
-
| <a id="property-match"></a> `match` | (`sanitizedPathname`) => [`RouteMatch`](RouteMatch.md) | [router-sync.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
12
|
-
| <a id="property-pathname"></a> `pathname` | `string` | [router-sync.ts:18](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
13
|
-
| <a id="property-search"></a> `search?` | `string` | [router-sync.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
| Property | Type | Defined in |
|
|
10
|
+
| ----------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| <a id="property-match"></a> `match` | (`sanitizedPathname`) => [`RouteMatch`](RouteMatch.md) | [router-sync.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L20) |
|
|
12
|
+
| <a id="property-pathname"></a> `pathname` | `string` | [router-sync.ts:18](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L18) |
|
|
13
|
+
| <a id="property-search"></a> `search?` | `string` | [router-sync.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-sync.ts#L19) |
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: LocationLike
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [types.ts:432](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L432)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
`connect()
|
|
9
|
-
global `location` when
|
|
7
|
+
The minimal location interface of an adapter that reads the current URL at the
|
|
8
|
+
moment of `connect()`. You can inject it for SSR and for a test: give a mock in
|
|
9
|
+
place of the global `location` when no DOM is available.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
the DOM lib.
|
|
11
|
+
The definition is structural, and it holds no reference to `Location`. This package
|
|
12
|
+
therefore compiles without the DOM lib.
|
|
13
13
|
|
|
14
14
|
## Example
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
// SSR
|
|
17
|
+
// SSR or a test — an injected mock
|
|
18
18
|
const mockLoc: LocationLike = { pathname: "/dashboard", search: "?tab=posts" };
|
|
19
19
|
connectRouter({ actor, routeMap, location: mockLoc });
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Properties
|
|
23
23
|
|
|
24
|
-
| Property | Modifier | Type | Defined in
|
|
25
|
-
| ----------------------------------------- | ---------- | -------- |
|
|
26
|
-
| <a id="property-pathname"></a> `pathname` | `readonly` | `string` | [types.ts:
|
|
27
|
-
| <a id="property-search"></a> `search` | `readonly` | `string` | [types.ts:
|
|
24
|
+
| Property | Modifier | Type | Defined in |
|
|
25
|
+
| ----------------------------------------- | ---------- | -------- | --------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| <a id="property-pathname"></a> `pathname` | `readonly` | `string` | [types.ts:433](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L433) |
|
|
27
|
+
| <a id="property-search"></a> `search` | `readonly` | `string` | [types.ts:434](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L434) |
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: MachineEdgeData
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
5
|
+
Defined in: [types.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L24)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
The data on each edge of the graph that represents the machine.
|
|
8
|
+
It holds the event of the transition and the information of its guard.
|
|
9
9
|
|
|
10
10
|
## Properties
|
|
11
11
|
|
|
12
|
-
| Property | Type
|
|
13
|
-
| ------------------------------------------------ |
|
|
14
|
-
| <a id="property-
|
|
15
|
-
| <a id="property-
|
|
16
|
-
| <a id="property-guarded"></a> `guarded?` | `boolean` | True when a guard function gates this transition. XState v6 compiles all guards to functions (authored predicates, JSON-layer names, and the route-matching guard synthesized on native route transitions), so only the presence of a guard — not its identity — is statically knowable. | [types.ts:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0-alpha.1/packages/play-router/src/types.ts#L40) |
|
|
17
|
-
| <a id="property-guardtype"></a> ~~`guardType?`~~ | `string` | **Deprecated** Never populated under XState v6: every guard (including JSON-layer guard names via `createMachineFromConfig`) compiles to a function, so guard identity is unrecoverable statically. Use [MachineEdgeData.guarded](#property-guarded) instead. | [types.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0-alpha.1/packages/play-router/src/types.ts#L33) |
|
|
12
|
+
| Property | Type | Description | Defined in |
|
|
13
|
+
| ------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
14
|
+
| <a id="property-eventtype"></a> `eventType` | `string` | The event type that starts this transition | [types.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L26) |
|
|
15
|
+
| <a id="property-guardtype"></a> ~~`guardType?`~~ | `string` | The guard as a string, when a guard is present **Deprecated** Will be removed in the next major. | [types.ts:32](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L32) |
|