@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,32 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteMap
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:105](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L105)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The shared base class of the route map for both directions.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
own and
|
|
9
|
+
Every framework adapter uses this class as its route map. An adapter adds no logic
|
|
10
|
+
of its own, and it inherits the complete public API from here.
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**The strategy of a lookup:**
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
of routes
|
|
17
|
-
-
|
|
18
|
-
|
|
14
|
+
- A static path, without a `:param` → a `Map` lookup in O(1)
|
|
15
|
+
- A dynamic path → a scan of the bucket index in O(k), with `URLPattern`, where
|
|
16
|
+
`k` is the number of the routes with the same first path segment
|
|
17
|
+
- The class keeps each result of a first match in an LRU cache. The default size
|
|
18
|
+
is 500 entries, and the `cacheSize` constructor option changes it
|
|
19
19
|
|
|
20
|
-
**
|
|
20
|
+
**The syntax of a pattern** (`:param`, `:param?`, and `*`):
|
|
21
21
|
|
|
22
|
-
- `:param` —
|
|
23
|
-
- `:param?` — optional segment
|
|
24
|
-
- `*` — wildcard
|
|
22
|
+
- `:param` — a necessary segment. It matches exactly one segment without a `/`
|
|
23
|
+
- `:param?` — an optional segment. It matches zero segments or one segment without a `/`
|
|
24
|
+
- `*` — a wildcard. It matches each number of segments, as URLPattern defines
|
|
25
25
|
|
|
26
|
-
**
|
|
27
|
-
`"#stateId"` or `"stateId"
|
|
28
|
-
`getStateIdByPath` returns the stateId exactly as
|
|
29
|
-
`getPathByStateId` accepts both forms.
|
|
30
|
-
forms
|
|
26
|
+
**The forms of a stateId:** you can register a stateId, and you can look one up,
|
|
27
|
+
in the form `"#stateId"` or in the form `"stateId"`. `RouteMap` makes the
|
|
28
|
+
canonical form itself. `getStateIdByPath` returns the stateId exactly as you
|
|
29
|
+
registered it, and `getPathByStateId` accepts both forms. A registration of the
|
|
30
|
+
same stateId in both forms gives one entry, and the later registration wins for
|
|
31
|
+
the lookup in the other direction.
|
|
31
32
|
|
|
32
33
|
## Example
|
|
33
34
|
|
|
@@ -57,31 +58,31 @@ map.getPathByStateId("missing"); // null
|
|
|
57
58
|
getPathByStateId(stateId): string | null;
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
61
|
+
Defined in: [play-router/src/base-route-map.ts:225](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L225)
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
Returns the path pattern of a state ID.
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
The method accepts the stateId in the form `"#stateId"` and in the form
|
|
66
|
+
`"stateId"`, and the form of the registration has no effect. The method makes the
|
|
67
|
+
canonical form itself. Therefore a consumer tries never both forms.
|
|
67
68
|
|
|
68
69
|
#### Parameters
|
|
69
70
|
|
|
70
|
-
| Parameter | Type | Description
|
|
71
|
-
| --------- | -------- |
|
|
72
|
-
| `stateId` | `string` |
|
|
71
|
+
| Parameter | Type | Description |
|
|
72
|
+
| --------- | -------- | --------------------------------------------------------------------------- |
|
|
73
|
+
| `stateId` | `string` | The state ID of the state machine, for example `"profile"` or `"#settings"` |
|
|
73
74
|
|
|
74
75
|
#### Returns
|
|
75
76
|
|
|
76
77
|
`string` \| `null`
|
|
77
78
|
|
|
78
|
-
The registered path pattern, or `null`
|
|
79
|
+
The registered path pattern, or `null` when the state ID is unknown
|
|
79
80
|
|
|
80
81
|
#### Example
|
|
81
82
|
|
|
82
83
|
```typescript
|
|
83
84
|
map.getPathByStateId("profile"); // "/profile/:userId"
|
|
84
|
-
map.getPathByStateId("#profile"); // "/profile/:userId"
|
|
85
|
+
map.getPathByStateId("#profile"); // "/profile/:userId" — the same entry
|
|
85
86
|
map.getPathByStateId("missing"); // null
|
|
86
87
|
```
|
|
87
88
|
|
|
@@ -93,25 +94,25 @@ map.getPathByStateId("missing"); // null
|
|
|
93
94
|
getStateIdByPath(path): string | null;
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
97
|
+
Defined in: [play-router/src/base-route-map.ts:185](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L185)
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
Resolves a URL path to its state ID.
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
lookup first, then
|
|
102
|
-
|
|
101
|
+
The method removes the query string and the hash fragment before the match. It
|
|
102
|
+
tries an exact lookup in O(1) first, then it uses the pattern match on the bucket
|
|
103
|
+
index. It keeps each result of a first pattern match in the cache.
|
|
103
104
|
|
|
104
105
|
#### Parameters
|
|
105
106
|
|
|
106
|
-
| Parameter | Type | Description
|
|
107
|
-
| --------- | -------- |
|
|
108
|
-
| `path` | `string` | URL pathname
|
|
107
|
+
| Parameter | Type | Description |
|
|
108
|
+
| --------- | -------- | -------------------------------------------------------------------------------------- |
|
|
109
|
+
| `path` | `string` | The URL pathname. It can hold a query and a hash, for example `"/profile/123?ref=nav"` |
|
|
109
110
|
|
|
110
111
|
#### Returns
|
|
111
112
|
|
|
112
113
|
`string` \| `null`
|
|
113
114
|
|
|
114
|
-
The
|
|
115
|
+
The state ID of the path, or `null` when no route matches
|
|
115
116
|
|
|
116
117
|
#### Example
|
|
117
118
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteMapOptions
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/create-route-map.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
5
|
+
Defined in: [play-router/src/create-route-map.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/create-route-map.ts#L9)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The options of `createRouteMap` and of `createRouteMapFromTree`.
|
|
8
8
|
|
|
9
9
|
## Properties
|
|
10
10
|
|
|
11
|
-
| Property | Type | Description
|
|
12
|
-
| -------------------------------------------- | -------- |
|
|
13
|
-
| <a id="property-cachesize"></a> `cacheSize?` | `number` |
|
|
11
|
+
| Property | Type | Description | Defined in |
|
|
12
|
+
| -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| <a id="property-cachesize"></a> `cacheSize?` | `number` | The maximum number of the resolved parameterized path lookups in the cache. `RouteMap.getStateIdByPath()` resolves a parameterized pattern, for example `/profile/:userId`, with URLPattern on each call. The map keeps each path of a frequent visit in an LRU cache, and a later lookup of that path is therefore O(1). Raise this value for an application with a large set of parameterized routes, or with a high frequency of the navigation. The default is `500`. | [play-router/src/create-route-map.ts:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/create-route-map.ts#L21) |
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteMapping
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/base-route-map.ts:
|
|
5
|
+
Defined in: [play-router/src/base-route-map.ts:54](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L54)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
One entry of the map between a state ID and a path.
|
|
8
8
|
|
|
9
|
-
Both fields are `readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`RouteMapping
|
|
9
|
+
Both fields are `readonly`, because a mapping is immutable after the caller gives
|
|
10
|
+
it to `RouteMap`. An adapter package re-exports a structurally compatible
|
|
11
|
+
`RouteMapping` type under its own name. `@xmachines/play-router` publishes this
|
|
12
|
+
type as `RouteMapping`, and its name therefore does not collide with such a local
|
|
13
|
+
type of an adapter.
|
|
13
14
|
|
|
14
15
|
## Example
|
|
15
16
|
|
|
@@ -21,7 +22,7 @@ const optionalMapping: RouteMapping = { stateId: "settings", path: "/settings/:s
|
|
|
21
22
|
|
|
22
23
|
## Properties
|
|
23
24
|
|
|
24
|
-
| Property | Modifier | Type | Description
|
|
25
|
-
| --------------------------------------- | ---------- | -------- |
|
|
26
|
-
| <a id="property-path"></a> `path` | `readonly` | `string` | URL path
|
|
27
|
-
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` |
|
|
25
|
+
| Property | Modifier | Type | Description | Defined in |
|
|
26
|
+
| --------------------------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| <a id="property-path"></a> `path` | `readonly` | `string` | The pattern of the URL path, for example `"/"`, `"/profile/:userId"`, or `"/settings/:section?"` | [play-router/src/base-route-map.ts:58](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L58) |
|
|
28
|
+
| <a id="property-stateid"></a> `stateId` | `readonly` | `string` | The state ID of the state machine, for example `"home"` or `"#profile"` | [play-router/src/base-route-map.ts:56](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L56) |
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/types.ts:
|
|
5
|
+
Defined in: [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: [play-router/src/types.ts:
|
|
59
|
+
Defined in: [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: [play-router/src/types.ts:
|
|
89
|
+
Defined in: [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
|
```
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: VanillaRouter
|
|
4
4
|
|
|
5
|
-
Defined in: [play-dom-router/src/create-router.ts:4](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
5
|
+
Defined in: [play-dom-router/src/create-router.ts:4](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-router.ts#L4)
|
|
6
6
|
|
|
7
7
|
## Properties
|
|
8
8
|
|
|
9
|
-
| Property | Modifier | Type | Description
|
|
10
|
-
| ------------------------------------------- | ---------- | -------------------------------------------------------- |
|
|
11
|
-
| <a id="property-history"></a> `history` | `readonly` | [`BrowserHistory`](BrowserHistory.md) |
|
|
12
|
-
| <a id="property-routetree"></a> `routeTree` | `readonly` | [`RouteTree`](../../play-router/interfaces/RouteTree.md) |
|
|
9
|
+
| Property | Modifier | Type | Description | Defined in |
|
|
10
|
+
| ------------------------------------------- | ---------- | -------------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| <a id="property-history"></a> `history` | `readonly` | [`BrowserHistory`](BrowserHistory.md) | The history instance | [play-dom-router/src/create-router.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-router.ts#L8) |
|
|
12
|
+
| <a id="property-routetree"></a> `routeTree` | `readonly` | [`RouteTree`](../../play-router/interfaces/RouteTree.md) | The route tree, as a reference to the structure | [play-dom-router/src/create-router.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-router.ts#L13) |
|
|
13
13
|
|
|
14
14
|
## Methods
|
|
15
15
|
|
|
@@ -19,9 +19,9 @@ Defined in: [play-dom-router/src/create-router.ts:4](https://gitlab.com/xmachin-
|
|
|
19
19
|
destroy(): void;
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Defined in: [play-dom-router/src/create-router.ts:18](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
22
|
+
Defined in: [play-dom-router/src/create-router.ts:18](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-router.ts#L18)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Cleans up
|
|
25
25
|
|
|
26
26
|
#### Returns
|
|
27
27
|
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
React renderer for XMachines Play architecture with signal-driven rendering.
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [.
|
|
7
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-react)
|
|
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-react
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
**Peer dependencies
|
|
15
|
+
**Peer dependencies.** Install them separately:
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
18
|
pnpm add react react-dom xstate @xstate/store @xmachines/json-render-react @xmachines/json-render-core @xmachines/json-render-xstate
|
|
@@ -25,7 +23,7 @@ Supported versions:
|
|
|
25
23
|
- `react` / `react-dom`: `^18.0.0 || ^19.0.0`
|
|
26
24
|
- `xstate`: `^5.31.0`
|
|
27
25
|
- `@xstate/store`: `^3.17.0`
|
|
28
|
-
- `@xmachines/json-render-*`: `^0.
|
|
26
|
+
- `@xmachines/json-render-*`: `^0.20.0-xm.2`
|
|
29
27
|
|
|
30
28
|
## Usage
|
|
31
29
|
|
|
@@ -36,6 +34,9 @@ The recommended pattern for actor-driven React rendering:
|
|
|
36
34
|
```tsx
|
|
37
35
|
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-react";
|
|
38
36
|
import { definePlayer } from "@xmachines/play-xstate";
|
|
37
|
+
import { myMachine } from "./machine.js"; // your xstate machine (states carry meta.view specs)
|
|
38
|
+
import { myCatalog } from "./catalog.js"; // defineCatalog(schema, ...) result, using the schema from "@xmachines/json-render-react/schema"
|
|
39
|
+
import { Login, Dashboard } from "./components.js"; // your React components
|
|
39
40
|
|
|
40
41
|
// 1. Create and start the actor
|
|
41
42
|
const actor = definePlayer({ machine: myMachine })();
|
|
@@ -65,27 +66,42 @@ function App() {
|
|
|
65
66
|
Pass navigation and validation helpers through `PlayUIProvider`:
|
|
66
67
|
|
|
67
68
|
```tsx
|
|
69
|
+
// actor, registryResult from the Quick Start above
|
|
68
70
|
<PlayUIProvider
|
|
69
71
|
actor={actor}
|
|
70
72
|
registryResult={registryResult}
|
|
71
|
-
navigate={(path) =>
|
|
73
|
+
navigate={(path) => history.pushState(null, "", path)}
|
|
72
74
|
validationFunctions={{ isEmail: (v) => /^.+@.+$/.test(String(v)) }}
|
|
73
75
|
>
|
|
74
76
|
<PlayRenderer />
|
|
75
77
|
</PlayUIProvider>
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
###
|
|
80
|
+
### Custom provider composition
|
|
79
81
|
|
|
80
82
|
Use `ActorProvider` directly when you need to compose providers manually:
|
|
81
83
|
|
|
82
84
|
```tsx
|
|
83
|
-
import {
|
|
85
|
+
import type { ReactNode } from "react";
|
|
86
|
+
import { ActorProvider, JSONUIProvider, PlayRenderer, usePlayView } from "@xmachines/play-react";
|
|
87
|
+
|
|
88
|
+
// Handlers and store live in ViewContext, so an inner bridge component must
|
|
89
|
+
// read them via usePlayView() and forward all three to JSONUIProvider —
|
|
90
|
+
// passing only `registry` would drop the action handlers and create a fresh store.
|
|
91
|
+
function Bridge({ children }: { children: ReactNode }) {
|
|
92
|
+
const view = usePlayView();
|
|
93
|
+
return (
|
|
94
|
+
<JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>
|
|
95
|
+
{children}
|
|
96
|
+
</JSONUIProvider>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
84
99
|
|
|
100
|
+
// actor, registryResult from the Quick Start above
|
|
85
101
|
<ActorProvider actor={actor} registryResult={registryResult}>
|
|
86
|
-
<
|
|
102
|
+
<Bridge>
|
|
87
103
|
<PlayRenderer />
|
|
88
|
-
</
|
|
104
|
+
</Bridge>
|
|
89
105
|
</ActorProvider>;
|
|
90
106
|
```
|
|
91
107
|
|
|
@@ -103,6 +119,7 @@ function SubmitButton() {
|
|
|
103
119
|
### Subscribing to signals directly
|
|
104
120
|
|
|
105
121
|
```tsx
|
|
122
|
+
import { useState } from "react";
|
|
106
123
|
import { useSignalEffect } from "@xmachines/play-react";
|
|
107
124
|
|
|
108
125
|
function MyComponent({ actor }) {
|
|
@@ -112,7 +129,7 @@ function MyComponent({ actor }) {
|
|
|
112
129
|
setView(actor.currentView.get());
|
|
113
130
|
}, [actor]); // deps: re-subscribe when the actor prop swaps
|
|
114
131
|
|
|
115
|
-
return <div>{view?.
|
|
132
|
+
return <div>{view?.root}</div>;
|
|
116
133
|
}
|
|
117
134
|
```
|
|
118
135
|
|
|
@@ -122,34 +139,34 @@ function MyComponent({ actor }) {
|
|
|
122
139
|
|
|
123
140
|
| Export | Description |
|
|
124
141
|
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
-
| `<PlayUIProvider>` |
|
|
142
|
+
| `<PlayUIProvider>` | Composite provider. It wraps `ActorProvider` and `JSONUIProvider`. Use it as the standard entry point. |
|
|
126
143
|
| `<PlayRenderer>` | Zero-prop leaf component. Reads the current actor view from context and renders it. Must be inside `PlayUIProvider` or `ActorProvider`. |
|
|
127
|
-
| `<ActorProvider>` |
|
|
128
|
-
| `<PlayErrorBoundary>` | React class error boundary
|
|
144
|
+
| `<ActorProvider>` | The low-level provider. It owns the actor bridge, the signal subscription, and the `StateStore` lifecycle of each view. |
|
|
145
|
+
| `<PlayErrorBoundary>` | The React class error boundary that catches a render error of a catalog component. |
|
|
129
146
|
|
|
130
147
|
### Hooks
|
|
131
148
|
|
|
132
|
-
| Export | Description
|
|
133
|
-
| ---------------------------------- |
|
|
134
|
-
| `useSignalEffect(callback, deps?)` | Subscribes to TC39 signal changes
|
|
135
|
-
| `useActor()` | Returns the raw actor instance. Must be called inside an `ActorProvider`/`PlayUIProvider` tree.
|
|
136
|
-
| `usePlayView()` | Returns `{ spec, handlers, registry, store }` for the current view. Must be called inside an `ActorProvider`/`PlayUIProvider` tree.
|
|
149
|
+
| Export | Description |
|
|
150
|
+
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `useSignalEffect(callback, deps?)` | Subscribes to the TC39 signal changes. It runs the callback again when a signal that the callback reads changes, and the callback triggers the re-render with its own setState. The optional `deps` array creates the subscription again, like `useEffect`. The hook removes the subscription on unmount. |
|
|
152
|
+
| `useActor()` | Returns the raw actor instance. Must be called inside an `ActorProvider`/`PlayUIProvider` tree. |
|
|
153
|
+
| `usePlayView()` | Returns `{ spec, handlers, registry, store }` for the current view. Must be called inside an `ActorProvider`/`PlayUIProvider` tree. |
|
|
137
154
|
|
|
138
155
|
### Types
|
|
139
156
|
|
|
140
|
-
| Export | Description
|
|
141
|
-
| ------------------------ |
|
|
142
|
-
| `PlayUIProviderProps` | Props for `<PlayUIProvider>`
|
|
143
|
-
| `ActorProviderProps` | Props for `<ActorProvider>` (also exported as `PlayRendererProps` for migration compatibility)
|
|
144
|
-
| `PlayErrorBoundaryProps` | Props for `<PlayErrorBoundary>`
|
|
145
|
-
| `PlayErrorBoundaryState` | State shape for `<PlayErrorBoundary>`
|
|
146
|
-
| `AnyPlayActor` | Type alias for `AbstractActor<AnyActorLogic>` — the bare actor type
|
|
147
|
-
| `ViewContextValue` |
|
|
148
|
-
| `RenderErrorHandler` | Error handler callback type for render errors
|
|
157
|
+
| Export | Description |
|
|
158
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| `PlayUIProviderProps` | Props for `<PlayUIProvider>` |
|
|
160
|
+
| `ActorProviderProps` | Props for `<ActorProvider>` (also exported as `PlayRendererProps` for migration compatibility) |
|
|
161
|
+
| `PlayErrorBoundaryProps` | Props for `<PlayErrorBoundary>` |
|
|
162
|
+
| `PlayErrorBoundaryState` | State shape for `<PlayErrorBoundary>` |
|
|
163
|
+
| `AnyPlayActor` | Type alias for `AbstractActor<AnyActorLogic>` — the bare actor type that the context providers use |
|
|
164
|
+
| `ViewContextValue` | The value shape that `usePlayView()` returns |
|
|
165
|
+
| `RenderErrorHandler` | Error handler callback type for render errors |
|
|
149
166
|
|
|
150
167
|
### Re-exports from `@xmachines/json-render-react`
|
|
151
168
|
|
|
152
|
-
`@xmachines/play-react` re-exports the
|
|
169
|
+
`@xmachines/play-react` re-exports the complete `@xmachines/json-render-react` surface, so a consumer needs one import only:
|
|
153
170
|
|
|
154
171
|
```ts
|
|
155
172
|
import {
|
|
@@ -166,7 +183,7 @@ import {
|
|
|
166
183
|
|
|
167
184
|
## Key Principle
|
|
168
185
|
|
|
169
|
-
React state is **never**
|
|
186
|
+
React state is **never** the place for the business logic. It only triggers the render cycle of React. The signals (`@xmachines/play-signals`) are the source of truth. `PlayUIProvider` observes the actor signals with `useSignalEffect`, and it renders again when the current view changes. It groups rapid signal updates into microtasks, so React does not render more often than necessary.
|
|
170
187
|
|
|
171
188
|
## Testing
|
|
172
189
|
|
|
@@ -182,7 +199,7 @@ Run tests with coverage:
|
|
|
182
199
|
pnpm --filter @xmachines/play-react run test:coverage
|
|
183
200
|
```
|
|
184
201
|
|
|
185
|
-
Run browser integration tests
|
|
202
|
+
Run the browser integration tests. They require Chromium:
|
|
186
203
|
|
|
187
204
|
```bash
|
|
188
205
|
pnpm --filter @xmachines/play-react run test:browser
|
|
@@ -194,17 +211,18 @@ Coverage thresholds: 80% lines, functions, branches, and statements.
|
|
|
194
211
|
|
|
195
212
|
MIT — see [LICENSE](./LICENSE).
|
|
196
213
|
|
|
197
|
-
@xmachines/play-react - React renderer for XMachines Play architecture
|
|
214
|
+
@xmachines/play-react - React renderer for the XMachines Play architecture
|
|
198
215
|
|
|
199
|
-
|
|
200
|
-
and renders UI components
|
|
201
|
-
|
|
202
|
-
that subscribes to signal
|
|
216
|
+
This package is the React rendering layer, and it works through providers. It
|
|
217
|
+
observes the actor signals and renders the UI components with
|
|
218
|
+
@xmachines/json-render-react. The architecture can therefore change the
|
|
219
|
+
framework, because React is only a render target that subscribes to the signal
|
|
220
|
+
changes.
|
|
203
221
|
|
|
204
|
-
**Key principle:** React state is NEVER
|
|
205
|
-
|
|
222
|
+
**Key principle:** React state is NEVER the place for the business logic. It only
|
|
223
|
+
triggers the render cycle of React. The signals are the source of truth.
|
|
206
224
|
|
|
207
|
-
**Standard
|
|
225
|
+
**Standard use:**
|
|
208
226
|
|
|
209
227
|
```tsx
|
|
210
228
|
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
@@ -212,15 +230,11 @@ triggering React's render cycle. Signals are the source of truth.
|
|
|
212
230
|
</PlayUIProvider>
|
|
213
231
|
```
|
|
214
232
|
|
|
215
|
-
**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<PlayRenderer />
|
|
221
|
-
</JSONUIProvider>
|
|
222
|
-
</ActorProvider>
|
|
223
|
-
```
|
|
233
|
+
**The escape hatch (a custom composition):** use `<ActorProvider>` directly, and give
|
|
234
|
+
the ViewContext values (`registry`, `handlers`, `store` from `usePlayView()`) to
|
|
235
|
+
`<JSONUIProvider>` through an inner bridge component. If you give only `registry`, you
|
|
236
|
+
lose the action handlers and you make a new store. `PlayUIProvider` is this exact
|
|
237
|
+
composition. Read its source for the reference bridge.
|
|
224
238
|
|
|
225
239
|
## Classes
|
|
226
240
|
|
|
@@ -245,6 +259,7 @@ triggering React's render cycle. Signals are the source of truth.
|
|
|
245
259
|
|
|
246
260
|
- [AnyPlayActor](type-aliases/AnyPlayActor.md)
|
|
247
261
|
- [ComponentFn](type-aliases/ComponentFn.md)
|
|
262
|
+
- [~~PlayRendererProps~~](type-aliases/PlayRendererProps.md)
|
|
248
263
|
- [RenderErrorHandler](type-aliases/RenderErrorHandler.md)
|
|
249
264
|
|
|
250
265
|
## Variables
|
|
@@ -267,9 +282,3 @@ triggering React's render cycle. Signals are the source of truth.
|
|
|
267
282
|
- [useSignalEffect](functions/useSignalEffect.md)
|
|
268
283
|
- [ValidationProvider](functions/ValidationProvider.md)
|
|
269
284
|
- [VisibilityProvider](functions/VisibilityProvider.md)
|
|
270
|
-
|
|
271
|
-
## References
|
|
272
|
-
|
|
273
|
-
### PlayRendererProps
|
|
274
|
-
|
|
275
|
-
Renames and re-exports [ActorProviderProps](interfaces/ActorProviderProps.md)
|