@xmachines/docs 2.1.1 → 3.0.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 +2 -2
- package/api/@xmachines/play/README.md +74 -7
- package/api/@xmachines/play/classes/NonNullableError.md +4 -4
- package/api/@xmachines/play/classes/PlayError.md +4 -4
- package/api/@xmachines/play/functions/asCleanup.md +78 -0
- package/api/@xmachines/play/functions/assertNonNullable.md +1 -1
- package/api/@xmachines/play/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play/type-aliases/DisposeKey.md +32 -0
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play/variables/DISPOSE.md +34 -0
- package/api/@xmachines/play-actor/README.md +8 -1
- package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +1 -1
- package/api/@xmachines/play-actor/functions/composePlayState.md +1 -1
- package/api/@xmachines/play-actor/functions/createFailureLatch.md +20 -0
- package/api/@xmachines/play-actor/functions/createReportGuard.md +26 -0
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +1 -1
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +1 -1
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +1 -1
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +1 -1
- package/api/@xmachines/play-actor/functions/sameViewInputs.md +25 -0
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +1 -1
- package/api/@xmachines/play-actor/functions/toAtomState.md +1 -1
- package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +5 -5
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +5 -5
- package/api/@xmachines/play-actor/interfaces/FailureLatch.md +59 -0
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
- package/api/@xmachines/play-actor/interfaces/ReportGuard.md +92 -0
- package/api/@xmachines/play-actor/interfaces/ReportGuardMessages.md +18 -0
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +2 -2
- package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
- package/api/@xmachines/play-actor/interfaces/ViewInputs.md +19 -0
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +3 -3
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +4 -4
- package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +1 -1
- package/api/@xmachines/play-dom/README.md +84 -16
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +10 -10
- package/api/@xmachines/play-dom/functions/createPlayUI.md +8 -8
- package/api/@xmachines/play-dom/functions/createRenderer.md +3 -3
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +17 -11
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +5 -4
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +14 -12
- package/api/@xmachines/play-dom/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play-dom/type-aliases/DisposablePlayUI.md +36 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +6 -1
- package/api/@xmachines/play-dom-router/README.md +46 -18
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +149 -7
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +6 -5
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +3 -3
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouter.md +20 -8
- package/api/@xmachines/play-dom-router/interfaces/BasePathOptions.md +32 -0
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +27 -17
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +16 -16
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +12 -6
- package/api/@xmachines/play-dom-router/interfaces/DisposableBrowserHistory.md +262 -0
- package/api/@xmachines/play-dom-router/interfaces/DisposableVanillaRouter.md +80 -0
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +4 -4
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterConnection.md +105 -0
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +26 -5
- package/api/@xmachines/play-dom-router/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play-dom-router/variables/DISPOSE.md +34 -0
- package/api/@xmachines/play-react/README.md +2 -2
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +42 -7
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +10 -10
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +8 -6
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -5
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +1 -1
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +1 -1
- package/api/@xmachines/play-react/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-react-router/README.md +2 -2
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +172 -15
- package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +7 -18
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +10 -8
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +15 -9
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterProviderBaseProps.md +26 -0
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-router/README.md +308 -11
- package/api/@xmachines/play-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +178 -19
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/cleanFrameworkParams.md +40 -0
- package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouterConnection.md +21 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
- package/api/@xmachines/play-router/functions/extractRouteParams.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getPatternParamNames.md +24 -0
- package/api/@xmachines/play-router/functions/getRequiredPatternParamNames.md +36 -0
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getRouteMappings.md +67 -0
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/isMountableBridge.md +26 -0
- package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
- package/api/@xmachines/play-router/functions/joinBasePath.md +37 -0
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/mountKey.md +28 -0
- package/api/@xmachines/play-router/functions/normalizeBasePath.md +43 -0
- package/api/@xmachines/play-router/functions/openProviderBridge.md +41 -0
- package/api/@xmachines/play-router/functions/pickOwnParams.md +41 -0
- package/api/@xmachines/play-router/functions/repointProviderBridge.md +27 -0
- package/api/@xmachines/play-router/functions/resolveBasePath.md +51 -0
- package/api/@xmachines/play-router/functions/resolveFrameworkParams.md +51 -0
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
- package/api/@xmachines/play-router/functions/stripBasePath.md +44 -0
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
- package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
- package/api/@xmachines/play-router/interfaces/BasePathOptions.md +32 -0
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +6 -6
- package/api/@xmachines/play-router/interfaces/FrameworkParamsSource.md +47 -0
- package/api/@xmachines/play-router/interfaces/LocationLike.md +5 -5
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +5 -5
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +7 -7
- package/api/@xmachines/play-router/interfaces/MountableRouterBridge.md +130 -0
- package/api/@xmachines/play-router/interfaces/OpenProviderBridgeArgs.md +28 -0
- package/api/@xmachines/play-router/interfaces/PlayActor.md +7 -7
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-router/interfaces/PlayRouterProviderBaseProps.md +33 -0
- package/api/@xmachines/play-router/interfaces/ResolvedBasePath.md +14 -0
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +5 -5
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +10 -10
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteNode.md +12 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +4 -4
- package/api/@xmachines/play-router/interfaces/RouteTree.md +7 -7
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +7 -3
- package/api/@xmachines/play-router/interfaces/RouterConnection.md +105 -0
- package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +1 -1
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
- package/api/@xmachines/play-router/type-aliases/PlayRouterBridgeConstructor.md +36 -0
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-router/variables/DISPOSE.md +34 -0
- package/api/@xmachines/play-router/variables/NO_BASE_PATH.md +18 -0
- package/api/@xmachines/play-signals/README.md +4 -2
- package/api/@xmachines/play-signals/functions/watchSignal.md +27 -4
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
- package/api/@xmachines/play-signals/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +23 -5
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +14 -1
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +10 -10
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +13 -5
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorContext.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-solid-router/README.md +19 -3
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +166 -18
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +8 -18
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +10 -8
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +14 -12
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterProviderBaseProps.md +26 -0
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-svelte/README.md +3 -3
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-svelte/functions/getActorContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +7 -1
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +10 -10
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/README.md +3 -1
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +148 -6
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/interfaces/BasePathOptions.md +32 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +12 -6
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterConnection.md +105 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +3 -1
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +148 -6
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-sveltekit-router/interfaces/BasePathOptions.md +32 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +28 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterConnection.md +105 -0
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +148 -6
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +7 -18
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +10 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +15 -9
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterProviderBaseProps.md +26 -0
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-tanstack-router/README.md +1 -1
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +153 -11
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +3 -3
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/README.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +149 -7
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +7 -17
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +10 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +15 -9
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterProviderBaseProps.md +26 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-vue/README.md +34 -12
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +6 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +12 -7
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +15 -10
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +1 -1
- 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 +6 -1
- package/api/@xmachines/play-vue-router/README.md +1 -1
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +154 -12
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +25 -2
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +1 -1
- package/api/@xmachines/play-xstate/README.md +19 -2
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +53 -17
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
- package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
- package/api/@xmachines/play-xstate/variables/DISPOSE.md +34 -0
- package/api/@xmachines/shared/README.md +1 -1
- 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/architecture.md +5 -1
- package/contributing/configuration.md +60 -18
- package/contributing/development.md +66 -44
- package/contributing/testing.md +34 -7
- package/examples/README.md +1 -1
- package/examples/multi-router-integration.md +126 -1
- package/examples/routing-patterns.md +1 -1
- package/guides/getting-started.md +7 -7
- package/guides/inspector.md +1 -1
- package/guides/signals.md +43 -0
- package/package.json +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +0 -32
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +0 -30
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +0 -32
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +0 -31
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-react-router](../README.md) / PlayRouterProviderBaseProps
|
|
2
|
+
|
|
3
|
+
# Type Alias: PlayRouterProviderBaseProps\<TRouter, TActor\>
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type PlayRouterProviderBaseProps<TRouter, TActor> = PlayRouterProviderBaseProps<
|
|
7
|
+
TRouter,
|
|
8
|
+
TActor,
|
|
9
|
+
ReactNode
|
|
10
|
+
>;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: [play-react-router/src/create-play-router-provider.tsx:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-react-router/src/create-play-router-provider.tsx#L35)
|
|
14
|
+
|
|
15
|
+
The props of a React `PlayRouterProvider`.
|
|
16
|
+
|
|
17
|
+
`TRouter` is the type of the router instance of the adapter, and the node type is
|
|
18
|
+
bound to `ReactNode`. See `PlayRouterProviderBaseProps` of
|
|
19
|
+
`@xmachines/play-router` for what each prop means.
|
|
20
|
+
|
|
21
|
+
## Type Parameters
|
|
22
|
+
|
|
23
|
+
| Type Parameter | Default type |
|
|
24
|
+
| ------------------------------------------------------------ | ----------------------------------------- |
|
|
25
|
+
| `TRouter` | - |
|
|
26
|
+
| `TActor` _extends_ [`PlayActor`](../interfaces/PlayActor.md) | [`PlayActor`](../interfaces/PlayActor.md) |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const PlayRouterProvider: <TActor>(__namedParameters) => Element;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-react-router/src/play-router-provider.tsx:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/
|
|
9
|
+
Defined in: [play-react-router/src/play-router-provider.tsx:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-react-router/src/play-router-provider.tsx#L40)
|
|
10
10
|
|
|
11
11
|
Connects a `PlayerActor` to React Router. It keeps the actor state and the browser
|
|
12
12
|
URL in step, in both directions.
|
|
@@ -24,9 +24,9 @@ references**: create them outside the JSX, or hold them with `useMemo`.
|
|
|
24
24
|
|
|
25
25
|
## Parameters
|
|
26
26
|
|
|
27
|
-
| Parameter | Type
|
|
28
|
-
| ------------------- |
|
|
29
|
-
| `__namedParameters` | [`PlayRouterProviderBaseProps`](../
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `__namedParameters` | [`PlayRouterProviderBaseProps`](../type-aliases/PlayRouterProviderBaseProps.md)\<`Router`, `TActor`\> |
|
|
30
30
|
|
|
31
31
|
## Returns
|
|
32
32
|
|
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
Route tree extraction from XState v5 state machines. Part of [@xmachines/play](../play/README.md) Universal Player Architecture.
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-router)
|
|
8
8
|
|
|
9
9
|
This package extracts the routes from a machine graph and looks them up in both directions. The Actor therefore keeps the authority over the navigation.
|
|
10
10
|
|
|
11
|
+
> **Browser floor: Chrome 110, Firefox 115, Safari 16.4.** This package calls the ES2023
|
|
12
|
+
> change-by-copy array methods, so a browser below that floor throws
|
|
13
|
+
> `TypeError: ... is not a function` at the extraction of the routes. Vite 8 resolves its
|
|
14
|
+
> default `baseline-widely-available` target to Firefox 114, which is below it — raise
|
|
15
|
+
> `build.target` when you bundle for the browser. The root README carries the table.
|
|
16
|
+
>
|
|
17
|
+
> A **parameterized route** raises Firefox to **117**, which is the version that has the
|
|
18
|
+
> URLPattern API. Load the `urlpattern-polyfill` for an older target, as the Installation
|
|
19
|
+
> section below says.
|
|
20
|
+
|
|
11
21
|
## Installation
|
|
12
22
|
|
|
13
23
|
```bash
|
|
@@ -38,6 +48,8 @@ pnpm add urlpattern-polyfill
|
|
|
38
48
|
|
|
39
49
|
`urlpattern-polyfill` is an optional peer dependency. A package manager does not install it for you. Install it and load it yourself when your runtime has no native URLPattern.
|
|
40
50
|
|
|
51
|
+
**When you need it:** `RouteMap` compiles each parameterized route in its CONSTRUCTOR, and it throws a `URLPatternUnavailableError` there when no URLPattern is available. One route that holds a `:param` or a `*` therefore makes the polyfill a startup requirement on such a runtime. A route map whose paths are all static needs URLPattern never.
|
|
52
|
+
|
|
41
53
|
## Usage
|
|
42
54
|
|
|
43
55
|
### Extract routes from a machine
|
|
@@ -125,6 +137,209 @@ actor.send({
|
|
|
125
137
|
});
|
|
126
138
|
```
|
|
127
139
|
|
|
140
|
+
### Sharing a router with the host (`basePath`)
|
|
141
|
+
|
|
142
|
+
A machine owns the complete URL space of its router by default. Give a `basePath`,
|
|
143
|
+
and it owns a prefix only: the host keeps the rest of the same router.
|
|
144
|
+
|
|
145
|
+
The shape that motivates this option is a URL such as `/:machineId/play/dashboard`.
|
|
146
|
+
The host resolves `:machineId` — in a loader of TanStack, in a `useParams()` call, in
|
|
147
|
+
a `load` function of SvelteKit — and the `meta.route` tree of the machine gives
|
|
148
|
+
everything below `/:machineId/play`.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
// The route of the host is /$machineId/play/$ and its loader resolved machineId.
|
|
152
|
+
const disconnect = connectRouter({
|
|
153
|
+
actor,
|
|
154
|
+
router,
|
|
155
|
+
routeMap, // unchanged — the route map stays relative to the machine
|
|
156
|
+
basePath: "/:machineId/play",
|
|
157
|
+
basePathParams: { machineId },
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// The "/dashboard" of the machine is now the URL "/abc123/play/dashboard".
|
|
161
|
+
// The "/" of the machine is now the URL "/abc123/play".
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The prefix can be a pattern, so that you keep one string that mirrors your route
|
|
165
|
+
config, but every `:param` needs a value in `basePathParams`. The bridge writes a
|
|
166
|
+
real browser URL, so it resolves the prefix in advance, and it refuses each shape
|
|
167
|
+
that resolves to one concrete path never: a `*` wildcard, a `:param?`, a `$param`
|
|
168
|
+
(the spelling of TanStack — write `:param`), a query string, and a hash. A base path
|
|
169
|
+
is a PATHNAME, so it also refuses a URL scheme: give `/admin`, and never
|
|
170
|
+
`https://app.example.com/admin`.
|
|
171
|
+
|
|
172
|
+
It also refuses every segment that a browser REWRITES, and it refuses the resolved
|
|
173
|
+
value of a `:param` on the same rule: a dot segment (`.`, `..`, and their
|
|
174
|
+
percent-encoded forms), a backslash, whitespace, and a character that a URL
|
|
175
|
+
percent-encodes, such as the `é` of `/café`. Each of them makes the prefix that comes
|
|
176
|
+
back differ from the prefix that went out, so every location would read as foreign
|
|
177
|
+
and the machine would go permanently silent. Give the segment in the form that a URL
|
|
178
|
+
carries: `/caf%C3%A9`.
|
|
179
|
+
|
|
180
|
+
**An unresolved `:param` throws** a `MissingBasePathParamError`, at the construction
|
|
181
|
+
and not on the first navigation. There is no "not ready yet" fallback, on purpose: a
|
|
182
|
+
bridge without a prefix would claim the complete router, and it would start to
|
|
183
|
+
correct the URLs of the host, which is worse than a loud failure. Resolve the value
|
|
184
|
+
before you connect or render — a route loader or a `useParams()` call holds it
|
|
185
|
+
already.
|
|
186
|
+
|
|
187
|
+
**A location outside the prefix belongs to the host.** The bridge sends no
|
|
188
|
+
`play.route` event there, it runs no corrective navigation there, and it writes no
|
|
189
|
+
route of its actor there. That silence lets the two halves live together, and it holds
|
|
190
|
+
in both directions: a route change that no URL event caused — an `after` timer, an
|
|
191
|
+
async guard that settles, a restore of a snapshot — would otherwise drag the user off
|
|
192
|
+
the page of the host. The bridge remembers such a move, and it writes it when the
|
|
193
|
+
location comes back under the prefix, so the machine keeps its place. Inside the mount
|
|
194
|
+
nothing changes: a path that the machine does not know is still a 404 of its own URL
|
|
195
|
+
space, and the URL still follows the actor.
|
|
196
|
+
|
|
197
|
+
| Location of the router | `basePath = "/abc123/play"` |
|
|
198
|
+
| ---------------------- | ----------------------------------------------------- |
|
|
199
|
+
| `/abc123/play` | the `/` of the machine → `play.route` |
|
|
200
|
+
| `/abc123/play/about` | the `/about` of the machine → `play.route` |
|
|
201
|
+
| `/abc123/play/nope` | unknown INSIDE the mount → the URL follows the actor |
|
|
202
|
+
| `/account/billing` | a route of the host → the bridge does nothing |
|
|
203
|
+
| `/abc123/playground` | another segment → the host's, the bridge does nothing |
|
|
204
|
+
|
|
205
|
+
**The machine is authoritative over its own params.** `event.params` holds what the
|
|
206
|
+
pattern of the machine declares, and nothing else. The params of the prefix belong to
|
|
207
|
+
the host — the host wrote the prefix and resolved them — so they travel in no
|
|
208
|
+
`play.route` event, and a param of the host that happens to share a name with one of
|
|
209
|
+
the machine cannot shadow it.
|
|
210
|
+
|
|
211
|
+
Read the resolved mount from the bridge instead, where it cannot go stale:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
bridge.basePath; // "/abc123/play"
|
|
215
|
+
bridge.basePathParams; // { machineId: "abc123" }
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
A machine that needs the identity of its host — a `machineId`, a tenant — takes it
|
|
219
|
+
through the `input` of the actor, where it belongs: that identity decides WHICH
|
|
220
|
+
machine runs, and it is not a param of a route inside the machine.
|
|
221
|
+
|
|
222
|
+
#### Several machines alive at once
|
|
223
|
+
|
|
224
|
+
More than one machine can be alive at a time, each mounted at its own prefix, all
|
|
225
|
+
sharing one router. Every bridge hears every location change of that router, and each
|
|
226
|
+
one recognises its own half and leaves the rest alone — a location under another
|
|
227
|
+
machine's prefix is foreign in exactly the way a route of the host is. So a
|
|
228
|
+
`play.route` reaches the machine that owns the URL and no other, and a correction of
|
|
229
|
+
an unknown path happens only inside the prefix that owns it.
|
|
230
|
+
|
|
231
|
+
**Each bridge can stay connected, as long as each one has its own prefix.** A bridge
|
|
232
|
+
outside its mount keeps the silence in BOTH directions: it sends no `play.route`, it
|
|
233
|
+
corrects no URL, and it writes no route of its actor. So the machine that the location
|
|
234
|
+
belongs to is the only one that writes, and an actor that nobody is looking at cannot
|
|
235
|
+
take the URL from the one on screen. A route that the hidden machine moved to is not
|
|
236
|
+
lost: the bridge remembers it, and it writes it when the host navigates back under its
|
|
237
|
+
prefix.
|
|
238
|
+
|
|
239
|
+
**Two bridges contend when neither prefix separates their halves of the URL.** That is
|
|
240
|
+
the case for two bridges with no prefix, for two with the same prefix, and also for two
|
|
241
|
+
whose prefixes NEST: a mount at `/a` and a mount at `/a/b` both claim `/a/b/x`, because
|
|
242
|
+
`/a` is a prefix of it. Give sibling prefixes — `/a/one` and `/a/two` — and no location
|
|
243
|
+
belongs to two machines. Where a prefix cannot separate them, connect the bridge that
|
|
244
|
+
owns the address bar and let the others keep their state with no bridge attached. `connect()` refuses a
|
|
245
|
+
second bridge for one actor, but it cannot know which of two different actors should
|
|
246
|
+
own the URL.
|
|
247
|
+
|
|
248
|
+
#### How to load and unload routes
|
|
249
|
+
|
|
250
|
+
The prefix lives on the **bridge**, and not on the `RouteMap`. A route map is static,
|
|
251
|
+
it is shared, and it holds an LRU cache inside, so one map serves every mount without
|
|
252
|
+
a rebuild.
|
|
253
|
+
|
|
254
|
+
`setBasePath()` moves WHERE an actor is mounted, and never WHICH actor is mounted:
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
// The host moved this actor from one region of its URL space to another.
|
|
258
|
+
bridge.setBasePath("/:region/:machineId/play", { region: "us", machineId });
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The call also brings the location in step. Nothing else moves the address bar, so a
|
|
262
|
+
move to a prefix that the URL is not under writes the new mount, and it keeps the
|
|
263
|
+
route of the actor: `/eu/abc123/play/about` becomes `/us/abc123/play/about`. A location
|
|
264
|
+
that already lies under the new prefix drives the actor instead, exactly as it does on
|
|
265
|
+
`connect()`.
|
|
266
|
+
|
|
267
|
+
**An actor never changes identity.** A segment of the prefix that IDENTIFIES the
|
|
268
|
+
actor — a `machineId` that names the document it runs — therefore never moves through
|
|
269
|
+
this method. A new identity is a new ACTOR, and a new actor takes a new bridge,
|
|
270
|
+
because `connect()` permits one bridge for each actor. Give the provider the new actor
|
|
271
|
+
and let it rebuild: that is the correct shape, and it is what the host wants, because
|
|
272
|
+
the new document starts at its own state.
|
|
273
|
+
|
|
274
|
+
The segments that move here are the ones that LOCATE: a region, a locale, a tenant, a
|
|
275
|
+
workspace slug. They say where the same actor lives, and they decide nothing about
|
|
276
|
+
it.
|
|
277
|
+
|
|
278
|
+
Nothing goes away: the actor, the route map, and its cache all stay, and the bridge
|
|
279
|
+
runs the same first-synchronization decision against the new prefix. A call that
|
|
280
|
+
resolves to the same prefix reconciles nothing, and it still takes the new params, so
|
|
281
|
+
a move between `"/abc123/play"` and `"/:machineId/play"` with `{ machineId }` keeps
|
|
282
|
+
`event.params` honest. A call with no argument removes the prefix, and it gives the
|
|
283
|
+
machine the complete router again.
|
|
284
|
+
|
|
285
|
+
Every `PlayRouterProvider` gives `basePath` and `basePathParams` as **reactive
|
|
286
|
+
props**, wired to `setBasePath()`. They need no stable reference, unlike `actor`,
|
|
287
|
+
`router`, and `routeMap`, and they rebuild the bridge never:
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
// A render with a new `region` moves the mount, and it rebuilds the bridge never. A
|
|
291
|
+
// render with a new `machineId` gives a different `actor` prop, and THAT rebuilds the
|
|
292
|
+
// bridge, which is correct: one actor takes one bridge.
|
|
293
|
+
<PlayRouterProvider
|
|
294
|
+
actor={actor}
|
|
295
|
+
router={router}
|
|
296
|
+
routeMap={routeMap}
|
|
297
|
+
basePath="/:machineId/play"
|
|
298
|
+
basePathParams={{ machineId }}
|
|
299
|
+
renderer={(a) => <PlayRenderer actor={a} registry={registry} />}
|
|
300
|
+
/>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
To register the routes of the machine in a host router that declares real route
|
|
304
|
+
objects, ask for the list — and drop it again when the machine unloads:
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import { extractMachineRoutes, getRouteMappings } from "@xmachines/play-router";
|
|
308
|
+
|
|
309
|
+
const tree = extractMachineRoutes(machine);
|
|
310
|
+
|
|
311
|
+
// Concrete, for a route that the host adds after a loader resolved the mount
|
|
312
|
+
getRouteMappings(tree, { basePath: "/:machineId/play", basePathParams: { machineId } });
|
|
313
|
+
// [{ stateId: "home", path: "/abc123/play" },
|
|
314
|
+
// { stateId: "profile", path: "/abc123/play/profile/:userId" }, ...]
|
|
315
|
+
|
|
316
|
+
// The pattern, for a static route declaration of the host
|
|
317
|
+
getRouteMappings(tree, { basePath: "/:machineId/play" });
|
|
318
|
+
// [{ stateId: "home", path: "/:machineId/play" }, ...]
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Each `stateId` comes from the route tree, so it carries NO `#`. A host that keys its
|
|
322
|
+
route table on the target of a `play.route` event adds the `#` itself, because the
|
|
323
|
+
event always carries the prefixed form.
|
|
324
|
+
|
|
325
|
+
> Under a mount, `@xmachines/play-vue-router` and `@xmachines/play-solid-router` read
|
|
326
|
+
> the pre-parsed route params of their framework never: under a prefix the framework
|
|
327
|
+
> matched a route of the HOST by construction, because the machine owns the suffix of
|
|
328
|
+
> the path only. Those params therefore describe the route of the machine never, even
|
|
329
|
+
> when a name collides — a collision carries the value of the HOST. Both adapters
|
|
330
|
+
> resolve each param from the stripped path with `URLPattern` instead, and they
|
|
331
|
+
> therefore need a polyfill on an older runtime when they are mounted.
|
|
332
|
+
>
|
|
333
|
+
> Without a prefix both adapters keep the parse of their framework, with its decoding
|
|
334
|
+
> and with no polyfill, but restricted to the names that the pattern of the machine
|
|
335
|
+
> declares. A splat of a catch-all, and a param of a wrapper route, reach the actor
|
|
336
|
+
> never.
|
|
337
|
+
>
|
|
338
|
+
> A location that fills NO optional segment reaches URLPattern never. `/settings` is the
|
|
339
|
+
> bare form of `/settings/:section?`, so the params are `{}`, and the adapters read that
|
|
340
|
+
> from the path alone rather than from their framework. The route map that HOLDS that
|
|
341
|
+
> pattern still needed URLPattern when it was built.
|
|
342
|
+
|
|
128
343
|
### How to write a `RouterBridgeBase` adapter
|
|
129
344
|
|
|
130
345
|
Extend `RouterBridgeBase`, then implement the three abstract methods for your framework:
|
|
@@ -211,6 +426,7 @@ bridge.disconnect();
|
|
|
211
426
|
| `getRoutableRoutes(tree)` | Returns every routable `RouteNode` in one flat array |
|
|
212
427
|
| `getNavigableRoutes(tree, stateId)` | Returns the child routes that a state can reach, through the hierarchy and through a transition |
|
|
213
428
|
| `routeExists(tree, path)` | Tells you if the tree holds a path |
|
|
429
|
+
| `getRouteMappings(tree, options?)` | The `{ stateId, path }` entries for a route table of a host, with an optional prefix |
|
|
214
430
|
| `getTransitionReachableRoutes(graph, stateId)` | Returns the route paths that a state can reach through an XState transition |
|
|
215
431
|
| `isRouteReachable(graph, fromStateId, toStateId)` | Tells you if a transition path is present between two states |
|
|
216
432
|
|
|
@@ -224,6 +440,56 @@ bridge.disconnect();
|
|
|
224
440
|
| `extractRouteParams(pathname, pattern)` | Reads the path parameters of a URL with URLPattern |
|
|
225
441
|
| `extractQuery(search)` | Reads the query parameters of a URL search string |
|
|
226
442
|
|
|
443
|
+
### Base Path
|
|
444
|
+
|
|
445
|
+
| Export | Description |
|
|
446
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
447
|
+
| `BasePathOptions` | `{ basePath?, basePathParams? }` — every bridge, provider, and `connectRouter` takes it |
|
|
448
|
+
| `RouterBridgeBase#basePath` | The resolved prefix of the mount, or `""` when the machine owns the complete router |
|
|
449
|
+
| `RouterBridgeBase#basePathParams` | The values of the `:param` segments of the mount — they travel in no `play.route` event |
|
|
450
|
+
| `RouterBridgeBase#setBasePath(p, prm?)` | Moves the mount of a live bridge, with no teardown, and brings the location in step |
|
|
451
|
+
| `normalizeBasePath(basePath?)` | Normalizes a prefix, and it keeps each `:param` segment |
|
|
452
|
+
| `resolveBasePath(basePath?, params?)` | Resolves a prefix to `{ path, params }`, and it substitutes every `:param` |
|
|
453
|
+
| `stripBasePath(pathname, basePath)` | The machine half of a location, or `null` when the location belongs to the host |
|
|
454
|
+
| `joinBasePath(basePath, path)` | Adds a prefix to a machine path, and it keeps a query string or a hash at the end |
|
|
455
|
+
| `NO_BASE_PATH` | The frozen `{ path: "", params: {} }` of a bridge that takes no `basePath` |
|
|
456
|
+
|
|
457
|
+
### Framework Params
|
|
458
|
+
|
|
459
|
+
A bridge whose framework parses the path params itself — Vue Router and SolidJS Router
|
|
460
|
+
both do — keeps that parse instead of running URLPattern again. The decision that makes
|
|
461
|
+
it safe is the same in both, so it lives here.
|
|
462
|
+
|
|
463
|
+
| Export | Description |
|
|
464
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
465
|
+
| `resolveFrameworkParams(source)` | Decides which params describe the route of the machine: `{}`, the parse of the framework, or the fallback |
|
|
466
|
+
| `getPatternParamNames(pattern)` | The names of every `:param` of a route pattern. A `*` wildcard carries none |
|
|
467
|
+
| `getRequiredPatternParamNames(pattern)` | The names the pattern REQUIRES, so an optional `:name?` is left out |
|
|
468
|
+
| `pickOwnParams(params, names, requiredNames?)` | The params that the pattern declares, or `null` when the framework covers them not. `requiredNames` says which names may NOT be absent; it defaults to every name, so a two-argument call treats an optional `:name?` as a gap |
|
|
469
|
+
| `cleanFrameworkParams(params)` | The params of a framework with no absent value, each one a string |
|
|
470
|
+
|
|
471
|
+
### Provider Lifecycle
|
|
472
|
+
|
|
473
|
+
A `PlayRouterProvider` of a framework is two things: the lifecycle of a bridge, and
|
|
474
|
+
about fifteen lines that bind that lifecycle to the effects of the framework. This
|
|
475
|
+
package holds the lifecycle, and it holds every decision in it. An adapter keeps its
|
|
476
|
+
own effects and nothing else.
|
|
477
|
+
|
|
478
|
+
| Export | Description |
|
|
479
|
+
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
480
|
+
| `PlayRouterProviderBaseProps<TRouter, TActor, TNode>` | The documented props. `TNode` is what the framework renders |
|
|
481
|
+
| `PlayRouterBridgeConstructor<TRouter>` | The constructor shape a bridge class must satisfy |
|
|
482
|
+
| `openProviderBridge(BridgeCtor, args)` | Builds the bridge, connects it, and returns it with a `close` |
|
|
483
|
+
| `repointProviderBridge(bridge, basePath, params?)` | Moves the mount of a live bridge. A `null` bridge and a bridge with no mount API are no-ops |
|
|
484
|
+
| `mountKey(basePath, params?)` | A key that changes when the mount changes, compared BY VALUE |
|
|
485
|
+
| `isMountableBridge(bridge)` | The run-time probe for a bridge that can move its mount |
|
|
486
|
+
| `createRouterConnection(bridge)` | Wraps a live bridge in the callable `RouterConnection` that `connectRouter` returns |
|
|
487
|
+
| `RouterConnection` | The callable handle: `disconnect()`, the mount to read and to move, and a `Disposable` |
|
|
488
|
+
|
|
489
|
+
Nothing here imports a framework, so this package keeps no framework dependency —
|
|
490
|
+
`tests/provider-factory-parity.test.ts` holds that. `TNode` is the only thing in the
|
|
491
|
+
props that a framework decides, which is why it is a type parameter.
|
|
492
|
+
|
|
227
493
|
### Validation
|
|
228
494
|
|
|
229
495
|
| Export | Description |
|
|
@@ -237,6 +503,7 @@ bridge.disconnect();
|
|
|
237
503
|
| Export | Description |
|
|
238
504
|
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
239
505
|
| `RouterBridge` | The interface of the `connect()` and `disconnect()` lifecycle |
|
|
506
|
+
| `MountableRouterBridge` | A `RouterBridge` whose mount can move — it adds `basePath` and `setBasePath()` |
|
|
240
507
|
| `RouteTree` | The hierarchical tree, with `root`, `byStateId`, `byPath`, and an optional `graph` |
|
|
241
508
|
| `RouteNode` | One node of the tree, with `id`, `path`, `fullPath`, `stateId`, `children`, and `parent` |
|
|
242
509
|
| `RouteInfo` | The flat route descriptor that comes from a state node |
|
|
@@ -251,16 +518,18 @@ bridge.disconnect();
|
|
|
251
518
|
|
|
252
519
|
### Errors (subpath `@xmachines/play-router/errors`)
|
|
253
520
|
|
|
254
|
-
| Class | Code | When thrown
|
|
255
|
-
| ---------------------------- | --------------------------------------- |
|
|
256
|
-
| `RouterSyncError` | `PLAY_ROUTER_SYNC_FAILED` | `syncActorFromRouter()` cannot send a `play.route` event
|
|
257
|
-
| `DuplicateBridgeError` | `PLAY_ROUTER_DUPLICATE_BRIDGE` | A second bridge tries to connect to an actor that already has one
|
|
258
|
-
| `URLPatternUnavailableError` | `PLAY_ROUTE_MAP_URLPATTERN_UNAVAILABLE` | The URLPattern API is absent, and no polyfill is loaded
|
|
259
|
-
| `InvalidRoutePatternError` | `PLAY_ROUTE_MAP_INVALID_PATTERN` |
|
|
260
|
-
| `EmptyRoutePathError` | `PLAY_ROUTE_EMPTY_PATH` | A state declares `meta.route: ""`
|
|
261
|
-
| `InvalidStateIdError` | `PLAY_ROUTE_INVALID_STATE_ID` | A route names a state ID that the machine graph does not hold
|
|
262
|
-
| `DuplicateRoutePathError` | `PLAY_ROUTE_DUPLICATE_PATH` | Two or more states share the same URL path
|
|
263
|
-
| `UnknownStateTypeError` | `PLAY_ROUTE_UNKNOWN_STATE_TYPE` | A state node has an XState `.type` value that the package does not know
|
|
521
|
+
| Class | Code | When thrown |
|
|
522
|
+
| ---------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
523
|
+
| `RouterSyncError` | `PLAY_ROUTER_SYNC_FAILED` | `syncActorFromRouter()` cannot send a `play.route` event |
|
|
524
|
+
| `DuplicateBridgeError` | `PLAY_ROUTER_DUPLICATE_BRIDGE` | A second bridge tries to connect to an actor that already has one |
|
|
525
|
+
| `URLPatternUnavailableError` | `PLAY_ROUTE_MAP_URLPATTERN_UNAVAILABLE` | The URLPattern API is absent, and no polyfill is loaded |
|
|
526
|
+
| `InvalidRoutePatternError` | `PLAY_ROUTE_MAP_INVALID_PATTERN` | A route pattern does not compile, or two of its params land on one URLPattern group |
|
|
527
|
+
| `EmptyRoutePathError` | `PLAY_ROUTE_EMPTY_PATH` | A state declares `meta.route: ""` |
|
|
528
|
+
| `InvalidStateIdError` | `PLAY_ROUTE_INVALID_STATE_ID` | A route names a state ID that the machine graph does not hold |
|
|
529
|
+
| `DuplicateRoutePathError` | `PLAY_ROUTE_DUPLICATE_PATH` | Two or more states share the same URL path |
|
|
530
|
+
| `UnknownStateTypeError` | `PLAY_ROUTE_UNKNOWN_STATE_TYPE` | A state node has an XState `.type` value that the package does not know |
|
|
531
|
+
| `InvalidBasePathError` | `PLAY_ROUTER_INVALID_BASE_PATH` | A `basePath` resolves to one concrete prefix never (`*`, `:p?`, `$p`, `?`, `#`, a scheme, `.`/`..`, whitespace) |
|
|
532
|
+
| `MissingBasePathParamError` | `PLAY_ROUTER_MISSING_BASE_PATH_PARAM` | A `:param` of a `basePath` has no value in `basePathParams` |
|
|
264
533
|
|
|
265
534
|
```typescript
|
|
266
535
|
import {
|
|
@@ -388,12 +657,18 @@ MIT — see [LICENSE](LICENSE).
|
|
|
388
657
|
|
|
389
658
|
## Interfaces
|
|
390
659
|
|
|
660
|
+
- [BasePathOptions](interfaces/BasePathOptions.md)
|
|
391
661
|
- [BuildPlayRouteEventOptions](interfaces/BuildPlayRouteEventOptions.md)
|
|
662
|
+
- [FrameworkParamsSource](interfaces/FrameworkParamsSource.md)
|
|
392
663
|
- [LocationLike](interfaces/LocationLike.md)
|
|
393
664
|
- [MachineEdgeData](interfaces/MachineEdgeData.md)
|
|
394
665
|
- [MachineNodeData](interfaces/MachineNodeData.md)
|
|
666
|
+
- [MountableRouterBridge](interfaces/MountableRouterBridge.md)
|
|
667
|
+
- [OpenProviderBridgeArgs](interfaces/OpenProviderBridgeArgs.md)
|
|
395
668
|
- [PlayActor](interfaces/PlayActor.md)
|
|
396
669
|
- [PlayRouteEvent](interfaces/PlayRouteEvent.md)
|
|
670
|
+
- [PlayRouterProviderBaseProps](interfaces/PlayRouterProviderBaseProps.md)
|
|
671
|
+
- [ResolvedBasePath](interfaces/ResolvedBasePath.md)
|
|
397
672
|
- [ResolvedRoutePath](interfaces/ResolvedRoutePath.md)
|
|
398
673
|
- [RoutableActor](interfaces/RoutableActor.md)
|
|
399
674
|
- [RouteInfo](interfaces/RouteInfo.md)
|
|
@@ -403,6 +678,7 @@ MIT — see [LICENSE](LICENSE).
|
|
|
403
678
|
- [RouteNode](interfaces/RouteNode.md)
|
|
404
679
|
- [RouteObject](interfaces/RouteObject.md)
|
|
405
680
|
- [RouterBridge](interfaces/RouterBridge.md)
|
|
681
|
+
- [RouterConnection](interfaces/RouterConnection.md)
|
|
406
682
|
- [RouteTree](interfaces/RouteTree.md)
|
|
407
683
|
- [RouteWatcherHandle](interfaces/RouteWatcherHandle.md)
|
|
408
684
|
- [WindowLike](interfaces/WindowLike.md)
|
|
@@ -411,14 +687,22 @@ MIT — see [LICENSE](LICENSE).
|
|
|
411
687
|
|
|
412
688
|
- [~~BaseRouteMapping~~](type-aliases/BaseRouteMapping.md)
|
|
413
689
|
- [MachineGraph](type-aliases/MachineGraph.md)
|
|
690
|
+
- [PlayRouterBridgeConstructor](type-aliases/PlayRouterBridgeConstructor.md)
|
|
414
691
|
- [RouteMetadata](type-aliases/RouteMetadata.md)
|
|
415
692
|
|
|
693
|
+
## Variables
|
|
694
|
+
|
|
695
|
+
- [DISPOSE](variables/DISPOSE.md)
|
|
696
|
+
- [NO\_BASE\_PATH](variables/NO_BASE_PATH.md)
|
|
697
|
+
|
|
416
698
|
## Functions
|
|
417
699
|
|
|
418
700
|
- [buildPlayRouteEvent](functions/buildPlayRouteEvent.md)
|
|
419
701
|
- [buildRouteTree](functions/buildRouteTree.md)
|
|
702
|
+
- [cleanFrameworkParams](functions/cleanFrameworkParams.md)
|
|
420
703
|
- [createRouteMap](functions/createRouteMap.md)
|
|
421
704
|
- [createRouteMapFromTree](functions/createRouteMapFromTree.md)
|
|
705
|
+
- [createRouterConnection](functions/createRouterConnection.md)
|
|
422
706
|
- [detectDuplicateRoutes](functions/detectDuplicateRoutes.md)
|
|
423
707
|
- [extractMachineRoutes](functions/extractMachineRoutes.md)
|
|
424
708
|
- [extractQuery](functions/extractQuery.md)
|
|
@@ -426,11 +710,24 @@ MIT — see [LICENSE](LICENSE).
|
|
|
426
710
|
- [findRouteById](functions/findRouteById.md)
|
|
427
711
|
- [findRouteByPath](functions/findRouteByPath.md)
|
|
428
712
|
- [getNavigableRoutes](functions/getNavigableRoutes.md)
|
|
713
|
+
- [getPatternParamNames](functions/getPatternParamNames.md)
|
|
714
|
+
- [getRequiredPatternParamNames](functions/getRequiredPatternParamNames.md)
|
|
429
715
|
- [getRoutableRoutes](functions/getRoutableRoutes.md)
|
|
716
|
+
- [getRouteMappings](functions/getRouteMappings.md)
|
|
430
717
|
- [getTransitionReachableRoutes](functions/getTransitionReachableRoutes.md)
|
|
718
|
+
- [isMountableBridge](functions/isMountableBridge.md)
|
|
431
719
|
- [isRouteReachable](functions/isRouteReachable.md)
|
|
720
|
+
- [joinBasePath](functions/joinBasePath.md)
|
|
432
721
|
- [machineToGraph](functions/machineToGraph.md)
|
|
722
|
+
- [mountKey](functions/mountKey.md)
|
|
723
|
+
- [normalizeBasePath](functions/normalizeBasePath.md)
|
|
724
|
+
- [openProviderBridge](functions/openProviderBridge.md)
|
|
725
|
+
- [pickOwnParams](functions/pickOwnParams.md)
|
|
726
|
+
- [repointProviderBridge](functions/repointProviderBridge.md)
|
|
727
|
+
- [resolveBasePath](functions/resolveBasePath.md)
|
|
728
|
+
- [resolveFrameworkParams](functions/resolveFrameworkParams.md)
|
|
433
729
|
- [routeExists](functions/routeExists.md)
|
|
434
730
|
- [sanitizePathname](functions/sanitizePathname.md)
|
|
731
|
+
- [stripBasePath](functions/stripBasePath.md)
|
|
435
732
|
- [validateRouteFormat](functions/validateRouteFormat.md)
|
|
436
733
|
- [validateStateExists](functions/validateStateExists.md)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: RouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [base-route-map.ts:105](https://gitlab.com/xmachin-es/xmachines-js/-/blob/
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:105](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-router/src/base-route-map.ts#L105)
|
|
6
6
|
|
|
7
7
|
The shared base class of the route map for both directions.
|
|
8
8
|
|
|
@@ -58,7 +58,7 @@ map.getPathByStateId("missing"); // null
|
|
|
58
58
|
new RouteMap(mappings, options?): RouteMap;
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
Defined in: [base-route-map.ts:133](https://gitlab.com/xmachin-es/xmachines-js/-/blob/
|
|
61
|
+
Defined in: [play-router/src/base-route-map.ts:133](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-router/src/base-route-map.ts#L133)
|
|
62
62
|
|
|
63
63
|
Builds a route map from an array of the mappings between a state ID and a path.
|
|
64
64
|
|
|
@@ -87,7 +87,7 @@ candidates is therefore efficient.
|
|
|
87
87
|
getPathByStateId(stateId): string | null;
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Defined in: [base-route-map.ts:
|
|
90
|
+
Defined in: [play-router/src/base-route-map.ts:229](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-router/src/base-route-map.ts#L229)
|
|
91
91
|
|
|
92
92
|
Returns the path pattern of a state ID.
|
|
93
93
|
|
|
@@ -123,7 +123,7 @@ map.getPathByStateId("missing"); // null
|
|
|
123
123
|
getStateIdByPath(path): string | null;
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
Defined in: [base-route-map.ts:
|
|
126
|
+
Defined in: [play-router/src/base-route-map.ts:189](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v3.0.0/packages/play-router/src/base-route-map.ts#L189)
|
|
127
127
|
|
|
128
128
|
Resolves a URL path to its state ID.
|
|
129
129
|
|