@xmachines/docs 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -13
- package/api/@xmachines/play/README.md +58 -63
- package/api/@xmachines/play/classes/NonNullableError.md +7 -7
- package/api/@xmachines/play/classes/PlayError.md +25 -27
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
- package/api/@xmachines/play-actor/README.md +72 -63
- package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
- package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
- package/api/@xmachines/play-dom/README.md +119 -85
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom-router/README.md +66 -49
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +63 -54
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +37 -28
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +94 -82
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +34 -29
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +40 -31
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +38 -34
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +66 -48
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +37 -17
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/README.md +71 -45
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +37 -35
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +65 -56
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +72 -70
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
- package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
- package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
- package/api/@xmachines/shared/README.md +11 -13
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/contributing/development.md +28 -0
- package/guides/inspector.md +1 -1
- package/package.json +1 -1
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-router/src/types.ts:
|
|
5
|
+
Defined in: [packages/play-router/src/types.ts:358](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L358)
|
|
6
6
|
|
|
7
|
-
RouterBridge interface
|
|
7
|
+
The RouterBridge interface of a runtime infrastructure adapter
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
The interface defines the connection of the lifecycle between the infrastructure,
|
|
10
|
+
for example a framework router, and the Actor. The infrastructure builds a "bridge"
|
|
11
|
+
to the Actor: it observes the signals of the Actor, and it manages its own
|
|
12
|
+
lifecycle accordingly.
|
|
12
13
|
|
|
13
|
-
**Architectural
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
**Architectural context:** the interface implements **Passive Infrastructure
|
|
15
|
+
(INV-04)**, because it gives an observation in one direction. The infrastructure
|
|
16
|
+
connects to observe the signals of the Actor (currentRoute, currentView, and
|
|
17
|
+
state), and it reflects each change. It makes no decision about the state.
|
|
16
18
|
|
|
17
19
|
## Example
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
The implementation of a framework router bridge
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
22
24
|
import type { RouterBridge } from "@xmachines/play-router";
|
|
@@ -26,7 +28,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
26
28
|
private watcher: Signal.Watcher | null = null;
|
|
27
29
|
|
|
28
30
|
async connect(): Promise<void> {
|
|
29
|
-
// Start
|
|
31
|
+
// Start the observation of the actor.currentRoute signal
|
|
30
32
|
this.watcher = new Signal.subtle.Watcher(() => {
|
|
31
33
|
const route = actor.currentRoute.get();
|
|
32
34
|
if (route) router.navigate(route);
|
|
@@ -35,7 +37,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
async disconnect(): Promise<void> {
|
|
38
|
-
// Stop
|
|
40
|
+
// Stop the observation, and clean the watchers up
|
|
39
41
|
this.watcher?.unwatch(actor.currentRoute);
|
|
40
42
|
this.watcher = null;
|
|
41
43
|
}
|
|
@@ -44,7 +46,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
44
46
|
|
|
45
47
|
## See
|
|
46
48
|
|
|
47
|
-
[Play RFC](../../../../rfc/play.md) -
|
|
49
|
+
[Play RFC](../../../../rfc/play.md) - invariant INV-04
|
|
48
50
|
|
|
49
51
|
## Methods
|
|
50
52
|
|
|
@@ -54,25 +56,26 @@ class MyRouterBridge implements RouterBridge {
|
|
|
54
56
|
connect(): void | Promise<void>;
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
Defined in: [packages/play-router/src/types.ts:
|
|
59
|
+
Defined in: [packages/play-router/src/types.ts:375](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L375)
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
Connects the router bridge to the Actor
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
The infrastructure calls it when it must start the observation of the Actor
|
|
64
|
+
signals, and when it must bring its own state, for example the browser URL, in line
|
|
65
|
+
with the Actor state.
|
|
63
66
|
|
|
64
67
|
#### Returns
|
|
65
68
|
|
|
66
69
|
`void` \| `Promise`\<`void`\>
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
The promise that resolves after the connection, or void for a synchronous connection
|
|
69
72
|
|
|
70
73
|
#### Example
|
|
71
74
|
|
|
72
75
|
```typescript
|
|
73
76
|
const bridge: RouterBridge = createBridge(actor, router);
|
|
74
77
|
await bridge.connect();
|
|
75
|
-
//
|
|
78
|
+
// The bridge observes the actor.currentRoute signal now
|
|
76
79
|
```
|
|
77
80
|
|
|
78
81
|
---
|
|
@@ -83,22 +86,22 @@ await bridge.connect();
|
|
|
83
86
|
disconnect(): void | Promise<void>;
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
Defined in: [packages/play-router/src/types.ts:
|
|
89
|
+
Defined in: [packages/play-router/src/types.ts:391](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L391)
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
Disconnects the router bridge from the Actor
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
The infrastructure calls it when it must stop the observation and free its
|
|
94
|
+
resources, for example a signal watcher and an event listener.
|
|
92
95
|
|
|
93
96
|
#### Returns
|
|
94
97
|
|
|
95
98
|
`void` \| `Promise`\<`void`\>
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
The promise that resolves after the disconnection, or void for a synchronous disconnection
|
|
98
101
|
|
|
99
102
|
#### Example
|
|
100
103
|
|
|
101
104
|
```typescript
|
|
102
105
|
await bridge.disconnect();
|
|
103
|
-
//
|
|
106
|
+
// The bridge stopped its observation, and it freed its resources
|
|
104
107
|
```
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
type PlayRouterBridgeConstructor<TRouter> = (router, actor, routeMap) => RouterBridge;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-solid-router/src/create-play-router-provider.tsx:
|
|
9
|
+
Defined in: [packages/play-solid-router/src/create-play-router-provider.tsx:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/create-play-router-provider.tsx#L24)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The constructor shape that a bridge class must satisfy for
|
|
12
12
|
`createPlayRouterProvider`: `(router, actor, routeMap) → RouterBridge`.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
takes
|
|
16
|
-
subclass
|
|
14
|
+
A bridge with another constructor shape, for example `SolidRouterBridge`, which
|
|
15
|
+
takes each hook result as a separate argument, receives a thin subclass. That
|
|
16
|
+
subclass packs the `router` prop again.
|
|
17
17
|
|
|
18
18
|
## Type Parameters
|
|
19
19
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
type RoutableActor = PlayActor;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L19)
|
|
10
10
|
|
|
11
11
|
## Deprecated
|
|
12
12
|
|
|
13
|
-
Use `PlayActor` from `@xmachines/play-router`.
|
|
13
|
+
Use `PlayActor` from `@xmachines/play-router`. The next major version removes this alias.
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
type SolidRouterHooks = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:37](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:37](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L37)
|
|
10
10
|
|
|
11
|
-
The three Solid Router
|
|
12
|
-
|
|
11
|
+
The three results of the Solid Router hooks that `PlayRouterProvider` and
|
|
12
|
+
`SolidRouterBridge` need. Give them directly from the hook calls of your component:
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
const navigate = useNavigate(); // → SolidRouterHooks.navigate
|
|
@@ -17,11 +17,11 @@ const location = useLocation(); // → SolidRouterHooks.location
|
|
|
17
17
|
const params = useParams(); // → SolidRouterHooks.params
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
- `navigate` —
|
|
21
|
-
- `location` — `pathname` and `search`
|
|
22
|
-
|
|
23
|
-
- `params` —
|
|
24
|
-
directly in `extractParams()
|
|
20
|
+
- `navigate` — the bridge pushes each URL change with it, when the `currentRoute` of the actor changes.
|
|
21
|
+
- `location` — the bridge reads `pathname` and `search` at the moment of `connect()`, for a deep link.
|
|
22
|
+
Each later change of the pathname then goes to the actor, through `createEffect`.
|
|
23
|
+
- `params` — the path parameters of the current route segment, which Solid parsed already. The bridge
|
|
24
|
+
uses them directly in `extractParams()`, and it parses them not again with URLPattern.
|
|
25
25
|
|
|
26
26
|
## Properties
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ const params = useParams(); // → SolidRouterHooks.params
|
|
|
31
31
|
location: Location;
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:39](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
34
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:39](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L39)
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ Defined in: [packages/play-solid-router/src/play-router-provider.tsx:39](https:/
|
|
|
41
41
|
navigate: Navigator;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
44
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L38)
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -51,4 +51,4 @@ Defined in: [packages/play-solid-router/src/play-router-provider.tsx:38](https:/
|
|
|
51
51
|
params: Params;
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
54
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L40)
|
|
@@ -6,17 +6,18 @@
|
|
|
6
6
|
const PlayRouterProvider: <TActor>(props) => any;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:
|
|
9
|
+
Defined in: [packages/play-solid-router/src/play-router-provider.tsx:94](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-solid-router/src/play-router-provider.tsx#L94)
|
|
10
10
|
|
|
11
|
-
Connects a `PlayerActor` to Solid Router
|
|
12
|
-
in
|
|
11
|
+
Connects a `PlayerActor` to Solid Router. It keeps the actor state and the browser
|
|
12
|
+
URL in step, in both directions.
|
|
13
13
|
|
|
14
|
-
The
|
|
15
|
-
execution model
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
The component creates the bridge synchronously, during its own evaluation, because
|
|
15
|
+
this is the execution model of Solid. It disconnects the bridge in `onCleanup`,
|
|
16
|
+
when Solid disposes of the component. React is different: the stability of a prop
|
|
17
|
+
is no concern here, because the `props` accessor of Solid is reactive already, and
|
|
18
|
+
the component creates the bridge one time for each of its instances.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
Take the `router` prop from the Solid Router hooks in the parent component:
|
|
20
21
|
|
|
21
22
|
```tsx
|
|
22
23
|
function AppShell() {
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# @xmachines/play-svelte
|
|
4
4
|
|
|
5
|
-
Svelte 5 renderer for the XMachines Play architecture
|
|
5
|
+
Svelte 5 renderer for the XMachines Play architecture. It connects an actor to a catalog-driven `@xmachines/json-render-svelte` UI, with Svelte 5 runes and TC39 Signals.
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [.
|
|
7
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-svelte)
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
@@ -14,7 +12,7 @@ Part of the [xmachines-js monorepo](../../README.md).
|
|
|
14
12
|
pnpm add @xmachines/play-svelte
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
**Peer dependencies
|
|
15
|
+
**Peer dependencies.** Install them separately:
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
18
|
pnpm add svelte@^5.0.0 xstate@^5.31.0 @xstate/store@^3.17.0 \
|
|
@@ -25,7 +23,7 @@ pnpm add svelte@^5.0.0 xstate@^5.31.0 @xstate/store@^3.17.0 \
|
|
|
25
23
|
|
|
26
24
|
### Basic setup
|
|
27
25
|
|
|
28
|
-
Define
|
|
26
|
+
Define the catalog and the registry one time. Then give both to `PlayUIProvider`, together with your actor. `PlayRenderer` then renders the current view of the actor:
|
|
29
27
|
|
|
30
28
|
```svelte
|
|
31
29
|
<!-- App.svelte -->
|
|
@@ -55,15 +53,23 @@ Define a catalog and registry once, then pass both to `PlayUIProvider` with your
|
|
|
55
53
|
|
|
56
54
|
### Lower-level: ActorProvider
|
|
57
55
|
|
|
58
|
-
Use `ActorProvider` directly when you need
|
|
56
|
+
Use `ActorProvider` directly when you need more control over the rendering. For example, use it to add a custom layout, or to add each `@xmachines/json-render-svelte` provider one by one:
|
|
59
57
|
|
|
60
58
|
```svelte
|
|
61
59
|
<script lang="ts">
|
|
62
60
|
import { ActorProvider } from "@xmachines/play-svelte";
|
|
63
61
|
|
|
64
|
-
let { actor, registryResult } = $props();
|
|
62
|
+
let { actor, registryResult, children } = $props();
|
|
63
|
+
|
|
64
|
+
function handleError(error: unknown, reset: () => void) {
|
|
65
|
+
console.error(error);
|
|
66
|
+
}
|
|
65
67
|
</script>
|
|
66
68
|
|
|
69
|
+
{#snippet loadingSnippet()}
|
|
70
|
+
<div>Loading…</div>
|
|
71
|
+
{/snippet}
|
|
72
|
+
|
|
67
73
|
<ActorProvider {actor} {registryResult} fallback={loadingSnippet} onError={handleError}>
|
|
68
74
|
<!-- children rendered inside StateProvider tree -->
|
|
69
75
|
{@render children()}
|
|
@@ -84,20 +90,20 @@ actor.send({ type: "some.event" });
|
|
|
84
90
|
|
|
85
91
|
### Components
|
|
86
92
|
|
|
87
|
-
| Component | Description
|
|
88
|
-
| ------------------ |
|
|
89
|
-
| `<PlayUIProvider>` |
|
|
90
|
-
| `<ActorProvider>` | Primitive provider — owns actor lifecycle, signal subscription, per-view `StateStore`, and `onRenderError` injection.
|
|
91
|
-
| `<PlayRenderer>` | Zero-prop leaf component — reads `getPlayViewContext()` and renders `<Renderer>` from `@xmachines/json-render-svelte`.
|
|
93
|
+
| Component | Description |
|
|
94
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `<PlayUIProvider>` | Composite provider. It wraps `ActorProvider` and `JsonUIProvider`. Use it as the standard entry point for an actor-driven UI. |
|
|
96
|
+
| `<ActorProvider>` | Primitive provider — owns actor lifecycle, signal subscription, per-view `StateStore`, and `onRenderError` injection. |
|
|
97
|
+
| `<PlayRenderer>` | Zero-prop leaf component — reads `getPlayViewContext()` and renders `<Renderer>` from `@xmachines/json-render-svelte`. |
|
|
92
98
|
|
|
93
99
|
### Functions
|
|
94
100
|
|
|
95
101
|
| Function | Description |
|
|
96
102
|
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
97
103
|
| `defineRegistry(catalog, options)` | Creates a typed component registry. Wraps `@xmachines/json-render-svelte`'s `defineRegistry` with catalog-typed `params` on action handlers. Import from `@xmachines/play-svelte`, not `@xmachines/json-render-svelte`. |
|
|
98
|
-
| `getActorContext()` | Returns the `AnyPlayActor`
|
|
104
|
+
| `getActorContext()` | Returns the `AnyPlayActor` of the nearest `ActorProvider` ancestor. It throws when the caller is outside the provider tree. |
|
|
99
105
|
| `getPlayViewContext()` | Returns the `ViewContextValue` (spec, registry, handlers, store) from the nearest `ActorProvider` ancestor. |
|
|
100
|
-
| `setActorContext(actor)` | Sets the actor context
|
|
106
|
+
| `setActorContext(actor)` | Sets the actor context. `ActorProvider` uses it internally. |
|
|
101
107
|
|
|
102
108
|
### Types
|
|
103
109
|
|
|
@@ -105,17 +111,17 @@ actor.send({ type: "some.event" });
|
|
|
105
111
|
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
106
112
|
| `ActorProviderProps` | Props for `<ActorProvider>`: `actor`, `registryResult`, optional `store`, `fallback` snippet, `onError`, `onRenderError`, `children`. |
|
|
107
113
|
| `PlayUIProviderProps` | Extends `ActorProviderProps` with optional `validationFunctions`, `navigate`, and `functions`. |
|
|
108
|
-
| `ViewContextValue` | The view context shape
|
|
109
|
-
| `AnyPlayActor` | `AbstractActor<AnyActorLogic> & Viewable` — the actor shape
|
|
114
|
+
| `ViewContextValue` | The view context shape that `ActorProvider` provides and `PlayRenderer` reads. |
|
|
115
|
+
| `AnyPlayActor` | `AbstractActor<AnyActorLogic> & Viewable` — the actor shape that `ActorProvider` and `getActorContext` accept. |
|
|
110
116
|
| `DefineRegistryOptions<C>` | Options for `defineRegistry`: `components`, catalog-typed `actions`, and `onRenderError`. |
|
|
111
|
-
| `ActionFn<C, K>` |
|
|
117
|
+
| `ActionFn<C, K>` | The handler type for one action. The params come from the catalog. |
|
|
112
118
|
| `Actions<C>` | Map of catalog-typed action handlers. |
|
|
113
|
-
| `SetState` |
|
|
114
|
-
| `RenderErrorHandler` |
|
|
119
|
+
| `SetState` | The state setter type. Each action handler receives it as the second argument. |
|
|
120
|
+
| `RenderErrorHandler` | The callback `(error: unknown, elementType: string) => void`. The renderer calls it when a catalog component throws. |
|
|
115
121
|
|
|
116
122
|
### Re-exports from `@xmachines/json-render-svelte`
|
|
117
123
|
|
|
118
|
-
Import everything from `@xmachines/play-svelte
|
|
124
|
+
Import everything from `@xmachines/play-svelte`. This package re-exports these providers:
|
|
119
125
|
|
|
120
126
|
```ts
|
|
121
127
|
import {
|
|
@@ -152,30 +158,33 @@ Or from within the package directory:
|
|
|
152
158
|
pnpm test
|
|
153
159
|
```
|
|
154
160
|
|
|
155
|
-
|
|
161
|
+
The tests run with [Vitest](https://vitest.dev/) in a `jsdom` environment, together with `@testing-library/svelte`. The browser tests are in `test/browser/`. They use a separate config with Playwright:
|
|
156
162
|
|
|
157
163
|
```bash
|
|
158
164
|
# From the package directory
|
|
159
165
|
pnpm exec vitest --config vitest.browser.config.ts
|
|
160
166
|
```
|
|
161
167
|
|
|
162
|
-
**Coverage thresholds:** 80% lines, functions, branches, and statements
|
|
168
|
+
**Coverage thresholds:** 80% for lines, functions, branches, and statements. The v8 provider enforces them.
|
|
163
169
|
|
|
164
170
|
## License
|
|
165
171
|
|
|
166
172
|
MIT — see [LICENSE](./LICENSE).
|
|
167
173
|
|
|
168
|
-
@xmachines/play-svelte - Svelte renderer for XMachines Play architecture
|
|
174
|
+
@xmachines/play-svelte - Svelte renderer for the XMachines Play architecture
|
|
169
175
|
|
|
170
|
-
|
|
176
|
+
The package splits the provider from the renderer, in the same way as
|
|
177
|
+
@xmachines/json-render-svelte:
|
|
171
178
|
|
|
172
|
-
- ActorProvider:
|
|
173
|
-
|
|
174
|
-
- PlayUIProvider:
|
|
175
|
-
- PlayRenderer:
|
|
179
|
+
- ActorProvider: the low-level provider. It owns the actor lifecycle, the signal
|
|
180
|
+
subscription, the StateStore of each view, and the injection of onRenderError
|
|
181
|
+
- PlayUIProvider: the composite provider (ActorProvider and JsonUIProvider)
|
|
182
|
+
- PlayRenderer: the leaf without props. It reads getPlayViewContext() and renders
|
|
183
|
+
the Renderer
|
|
176
184
|
|
|
177
|
-
|
|
178
|
-
from @xmachines/play-svelte
|
|
185
|
+
The package re-exports the primitives of @xmachines/json-render-svelte. A
|
|
186
|
+
consumer therefore imports everything from @xmachines/play-svelte, and not from
|
|
187
|
+
@xmachines/json-render-svelte.
|
|
179
188
|
|
|
180
189
|
## Interfaces
|
|
181
190
|
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
function defineRegistry<C>(catalog, options): DefineRegistryResult;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-svelte/src/define-registry.ts:
|
|
9
|
+
Defined in: [packages/play-svelte/src/define-registry.ts:156](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/define-registry.ts#L156)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Creates a component registry, and gives each action handler its catalog-typed `params`.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
`@xmachines/
|
|
13
|
+
This function is the drop-in replacement for `defineRegistry` from
|
|
14
|
+
`@xmachines/json-render-svelte`. Import it from `@xmachines/play-svelte`, and each
|
|
15
|
+
action then gets its param type from the catalog.
|
|
15
16
|
|
|
16
17
|
## Type Parameters
|
|
17
18
|
|
|
@@ -21,10 +22,10 @@ Drop-in replacement for `defineRegistry` from `@xmachines/json-render-svelte`. I
|
|
|
21
22
|
|
|
22
23
|
## Parameters
|
|
23
24
|
|
|
24
|
-
| Parameter | Type | Description
|
|
25
|
-
| --------- | ------------------------------------------------------------------------ |
|
|
26
|
-
| `catalog` | `C` | The json-render catalog
|
|
27
|
-
| `options` | [`DefineRegistryOptions`](../interfaces/DefineRegistryOptions.md)\<`C`\> |
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| --------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `catalog` | `C` | The json-render catalog. It defines the prop shape of each component and the schema of each action. |
|
|
28
|
+
| `options` | [`DefineRegistryOptions`](../interfaces/DefineRegistryOptions.md)\<`C`\> | The registry options. Each `actions` entry receives its params with the type from the catalog. |
|
|
28
29
|
|
|
29
30
|
## Returns
|
|
30
31
|
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
function getActorContext(): AnyPlayActor;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:
|
|
9
|
+
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:42](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L42)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns the actor of the nearest ActorProvider ancestor.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
This function had the name useActor() before. The new name follows the
|
|
14
|
+
get*Context() convention of @xmachines/json-render-svelte (D-07).
|
|
14
15
|
|
|
15
16
|
## Returns
|
|
16
17
|
|
|
@@ -18,4 +19,4 @@ Renamed from useActor() to match @xmachines/json-render-svelte's get*Context() c
|
|
|
18
19
|
|
|
19
20
|
## Throws
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
When the caller is outside <ActorProvider> or <PlayUIProvider>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
function getPlayViewContext(): ViewContextValue;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:
|
|
9
|
+
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:63](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L63)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns the current view context of the nearest ActorProvider ancestor.
|
|
12
12
|
|
|
13
13
|
## Returns
|
|
14
14
|
|
|
@@ -16,4 +16,4 @@ Get the current view context from the nearest ActorProvider ancestor.
|
|
|
16
16
|
|
|
17
17
|
## Throws
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
When the caller is outside <ActorProvider> or <PlayUIProvider>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function setActorContext(actor): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:
|
|
9
|
+
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L31)
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ActorProviderProps
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:
|
|
5
|
+
Defined in: [packages/play-svelte/src/actor-context.svelte.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L72)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`DefineRegistryResult` type
|
|
10
|
-
`@xmachines/json-render-core
|
|
7
|
+
The framework-agnostic base props. Every `ActorProvider` implementation shares
|
|
8
|
+
them: React, Vue, Solid, and Svelte. `TRegistry` holds the
|
|
9
|
+
`DefineRegistryResult` type of the framework. `RenderErrorHandler` comes from
|
|
10
|
+
`@xmachines/json-render-core`, and a second generic parameter is therefore not
|
|
11
|
+
necessary.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Each framework package extends this interface with its `fallback` field, its
|
|
14
|
+
`onError` field, and its `children` field.
|
|
13
15
|
|
|
14
16
|
## Example
|
|
15
17
|
|
|
@@ -33,12 +35,12 @@ interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult
|
|
|
33
35
|
|
|
34
36
|
## Properties
|
|
35
37
|
|
|
36
|
-
| Property | Type | Description
|
|
37
|
-
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
-
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) |
|
|
39
|
-
| <a id="property-children"></a> `children` | `Snippet` | -
|
|
40
|
-
| <a id="property-fallback"></a> `fallback?` | `Snippet`\<\[\]\> | -
|
|
41
|
-
| <a id="property-onerror"></a> `onError?` | (`error`, `reset`) => `void` | -
|
|
42
|
-
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) |
|
|
43
|
-
| <a id="property-registryresult"></a> `registryResult` | `DefineRegistryResult` |
|
|
44
|
-
| <a id="property-store"></a> `store?` | `StateStore` |
|
|
38
|
+
| Property | Type | Description | Inherited from | Defined in |
|
|
39
|
+
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | The actor instance with the currentView signal. It requires the Viewable capability. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`actor`](../../play-actor/interfaces/BaseActorProviderProps.md#property-actor) | [packages/play-actor/src/abstract-actor.ts:163](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L163) |
|
|
41
|
+
| <a id="property-children"></a> `children` | `Snippet` | - | - | [packages/play-svelte/src/actor-context.svelte.ts:75](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L75) |
|
|
42
|
+
| <a id="property-fallback"></a> `fallback?` | `Snippet`\<\[\]\> | - | - | [packages/play-svelte/src/actor-context.svelte.ts:73](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L73) |
|
|
43
|
+
| <a id="property-onerror"></a> `onError?` | (`error`, `reset`) => `void` | - | - | [packages/play-svelte/src/actor-context.svelte.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-svelte/src/actor-context.svelte.ts#L74) |
|
|
44
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | The provider calls it when one catalog component throws during a render. This handler replaces every onRenderError of defineRegistry. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`onRenderError`](../../play-actor/interfaces/BaseActorProviderProps.md#property-onrendererror) | [packages/play-actor/src/abstract-actor.ts:177](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L177) |
|
|
45
|
+
| <a id="property-registryresult"></a> `registryResult` | `DefineRegistryResult` | The complete result of defineRegistry(). It holds the component registry and the factory of the action handlers. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`registryResult`](../../play-actor/interfaces/BaseActorProviderProps.md#property-registryresult) | [packages/play-actor/src/abstract-actor.ts:165](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L165) |
|
|
46
|
+
| <a id="property-store"></a> `store?` | `StateStore` | The optional external StateStore, which is the controlled mode. With this option, the provider ignores spec.state, and this store is the single source of truth. Without it, the provider makes a new @xstate/store atom for each view transition, with the values of spec.state. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`store`](../../play-actor/interfaces/BaseActorProviderProps.md#property-store) | [packages/play-actor/src/abstract-actor.ts:172](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-actor/src/abstract-actor.ts#L172) |
|