@xmachines/docs 3.0.0 → 4.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 +8 -16
- package/api/@xmachines/play/README.md +11 -100
- package/api/@xmachines/play/errors/README.md +8 -0
- package/api/@xmachines/play/{classes → errors/classes}/NonNullableError.md +6 -6
- package/api/@xmachines/play/{classes → errors/classes}/PlayError.md +35 -10
- package/api/@xmachines/play/index/README.md +75 -0
- package/api/@xmachines/play/{functions → index/functions}/asCleanup.md +2 -2
- package/api/@xmachines/play/{functions → index/functions}/assertNonNullable.md +2 -2
- package/api/@xmachines/{play-actor → play/index}/functions/shallowEqualExcept.md +3 -3
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/Cleanup.md +3 -3
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/DisposeKey.md +2 -2
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/PlayEvent.md +4 -4
- package/api/@xmachines/play/{variables → index/variables}/DISPOSE.md +2 -2
- package/api/@xmachines/play-actor/README.md +78 -229
- package/api/@xmachines/play-actor/interfaces/ActorEvent.md +18 -0
- package/api/@xmachines/play-actor/interfaces/PlayActor.md +73 -0
- package/api/@xmachines/play-dom/README.md +28 -40
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +12 -11
- package/api/@xmachines/play-dom/functions/asCleanup.md +78 -0
- package/api/@xmachines/play-dom/functions/createPlayUI.md +4 -4
- package/api/@xmachines/play-dom/functions/createRenderer.md +1 -1
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +6 -6
- package/api/@xmachines/play-dom/type-aliases/Cleanup.md +2 -2
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +29 -12
- package/api/@xmachines/play-dom-router/README.md +70 -70
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +22 -21
- package/api/@xmachines/{play-vue-router → play-dom-router}/classes/RouteMap.md +12 -6
- package/api/@xmachines/play-dom-router/functions/asCleanup.md +78 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +3 -8
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +9 -3
- package/api/@xmachines/play-dom-router/functions/createRouter.md +8 -14
- package/api/@xmachines/play-dom-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +70 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +24 -21
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +4 -4
- 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 +8 -8
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +36 -23
- package/api/@xmachines/play-dom-router/type-aliases/Cleanup.md +2 -2
- package/api/@xmachines/play-dom-router/variables/DISPOSE.md +2 -2
- package/api/@xmachines/play-react/README.md +17 -39
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -10
- 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 +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +6 -6
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -3
- 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/variables/schema.md +52 -0
- package/api/@xmachines/play-react-router/README.md +22 -50
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +17 -16
- package/api/@xmachines/play-react-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +4 -4
- 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 +17 -7
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-router/README.md +104 -196
- package/api/@xmachines/play-router/errors/README.md +15 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateBridgeError.md +191 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/EmptyRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-router/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-router/errors/classes/InvalidStateIdError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-router/errors/classes/RouterSyncError.md +192 -0
- package/api/@xmachines/play-router/errors/classes/UnknownStateTypeError.md +182 -0
- package/api/@xmachines/play-router/index/README.md +75 -0
- package/api/@xmachines/play-router/{classes → index/classes}/RouteMap.md +12 -6
- package/api/@xmachines/play-router/{classes → index/classes}/RouterBridgeBase.md +19 -17
- package/api/@xmachines/play-router/{functions → index/functions}/buildPlayRouteEvent.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/buildRouteTree.md +14 -4
- package/api/@xmachines/play-router/{functions → index/functions}/cleanFrameworkParams.md +3 -4
- package/api/@xmachines/play-router/{functions → index/functions}/createRouteMapFromTree.md +13 -6
- package/api/@xmachines/play-router/{functions → index/functions}/createRouterConnection.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/detectDuplicateRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractQuery.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractRouteParams.md +3 -3
- package/api/@xmachines/play-router/{functions → index/functions}/findRouteById.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/findRouteByPath.md +2 -2
- package/api/@xmachines/play-router/index/functions/getPatternParamNames.md +29 -0
- package/api/@xmachines/play-router/index/functions/getRequiredPatternParamNames.md +39 -0
- package/api/@xmachines/play-router/{functions → index/functions}/isMountableBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/joinBasePath.md +37 -0
- package/api/@xmachines/play-router/{functions → index/functions}/mountKey.md +2 -2
- package/api/@xmachines/play-router/index/functions/normalizeBasePath.md +43 -0
- package/api/@xmachines/play-router/{functions → index/functions}/openProviderBridge.md +14 -14
- package/api/@xmachines/play-router/index/functions/pickOwnParams.md +41 -0
- package/api/@xmachines/play-router/{functions → index/functions}/repointProviderBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/resolveBasePath.md +51 -0
- package/api/@xmachines/play-router/{functions → index/functions}/resolveFrameworkParams.md +11 -13
- package/api/@xmachines/play-router/{functions → index/functions}/sanitizePathname.md +2 -2
- package/api/@xmachines/play-router/index/functions/stripBasePath.md +44 -0
- package/api/@xmachines/play-router/{functions → index/functions}/validateRouteFormat.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/validateStateExists.md +2 -2
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/BasePathOptions.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/BuildPlayRouteEventOptions.md +13 -0
- package/api/@xmachines/play-router/index/interfaces/FrameworkParamsSource.md +47 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/LocationLike.md +6 -6
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/MountableRouterBridge.md +9 -9
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/OpenProviderBridgeArgs.md +13 -13
- package/api/@xmachines/play-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/PlayRouterProviderBaseProps.md +15 -15
- package/api/@xmachines/play-router/index/interfaces/ResolvedBasePath.md +14 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/ResolvedRoutePath.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/Routable.md +26 -0
- package/api/@xmachines/play-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/RouteMatch.md +12 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteNode.md +13 -13
- package/api/@xmachines/play-router/index/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-router/index/interfaces/RouteTree.md +27 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteWatcherHandle.md +7 -7
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterBridge.md +5 -5
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterConnection.md +10 -10
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/WindowLike.md +4 -4
- package/api/@xmachines/play-router/index/type-aliases/PlayRouterBridgeConstructor.md +46 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/{play-xstate → play-router/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-router/index/variables/NO_BASE_PATH.md +18 -0
- package/api/@xmachines/play-router/index/variables/ROOT_NODE_ID.md +18 -0
- package/api/@xmachines/play-router/xstate/README.md +53 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/createRouteMap.md +8 -6
- package/api/@xmachines/play-router/{functions → xstate/functions}/extractMachineRoutes.md +4 -4
- package/api/@xmachines/play-router/xstate/functions/getNavigableRoutes.md +35 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRoutableRoutes.md +6 -6
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRouteMappings.md +7 -7
- package/api/@xmachines/play-router/{functions → xstate/functions}/getTransitionReachableRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/isRouteReachable.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/machineToGraph.md +2 -2
- package/api/@xmachines/play-router/xstate/functions/routeExists.md +26 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineEdgeData.md +15 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineNodeData.md +17 -0
- package/api/@xmachines/play-router/{type-aliases → xstate/type-aliases}/MachineGraph.md +2 -2
- package/api/@xmachines/play-signals/README.md +2 -24
- package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
- 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 +2 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +14 -31
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -3
- 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/variables/schema.md +71 -0
- package/api/@xmachines/play-solid-router/README.md +31 -52
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +30 -53
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +38 -35
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +12 -12
- package/api/@xmachines/play-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +17 -7
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- 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 +11 -26
- 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 +1 -1
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +12 -12
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-svelte/variables/schema.md +16 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +22 -41
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +22 -21
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-svelte-spa-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-svelte-spa-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +4 -4
- 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 +8 -8
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/README.md +17 -35
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +22 -21
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-sveltekit-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-sveltekit-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +4 -4
- 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 +8 -8
- package/api/@xmachines/play-tanstack-react-router/README.md +19 -43
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +18 -17
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.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 +17 -7
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- 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 +6 -4
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +17 -20
- 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 +26 -52
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +49 -45
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +4 -4
- 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 +17 -7
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- 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-url/README.md +69 -0
- package/api/@xmachines/play-url/errors/README.md +17 -0
- package/api/@xmachines/play-url/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-url/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-url/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-url/index/README.md +65 -0
- package/api/@xmachines/play-url/index/functions/cleanFrameworkParams.md +39 -0
- package/api/@xmachines/play-url/index/functions/getCandidates.md +29 -0
- package/api/@xmachines/play-url/index/functions/getCompiledPattern.md +31 -0
- package/api/@xmachines/play-url/index/functions/getIndexKey.md +30 -0
- package/api/@xmachines/play-url/index/functions/getNormalizedParamNameMap.md +32 -0
- package/api/@xmachines/play-url/index/functions/getPatternParamNames.md +29 -0
- package/api/@xmachines/play-url/index/functions/getRequiredPatternParamNames.md +39 -0
- package/api/@xmachines/play-url/index/functions/holdsUnsubstitutedParam.md +36 -0
- package/api/@xmachines/play-url/index/functions/isParameterizedPattern.md +36 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/joinBasePath.md +2 -2
- package/api/@xmachines/{play-router → play-url/index}/functions/normalizeBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/normalizeParamNames.md +36 -0
- package/api/@xmachines/play-url/index/functions/parsePattern.md +27 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/pickOwnParams.md +4 -4
- package/api/@xmachines/{play-router → play-url/index}/functions/resolveBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/resolveFrameworkParams.md +49 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/stripBasePath.md +2 -2
- package/api/@xmachines/play-url/index/interfaces/BasePathOptions.md +28 -0
- package/api/@xmachines/{play-router → play-url/index}/interfaces/FrameworkParamsSource.md +9 -9
- package/api/@xmachines/play-url/index/interfaces/GroupPart.md +15 -0
- package/api/@xmachines/play-url/index/interfaces/LiteralPart.md +14 -0
- package/api/@xmachines/play-url/index/interfaces/ParamPart.md +21 -0
- package/api/@xmachines/play-url/index/interfaces/ParsedPattern.md +23 -0
- package/api/@xmachines/play-url/index/interfaces/PatternParam.md +15 -0
- package/api/@xmachines/{play-router → play-url/index}/interfaces/ResolvedBasePath.md +6 -6
- package/api/@xmachines/play-url/index/type-aliases/PatternModifier.md +11 -0
- package/api/@xmachines/play-url/index/type-aliases/PatternPart.md +9 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternCtor.md +22 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternLike.md +68 -0
- package/api/@xmachines/{play-router → play-url/index}/variables/NO_BASE_PATH.md +2 -2
- package/api/@xmachines/play-url/index/variables/URLPattern.md +21 -0
- package/api/@xmachines/play-view/README.md +165 -0
- package/api/@xmachines/play-view/errors/README.md +17 -0
- package/api/@xmachines/play-view/errors/classes/ReadOnlyContextError.md +192 -0
- package/api/@xmachines/play-view/index/README.md +55 -0
- package/api/@xmachines/{play-actor → play-view/index}/functions/attachRenderErrorHandler.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/functions/composePlayState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createFailureLatch.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createReportGuard.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createViewStoreLifecycle.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/guardContextWrites.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/refreshContextSubtree.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/reuseComposedState.md +3 -3
- package/api/@xmachines/{play-actor → play-view/index}/functions/sameViewInputs.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/toAtomState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/typedSpec.md +2 -2
- package/api/@xmachines/play-view/index/interfaces/BaseActorProviderProps.md +49 -0
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/BaseViewContextValue.md +12 -12
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/FailureLatch.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/PlaySpec.md +8 -8
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuard.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuardMessages.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ResolveViewStoreOptions.md +5 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewInputs.md +7 -7
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreLifecycle.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/Viewable.md +5 -5
- package/api/@xmachines/play-view/index/type-aliases/ViewActor.md +26 -0
- package/api/@xmachines/{play-actor → play-view/index}/variables/CONTEXT_STATE_KEY.md +2 -2
- package/api/@xmachines/play-vue/README.md +15 -33
- 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 +1 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +9 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +11 -11
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -3
- 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/schema.md +71 -0
- package/api/@xmachines/play-vue-router/README.md +34 -77
- package/api/@xmachines/play-vue-router/errors/README.md +8 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterNavigationError.md +193 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterSendError.md +177 -0
- package/api/@xmachines/play-vue-router/index/README.md +20 -0
- package/api/@xmachines/play-vue-router/index/classes/RouteMap.md +157 -0
- package/api/@xmachines/play-vue-router/{classes → index/classes}/VueRouterBridge.md +24 -43
- package/api/@xmachines/play-vue-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-vue-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouterBridge.md +5 -5
- package/api/@xmachines/play-vue-router/{variables → index/variables}/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-xstate/README.md +153 -105
- package/api/@xmachines/play-xstate/errors/README.md +13 -0
- package/api/@xmachines/play-xstate/errors/classes/ActorThrewNonErrorError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidEventError.md +198 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidMachineError.md +169 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteHandlerError.md +197 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteMetadataError.md +176 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingRouteParamError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingStateIdError.md +203 -0
- package/api/@xmachines/play-xstate/index/README.md +38 -0
- package/api/@xmachines/play-xstate/index/classes/PlayerActor.md +584 -0
- package/api/@xmachines/play-xstate/index/functions/compose.md +224 -0
- package/api/@xmachines/play-xstate/index/functions/definePlayer.md +158 -0
- package/api/@xmachines/play-xstate/index/interfaces/PlayerConfig.md +22 -0
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerFactoryResumeOptions.md +3 -3
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerOptions.md +8 -8
- package/api/@xmachines/play-xstate/index/type-aliases/Capability.md +33 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerConstructor.md +39 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerFactory.md +27 -0
- package/api/@xmachines/{play-router → play-xstate/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/README.md +46 -0
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/buildRouteUrl.md +2 -2
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/deriveRoute.md +4 -4
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/formatPlayRouteTransitions.md +2 -2
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/isAbsoluteRoute.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/functions/withRouting.md +36 -0
- package/api/@xmachines/play-xstate/{interfaces → with-routing/interfaces}/RouteContext.md +6 -6
- package/api/@xmachines/play-xstate/with-routing/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteMachineConfig.md +5 -5
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteStateNode.md +21 -7
- package/api/@xmachines/play-xstate/with-view/README.md +31 -0
- package/api/@xmachines/play-xstate/with-view/functions/withView.md +32 -0
- package/api/@xmachines/shared/README.md +10 -32
- 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 +2 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/api/README.md +2 -0
- package/api/llms.txt +15 -10
- package/contributing/architecture.md +94 -66
- package/contributing/configuration.md +85 -26
- package/contributing/deployment.md +30 -28
- package/contributing/development.md +51 -10
- package/contributing/testing.md +87 -28
- package/examples/README.md +9 -7
- package/examples/form-validation.md +3 -2
- package/examples/multi-router-integration.md +61 -39
- package/examples/routing-patterns.md +15 -14
- package/examples/traffic-light.md +11 -5
- package/guides/README.md +1 -0
- package/guides/actor-model.md +35 -26
- package/guides/getting-started.md +49 -46
- package/guides/inspector.md +4 -4
- package/guides/routing.md +245 -0
- package/guides/state-machines.md +16 -17
- package/package.json +10 -9
- package/rfc/play.md +35 -22
- package/api/@xmachines/play-actor/classes/AbstractActor.md +0 -505
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +0 -48
- package/api/@xmachines/play-actor/interfaces/Routable.md +0 -14
- package/api/@xmachines/play-dom/type-aliases/DisposablePlayUI.md +0 -36
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-dom-router/interfaces/DisposableBrowserHistory.md +0 -262
- package/api/@xmachines/play-dom-router/interfaces/DisposableVanillaRouter.md +0 -80
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +0 -122
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +0 -13
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +0 -35
- package/api/@xmachines/play-router/functions/getPatternParamNames.md +0 -24
- package/api/@xmachines/play-router/functions/getRequiredPatternParamNames.md +0 -36
- package/api/@xmachines/play-router/functions/routeExists.md +0 -26
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +0 -15
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +0 -17
- package/api/@xmachines/play-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +0 -65
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +0 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +0 -21
- package/api/@xmachines/play-router/interfaces/RouteTree.md +0 -21
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +0 -13
- package/api/@xmachines/play-router/type-aliases/PlayRouterBridgeConstructor.md +0 -36
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +0 -11
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +0 -471
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +0 -29
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +0 -31
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +0 -9
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +0 -39
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +0 -13
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +0 -13
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +0 -568
- package/api/@xmachines/play-xstate/functions/composeGuards.md +0 -86
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +0 -72
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +0 -43
- package/api/@xmachines/play-xstate/functions/definePlayer.md +0 -78
- package/api/@xmachines/play-xstate/functions/eventMatches.md +0 -45
- package/api/@xmachines/play-xstate/functions/hasContext.md +0 -45
- package/api/@xmachines/play-xstate/functions/negateGuard.md +0 -67
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +0 -20
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +0 -19
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +0 -36
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +0 -23
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +0 -26
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +0 -9
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-xstate](../README.md) / with-routing
|
|
2
|
+
|
|
3
|
+
# with-routing
|
|
4
|
+
|
|
5
|
+
The routing capability of an XState actor, as a mixin.
|
|
6
|
+
|
|
7
|
+
`PlayerActor` holds `state` and `send`, and nothing about a route. This module adds
|
|
8
|
+
`currentRoute` and `initialRoute`, which is what `Routable` of `@xmachines/play-router`
|
|
9
|
+
asks for and what every router bridge reads.
|
|
10
|
+
|
|
11
|
+
It is a SEPARATE entry point, `@xmachines/play-xstate/routing`, and the core imports it
|
|
12
|
+
never. `@xmachines/play-router` is an OPTIONAL peer of this package for the same reason:
|
|
13
|
+
an application that declares no route installs neither that package nor the route map
|
|
14
|
+
and the bridge that it carries.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { definePlayer, PlayerActor, compose } from "@xmachines/play-xstate";
|
|
20
|
+
import { withRouting } from "@xmachines/play-xstate/routing";
|
|
21
|
+
|
|
22
|
+
const createPlayer = definePlayer({ machine, actor: compose(PlayerActor, withRouting) });
|
|
23
|
+
const actor = createPlayer();
|
|
24
|
+
actor.currentRoute.get(); // "/profile/alice"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Interfaces
|
|
28
|
+
|
|
29
|
+
- [RouteContext](interfaces/RouteContext.md)
|
|
30
|
+
- [RouteObject](interfaces/RouteObject.md)
|
|
31
|
+
|
|
32
|
+
## Type Aliases
|
|
33
|
+
|
|
34
|
+
- [RouteData](type-aliases/RouteData.md)
|
|
35
|
+
- [RouteDataResolver](type-aliases/RouteDataResolver.md)
|
|
36
|
+
- [RouteMachineConfig](type-aliases/RouteMachineConfig.md)
|
|
37
|
+
- [RouteMetadata](type-aliases/RouteMetadata.md)
|
|
38
|
+
- [RouteStateNode](type-aliases/RouteStateNode.md)
|
|
39
|
+
|
|
40
|
+
## Functions
|
|
41
|
+
|
|
42
|
+
- [buildRouteUrl](functions/buildRouteUrl.md)
|
|
43
|
+
- [deriveRoute](functions/deriveRoute.md)
|
|
44
|
+
- [formatPlayRouteTransitions](functions/formatPlayRouteTransitions.md)
|
|
45
|
+
- [isAbsoluteRoute](functions/isAbsoluteRoute.md)
|
|
46
|
+
- [withRouting](functions/withRouting.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / buildRouteUrl
|
|
2
2
|
|
|
3
3
|
# Function: buildRouteUrl()
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function buildRouteUrl(routeTemplate, context?): string;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/build-url.ts:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/build-url.ts:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/build-url.ts#L38)
|
|
10
10
|
|
|
11
11
|
Builds a complete URL from a route template and the context of the actor.
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / deriveRoute
|
|
2
2
|
|
|
3
3
|
# Function: deriveRoute()
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function deriveRoute(stateMeta): string | null;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/derive-route.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/derive-route.ts:93](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/derive-route.ts#L93)
|
|
10
10
|
|
|
11
11
|
Derives the route from the metadata of an XState state
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ The template of the route path, which can hold a :param, or null when the functi
|
|
|
37
37
|
The basic read of a route
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
|
-
import { deriveRoute } from "@xmachines/play-xstate";
|
|
40
|
+
import { deriveRoute } from "@xmachines/play-xstate/routing";
|
|
41
41
|
import { setup } from "xstate";
|
|
42
42
|
|
|
43
43
|
const machine = setup({}).createMachine({
|
|
@@ -95,7 +95,7 @@ console.log(route); // "/dashboard"
|
|
|
95
95
|
|
|
96
96
|
## See
|
|
97
97
|
|
|
98
|
-
- [Play RFC](
|
|
98
|
+
- [Play RFC](../../../../../rfc/play.md)
|
|
99
99
|
- [buildRouteUrl](buildRouteUrl.md) for the construction of a URL, with the substitution of each parameter
|
|
100
100
|
- [isAbsoluteRoute](isAbsoluteRoute.md) for the test of an absolute path
|
|
101
101
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / formatPlayRouteTransitions
|
|
2
2
|
|
|
3
3
|
# Function: formatPlayRouteTransitions()
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function formatPlayRouteTransitions<T>(machineConfig): T;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:216](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L216)
|
|
10
10
|
|
|
11
11
|
Makes the play.route transitions from the declarative route configs
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / isAbsoluteRoute
|
|
2
2
|
|
|
3
3
|
# Function: isAbsoluteRoute()
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function isAbsoluteRoute(path): boolean;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/derive-route.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/derive-route.ts:269](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/derive-route.ts#L269)
|
|
10
10
|
|
|
11
11
|
Tells you if the route path is absolute
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ true when the path starts with '/'. In every other case, false
|
|
|
29
29
|
## Example
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
-
import { isAbsoluteRoute } from "@xmachines/play-xstate";
|
|
32
|
+
import { isAbsoluteRoute } from "@xmachines/play-xstate/routing";
|
|
33
33
|
|
|
34
34
|
console.log(isAbsoluteRoute("/dashboard")); // true
|
|
35
35
|
console.log(isAbsoluteRoute("settings")); // false
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / withRouting
|
|
2
|
+
|
|
3
|
+
# Function: withRouting()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function withRouting<TMachine>(Base): PlayerConstructor<TMachine, Routable>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-xstate/src/with-routing.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/with-routing.ts#L46)
|
|
10
|
+
|
|
11
|
+
Adds the routing capability to an actor class.
|
|
12
|
+
|
|
13
|
+
The result satisfies `Routable`, so a router bridge accepts it. A class without this
|
|
14
|
+
mixin exposes no `currentRoute`, and a bridge therefore refuses it when it compiles,
|
|
15
|
+
rather than at the first navigation.
|
|
16
|
+
|
|
17
|
+
The mixin declares NO constructor, and that is deliberate: TypeScript demands the
|
|
18
|
+
signature `...args: any[]` from a mixin over a generic base (TS2545), and this
|
|
19
|
+
workspace writes no `any`. A field initializer of a subclass runs after `super()`
|
|
20
|
+
instead, and it reads the inputs that `PlayerActor` keeps for a capability.
|
|
21
|
+
|
|
22
|
+
## Type Parameters
|
|
23
|
+
|
|
24
|
+
| Type Parameter |
|
|
25
|
+
| ---------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) |
|
|
27
|
+
|
|
28
|
+
## Parameters
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Description |
|
|
31
|
+
| --------- | ---------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
32
|
+
| `Base` | [`PlayerConstructor`](../../index/type-aliases/PlayerConstructor.md)\<`TMachine`\> | The actor class to extend, normally `PlayerActor`. |
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
[`PlayerConstructor`](../../index/type-aliases/PlayerConstructor.md)\<`TMachine`, [`Routable`](../../../play-router/index/interfaces/Routable.md)\>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteContext
|
|
2
2
|
|
|
3
3
|
# Interface: RouteContext
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-xstate/src/routing/types.ts:
|
|
5
|
+
Defined in: [packages/play-xstate/src/routing/types.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/types.ts#L28)
|
|
6
6
|
|
|
7
7
|
The context of the route construction, from the machine context.
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ machine that calls `buildRouteUrl` itself must fill `params` itself.
|
|
|
19
19
|
|
|
20
20
|
| Property | Type | Description | Defined in |
|
|
21
21
|
| ------------------------------------------ | ------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
22
|
-
| <a id="property-basepath"></a> `basePath?` | `string` | The base path of a relative route | [packages/play-xstate/src/routing/types.ts:
|
|
23
|
-
| <a id="property-hash"></a> `hash?` | `string` | The hash fragment | [packages/play-xstate/src/routing/types.ts:
|
|
24
|
-
| <a id="property-params"></a> `params?` | `Record`\<`string`, `unknown`\> | The parameters of the path to substitute, for example `:userId` of `/profile/:userId` | [packages/play-xstate/src/routing/types.ts:
|
|
25
|
-
| <a id="property-query"></a> `query?` | `Record`\<`string`, `unknown`\> | The query parameters | [packages/play-xstate/src/routing/types.ts:
|
|
22
|
+
| <a id="property-basepath"></a> `basePath?` | `string` | The base path of a relative route | [packages/play-xstate/src/routing/types.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/types.ts#L30) |
|
|
23
|
+
| <a id="property-hash"></a> `hash?` | `string` | The hash fragment | [packages/play-xstate/src/routing/types.ts:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/types.ts#L36) |
|
|
24
|
+
| <a id="property-params"></a> `params?` | `Record`\<`string`, `unknown`\> | The parameters of the path to substitute, for example `:userId` of `/profile/:userId` | [packages/play-xstate/src/routing/types.ts:32](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/types.ts#L32) |
|
|
25
|
+
| <a id="property-query"></a> `query?` | `Record`\<`string`, `unknown`\> | The query parameters | [packages/play-xstate/src/routing/types.ts:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/types.ts#L34) |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteObject
|
|
2
|
+
|
|
3
|
+
# Interface: RouteObject
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-router/src/types.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L33)
|
|
6
|
+
|
|
7
|
+
A route object, with more metadata.
|
|
8
|
+
|
|
9
|
+
## Indexable
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
[key: string]: unknown
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The additional metadata of the route: a title, a breadcrumb, and so on.
|
|
16
|
+
|
|
17
|
+
CAUTION: `path`, `handler`, `reenter` and `data` are RESERVED. The routing layer
|
|
18
|
+
reads those four names, and a release before this one read `path` alone. A state
|
|
19
|
+
that carries its own `handler` value now throws an `InvalidRouteHandlerError` from
|
|
20
|
+
`formatPlayRouteTransitions`, so the machine builds never; a state that carries its
|
|
21
|
+
own `data` value now writes that value to `context.data`, where the `/context`
|
|
22
|
+
projection of every view reads it. A `reenter` value is read as the FLAG of the
|
|
23
|
+
generated transition, and the literal `true` alone turns the reentry on: the
|
|
24
|
+
default is `false`, and a release before this one generated every transition with
|
|
25
|
+
`reenter: true`. Give such a field another name.
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
| Property | Type | Description | Defined in |
|
|
30
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| <a id="property-data"></a> `data?` | \| [`RouteData`](../type-aliases/RouteData.md) \| [`RouteDataResolver`](../type-aliases/RouteDataResolver.md) | The extra data that the state threads into its `play.route` event. The shape follows `WithDynamicParams` of XState, which is how XState itself parameterizes an action and a guard: the field holds a literal value, OR a function of `{ context, event }` that returns one. `// The literal form. It survives a serialization of the machine. meta: { route: { path: "/doc/:docId", data: { titleKey: "doc.view" } } } // The function form, for a value that depends on the route. meta: { route: { path: "/doc/:docId", data: ({ event }) => ({ title: `Document ${event.params?.docId}` }), }, }` The generated transition resolves the value and assigns it to the `data` field of the context, beside `params` and `query`. The data of a state does NOT merge with the data of its ancestors: each state declares the whole value that its own route carries. This field and [PlayRouteEvent.data](../../../play-dom-router/interfaces/PlayRouteEvent.md#property-data) are two different things, and they meet in the resolver. This field is what the STATE declares, in its machine. `PlayRouteEvent.data` is what the SENDER of the event supplies, such as a router bridge or the code of an application. A resolver reads `event.data` and returns whatever mix of the two the state needs. CAUTION: the function form holds a function inside `meta`, and a function does not survive `JSON.stringify`. A machine that Stately Studio reads, or that a process sends over a wire, must use the literal form. | [packages/play-router/src/types.ts:131](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L131) |
|
|
32
|
+
| <a id="property-handler"></a> `handler?` | `"root"` \| `"local"` \| `"both"` | Where the generated `play.route` transition sits. `"root"` is the default, and it is what XState does: `formatRouteTransitions` installs every route transition on the ROOT of the machine, and each one targets its state by the ID. A route from any state therefore reaches this state. The cost is that the root is the domain of the transition, so XState re-enters each ancestor on the path to the target, and those ancestors run their `entry` actions again although they stay active. `"local"` installs the transition on the PARENT of this state instead, and it targets this state relatively. XState offers the transitions of the deepest active state node first, so the parent answers the event itself and runs its `exit` and its `entry` actions NOT again. `"both"` installs one transition in each place. The local one answers while the parent is active, and the root one answers a route that arrives from outside the parent. Use `"both"` where an ancestor holds an `entry` action that must run one time for each real entry, such as an analytics event or an audit record. CAUTION: `"local"` makes this state reachable by a route ONLY while its parent is active. A `play.route` event that arrives from anywhere else matches no transition and the actor does not move. A browser URL for this state therefore leaves the URL and the actor divergent. Choose `"local"` to SCOPE a route on purpose, for example a step that a person reaches only inside its wizard. Choose `"both"` where the state must stay reachable from everywhere. The field has no effect on a state whose parent IS the root: the root transition of such a state is already local to its parent, so all three values agree. | [packages/play-router/src/types.ts:95](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L95) |
|
|
33
|
+
| <a id="property-path"></a> `path` | `string` | The template of the route path, for example `"/user/:id"`. | [packages/play-router/src/types.ts:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L35) |
|
|
34
|
+
| <a id="property-reenter"></a> `reenter?` | `boolean` | The `reenter` flag of the generated `play.route` transition. The default is `false`, which is also the default of XState. The flag spares the DOMAIN of the transition, and not every ancestor that stays active. Under the default placement `handler: "root"` the domain is the root of the machine, so `false` spares the root alone: each ancestor BETWEEN the root and the target still runs its `exit` and its `entry` actions, because XState re-enters every descendant of the domain that lies on the path to the target. A move between two siblings therefore still runs the `entry` action of their shared parent. [RouteObject.handler](#property-handler) is the field that spares those intermediate ancestors: `"local"` and `"both"` move the domain down to the parent of the state. Use the two fields together where an `entry` action must run one time for each state that the actor really enters. Set the field to `true` where the domain must run its `entry` actions again on every route to a descendant. The flag does not decide the destination. The value of the machine after a route is identical under both settings. A route to a state that has children still enters the `initial` child of that state, because the generated transition targets the state by its id, and XState enters the initial child of an id target under both settings. **See** [Play RFC](../../../../../rfc/play.md) | [packages/play-router/src/types.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L64) |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteData
|
|
2
|
+
|
|
3
|
+
# Type Alias: RouteData
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type RouteData = Record<string, unknown>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-router/src/types.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L15)
|
|
10
|
+
|
|
11
|
+
The resolved extra data of a route. It reaches the consumer on the `data` field of a
|
|
12
|
+
`play.route` event.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteDataResolver
|
|
2
|
+
|
|
3
|
+
# Type Alias: RouteDataResolver
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type RouteDataResolver = (args) => RouteData;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-router/src/types.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L28)
|
|
10
|
+
|
|
11
|
+
The function form of [RouteObject.data](../interfaces/RouteObject.md#property-data).
|
|
12
|
+
|
|
13
|
+
The signature mirrors `WithDynamicParams` of XState: the resolver reads the context
|
|
14
|
+
of the machine and the event that asks for the route, and it returns the data.
|
|
15
|
+
|
|
16
|
+
The resolver reads every field of the event, and `event.data` among them: that field
|
|
17
|
+
carries what the SENDER of the event supplied, and the resolver decides how it
|
|
18
|
+
combines with what the state declares. The `data` that the resolver RETURNS goes to
|
|
19
|
+
`context.data`, and it does not go back onto the event.
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Type |
|
|
24
|
+
| -------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `args` | \{ `context`: `unknown`; `event`: [`PlayRouteEvent`](../../../play-dom-router/interfaces/PlayRouteEvent.md); \} |
|
|
26
|
+
| `args.context` | `unknown` |
|
|
27
|
+
| `args.event` | [`PlayRouteEvent`](../../../play-dom-router/interfaces/PlayRouteEvent.md) |
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
[`RouteData`](RouteData.md)
|
package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteMachineConfig.md
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteMachineConfig
|
|
2
2
|
|
|
3
3
|
# Type Alias: RouteMachineConfig
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type RouteMachineConfig = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:177](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L177)
|
|
10
10
|
|
|
11
11
|
The minimal structural constraint of a machine config that
|
|
12
12
|
`formatPlayRouteTransitions` accepts.
|
|
@@ -32,7 +32,7 @@ original concrete type through the transform. Therefore
|
|
|
32
32
|
optional context?: unknown;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
35
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:178](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L178)
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:7
|
|
|
42
42
|
optional on?: Record<string, unknown>;
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
45
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:180](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L180)
|
|
46
46
|
|
|
47
47
|
---
|
|
48
48
|
|
|
@@ -52,4 +52,4 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:7
|
|
|
52
52
|
optional states?: Record<string, unknown>;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
55
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:179](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L179)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteMetadata
|
|
2
|
+
|
|
3
|
+
# Type Alias: RouteMetadata
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type RouteMetadata = string | RouteObject;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-router/src/types.ts:151](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-router/src/types.ts#L151)
|
|
10
|
+
|
|
11
|
+
The route metadata of the `meta.route` field of a state machine.
|
package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteStateNode.md
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-routing](../README.md) / RouteStateNode
|
|
2
2
|
|
|
3
3
|
# Type Alias: RouteStateNode
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type RouteStateNode = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L30)
|
|
10
10
|
|
|
11
11
|
The minimal structural shape of one XState state node, as
|
|
12
12
|
`formatPlayRouteTransitions` reads it during its walk over the machine config.
|
|
@@ -29,7 +29,7 @@ signature without a change.
|
|
|
29
29
|
optional id?: string;
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
32
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L34)
|
|
33
33
|
|
|
34
34
|
The optional explicit state ID, for example `"home"` or `"settings"`. It is the `#id` target of a `play.route` event.
|
|
35
35
|
|
|
@@ -41,7 +41,7 @@ The optional explicit state ID, for example `"home"` or `"settings"`. It is the
|
|
|
41
41
|
optional meta?: object;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
44
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L36)
|
|
45
45
|
|
|
46
46
|
The state metadata. A `meta.route` field gives the state a route.
|
|
47
47
|
|
|
@@ -52,8 +52,22 @@ optional route?: RouteMetadata;
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
The template of the URL path: the string form, for example
|
|
55
|
-
`"/profile/:username"`, or the object form (`{ path, title }`). Both
|
|
56
|
-
[RouteMetadata](RouteMetadata.md).
|
|
55
|
+
`"/profile/:username"`, or the object form (`{ path, reenter, title }`). Both
|
|
56
|
+
match [RouteMetadata](RouteMetadata.md). The object form declares the `reenter` flag of the
|
|
57
|
+
generated transition, and that flag defaults to `false`.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### on?
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
optional on?: Record<string, unknown>;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L51)
|
|
68
|
+
|
|
69
|
+
The event handlers of this state. The function reads them where a child asks for a
|
|
70
|
+
local `play.route` handler, so that the transitions of the user survive the merge.
|
|
57
71
|
|
|
58
72
|
---
|
|
59
73
|
|
|
@@ -63,6 +77,6 @@ The template of the URL path: the string form, for example
|
|
|
63
77
|
optional states?: Record<string, RouteStateNode>;
|
|
64
78
|
```
|
|
65
79
|
|
|
66
|
-
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:
|
|
80
|
+
Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/routing/format-play-route-transitions.ts#L46)
|
|
67
81
|
|
|
68
82
|
The nested child states. The function walks them for each further route declaration.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-xstate](../README.md) / with-view
|
|
2
|
+
|
|
3
|
+
# with-view
|
|
4
|
+
|
|
5
|
+
The view capability of an XState actor, as a mixin.
|
|
6
|
+
|
|
7
|
+
`PlayerActor` holds `state` and `send`, and nothing about a view. This module adds
|
|
8
|
+
`currentView`, which is what `Viewable` of `@xmachines/play-view` asks for and what
|
|
9
|
+
every renderer reads.
|
|
10
|
+
|
|
11
|
+
It is a SEPARATE entry point, `@xmachines/play-xstate/view`, and the core imports it
|
|
12
|
+
never. `@xmachines/play-view` is an OPTIONAL peer of this package for the same reason:
|
|
13
|
+
an application that renders no view installs neither that package nor the json-render
|
|
14
|
+
types that it names.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { definePlayer, PlayerActor, compose } from "@xmachines/play-xstate";
|
|
20
|
+
import { withRouting } from "@xmachines/play-xstate/routing";
|
|
21
|
+
import { withView } from "@xmachines/play-xstate/view";
|
|
22
|
+
|
|
23
|
+
const createPlayer = definePlayer({
|
|
24
|
+
machine,
|
|
25
|
+
actor: compose(PlayerActor, withRouting, withView),
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Functions
|
|
30
|
+
|
|
31
|
+
- [withView](functions/withView.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [with-view](../README.md) / withView
|
|
2
|
+
|
|
3
|
+
# Function: withView()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function withView<TMachine>(Base): PlayerConstructor<TMachine, Viewable>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-xstate/src/with-view.ts:98](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/with-view.ts#L98)
|
|
10
|
+
|
|
11
|
+
Adds the view capability to an actor class.
|
|
12
|
+
|
|
13
|
+
Compose it AFTER the routing capability. An override calls `super.onSnapshot()` first,
|
|
14
|
+
so `compose(PlayerActor, withRouting, withView)` gives the route its new value before
|
|
15
|
+
the view derives from the same transition. A router bridge therefore sees a guard
|
|
16
|
+
redirect before a renderer sees the view of the state that the guard refused.
|
|
17
|
+
|
|
18
|
+
## Type Parameters
|
|
19
|
+
|
|
20
|
+
| Type Parameter |
|
|
21
|
+
| ---------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) |
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
28
|
+
| `Base` | [`PlayerConstructor`](../../index/type-aliases/PlayerConstructor.md)\<`TMachine`\> | The actor class to extend, normally `PlayerActor` or the result of another capability. |
|
|
29
|
+
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
[`PlayerConstructor`](../../index/type-aliases/PlayerConstructor.md)\<`TMachine`, [`Viewable`](../../../play-view/index/interfaces/Viewable.md)\>
|
|
@@ -22,17 +22,16 @@ In the monorepo, each package refers to it by name:
|
|
|
22
22
|
|
|
23
23
|
## Exports
|
|
24
24
|
|
|
25
|
-
| Export
|
|
26
|
-
|
|
|
27
|
-
| `@xmachines/shared/tsconfig`
|
|
28
|
-
| `@xmachines/shared/tsconfig-test`
|
|
29
|
-
| `@xmachines/shared/oxlint`
|
|
30
|
-
| `@xmachines/shared/oxfmt`
|
|
31
|
-
| `@xmachines/shared/vite-aliases`
|
|
32
|
-
| `@xmachines/shared/vitest`
|
|
33
|
-
| `@xmachines/shared/vitest-setup`
|
|
34
|
-
| `@xmachines/shared/vitest-node-setup`
|
|
35
|
-
| `@xmachines/shared/vitest-urlpattern-setup` | `config/vitest.urlpattern.setup.ts` | Optional URLPattern polyfill setup for route-matching tests |
|
|
25
|
+
| Export | File | Description |
|
|
26
|
+
| ------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `@xmachines/shared/tsconfig` | `config/tsconfig.json` | Base TypeScript configuration for all packages |
|
|
28
|
+
| `@xmachines/shared/tsconfig-test` | `config/tsconfig.test.json` | TypeScript configuration for test files (no emit, `allowImportingTsExtensions`, Vitest globals) |
|
|
29
|
+
| `@xmachines/shared/oxlint` | `config/oxlint.config.ts` | Shared oxlint configuration |
|
|
30
|
+
| `@xmachines/shared/oxfmt` | `config/oxfmt.config.ts` | Shared oxfmt formatter configuration |
|
|
31
|
+
| `@xmachines/shared/vite-aliases` | `config/vite-aliases.ts` | Vite resolve aliases for all `@xmachines/*` workspace packages |
|
|
32
|
+
| `@xmachines/shared/vitest` | `config/vitest.ts` | `defineXmVitestConfig` helper for per-package Vitest configs |
|
|
33
|
+
| `@xmachines/shared/vitest-setup` | `config/vitest.setup.ts` | Shared Vitest setup — extends matchers with `@testing-library/jest-dom` |
|
|
34
|
+
| `@xmachines/shared/vitest-node-setup` | `config/vitest.node.setup.ts` | Node.js runtime guard — asserts `Node.js >= 24` |
|
|
36
35
|
|
|
37
36
|
## Usage
|
|
38
37
|
|
|
@@ -108,17 +107,6 @@ export default defineXmVitestConfig(import.meta.url, {
|
|
|
108
107
|
- `config/vitest.node.setup.ts` — the Node.js runtime guard (the browser mode skips it)
|
|
109
108
|
- `config/vitest.setup.ts` — `@testing-library/jest-dom` matcher extensions
|
|
110
109
|
|
|
111
|
-
For packages that test URL routing, add the URLPattern polyfill setup:
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
export default defineXmVitestConfig(import.meta.url, {
|
|
115
|
-
test: {
|
|
116
|
-
globals: true,
|
|
117
|
-
setupFiles: ["@xmachines/shared/vitest-urlpattern-setup"],
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
110
|
### Vite Aliases
|
|
123
111
|
|
|
124
112
|
In a Vite demo package or app package, resolve every `@xmachines/*` package to its TypeScript source. A build first is not necessary:
|
|
@@ -157,16 +145,6 @@ The base `config/tsconfig.json` configures:
|
|
|
157
145
|
- **Interop:** `verbatimModuleSyntax`, `isolatedModules`
|
|
158
146
|
- **Custom condition:** `"source"` — `xmAliases` uses it to resolve a package to its TypeScript source in development and in a test
|
|
159
147
|
|
|
160
|
-
## Testing
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Run tests for this package
|
|
164
|
-
pnpm --filter @xmachines/shared test
|
|
165
|
-
|
|
166
|
-
# Or from the package directory
|
|
167
|
-
pnpm test
|
|
168
|
-
```
|
|
169
|
-
|
|
170
148
|
## License
|
|
171
149
|
|
|
172
150
|
MIT — see [LICENSE](LICENSE).
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmAliases(importMetaUrl): Record<string, string>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vite-aliases.ts:
|
|
9
|
+
Defined in: [vite-aliases.ts:238](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L238)
|
|
10
10
|
|
|
11
11
|
Vite resolve.alias entries for all @xmachines/* workspace packages.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmCacheDir(importMetaUrl, name): string;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vite-aliases.ts:
|
|
9
|
+
Defined in: [vite-aliases.ts:355](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L355)
|
|
10
10
|
|
|
11
11
|
Returns the shared Vite `cacheDir` for this workspace package.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmOptimizeDeps(include?): DepOptimizationOptions;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vite-aliases.ts:
|
|
9
|
+
Defined in: [vite-aliases.ts:308](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L308)
|
|
10
10
|
|
|
11
11
|
Returns the standard Vite `optimizeDeps` config for browser test projects.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmResolve(importMetaUrl, extra?): ResolveOptions & object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vite-aliases.ts:
|
|
9
|
+
Defined in: [vite-aliases.ts:275](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L275)
|
|
10
10
|
|
|
11
11
|
Full Vite `resolve` config for @xmachines/* workspace packages.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function xmSvelteRunes(): object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vite-aliases.ts:
|
|
9
|
+
Defined in: [vite-aliases.ts:334](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L334)
|
|
10
10
|
|
|
11
11
|
Svelte plugin options that enforce runes mode for workspace sources only.
|
|
12
12
|
|
|
@@ -35,4 +35,4 @@ one and change the other.
|
|
|
35
35
|
|
|
36
36
|
| Name | Type | Defined in |
|
|
37
37
|
| ------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
-
| `dynamicCompileOptions()` | (`data`) => \| \{ `runes`: `boolean`; \} \| `undefined` | [vite-aliases.ts:
|
|
38
|
+
| `dynamicCompileOptions()` | (`data`) => \| \{ `runes`: `boolean`; \} \| `undefined` | [vite-aliases.ts:335](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vite-aliases.ts#L335) |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function defineXmBrowserConfig(importMetaUrl, overrides, options?): UserConfig;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [vitest.ts:
|
|
9
|
+
Defined in: [vitest.ts:209](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/shared/config/vitest.ts#L209)
|
|
10
10
|
|
|
11
11
|
Create a Vitest browser-mode config with XMachines workspace defaults.
|
|
12
12
|
|