@xmachines/docs 1.0.0-beta.25 → 1.0.0-beta.27
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/api/@xmachines/play/classes/PlayError.md +10 -4
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play-actor/README.md +4 -0
- package/api/@xmachines/play-actor/classes/AbstractActor.md +49 -92
- package/api/@xmachines/play-actor/functions/typedSpec.md +57 -0
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +9 -18
- package/api/@xmachines/play-actor/interfaces/Routable.md +5 -21
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +6 -6
- package/api/@xmachines/play-actor/interfaces/Viewable.md +5 -6
- package/api/@xmachines/play-dom/README.md +24 -8
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +4 -4
- package/api/@xmachines/play-dom/functions/connectRenderer.md +1 -1
- package/api/@xmachines/play-dom/functions/defineRegistry.md +61 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +29 -12
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +62 -0
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/DefineRegistryOptions.md +25 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +18 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +13 -10
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +29 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +5 -5
- package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +53 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +16 -3
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +5 -2
- package/api/@xmachines/play-dom-router/README.md +10 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +18 -46
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +38 -0
- package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +16 -16
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +16 -16
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +114 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +50 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +6 -6
- package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-dom-router-demo/README.md +46 -51
- package/api/@xmachines/play-react/README.md +4 -4
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +31 -5
- package/api/@xmachines/play-react/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useBoundProp.md +2 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/functions/useStateBinding.md +2 -0
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-react/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react-router/README.md +5 -1
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +102 -25
- package/api/@xmachines/play-react-router/classes/RouteMap.md +17 -33
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +8 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +21 -11
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +7 -7
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +18 -8
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/README.md +42 -5
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +12 -19
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +100 -25
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromMachine.md +38 -0
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +45 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
- package/api/@xmachines/play-router/functions/extractRouteParams.md +46 -0
- package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
- package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteMap.md +4 -4
- package/api/@xmachines/play-router/interfaces/{BaseRouteMapping.md → RouteMapping.md} +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteNode.md +12 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- 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/namespaces/Signal/classes/Computed.md +6 -0
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +8 -0
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +10 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +2 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +2 -0
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +4 -4
- package/api/@xmachines/play-solid/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/useStateBinding.md +2 -0
- package/api/@xmachines/play-solid/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid-router/README.md +2 -2
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +121 -46
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +15 -9
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +47 -92
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +19 -6
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +21 -18
- package/api/@xmachines/play-solid-router-demo/README.md +25 -28
- package/api/@xmachines/play-svelte/README.md +28 -0
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +9 -9
- package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +2 -0
- package/api/@xmachines/play-svelte/variables/PlayRenderer.md +2 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +1 -0
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +14 -1
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +23 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +6 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +20 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-svelte-spa-router-demo/README.md +119 -12
- package/api/@xmachines/play-sveltekit-router/README.md +2 -1
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +46 -24
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +14 -1
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +23 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +10 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +20 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router-demo/README.md +120 -12
- package/api/@xmachines/play-tanstack-react-router/README.md +5 -3
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +17 -33
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +93 -25
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +21 -11
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +18 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +13 -19
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +23 -29
- package/api/@xmachines/play-tanstack-solid-router/README.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +13 -26
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +101 -36
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +15 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +13 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +23 -24
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +25 -26
- package/api/@xmachines/play-vue/README.md +4 -4
- 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/useStateBinding.md +2 -0
- package/api/@xmachines/play-vue/interfaces/ComponentContext.md +2 -0
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +5 -5
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +2 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -3
- package/api/@xmachines/play-vue/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue-router/README.md +2 -2
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +18 -108
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +44 -104
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +127 -62
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +8 -8
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +19 -7
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-vue-router-demo/README.md +47 -40
- package/api/@xmachines/play-xstate/README.md +15 -15
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +46 -30
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +20 -15
- package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +2 -2
- package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +14 -12
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +3 -7
- package/api/@xmachines/shared/functions/xmAliases.md +1 -1
- package/api/README.md +4 -4
- package/api/llms.txt +3 -3
- package/examples/README.md +50 -32
- package/examples/basic-state-machine.md +75 -31
- package/examples/form-validation.md +199 -127
- package/examples/multi-router-integration.md +312 -230
- package/examples/routing-patterns.md +243 -187
- package/examples/traffic-light.md +114 -65
- package/guides/README.md +29 -15
- package/guides/getting-started.md +224 -144
- package/guides/installation.md +153 -213
- package/package.json +2 -2
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +0 -38
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +0 -33
|
@@ -60,6 +60,28 @@ For anything else (`schema`, `Renderer`, `JsonUIProvider`, context helpers), imp
|
|
|
60
60
|
- If you do not pass a `store`, `PlayRenderer` creates an internal `@xstate/store` atom from `view.spec.state`.
|
|
61
61
|
- If you do pass a `store`, that external store wins and no internal store is created for the view.
|
|
62
62
|
|
|
63
|
+
## Error handling
|
|
64
|
+
|
|
65
|
+
`PlayRenderer` wraps its content in a Svelte 5 `<svelte:boundary>`. Two props control error behavior:
|
|
66
|
+
|
|
67
|
+
- **`fallback`** — a Svelte snippet rendered when `currentView` is `null` (no active view) or when a catalog component throws during render.
|
|
68
|
+
- **`onError`** — a callback invoked when a catalog component throws. Receives the error and a `reset` function that clears the boundary and attempts to re-render.
|
|
69
|
+
|
|
70
|
+
```svelte
|
|
71
|
+
<PlayRenderer
|
|
72
|
+
{actor}
|
|
73
|
+
{registry}
|
|
74
|
+
fallback={errorSnippet}
|
|
75
|
+
onError={(error, reset) => {
|
|
76
|
+
console.error("Render error:", error);
|
|
77
|
+
// Optionally attempt recovery:
|
|
78
|
+
// reset();
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`onError` is optional. When omitted, render errors are silently caught by the boundary and `fallback` is shown if provided. The `reset` parameter follows Svelte 5's `<svelte:boundary onerror>` contract.
|
|
84
|
+
|
|
63
85
|
@xmachines/play-svelte - Svelte renderer for XMachines Play architecture
|
|
64
86
|
|
|
65
87
|
Provides a thin Svelte rendering layer that passively observes actor signals
|
|
@@ -89,3 +111,9 @@ from `@xmachines/play-svelte` rather than `@json-render/svelte` directly.
|
|
|
89
111
|
## Functions
|
|
90
112
|
|
|
91
113
|
- [defineRegistry](functions/defineRegistry.md)
|
|
114
|
+
|
|
115
|
+
## References
|
|
116
|
+
|
|
117
|
+
### getStateValue
|
|
118
|
+
|
|
119
|
+
Renames and re-exports [getBoundProp](variables/getBoundProp.md)
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
function defineRegistry<C, TComponents>(_catalog, options): DefineRegistryResult;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
Defined in: `@json-render/svelte`
|
|
10
|
+
|
|
9
11
|
Create a registry from a catalog with Svelte components and/or actions.
|
|
10
12
|
|
|
11
13
|
Components must accept `BaseComponentProps` as their props interface.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayRendererProps\<TLogic\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-svelte/src/types.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-svelte/src/types.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L13)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -12,11 +12,11 @@ Defined in: [packages/play-svelte/src/types.ts:13](https://gitlab.com/xmachin-es
|
|
|
12
12
|
|
|
13
13
|
## Properties
|
|
14
14
|
|
|
15
|
-
| Property | Type | Description
|
|
16
|
-
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
-
| <a id="property-actions"></a> `actions?` | `object` | -
|
|
18
|
-
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`TLogic`, [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | -
|
|
19
|
-
| <a id="property-fallback"></a> `fallback?` | `Snippet`\<\[\]\> | Svelte snippet rendered when currentView is null (no active view). Also shown when a catalog component throws during render.
|
|
20
|
-
| <a id="property-onerror"></a> `onError?` | (`error`) => `void`
|
|
21
|
-
| <a id="property-registry"></a> `registry` | `ComponentRegistry` | -
|
|
22
|
-
| <a id="property-store"></a> `store?` | `StateStore` | -
|
|
15
|
+
| Property | Type | Description | Defined in |
|
|
16
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| <a id="property-actions"></a> `actions?` | `object` | - | [packages/play-svelte/src/types.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L17) |
|
|
18
|
+
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`TLogic`, [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | - | [packages/play-svelte/src/types.ts:14](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L14) |
|
|
19
|
+
| <a id="property-fallback"></a> `fallback?` | `Snippet`\<\[\]\> | Svelte snippet rendered when currentView is null (no active view). Also shown when a catalog component throws during render. | [packages/play-svelte/src/types.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L22) |
|
|
20
|
+
| <a id="property-onerror"></a> `onError?` | (`error`, `reset`) => `void` | Called when a catalog component throws during render. Receives the thrown error and a `reset` function that clears the boundary and attempts to re-render. Matches Svelte 5's `<svelte:boundary onerror>` signature. | [packages/play-svelte/src/types.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L28) |
|
|
21
|
+
| <a id="property-registry"></a> `registry` | `ComponentRegistry` | - | [packages/play-svelte/src/types.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L15) |
|
|
22
|
+
| <a id="property-store"></a> `store?` | `StateStore` | - | [packages/play-svelte/src/types.ts:16](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte/src/types.ts#L16) |
|
|
@@ -42,6 +42,7 @@ const disconnect = connectRouter({ actor, routeMap });
|
|
|
42
42
|
- [PlayRouteEvent](interfaces/PlayRouteEvent.md)
|
|
43
43
|
- [RouteMapping](interfaces/RouteMapping.md)
|
|
44
44
|
- [RouterBridge](interfaces/RouterBridge.md)
|
|
45
|
+
- [WindowLike](interfaces/WindowLike.md)
|
|
45
46
|
|
|
46
47
|
## Type Aliases
|
|
47
48
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: RouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [play-
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L100)
|
|
6
6
|
|
|
7
7
|
Shared bidirectional route map base class.
|
|
8
8
|
|
|
@@ -14,7 +14,8 @@ own and inherit the full public API from here.
|
|
|
14
14
|
- Static paths (no `:param`) → O(1) `Map` lookup
|
|
15
15
|
- Dynamic paths → O(k) bucket-indexed scan using `URLPattern`, where `k` is the number
|
|
16
16
|
of routes sharing the same first path segment
|
|
17
|
-
- Results are cached after the first match
|
|
17
|
+
- Results are cached after the first match in an LRU cache (default 500 entries,
|
|
18
|
+
configurable via the `cacheSize` constructor option)
|
|
18
19
|
|
|
19
20
|
**Pattern syntax** (`:param` / `:param?`):
|
|
20
21
|
|
|
@@ -41,19 +42,15 @@ map.getPathByStateId("profile"); // "/profile/:userId"
|
|
|
41
42
|
map.getPathByStateId("missing"); // null
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
## Extends
|
|
45
|
-
|
|
46
|
-
- [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md)
|
|
47
|
-
|
|
48
45
|
## Constructors
|
|
49
46
|
|
|
50
47
|
### Constructor
|
|
51
48
|
|
|
52
49
|
```ts
|
|
53
|
-
new RouteMap(mappings):
|
|
50
|
+
new RouteMap(mappings, options?): BaseRouteMap;
|
|
54
51
|
```
|
|
55
52
|
|
|
56
|
-
Defined in: play-router/
|
|
53
|
+
Defined in: [play-router/src/base-route-map.ts:125](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L125)
|
|
57
54
|
|
|
58
55
|
Build a route map from an array of state ID ↔ path mappings.
|
|
59
56
|
|
|
@@ -63,17 +60,15 @@ buckets for efficient candidate selection.
|
|
|
63
60
|
|
|
64
61
|
#### Parameters
|
|
65
62
|
|
|
66
|
-
| Parameter
|
|
67
|
-
|
|
|
68
|
-
| `mappings`
|
|
63
|
+
| Parameter | Type | Description |
|
|
64
|
+
| -------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
65
|
+
| `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] | Array of `{ stateId, path }` entries. Order determines priority when multiple patterns could match the same path. |
|
|
66
|
+
| `options` | \{ `cacheSize?`: `number`; \} | Optional configuration. `options.cacheSize`: Maximum number of resolved parameterized path lookups to cache. Defaults to `500`. Increase for applications with many unique parameterized URL values (e.g. user profile pages with thousands of distinct IDs). After eviction the path falls back to the O(k) bucket pattern scan — correct but slower. Minimum effective value is `1` (QuickLRU constraint). |
|
|
67
|
+
| `options.cacheSize?` | `number` | - |
|
|
69
68
|
|
|
70
69
|
#### Returns
|
|
71
70
|
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
#### Inherited from
|
|
75
|
-
|
|
76
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`constructor`](../../play-router/classes/BaseRouteMap.md#constructor)
|
|
71
|
+
`BaseRouteMap`
|
|
77
72
|
|
|
78
73
|
## Methods
|
|
79
74
|
|
|
@@ -83,7 +78,7 @@ buckets for efficient candidate selection.
|
|
|
83
78
|
getPathByStateId(stateId): string | null;
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
Defined in: play-router/
|
|
81
|
+
Defined in: [play-router/src/base-route-map.ts:209](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L209)
|
|
87
82
|
|
|
88
83
|
Look up the path pattern registered for a state ID.
|
|
89
84
|
|
|
@@ -106,10 +101,6 @@ map.getPathByStateId("profile"); // "/profile/:userId"
|
|
|
106
101
|
map.getPathByStateId("missing"); // null
|
|
107
102
|
```
|
|
108
103
|
|
|
109
|
-
#### Inherited from
|
|
110
|
-
|
|
111
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getPathByStateId`](../../play-router/classes/BaseRouteMap.md#getpathbystateid)
|
|
112
|
-
|
|
113
104
|
---
|
|
114
105
|
|
|
115
106
|
### getStateIdByPath()
|
|
@@ -118,7 +109,7 @@ map.getPathByStateId("missing"); // null
|
|
|
118
109
|
getStateIdByPath(path): string | null;
|
|
119
110
|
```
|
|
120
111
|
|
|
121
|
-
Defined in: play-router/
|
|
112
|
+
Defined in: [play-router/src/base-route-map.ts:174](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L174)
|
|
122
113
|
|
|
123
114
|
Resolve a URL path to its mapped state ID.
|
|
124
115
|
|
|
@@ -144,7 +135,3 @@ The mapped state ID, or `null` if no route matches
|
|
|
144
135
|
map.getStateIdByPath("/profile/123"); // "profile"
|
|
145
136
|
map.getStateIdByPath("/unknown"); // null
|
|
146
137
|
```
|
|
147
|
-
|
|
148
|
-
#### Inherited from
|
|
149
|
-
|
|
150
|
-
[`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getStateIdByPath`](../../play-router/classes/BaseRouteMap.md#getstateidbypath)
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
function connectRouter(options): () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-svelte-spa-router/src/connect-router.ts:
|
|
9
|
+
Defined in: [play-svelte-spa-router/src/connect-router.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/connect-router.ts#L30)
|
|
10
|
+
|
|
11
|
+
Connect svelte-spa-router to actor.
|
|
12
|
+
|
|
13
|
+
Returns a cleanup function. The public API surface is unchanged (D-14).
|
|
10
14
|
|
|
11
15
|
## Parameters
|
|
12
16
|
|
|
@@ -17,3 +21,12 @@ Defined in: [play-svelte-spa-router/src/connect-router.ts:46](https://gitlab.com
|
|
|
17
21
|
## Returns
|
|
18
22
|
|
|
19
23
|
() => `void`
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { connectRouter, createRouteMap } from "@xmachines/play-svelte-spa-router";
|
|
29
|
+
const routeMap = createRouteMap(machine);
|
|
30
|
+
const disconnect = connectRouter({ actor, routeMap });
|
|
31
|
+
onDestroy(() => disconnect());
|
|
32
|
+
```
|
|
@@ -6,14 +6,33 @@
|
|
|
6
6
|
function createRouteMap(machine): RouteMap;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-
|
|
9
|
+
Defined in: [play-router/src/create-route-map-from-machine.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/create-route-map-from-machine.ts#L26)
|
|
10
|
+
|
|
11
|
+
Create a `BaseRouteMap` from an XState state machine.
|
|
12
|
+
|
|
13
|
+
Extracts all routable states (those with `meta.route`) and builds a bidirectional
|
|
14
|
+
path ↔ stateId lookup structure. The returned map is used by `RouterBridgeBase`
|
|
15
|
+
subclasses to translate browser URL changes into `play.route` actor events and
|
|
16
|
+
vice-versa.
|
|
10
17
|
|
|
11
18
|
## Parameters
|
|
12
19
|
|
|
13
|
-
| Parameter | Type |
|
|
14
|
-
| --------- | ------------------------------------------------------------------------- |
|
|
15
|
-
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) |
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| --------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
22
|
+
| `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine with `meta.route` annotations on states. |
|
|
16
23
|
|
|
17
24
|
## Returns
|
|
18
25
|
|
|
19
26
|
[`RouteMap`](../classes/RouteMap.md)
|
|
27
|
+
|
|
28
|
+
A `BaseRouteMap` for passing to any `RouterBridgeBase`-based adapter.
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createRouteMapFromMachine } from "@xmachines/play-router";
|
|
34
|
+
import { connectRouter } from "@xmachines/play-dom-router";
|
|
35
|
+
|
|
36
|
+
const routeMap = createRouteMapFromMachine(myMachine);
|
|
37
|
+
const disconnect = connectRouter({ actor, router, routeMap });
|
|
38
|
+
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ConnectRouterOptions
|
|
4
4
|
|
|
5
|
-
Defined in: [play-svelte-spa-router/src/connect-router.ts:
|
|
5
|
+
Defined in: [play-svelte-spa-router/src/connect-router.ts:7](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/connect-router.ts#L7)
|
|
6
6
|
|
|
7
7
|
@xmachines/play-svelte-spa-router
|
|
8
8
|
|
|
@@ -10,7 +10,8 @@ Svelte SPA router adapter for XMachines Play architecture.
|
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
|
-
| Property | Modifier | Type | Defined in |
|
|
14
|
-
| ----------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
-
| <a id="property-actor"></a> `actor` | `readonly` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Routable`](../../play-actor/interfaces/Routable.md) | [play-svelte-spa-router/src/connect-router.ts:
|
|
16
|
-
| <a id="property-routemap"></a> `routeMap` | `readonly` | [`RouteMap`](../classes/RouteMap.md) | [play-svelte-spa-router/src/connect-router.ts:
|
|
13
|
+
| Property | Modifier | Type | Description | Defined in |
|
|
14
|
+
| ----------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| <a id="property-actor"></a> `actor` | `readonly` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Routable`](../../play-actor/interfaces/Routable.md) | - | [play-svelte-spa-router/src/connect-router.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/connect-router.ts#L8) |
|
|
16
|
+
| <a id="property-routemap"></a> `routeMap` | `readonly` | [`RouteMap`](../classes/RouteMap.md) | - | [play-svelte-spa-router/src/connect-router.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/connect-router.ts#L9) |
|
|
17
|
+
| <a id="property-window"></a> `window?` | `readonly` | [`WindowLike`](WindowLike.md) | Window-like object for `hashchange` subscriptions. Defaults to the global `window`. Pass a mock in tests or a no-op in SSR environments. | [play-svelte-spa-router/src/connect-router.ts:14](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/connect-router.ts#L14) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayRouteEvent
|
|
4
4
|
|
|
5
|
-
Defined in: play-router/
|
|
5
|
+
Defined in: [play-router/src/types.ts:223](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L223)
|
|
6
6
|
|
|
7
7
|
Enhanced routing event with parameter and query support
|
|
8
8
|
|
|
@@ -30,7 +30,7 @@ Target state ID with # prefix (e.g., '#home', '#profile')
|
|
|
30
30
|
|
|
31
31
|
## Param
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Path-only route parameters extracted from the URL path (e.g., `{ userId: '123' }` from `/profile/123`). Query parameters are kept separate in `query`.
|
|
34
34
|
|
|
35
35
|
## Param
|
|
36
36
|
|
|
@@ -85,7 +85,7 @@ import type { PlayRouteEvent } from "@xmachines/play-router";
|
|
|
85
85
|
const event: PlayRouteEvent = {
|
|
86
86
|
type: "play.route",
|
|
87
87
|
to: "#settings",
|
|
88
|
-
params: { section: "profile" }, //
|
|
88
|
+
params: { section: "profile" }, // Path-only route parameter
|
|
89
89
|
query: { tab: "security" }, // Query-only
|
|
90
90
|
};
|
|
91
91
|
actor.send(event);
|
|
@@ -110,10 +110,10 @@ URLPatternResult for advanced use cases (debugging, pattern analysis).
|
|
|
110
110
|
|
|
111
111
|
## Properties
|
|
112
112
|
|
|
113
|
-
| Property | Modifier | Type | Defined in
|
|
114
|
-
| -------------------------------------- | ---------- | ------------------------------ |
|
|
115
|
-
| <a id="property-match"></a> `match?` | `readonly` | `unknown` | play-router/
|
|
116
|
-
| <a id="property-params"></a> `params?` | `readonly` | `Record`\<`string`, `string`\> | play-router/
|
|
117
|
-
| <a id="property-query"></a> `query?` | `readonly` | `Record`\<`string`, `string`\> | play-router/
|
|
118
|
-
| <a id="property-to"></a> `to` | `readonly` | `string` | play-router/
|
|
119
|
-
| <a id="property-type"></a> `type` | `readonly` | `"play.route"` | play-router/
|
|
113
|
+
| Property | Modifier | Type | Defined in |
|
|
114
|
+
| -------------------------------------- | ---------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
115
|
+
| <a id="property-match"></a> `match?` | `readonly` | `unknown` | [play-router/src/types.ts:228](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L228) |
|
|
116
|
+
| <a id="property-params"></a> `params?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:226](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L226) |
|
|
117
|
+
| <a id="property-query"></a> `query?` | `readonly` | `Record`\<`string`, `string`\> | [play-router/src/types.ts:227](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L227) |
|
|
118
|
+
| <a id="property-to"></a> `to` | `readonly` | `string` | [play-router/src/types.ts:225](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L225) |
|
|
119
|
+
| <a id="property-type"></a> `type` | `readonly` | `"play.route"` | [play-router/src/types.ts:224](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L224) |
|
|
@@ -2,11 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteMapping
|
|
4
4
|
|
|
5
|
-
Defined in: [play-
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L57)
|
|
6
|
+
|
|
7
|
+
A single state ID ↔ path mapping entry.
|
|
8
|
+
|
|
9
|
+
Both fields are `readonly` — mappings are immutable once passed to `BaseRouteMap`.
|
|
10
|
+
Adapter packages re-export a structurally compatible `RouteMapping` type under
|
|
11
|
+
their own name. This type is published from `@xmachines/play-router` as
|
|
12
|
+
`BaseRouteMapping` to avoid name collisions with those adapter-local types.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
const mapping: BaseRouteMapping = { stateId: "home", path: "/" };
|
|
18
|
+
const paramMapping: BaseRouteMapping = { stateId: "profile", path: "/profile/:userId" };
|
|
19
|
+
const optionalMapping: BaseRouteMapping = { stateId: "settings", path: "/settings/:section?" };
|
|
20
|
+
```
|
|
6
21
|
|
|
7
22
|
## Properties
|
|
8
23
|
|
|
9
|
-
| Property | Modifier | Type | Defined in
|
|
10
|
-
| --------------------------------------- | ---------- | -------- |
|
|
11
|
-
| <a id="property-path"></a> `path` | `readonly` | `string` | [play-
|
|
12
|
-
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | [play-
|
|
24
|
+
| Property | Modifier | Type | Description | Defined in |
|
|
25
|
+
| --------------------------------------- | ---------- | -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| <a id="property-path"></a> `path` | `readonly` | `string` | URL path pattern (e.g., `"/"`, `"/profile/:userId"`, `"/settings/:section?"`) | [play-router/src/base-route-map.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L61) |
|
|
27
|
+
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | State machine state ID (e.g., `"home"`, `"#profile"`) | [play-router/src/base-route-map.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/base-route-map.ts#L59) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: play-router/
|
|
5
|
+
Defined in: [play-router/src/types.ts:271](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L271)
|
|
6
6
|
|
|
7
7
|
RouterBridge interface for runtime infrastructure adapters
|
|
8
8
|
|
|
@@ -54,7 +54,7 @@ class TanStackRouterBridge implements RouterBridge {
|
|
|
54
54
|
connect(): void | Promise<void>;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Defined in: play-router/
|
|
57
|
+
Defined in: [play-router/src/types.ts:287](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L287)
|
|
58
58
|
|
|
59
59
|
Connect the router bridge to the Actor
|
|
60
60
|
|
|
@@ -83,7 +83,7 @@ await bridge.connect();
|
|
|
83
83
|
disconnect(): void | Promise<void>;
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Defined in: play-router/
|
|
86
|
+
Defined in: [play-router/src/types.ts:303](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L303)
|
|
87
87
|
|
|
88
88
|
Disconnect the router bridge from the Actor
|
|
89
89
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-svelte-spa-router](../README.md) / WindowLike
|
|
2
|
+
|
|
3
|
+
# Interface: WindowLike
|
|
4
|
+
|
|
5
|
+
Defined in: [play-router/src/types.ts:324](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L324)
|
|
6
|
+
|
|
7
|
+
Minimal window interface required by adapters that subscribe to DOM events
|
|
8
|
+
(e.g. `hashchange`). Injectable for SSR and testing — pass a mock instead of
|
|
9
|
+
the global `window` when the DOM is unavailable.
|
|
10
|
+
|
|
11
|
+
Defined structurally (no `Window` reference) so this package compiles without
|
|
12
|
+
the DOM lib.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// Normal usage — global window (default)
|
|
18
|
+
connectRouter({ actor, routeMap });
|
|
19
|
+
|
|
20
|
+
// SSR / test — injected mock
|
|
21
|
+
const mockWin: WindowLike = { addEventListener: vi.fn(), removeEventListener: vi.fn() };
|
|
22
|
+
connectRouter({ actor, routeMap, window: mockWin });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Methods
|
|
26
|
+
|
|
27
|
+
### addEventListener()
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
addEventListener(type, listener): void;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Defined in: [play-router/src/types.ts:325](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L325)
|
|
34
|
+
|
|
35
|
+
#### Parameters
|
|
36
|
+
|
|
37
|
+
| Parameter | Type |
|
|
38
|
+
| ---------- | ------------------- |
|
|
39
|
+
| `type` | `string` |
|
|
40
|
+
| `listener` | (`event`) => `void` |
|
|
41
|
+
|
|
42
|
+
#### Returns
|
|
43
|
+
|
|
44
|
+
`void`
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### removeEventListener()
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
removeEventListener(type, listener): void;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Defined in: [play-router/src/types.ts:326](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-router/src/types.ts#L326)
|
|
55
|
+
|
|
56
|
+
#### Parameters
|
|
57
|
+
|
|
58
|
+
| Parameter | Type |
|
|
59
|
+
| ---------- | ------------------- |
|
|
60
|
+
| `type` | `string` |
|
|
61
|
+
| `listener` | (`event`) => `void` |
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`void`
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
type RoutableActor = AbstractActor<AnyActorLogic> & Routable;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [play-svelte-spa-router/src/types.ts:
|
|
9
|
+
Defined in: [play-svelte-spa-router/src/types.ts:6](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-svelte-spa-router/src/types.ts#L6)
|