@xmachines/docs 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -13
- package/api/@xmachines/play/README.md +58 -63
- package/api/@xmachines/play/classes/NonNullableError.md +7 -7
- package/api/@xmachines/play/classes/PlayError.md +25 -27
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
- package/api/@xmachines/play-actor/README.md +72 -63
- package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
- package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
- package/api/@xmachines/play-dom/README.md +119 -85
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom-router/README.md +66 -49
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +63 -54
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +37 -28
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +94 -82
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +34 -29
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +40 -31
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +38 -34
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +67 -48
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +67 -17
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +55 -17
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +67 -17
- package/api/@xmachines/play-tanstack-solid-router/README.md +72 -45
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +67 -17
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +37 -35
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +65 -56
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +72 -70
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
- package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
- package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
- package/api/@xmachines/shared/README.md +11 -13
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/contributing/development.md +28 -0
- package/guides/inspector.md +1 -1
- package/package.json +1 -1
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
|
@@ -4,22 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
**TanStack Solid Router adapter for XMachines Universal Player Architecture**
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-tanstack-solid-router)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Part of the [xmachines-js](../../README.md) monorepo.
|
|
9
|
+
This package integrates TanStack Solid Router with the TC39 Signals. The logic then drives the navigation through the Solid.js reactivity.
|
|
12
10
|
|
|
13
11
|
## Overview
|
|
14
12
|
|
|
15
13
|
[`@xmachines/play-tanstack-solid-router`](README.md) connects a Play actor to TanStack Solid Router through `TanStackSolidRouterBridge`.
|
|
16
14
|
|
|
17
|
-
The bridge extends `RouterBridgeBase` from [`@xmachines/play-router`](../play-router/README.md)
|
|
15
|
+
The bridge extends `RouterBridgeBase` from [`@xmachines/play-router`](../play-router/README.md). Each adapter therefore behaves in the same way in every framework:
|
|
18
16
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
17
|
+
- The actor route signal (`actor.currentRoute`) drives the router navigation.
|
|
18
|
+
- Each router history event sends a `play.route` intent to the actor.
|
|
19
|
+
- The actor keeps the ownership of each guarded state transition (Actor Authority).
|
|
20
|
+
- `RouterBridgeBase` stops a circular update.
|
|
23
21
|
|
|
24
22
|
## Installation
|
|
25
23
|
|
|
@@ -36,31 +34,53 @@ pnpm add @xmachines/play-tanstack-solid-router @xmachines/play-router
|
|
|
36
34
|
|
|
37
35
|
## Current Exports
|
|
38
36
|
|
|
39
|
-
- `TanStackSolidRouterBridge` — primary adapter class
|
|
40
|
-
- `PlayRouterProvider` — Solid component
|
|
37
|
+
- `TanStackSolidRouterBridge` — the primary adapter class
|
|
38
|
+
- `PlayRouterProvider` — the Solid component that manages the bridge lifecycle
|
|
41
39
|
- `PlayRouterProviderProps`, `TanStackRouterInstance` (types)
|
|
42
|
-
- `PlayActor` — canonical actor shape (`AbstractActor & Routable & Viewable`) from `@xmachines/play-router
|
|
43
|
-
- `RoutableActor` — deprecated alias
|
|
40
|
+
- `PlayActor` — the canonical actor shape (`AbstractActor & Routable & Viewable`) from `@xmachines/play-router`. Use it for the type of a renderer callback of `PlayRouterProvider`
|
|
41
|
+
- `RoutableActor` — the deprecated alias of `PlayActor`. Use `PlayActor` from `@xmachines/play-router`
|
|
44
42
|
- `RouteMap`, `createRouteMap`, `RouteMapping`, `RouteMapOptions` (re-exported from `@xmachines/play-router`)
|
|
45
43
|
- `TanStackRouterLike` (type)
|
|
46
44
|
- `RouterBridge`, `PlayRouteEvent` (types)
|
|
47
45
|
|
|
48
46
|
## URLPattern Support
|
|
49
47
|
|
|
50
|
-
This package
|
|
48
|
+
This package matches each route pattern with the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern), through [`@xmachines/play-router`](../play-router/README.md).
|
|
51
49
|
|
|
52
|
-
URLPattern is
|
|
50
|
+
URLPattern is native in Node.js 24+ and in a modern browser (Chrome 95+, Firefox 117+, Safari 16.4+). In an older environment, load a polyfill **before** you import this package. See [`@xmachines/play-router`](../play-router/README.md) for the details.
|
|
53
51
|
|
|
54
52
|
## Quick Start
|
|
55
53
|
|
|
56
54
|
```tsx
|
|
57
|
-
import { createRouter } from "@tanstack/solid-router";
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
55
|
+
import { createRouter, createRootRoute, createRoute } from "@tanstack/solid-router";
|
|
56
|
+
import { createMachine } from "xstate";
|
|
57
|
+
import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
|
|
58
|
+
import { extractMachineRoutes, getRoutableRoutes } from "@xmachines/play-router";
|
|
60
59
|
import { TanStackSolidRouterBridge, createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
61
60
|
|
|
61
|
+
const machine = createMachine(
|
|
62
|
+
formatPlayRouteTransitions({
|
|
63
|
+
id: "app",
|
|
64
|
+
initial: "home",
|
|
65
|
+
states: {
|
|
66
|
+
home: { id: "home", meta: { route: "/" } },
|
|
67
|
+
about: { id: "about", meta: { route: "/about" } },
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
62
72
|
const routeMap = createRouteMap(machine);
|
|
63
|
-
|
|
73
|
+
|
|
74
|
+
// Mirror the machine's routable states as TanStack routes
|
|
75
|
+
const rootRoute = createRootRoute();
|
|
76
|
+
const tanstackRoutes = getRoutableRoutes(extractMachineRoutes(machine)).map((route) =>
|
|
77
|
+
createRoute({
|
|
78
|
+
getParentRoute: () => rootRoute,
|
|
79
|
+
path: route.fullPath.replace(/:(\w+)/g, "$$$1"),
|
|
80
|
+
component: () => null,
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
const router = createRouter({ routeTree: rootRoute.addChildren(tanstackRoutes) });
|
|
64
84
|
|
|
65
85
|
const actor = definePlayer({ machine })();
|
|
66
86
|
actor.start();
|
|
@@ -74,12 +94,13 @@ bridge.disconnect();
|
|
|
74
94
|
|
|
75
95
|
### Solid convenience wrapper
|
|
76
96
|
|
|
77
|
-
Use `PlayRouterProvider` when you want
|
|
97
|
+
Use `PlayRouterProvider` when you want a component to manage the bridge lifecycle:
|
|
78
98
|
|
|
79
99
|
```tsx
|
|
80
100
|
import { PlayRouterProvider } from "@xmachines/play-tanstack-solid-router";
|
|
81
101
|
import { RouterProvider } from "@tanstack/solid-router";
|
|
82
102
|
|
|
103
|
+
// actor, router, and routeMap from the Quick Start above
|
|
83
104
|
<PlayRouterProvider
|
|
84
105
|
actor={actor}
|
|
85
106
|
router={router}
|
|
@@ -94,7 +115,7 @@ import { RouterProvider } from "@tanstack/solid-router";
|
|
|
94
115
|
|
|
95
116
|
### `TanStackSolidRouterBridge`
|
|
96
117
|
|
|
97
|
-
|
|
118
|
+
The primary adapter class. It extends `RouterBridgeBase`.
|
|
98
119
|
|
|
99
120
|
```ts
|
|
100
121
|
class TanStackSolidRouterBridge {
|
|
@@ -107,14 +128,15 @@ class TanStackSolidRouterBridge {
|
|
|
107
128
|
|
|
108
129
|
**Behavior:**
|
|
109
130
|
|
|
110
|
-
- `connect()` — subscribes to `router.history`,
|
|
111
|
-
- `disconnect()` —
|
|
112
|
-
-
|
|
113
|
-
-
|
|
131
|
+
- `connect()` — subscribes to `router.history`, sets the actor state from `router.history.location` for a deep link, and then watches `actor.currentRoute` for a state-driven navigation.
|
|
132
|
+
- `disconnect()` — cancels the subscription to the history and stops all the synchronization.
|
|
133
|
+
- It navigates with `router.navigate({ to: path })`.
|
|
134
|
+
- It subscribes with `router.history.subscribe`. This covers PUSH, POP, BACK, FORWARD, REPLACE, and GO, and it works when no `<RouterProvider>` is mounted.
|
|
135
|
+
- It waits for the `router.load()` of a history event before it synchronizes the actor. A mounted `<RouterProvider>` defers the refresh of `router.latestLocation`, and without the wait TanStack drops the corrective navigation for a refused URL. See the [`@xmachines/play-tanstack-router` README](../play-tanstack-router/README.md) for the details.
|
|
114
136
|
|
|
115
137
|
### `PlayRouterProvider`
|
|
116
138
|
|
|
117
|
-
Solid component
|
|
139
|
+
This Solid component creates a `TanStackSolidRouterBridge`, connects it, and cleans it up for you.
|
|
118
140
|
|
|
119
141
|
```ts
|
|
120
142
|
interface PlayRouterProviderProps<TActor extends PlayActor = PlayActor> {
|
|
@@ -129,11 +151,11 @@ interface PlayRouterProviderProps<TActor extends PlayActor = PlayActor> {
|
|
|
129
151
|
}
|
|
130
152
|
```
|
|
131
153
|
|
|
132
|
-
The
|
|
154
|
+
The component creates the bridge synchronously, during its own evaluation, because this is the execution model of Solid. It disconnects the bridge in `onCleanup`, when Solid disposes of the component.
|
|
133
155
|
|
|
134
156
|
### `RouteMap` and `createRouteMap`
|
|
135
157
|
|
|
136
|
-
|
|
158
|
+
These two exports map each state ID to a URL path, and each URL back to a state ID.
|
|
137
159
|
|
|
138
160
|
```ts
|
|
139
161
|
const routeMap = new RouteMap([
|
|
@@ -145,13 +167,17 @@ const routeMap = new RouteMap([
|
|
|
145
167
|
routeMap.getStateIdByPath("/profile/123"); // "profile"
|
|
146
168
|
routeMap.getPathByStateId("home"); // "/"
|
|
147
169
|
routeMap.getStateIdByPath("/unknown"); // null
|
|
170
|
+
```
|
|
148
171
|
|
|
149
|
-
|
|
172
|
+
Or build from a machine directly:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
150
175
|
import { createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
151
|
-
|
|
176
|
+
|
|
177
|
+
const routeMap = createRouteMap(machine); // machine: your routable machine (states carry meta.route)
|
|
152
178
|
```
|
|
153
179
|
|
|
154
|
-
`getStateIdByPath` returns `null
|
|
180
|
+
`getStateIdByPath` returns `null`, not `undefined`, for a path that it cannot match.
|
|
155
181
|
|
|
156
182
|
## Usage Patterns
|
|
157
183
|
|
|
@@ -169,7 +195,7 @@ const routeMap = new RouteMap([
|
|
|
169
195
|
|
|
170
196
|
### Protected Routes and Guards
|
|
171
197
|
|
|
172
|
-
|
|
198
|
+
The auth guards are inside the state machine only. Unauthorized content therefore never appears, not even for a moment:
|
|
173
199
|
|
|
174
200
|
```ts
|
|
175
201
|
const machineConfig = {
|
|
@@ -185,13 +211,13 @@ const machineConfig = {
|
|
|
185
211
|
};
|
|
186
212
|
```
|
|
187
213
|
|
|
188
|
-
|
|
214
|
+
A user navigates to `/dashboard`, and the user is not authenticated:
|
|
189
215
|
|
|
190
|
-
1. TanStack Router updates location.
|
|
191
|
-
2.
|
|
192
|
-
3.
|
|
193
|
-
4.
|
|
194
|
-
5.
|
|
216
|
+
1. TanStack Router updates the location.
|
|
217
|
+
2. The bridge receives the change and sends `play.route` to the actor.
|
|
218
|
+
3. The actor evaluates the guard. The guard refuses the transition, and the actor moves to `login`.
|
|
219
|
+
4. The bridge reads the new actor route (`/login`).
|
|
220
|
+
5. The bridge calls `router.navigate({ to: "/login" })`.
|
|
195
221
|
|
|
196
222
|
### Full App Example
|
|
197
223
|
|
|
@@ -201,6 +227,7 @@ import { onCleanup } from "solid-js";
|
|
|
201
227
|
import { PlayRouterProvider, createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
202
228
|
import { definePlayer } from "@xmachines/play-xstate";
|
|
203
229
|
import { extractMachineRoutes, getRoutableRoutes } from "@xmachines/play-router";
|
|
230
|
+
import { authMachine } from "./auth-machine.js"; // your routable machine (states carry meta.route)
|
|
204
231
|
|
|
205
232
|
const createPlayer = definePlayer({ machine: authMachine });
|
|
206
233
|
const actor = createPlayer();
|
|
@@ -246,12 +273,12 @@ export default function App() {
|
|
|
246
273
|
|
|
247
274
|
Bridge-first data flow:
|
|
248
275
|
|
|
249
|
-
1. `RouterBridgeBase.connect()`
|
|
250
|
-
2.
|
|
251
|
-
3. TanStack history updates
|
|
252
|
-
4.
|
|
276
|
+
1. `RouterBridgeBase.connect()` does the first synchronization between the actor and the router. It sends both the pathname and the query string of `router.history.location` to the actor.
|
|
277
|
+
2. Each actor route update, through the `actor.currentRoute` signal, calls the TanStack navigation (`router.navigate({ to })`).
|
|
278
|
+
3. The bridge subscribes to the TanStack history updates. It converts each update into a `play.route` event, then sends the event to the actor.
|
|
279
|
+
4. The guards of the actor accept or refuse each transition. The infrastructure reflects the state that results.
|
|
253
280
|
|
|
254
|
-
|
|
281
|
+
The routing infrastructure therefore stays passive, and the state machine keeps the control of the business logic.
|
|
255
282
|
|
|
256
283
|
## Testing
|
|
257
284
|
|
|
@@ -267,7 +294,7 @@ Or from the package directory:
|
|
|
267
294
|
pnpm test
|
|
268
295
|
```
|
|
269
296
|
|
|
270
|
-
**Browser tests** (`test/browser/**/*.browser.test.ts`) run
|
|
297
|
+
**Browser tests** (`test/browser/**/*.browser.test.ts`) run in real Chromium through Playwright. They cover the asynchronous sequences that jsdom cannot reproduce: BACK and FORWARD navigation through `router.history.subscribe`, echo suppression under real microtask timing, the check of each `navigate({ to })` call, and subscriber teardown on `disconnect()` and on `dispose()`.
|
|
271
298
|
|
|
272
299
|
```bash
|
|
273
300
|
# Run browser tests only
|
|
@@ -279,7 +306,7 @@ Coverage thresholds: lines 80%, functions 80%, branches 70%, statements 80%.
|
|
|
279
306
|
## Related Packages
|
|
280
307
|
|
|
281
308
|
- [@xmachines/play-router](../play-router/README.md) — core router primitives and `RouterBridgeBase`
|
|
282
|
-
- [@xmachines/play-tanstack-react-router](../play-tanstack-react-router/README.md) — TanStack Router (React)
|
|
309
|
+
- [@xmachines/play-tanstack-react-router](../play-tanstack-react-router/README.md) — the same adapter for TanStack Router (React)
|
|
283
310
|
- [@xmachines/play-solid](../play-solid/README.md) — SolidJS renderer
|
|
284
311
|
- [@xmachines/play-solid-router](../play-solid-router/README.md) — native `@solidjs/router` adapter
|
|
285
312
|
- [@xmachines/play-xstate](../play-xstate/README.md) — XState v5 player factory
|
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: RouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:105](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/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
|
|
|
9
|
-
|
|
10
|
-
own and
|
|
9
|
+
Every framework adapter uses this class as its route map. An adapter adds no logic
|
|
10
|
+
of its own, and it inherits the complete public API from here.
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**The strategy of a lookup:**
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
of routes
|
|
17
|
-
-
|
|
18
|
-
|
|
14
|
+
- A static path, without a `:param` → a `Map` lookup in O(1)
|
|
15
|
+
- A dynamic path → a scan of the bucket index in O(k), with `URLPattern`, where
|
|
16
|
+
`k` is the number of the routes with the same first path segment
|
|
17
|
+
- The class keeps each result of a first match in an LRU cache. The default size
|
|
18
|
+
is 500 entries, and the `cacheSize` constructor option changes it
|
|
19
19
|
|
|
20
|
-
**
|
|
20
|
+
**The syntax of a pattern** (`:param`, `:param?`, and `*`):
|
|
21
21
|
|
|
22
|
-
- `:param` —
|
|
23
|
-
- `:param?` — optional segment
|
|
24
|
-
- `*` — wildcard
|
|
22
|
+
- `:param` — a necessary segment. It matches exactly one segment without a `/`
|
|
23
|
+
- `:param?` — an optional segment. It matches zero segments or one segment without a `/`
|
|
24
|
+
- `*` — a wildcard. It matches each number of segments, as URLPattern defines
|
|
25
25
|
|
|
26
|
-
**
|
|
27
|
-
`"#stateId"` or `"stateId"
|
|
28
|
-
`getStateIdByPath` returns the stateId exactly as
|
|
29
|
-
`getPathByStateId` accepts both forms.
|
|
30
|
-
forms
|
|
26
|
+
**The forms of a stateId:** you can register a stateId, and you can look one up,
|
|
27
|
+
in the form `"#stateId"` or in the form `"stateId"`. `RouteMap` makes the
|
|
28
|
+
canonical form itself. `getStateIdByPath` returns the stateId exactly as you
|
|
29
|
+
registered it, and `getPathByStateId` accepts both forms. A registration of the
|
|
30
|
+
same stateId in both forms gives one entry, and the later registration wins for
|
|
31
|
+
the lookup in the other direction.
|
|
31
32
|
|
|
32
33
|
## Example
|
|
33
34
|
|
|
@@ -57,21 +58,22 @@ map.getPathByStateId("missing"); // null
|
|
|
57
58
|
new RouteMap(mappings, options?): RouteMap;
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
61
|
+
Defined in: [play-router/src/base-route-map.ts:133](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-router/src/base-route-map.ts#L133)
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
Builds a route map from an array of the mappings between a state ID and a path.
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
buckets
|
|
65
|
+
The constructor puts each static path, which holds no `:param`, into a `Map` for a
|
|
66
|
+
lookup in O(1). It compiles each parameterized path to a `URLPattern`, and it
|
|
67
|
+
groups the patterns into the buckets of the first segment. The selection of the
|
|
68
|
+
candidates is therefore efficient.
|
|
67
69
|
|
|
68
70
|
#### Parameters
|
|
69
71
|
|
|
70
|
-
| Parameter | Type | Description
|
|
71
|
-
| -------------------- | ------------------------------------------------- |
|
|
72
|
-
| `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] |
|
|
73
|
-
| `options` | \{ `cacheSize?`: `number`; \} |
|
|
74
|
-
| `options.cacheSize?` | `number` | -
|
|
72
|
+
| Parameter | Type | Description |
|
|
73
|
+
| -------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] | The array of the `{ stateId, path }` entries. The order gives the priority when more than one pattern can match the same path. |
|
|
75
|
+
| `options` | \{ `cacheSize?`: `number`; \} | The optional configuration. `options.cacheSize`: the maximum number of the resolved parameterized path lookups in the cache. The default is `500`. Raise it for an application with many different values in a parameterized URL, for example a page of a user profile with thousands of different IDs. After an eviction, the path goes to the bucket pattern scan in O(k) again, which is correct but slower. The smallest effective value is `1`, because QuickLRU requires it. |
|
|
76
|
+
| `options.cacheSize?` | `number` | - |
|
|
75
77
|
|
|
76
78
|
#### Returns
|
|
77
79
|
|
|
@@ -85,31 +87,31 @@ buckets for efficient candidate selection.
|
|
|
85
87
|
getPathByStateId(stateId): string | null;
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
90
|
+
Defined in: [play-router/src/base-route-map.ts:225](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-router/src/base-route-map.ts#L225)
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
Returns the path pattern of a state ID.
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
The method accepts the stateId in the form `"#stateId"` and in the form
|
|
95
|
+
`"stateId"`, and the form of the registration has no effect. The method makes the
|
|
96
|
+
canonical form itself. Therefore a consumer tries never both forms.
|
|
95
97
|
|
|
96
98
|
#### Parameters
|
|
97
99
|
|
|
98
|
-
| Parameter | Type | Description
|
|
99
|
-
| --------- | -------- |
|
|
100
|
-
| `stateId` | `string` |
|
|
100
|
+
| Parameter | Type | Description |
|
|
101
|
+
| --------- | -------- | --------------------------------------------------------------------------- |
|
|
102
|
+
| `stateId` | `string` | The state ID of the state machine, for example `"profile"` or `"#settings"` |
|
|
101
103
|
|
|
102
104
|
#### Returns
|
|
103
105
|
|
|
104
106
|
`string` \| `null`
|
|
105
107
|
|
|
106
|
-
The registered path pattern, or `null`
|
|
108
|
+
The registered path pattern, or `null` when the state ID is unknown
|
|
107
109
|
|
|
108
110
|
#### Example
|
|
109
111
|
|
|
110
112
|
```typescript
|
|
111
113
|
map.getPathByStateId("profile"); // "/profile/:userId"
|
|
112
|
-
map.getPathByStateId("#profile"); // "/profile/:userId"
|
|
114
|
+
map.getPathByStateId("#profile"); // "/profile/:userId" — the same entry
|
|
113
115
|
map.getPathByStateId("missing"); // null
|
|
114
116
|
```
|
|
115
117
|
|
|
@@ -121,25 +123,25 @@ map.getPathByStateId("missing"); // null
|
|
|
121
123
|
getStateIdByPath(path): string | null;
|
|
122
124
|
```
|
|
123
125
|
|
|
124
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
126
|
+
Defined in: [play-router/src/base-route-map.ts:185](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-router/src/base-route-map.ts#L185)
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
Resolves a URL path to its state ID.
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
lookup first, then
|
|
130
|
-
|
|
130
|
+
The method removes the query string and the hash fragment before the match. It
|
|
131
|
+
tries an exact lookup in O(1) first, then it uses the pattern match on the bucket
|
|
132
|
+
index. It keeps each result of a first pattern match in the cache.
|
|
131
133
|
|
|
132
134
|
#### Parameters
|
|
133
135
|
|
|
134
|
-
| Parameter | Type | Description
|
|
135
|
-
| --------- | -------- |
|
|
136
|
-
| `path` | `string` | URL pathname
|
|
136
|
+
| Parameter | Type | Description |
|
|
137
|
+
| --------- | -------- | -------------------------------------------------------------------------------------- |
|
|
138
|
+
| `path` | `string` | The URL pathname. It can hold a query and a hash, for example `"/profile/123?ref=nav"` |
|
|
137
139
|
|
|
138
140
|
#### Returns
|
|
139
141
|
|
|
140
142
|
`string` \| `null`
|
|
141
143
|
|
|
142
|
-
The
|
|
144
|
+
The state ID of the path, or `null` when no route matches
|
|
143
145
|
|
|
144
146
|
#### Example
|
|
145
147
|
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: TanStackSolidRouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:
|
|
5
|
+
Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L43)
|
|
6
6
|
|
|
7
|
-
TanStack Solid Router adapter
|
|
7
|
+
TanStack Solid Router adapter that implements the RouterBridge protocol through TanStackRouterBridgeBase
|
|
8
8
|
|
|
9
9
|
## Remarks
|
|
10
10
|
|
|
11
|
-
All behavior
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
All the behavior is in the shared `TanStackRouterBridgeBase`. Its own
|
|
12
|
+
documentation gives the reason for the history subscription and the rules of the
|
|
13
|
+
first synchronization. This subclass binds the adapter to the Solid version of
|
|
14
|
+
TanStack Router, and it keeps the `dispose()` alias.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
Call `onCleanup(() => bridge.disconnect())` in your Solid component. The bridge
|
|
17
|
+
then disconnects on unmount.
|
|
17
18
|
|
|
18
19
|
## Extends
|
|
19
20
|
|
|
@@ -30,17 +31,17 @@ new TanStackSolidRouterBridge(
|
|
|
30
31
|
routeMap): TanStackSolidRouterBridge;
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
Defined in: [play-tanstack-router/src/tanstack-router-bridge-base.ts:
|
|
34
|
+
Defined in: [play-tanstack-router/src/tanstack-router-bridge-base.ts:150](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-tanstack-router/src/tanstack-router-bridge-base.ts#L150)
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
Creates a TanStack Router bridge
|
|
36
37
|
|
|
37
38
|
#### Parameters
|
|
38
39
|
|
|
39
|
-
| Parameter | Type | Description
|
|
40
|
-
| ---------- | ----------------------------------------------------------------------------------------- |
|
|
41
|
-
| `router` | [`TanStackRouterLike`](../type-aliases/TanStackRouterLike.md) | TanStack Router instance
|
|
42
|
-
| `actor` | [`RoutableActor`](../../play-dom-router/interfaces/RoutableActor.md) | XMachines actor instance
|
|
43
|
-
| `routeMap` | [`TanStackRouteMapLike`](../../play-tanstack-router/type-aliases/TanStackRouteMapLike.md) |
|
|
40
|
+
| Parameter | Type | Description |
|
|
41
|
+
| ---------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
42
|
+
| `router` | [`TanStackRouterLike`](../type-aliases/TanStackRouterLike.md) | The TanStack Router instance from `createRouter` |
|
|
43
|
+
| `actor` | [`RoutableActor`](../../play-dom-router/interfaces/RoutableActor.md) | The XMachines actor instance |
|
|
44
|
+
| `routeMap` | [`TanStackRouteMapLike`](../../play-tanstack-router/type-aliases/TanStackRouteMapLike.md) | The bidirectional map between the state IDs and the paths |
|
|
44
45
|
|
|
45
46
|
#### Returns
|
|
46
47
|
|
|
@@ -58,21 +59,23 @@ Create a TanStack Router bridge
|
|
|
58
59
|
connect(): void;
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
Defined in: [play-router/src/router-bridge-base.ts:
|
|
62
|
+
Defined in: [play-router/src/router-bridge-base.ts:158](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-router/src/router-bridge-base.ts#L158)
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
Connects the router bridge to the Actor.
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
starts
|
|
66
|
+
The method installs the TC39 Signal watcher of the direction from the actor to the
|
|
67
|
+
router. It then starts the watch of the router changes, which each framework does
|
|
68
|
+
in its own way.
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
The order of these steps is part of the contract of the bridge:
|
|
69
71
|
|
|
70
|
-
- `lastSyncedPath`
|
|
71
|
-
- the actor watcher
|
|
72
|
-
-
|
|
72
|
+
- The constructor seeds `lastSyncedPath` from `actor.currentRoute`
|
|
73
|
+
- The method installs the actor watcher before the router subscriptions of the adapter
|
|
74
|
+
- The first synchronization then separates a deep link from a restore, with `actor.initialRoute`
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
`getInitialRouterPath()
|
|
76
|
+
An adapter that needs a different behavior of the first synchronization overrides
|
|
77
|
+
`getInitialRouterPath()`. It does not change the order of the steps of
|
|
78
|
+
`connect()`.
|
|
76
79
|
|
|
77
80
|
#### Returns
|
|
78
81
|
|
|
@@ -90,11 +93,12 @@ Adapters that need custom initial-sync behavior should override
|
|
|
90
93
|
disconnect(): void;
|
|
91
94
|
```
|
|
92
95
|
|
|
93
|
-
Defined in: [play-router/src/router-bridge-base.ts:
|
|
96
|
+
Defined in: [play-router/src/router-bridge-base.ts:270](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-router/src/router-bridge-base.ts#L270)
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
Disconnects the router bridge from the Actor.
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
The method stops the watch of the signal, and it removes the router listener of the
|
|
101
|
+
framework.
|
|
98
102
|
|
|
99
103
|
#### Returns
|
|
100
104
|
|
|
@@ -106,16 +110,20 @@ Stops signal watching and unregisters framework-specific router listener.
|
|
|
106
110
|
|
|
107
111
|
---
|
|
108
112
|
|
|
109
|
-
### dispose()
|
|
113
|
+
### ~~dispose()~~
|
|
110
114
|
|
|
111
115
|
```ts
|
|
112
116
|
dispose(): void;
|
|
113
117
|
```
|
|
114
118
|
|
|
115
|
-
Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:
|
|
119
|
+
Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L49)
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
Disposes of the bridge. This method is the alias of disconnect.
|
|
118
122
|
|
|
119
123
|
#### Returns
|
|
120
124
|
|
|
121
125
|
`void`
|
|
126
|
+
|
|
127
|
+
#### Deprecated
|
|
128
|
+
|
|
129
|
+
Use [disconnect](#disconnect). Will be removed in the next major.
|
|
@@ -6,17 +6,18 @@
|
|
|
6
6
|
function createPlayRouterProvider<TRouter>(BridgeCtor): <TActor>(props) => any;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-tanstack-solid-router/src/create-play-router-provider.tsx:
|
|
9
|
+
Defined in: [play-tanstack-solid-router/src/create-play-router-provider.tsx:78](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.1/packages/play-tanstack-solid-router/src/create-play-router-provider.tsx#L78)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Creates a Solid `PlayRouterProvider` component of one bridge class.
|
|
12
12
|
|
|
13
|
-
The
|
|
14
|
-
|
|
13
|
+
The component of the return value connects a `PlayerActor` to the framework
|
|
14
|
+
router. It keeps the actor state and the browser URL in step, in both directions.
|
|
15
15
|
|
|
16
|
-
The
|
|
17
|
-
execution model
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
The component creates the bridge synchronously, during its own evaluation, because
|
|
17
|
+
this is the execution model of Solid. It disconnects the bridge in `onCleanup`,
|
|
18
|
+
when Solid disposes of the component. React is different: the stability of a prop
|
|
19
|
+
is no concern here, because the `props` accessor of Solid is reactive already, and
|
|
20
|
+
the component creates the bridge one time for each of its instances.
|
|
20
21
|
|
|
21
22
|
## Type Parameters
|
|
22
23
|
|
|
@@ -26,14 +27,15 @@ already reactive and the bridge is created once per component instance.
|
|
|
26
27
|
|
|
27
28
|
## Parameters
|
|
28
29
|
|
|
29
|
-
| Parameter | Type | Description
|
|
30
|
-
| ------------ | -------------------------------------------------------------------------------------------- |
|
|
31
|
-
| `BridgeCtor` | [`PlayRouterBridgeConstructor`](../type-aliases/PlayRouterBridgeConstructor.md)\<`TRouter`\> |
|
|
30
|
+
| Parameter | Type | Description |
|
|
31
|
+
| ------------ | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
32
|
+
| `BridgeCtor` | [`PlayRouterBridgeConstructor`](../type-aliases/PlayRouterBridgeConstructor.md)\<`TRouter`\> | The bridge class. The provider builds it as `new BridgeCtor(router, actor, routeMap)`. |
|
|
32
33
|
|
|
33
34
|
## Returns
|
|
34
35
|
|
|
35
|
-
A `PlayRouterProvider` component
|
|
36
|
-
`renderer` callback receives the same concrete actor type
|
|
36
|
+
A `PlayRouterProvider` component. It is generic over the actor type.
|
|
37
|
+
Therefore the `renderer` callback receives the same concrete actor type as the
|
|
38
|
+
prop.
|
|
37
39
|
|
|
38
40
|
\<`TActor`\>(`props`) => `any`
|
|
39
41
|
|