@xmachines/docs 1.0.0-beta.46 → 1.0.0-beta.48
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 +135 -7
- package/api/@xmachines/play/README.md +134 -57
- package/api/@xmachines/play/classes/NonNullableError.md +4 -4
- package/api/@xmachines/play/classes/PlayError.md +4 -4
- package/api/@xmachines/play/functions/assertNonNullable.md +1 -1
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play-actor/README.md +130 -155
- package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
- package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +5 -5
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +5 -5
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
- package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
- package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
- package/api/@xmachines/play-dom/README.md +140 -232
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +4 -4
- package/api/@xmachines/play-dom/functions/connectRenderer.md +1 -1
- package/api/@xmachines/play-dom/functions/createPlayUI.md +1 -1
- package/api/@xmachines/play-dom/functions/createRenderer.md +1 -1
- package/api/@xmachines/play-dom/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-dom/functions/renderSpec.md +1 -1
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +7 -7
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +13 -13
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +6 -6
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +4 -4
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +12 -12
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +4 -4
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +5 -5
- package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +5 -5
- package/api/@xmachines/play-dom/type-aliases/ActionFn.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/Actions.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +7 -7
- package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/DomSchema.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/SetState.md +1 -1
- package/api/@xmachines/play-dom/variables/schema.md +1 -1
- package/api/@xmachines/play-dom-router/README.md +160 -158
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
- package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-react/README.md +109 -320
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -5
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +8 -8
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +8 -8
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-react/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-react-router/README.md +107 -124
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +23 -23
- package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/README.md +235 -475
- package/api/@xmachines/play-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +23 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMatcher.md +1 -1
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
- package/api/@xmachines/play-router/functions/extractRouteParams.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
- package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteMatcher.md +4 -4
- package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
- package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-signals/README.md +105 -73
- package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +117 -263
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +8 -8
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +8 -8
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorContext.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-solid-router/README.md +93 -606
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-svelte/README.md +111 -103
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-svelte/functions/getActorContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +8 -8
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +11 -11
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-svelte/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/README.md +156 -17
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +168 -17
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +147 -122
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +23 -23
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/README.md +195 -173
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +3 -3
- package/api/@xmachines/play-vue/README.md +126 -271
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +5 -5
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +8 -8
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +5 -5
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +1 -1
- 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/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue-router/README.md +148 -528
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +24 -24
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +2 -2
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-xstate/README.md +167 -496
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +12 -12
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
- package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
- package/api/@xmachines/shared/README.md +81 -294
- 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/vitest/functions/defineXmVitestConfig.md +1 -1
- package/examples/@xmachines/play-dom-demo/README.md +3 -3
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-dom-router-demo/README.md +2 -2
- package/examples/@xmachines/play-react-demo/README.md +1 -1
- package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-react-router-demo/README.md +1 -1
- package/examples/@xmachines/play-solid-demo/README.md +1 -1
- package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/README.md +1 -1
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-spa-router-demo/README.md +2 -2
- package/examples/@xmachines/play-sveltekit-router-demo/README.md +2 -2
- package/examples/@xmachines/play-vue-demo/README.md +1 -1
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
- package/examples/README.md +24 -25
- package/examples/form-validation.md +2 -2
- package/guides/README.md +7 -7
- package/guides/actor-model.md +18 -18
- package/guides/architecture.md +500 -0
- package/guides/configuration.md +556 -0
- package/guides/deployment.md +336 -0
- package/guides/development.md +617 -0
- package/guides/getting-started.md +351 -142
- package/guides/signals.md +19 -19
- package/guides/state-machines.md +16 -16
- package/guides/testing.md +460 -0
- package/package.json +5 -5
- package/guides/installation.md +0 -257
|
@@ -1,174 +1,56 @@
|
|
|
1
1
|
[API](../../README.md) / @xmachines/play-react
|
|
2
2
|
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
3
5
|
# @xmachines/play-react
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
React renderer for XMachines Play architecture with signal-driven rendering.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Part of the [xmachines-js monorepo](../../README.md).
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## Installation
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm install @xmachines/play-react
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Peer dependencies** (must be installed separately):
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- Manages per-view UI state in an `@xstate/store` atom (automatic or caller-supplied)
|
|
19
|
+
```bash
|
|
20
|
+
npm install react react-dom xstate @xstate/store @json-render/react @json-render/core @json-render/xstate
|
|
21
|
+
```
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
Supported versions:
|
|
19
24
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
25
|
+
- `react` / `react-dom`: `^18.0.0 || ^19.0.0`
|
|
26
|
+
- `xstate`: `^5.30.0`
|
|
27
|
+
- `@xstate/store`: `^3.17.0`
|
|
28
|
+
- `@json-render/*`: `^0.18.0`
|
|
23
29
|
|
|
24
|
-
##
|
|
30
|
+
## Usage
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
npm install @xmachines/play-react
|
|
28
|
-
npm install @json-render/react @json-render/core # peer deps
|
|
29
|
-
npm install @json-render/xstate @xstate/store # store integration
|
|
30
|
-
```
|
|
32
|
+
### Standard usage — `PlayUIProvider` + `PlayRenderer`
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
so `defineRegistry(..., { onRenderError })` can intercept inner element-boundary errors
|
|
34
|
-
without muting console output.
|
|
35
|
-
|
|
36
|
-
## Current Exports
|
|
37
|
-
|
|
38
|
-
- `PlayRenderer` — main renderer component
|
|
39
|
-
- `useActor` — hook for accessing the actor inside a `PlayRenderer` tree
|
|
40
|
-
- `useSignalEffect` — React hook for subscribing to TC39 Signals
|
|
41
|
-
- `PlayErrorBoundary` — error boundary wrapping renderer output
|
|
42
|
-
- `defineRegistry` — re-exported from `@json-render/react`
|
|
43
|
-
- `useBoundProp` — re-exported from `@json-render/react`
|
|
44
|
-
- `ComponentFn` (type) — re-exported from `@json-render/react`
|
|
45
|
-
- `ComponentContext` (type) — re-exported from `@json-render/react`
|
|
46
|
-
- `ActorProvider` — escape hatch primitive (owns actor bridging, signal bridge, store lifecycle)
|
|
47
|
-
- `PlayUIProvider` — batteries-included composite (wraps `ActorProvider` + `JSONUIProvider`)
|
|
48
|
-
- `usePlayView` — hook for accessing the current view spec inside a provider tree
|
|
49
|
-
- `RenderErrorHandler` (type) — inner per-element error callback signature
|
|
50
|
-
- `ActorProviderProps` (type)
|
|
51
|
-
- `ViewContextValue` (type)
|
|
52
|
-
- `PlayActor` (type)
|
|
53
|
-
|
|
54
|
-
## Quick Start
|
|
34
|
+
The recommended pattern for actor-driven React rendering:
|
|
55
35
|
|
|
56
36
|
```tsx
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import { defineCatalog } from "@json-render/core";
|
|
60
|
-
import { defineRegistry } from "@xmachines/play-react";
|
|
61
|
-
import type { ComponentFn } from "@xmachines/play-react";
|
|
62
|
-
import { setup, assign } from "xstate";
|
|
63
|
-
import { z } from "zod";
|
|
64
|
-
|
|
65
|
-
// 1. Define catalog — the contract between machine spec and UI components
|
|
66
|
-
const catalog = defineCatalog({
|
|
67
|
-
elements: {
|
|
68
|
-
Login: { props: z.object({ title: z.string() }), description: "Login form" },
|
|
69
|
-
Dashboard: { props: z.object({ username: z.string() }), description: "Dashboard" },
|
|
70
|
-
},
|
|
71
|
-
});
|
|
37
|
+
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-react";
|
|
38
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
72
39
|
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
<h2>{props.title}</h2>
|
|
82
|
-
<button type="submit">Log In</button>
|
|
83
|
-
</form>
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const Dashboard: ComponentFn<typeof catalog, "Dashboard"> = ({ props }) => (
|
|
87
|
-
<div>Welcome, {props.username}!</div>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// 3. Build registry — wires components to catalog and declares action handlers
|
|
91
|
-
const registryResult = defineRegistry(catalog, {
|
|
40
|
+
// 1. Create and start the actor
|
|
41
|
+
const actor = definePlayer({ machine: myMachine })();
|
|
42
|
+
actor.start();
|
|
43
|
+
|
|
44
|
+
// 2. Define the component registry with action handlers
|
|
45
|
+
const registryResult = defineRegistry(myCatalog, {
|
|
92
46
|
components: { Login, Dashboard },
|
|
93
47
|
actions: {
|
|
94
|
-
login: async (
|
|
95
|
-
|
|
96
|
-
actor.send({ type: "auth.login", username: params.username });
|
|
97
|
-
},
|
|
98
|
-
logout: async () => {
|
|
99
|
-
actor.send({ type: "auth.logout" });
|
|
100
|
-
},
|
|
48
|
+
login: async ({ username }) => actor.send({ type: "auth.login", username }),
|
|
49
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
101
50
|
},
|
|
102
51
|
});
|
|
103
52
|
|
|
104
|
-
//
|
|
105
|
-
const machine = setup({
|
|
106
|
-
types: {
|
|
107
|
-
context: {} as {
|
|
108
|
-
isAuthenticated: boolean;
|
|
109
|
-
username: string | null;
|
|
110
|
-
params: Record<string, string>;
|
|
111
|
-
query: Record<string, string>;
|
|
112
|
-
},
|
|
113
|
-
events: {} as
|
|
114
|
-
| { type: "auth.login"; username: string }
|
|
115
|
-
| { type: "auth.logout" }
|
|
116
|
-
| { type: "play.route"; to: string; params?: Record<string, string> },
|
|
117
|
-
},
|
|
118
|
-
}).createMachine(
|
|
119
|
-
formatPlayRouteTransitions({
|
|
120
|
-
id: "app",
|
|
121
|
-
initial: "login",
|
|
122
|
-
context: { isAuthenticated: false, username: null, params: {}, query: {} },
|
|
123
|
-
states: {
|
|
124
|
-
login: {
|
|
125
|
-
id: "login",
|
|
126
|
-
meta: {
|
|
127
|
-
route: "/login",
|
|
128
|
-
view: {
|
|
129
|
-
root: "root",
|
|
130
|
-
elements: {
|
|
131
|
-
root: { type: "Login", props: { title: "Sign In" }, children: [] },
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
dashboard: {
|
|
137
|
-
id: "dashboard",
|
|
138
|
-
meta: {
|
|
139
|
-
route: "/dashboard",
|
|
140
|
-
view: {
|
|
141
|
-
root: "root",
|
|
142
|
-
elements: {
|
|
143
|
-
root: { type: "Dashboard", props: { username: "" }, children: [] },
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
on: {
|
|
150
|
-
"auth.login": {
|
|
151
|
-
target: ".dashboard",
|
|
152
|
-
guard: ({ context }) => !context.isAuthenticated,
|
|
153
|
-
actions: assign({
|
|
154
|
-
isAuthenticated: true,
|
|
155
|
-
username: ({ event }) => event.username,
|
|
156
|
-
}),
|
|
157
|
-
},
|
|
158
|
-
"auth.logout": {
|
|
159
|
-
target: ".login",
|
|
160
|
-
guard: ({ context }) => context.isAuthenticated,
|
|
161
|
-
actions: assign({ isAuthenticated: false, username: null }),
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
}),
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
// 5. Create actor and render
|
|
168
|
-
const createPlayer = definePlayer({ machine });
|
|
169
|
-
const actor = createPlayer();
|
|
170
|
-
actor.start();
|
|
171
|
-
|
|
53
|
+
// 3. Render — signals drive view transitions automatically
|
|
172
54
|
function App() {
|
|
173
55
|
return (
|
|
174
56
|
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
@@ -178,232 +60,139 @@ function App() {
|
|
|
178
60
|
}
|
|
179
61
|
```
|
|
180
62
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
### `PlayUIProvider`
|
|
63
|
+
### With optional `JSONUIProvider` props
|
|
184
64
|
|
|
185
|
-
|
|
65
|
+
Pass navigation and validation helpers through `PlayUIProvider`:
|
|
186
66
|
|
|
187
67
|
```tsx
|
|
188
68
|
<PlayUIProvider
|
|
189
|
-
actor={actor} // required
|
|
190
|
-
registryResult={registryResult} // required
|
|
191
|
-
store={myStore} // optional — controlled mode
|
|
192
|
-
fallback={<p>Loading…</p>} // optional
|
|
193
|
-
onError={(err, info) => Sentry.captureException(err, { extra: info })} // optional
|
|
194
|
-
onRenderError={(error, elementType) => console.warn(`<${elementType}> crashed:`, error)} // optional
|
|
195
|
-
>
|
|
196
|
-
<PlayRenderer />
|
|
197
|
-
</PlayUIProvider>
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**`actor`** — A `PlayerActor` (or any `AbstractActor & Viewable`). Provides the `currentView` signal.
|
|
201
|
-
|
|
202
|
-
**`registryResult`** — Full result from `defineRegistry(catalog, { components, actions })`. Contains both the component registry and action handlers.
|
|
203
|
-
|
|
204
|
-
**`store`** (optional) — Controls per-view UI state (form values, `$state` bindings):
|
|
205
|
-
|
|
206
|
-
- **Omitted (uncontrolled, default):** A fresh `@xstate/store` atom is created per view transition, seeded from `view.spec.state`. The atom resets automatically on each state transition.
|
|
207
|
-
- **Provided (controlled):** The caller owns the store lifecycle. `spec.state` is ignored.
|
|
208
|
-
|
|
209
|
-
```tsx
|
|
210
|
-
import { createAtom } from "@xstate/store";
|
|
211
|
-
import { xstateStoreStateStore } from "@json-render/xstate";
|
|
212
|
-
import type { StateStore } from "@json-render/core";
|
|
213
|
-
|
|
214
|
-
const store: StateStore = xstateStoreStateStore({ atom: createAtom({ username: "alice" }) });
|
|
215
|
-
|
|
216
|
-
<PlayUIProvider actor={actor} registryResult={registryResult} store={store}>
|
|
217
|
-
<PlayRenderer />
|
|
218
|
-
</PlayUIProvider>;
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**`fallback`** — Shown when `actor.currentView.get()` is `null` (machine in a no-view state, or during initialisation).
|
|
222
|
-
|
|
223
|
-
**`onError`** — Called when the outer `PlayErrorBoundary` catches an error. Receives `(error: Error, info: React.ErrorInfo)`. Use for observability tools (Sentry, Datadog, etc.).
|
|
224
|
-
|
|
225
|
-
**`onRenderError`** — Called when an individual catalog component throws during render. Caught by `@json-render/react`'s inner per-element boundary — the failed component is silently removed while the rest of the spec continues rendering. `onError` / `fallback` are **not** triggered. When both `onRenderError` on `PlayUIProvider` and on `defineRegistry` are set, the prop wins.
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
### `ActorProvider`
|
|
230
|
-
|
|
231
|
-
Escape hatch primitive. Owns actor bridging, signal bridge, and store lifecycle. Use this when you need direct control over the provider layer (e.g. custom `JSONUIProvider` configuration).
|
|
232
|
-
|
|
233
|
-
```tsx
|
|
234
|
-
import { ActorProvider } from "@xmachines/play-react";
|
|
235
|
-
|
|
236
|
-
<ActorProvider
|
|
237
69
|
actor={actor}
|
|
238
70
|
registryResult={registryResult}
|
|
239
|
-
|
|
71
|
+
navigate={(path) => router.push(path)}
|
|
72
|
+
validationFunctions={{ isEmail: (v) => /^.+@.+$/.test(String(v)) }}
|
|
240
73
|
>
|
|
241
|
-
{/* your own JSONUIProvider + PlayRenderer tree */}
|
|
242
|
-
</ActorProvider>;
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
### `PlayRenderer`
|
|
248
|
-
|
|
249
|
-
Zero-prop leaf component. Must be rendered inside a `PlayUIProvider` (or `ActorProvider`) tree. Subscribes to `actor.currentView` via context and renders the current spec.
|
|
250
|
-
|
|
251
|
-
```tsx
|
|
252
|
-
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
253
74
|
<PlayRenderer />
|
|
254
75
|
</PlayUIProvider>
|
|
255
76
|
```
|
|
256
77
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
## Error handling
|
|
260
|
-
|
|
261
|
-
The provider tree has two layers of error boundaries:
|
|
78
|
+
### Escape hatch — custom provider composition
|
|
262
79
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
Wraps the entire renderer output via `PlayErrorBoundary`. Triggered when the spec or store setup throws, or when the inner boundary is not present.
|
|
80
|
+
Use `ActorProvider` directly when you need to compose providers manually:
|
|
266
81
|
|
|
267
82
|
```tsx
|
|
268
|
-
|
|
269
|
-
actor={actor}
|
|
270
|
-
registryResult={registryResult}
|
|
271
|
-
fallback={<p>Something went wrong.</p>}
|
|
272
|
-
onError={(err, info) => Sentry.captureException(err, { extra: info })}
|
|
273
|
-
>
|
|
274
|
-
<PlayRenderer />
|
|
275
|
-
</PlayUIProvider>
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Inner boundary — `onRenderError`
|
|
279
|
-
|
|
280
|
-
Each catalog element is individually wrapped in an error boundary by `@json-render/react`. When a component throws, it is silently removed while the rest of the spec continues rendering. The outer boundary is **not** triggered.
|
|
281
|
-
|
|
282
|
-
Pass `onRenderError` to `PlayUIProvider` (or `ActorProvider`) — overrides any registry-level handler — or bake it into `defineRegistry`:
|
|
83
|
+
import { ActorProvider, JSONUIProvider, PlayRenderer } from "@xmachines/play-react";
|
|
283
84
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
onRenderError={(error, elementType) => {
|
|
290
|
-
console.warn(`<${elementType}> crashed:`, error);
|
|
291
|
-
}}
|
|
292
|
-
>
|
|
293
|
-
<PlayRenderer />
|
|
294
|
-
</PlayUIProvider>
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
```ts
|
|
298
|
-
// via defineRegistry — bakes the handler into the registry
|
|
299
|
-
const registryResult = defineRegistry(catalog, {
|
|
300
|
-
components: { Login, Dashboard },
|
|
301
|
-
actions: { login: async (params) => { ... }, logout: async () => { ... } },
|
|
302
|
-
onRenderError(error, elementType) {
|
|
303
|
-
reportExpectedRenderError(error, elementType);
|
|
304
|
-
},
|
|
305
|
-
});
|
|
85
|
+
<ActorProvider actor={actor} registryResult={registryResult}>
|
|
86
|
+
<JSONUIProvider registry={registryResult.registry}>
|
|
87
|
+
<PlayRenderer />
|
|
88
|
+
</JSONUIProvider>
|
|
89
|
+
</ActorProvider>;
|
|
306
90
|
```
|
|
307
91
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
### `useActor`
|
|
313
|
-
|
|
314
|
-
Hook for accessing the actor from inside any component rendered by `PlayRenderer`. No prop drilling needed.
|
|
92
|
+
### Accessing the actor from inside the tree
|
|
315
93
|
|
|
316
94
|
```tsx
|
|
317
95
|
import { useActor } from "@xmachines/play-react";
|
|
318
96
|
|
|
319
|
-
|
|
320
|
-
function LogoutButton() {
|
|
97
|
+
function SubmitButton() {
|
|
321
98
|
const actor = useActor();
|
|
322
|
-
return <button onClick={() => actor.send({ type: "
|
|
99
|
+
return <button onClick={() => actor.send({ type: "SUBMIT" })}>Submit</button>;
|
|
323
100
|
}
|
|
324
101
|
```
|
|
325
102
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
### `useSignalEffect`
|
|
331
|
-
|
|
332
|
-
Hook for subscribing to TC39 Signals in React components that live outside a `PlayRenderer` tree (e.g. nav bars, status indicators driven by actor state).
|
|
103
|
+
### Subscribing to signals directly
|
|
333
104
|
|
|
334
105
|
```tsx
|
|
335
106
|
import { useSignalEffect } from "@xmachines/play-react";
|
|
336
107
|
|
|
337
|
-
function
|
|
338
|
-
const [
|
|
108
|
+
function MyComponent({ actor }) {
|
|
109
|
+
const [view, setView] = useState(null);
|
|
339
110
|
|
|
340
111
|
useSignalEffect(() => {
|
|
341
|
-
|
|
342
|
-
setIsAuth((snap.context as { isAuthenticated: boolean }).isAuthenticated);
|
|
112
|
+
setView(actor.currentView.get());
|
|
343
113
|
});
|
|
344
114
|
|
|
345
|
-
return <
|
|
115
|
+
return <div>{view?.component}</div>;
|
|
346
116
|
}
|
|
347
117
|
```
|
|
348
118
|
|
|
349
|
-
|
|
119
|
+
## API Summary
|
|
350
120
|
|
|
351
|
-
###
|
|
121
|
+
### Components
|
|
352
122
|
|
|
353
|
-
|
|
123
|
+
| Export | Description |
|
|
124
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| `<PlayUIProvider>` | Batteries-included provider: wraps `ActorProvider` + `JSONUIProvider`. Standard entry point. |
|
|
126
|
+
| `<PlayRenderer>` | Zero-prop leaf component. Reads the current actor view from context and renders it. Must be inside `PlayUIProvider` or `ActorProvider`. |
|
|
127
|
+
| `<ActorProvider>` | Escape-hatch primitive. Owns actor bridging, signal subscription, and per-view `StateStore` lifecycle. |
|
|
128
|
+
| `<PlayErrorBoundary>` | React class error boundary for catching catalog component render errors. |
|
|
354
129
|
|
|
355
|
-
|
|
130
|
+
### Hooks
|
|
356
131
|
|
|
357
|
-
|
|
358
|
-
|
|
132
|
+
| Export | Description |
|
|
133
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| `useSignalEffect(callback)` | Subscribes to TC39 signal changes; re-runs the callback and forces a React re-render when any accessed signal changes. Cleanup is automatic on unmount. |
|
|
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. |
|
|
359
137
|
|
|
360
|
-
|
|
361
|
-
fallback={<p>Something went wrong.</p>}
|
|
362
|
-
onError={(err, info) => Sentry.captureException(err, { extra: info })}
|
|
363
|
-
>
|
|
364
|
-
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
365
|
-
<PlayRenderer />
|
|
366
|
-
</PlayUIProvider>
|
|
367
|
-
</PlayErrorBoundary>;
|
|
368
|
-
```
|
|
138
|
+
### Types
|
|
369
139
|
|
|
370
|
-
|
|
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
|
+
| `PlayActor` | Type alias for `AbstractActor<AnyActorLogic>` |
|
|
147
|
+
| `ViewContextValue` | Value shape returned by `usePlayView()` |
|
|
148
|
+
| `RenderErrorHandler` | Error handler callback type for render errors |
|
|
371
149
|
|
|
372
|
-
|
|
150
|
+
### Re-exports from `@json-render/react`
|
|
373
151
|
|
|
374
|
-
|
|
152
|
+
`@xmachines/play-react` re-exports the full `@json-render/react` surface so consumers only need one import:
|
|
375
153
|
|
|
376
154
|
```ts
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
155
|
+
import {
|
|
156
|
+
defineRegistry,
|
|
157
|
+
useBoundProp,
|
|
158
|
+
JSONUIProvider,
|
|
159
|
+
StateProvider,
|
|
160
|
+
ActionProvider,
|
|
161
|
+
VisibilityProvider,
|
|
162
|
+
ValidationProvider,
|
|
163
|
+
Renderer,
|
|
164
|
+
} from "@xmachines/play-react";
|
|
380
165
|
```
|
|
381
166
|
|
|
382
|
-
|
|
167
|
+
## Key Principle
|
|
383
168
|
|
|
384
|
-
|
|
169
|
+
React state is **never** used for business logic — only for triggering React's render cycle. Signals (`@xmachines/play-signals`) are the source of truth. `PlayUIProvider` passively observes actor signals via `useSignalEffect` and re-renders when the current view changes. Rapid signal updates are batched via microtasks to prevent unnecessary React renders.
|
|
385
170
|
|
|
386
|
-
##
|
|
171
|
+
## Testing
|
|
387
172
|
|
|
388
|
-
|
|
389
|
-
| ------------------------------------------------------------------------ | ---------------------------- | ---------------------------------------------------------------- |
|
|
390
|
-
| `useActor() must be called inside <ActorProvider> (or <PlayUIProvider>)` | Hook called outside the tree | Wrap with `<PlayUIProvider>` or `<ActorProvider>` |
|
|
391
|
-
| Component render error | Component throws | `PlayErrorBoundary` catches it; inspect component implementation |
|
|
173
|
+
Run unit tests (jsdom environment):
|
|
392
174
|
|
|
393
|
-
|
|
175
|
+
```bash
|
|
176
|
+
npm test -w @xmachines/play-react
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Run tests with coverage:
|
|
394
180
|
|
|
395
|
-
|
|
181
|
+
```bash
|
|
182
|
+
npm run test:coverage -w @xmachines/play-react
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Run browser integration tests (requires Chromium):
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run test:browser -w @xmachines/play-react
|
|
189
|
+
```
|
|
396
190
|
|
|
397
|
-
|
|
398
|
-
- `actor.currentView` (TC39 Signal) is the sole render trigger; `PlayRenderer` is a passive observer
|
|
399
|
-
- Per-view UI state lives in an `@xstate/store` atom, not in React state
|
|
400
|
-
- `@json-render/react` drives rendering; `PlayRenderer` is the signal bridge — import `defineRegistry`, `ComponentFn`, `ComponentContext`, and `useBoundProp` from
|
|
191
|
+
Coverage thresholds: 80% lines, functions, branches, and statements.
|
|
401
192
|
|
|
402
|
-
##
|
|
193
|
+
## License
|
|
403
194
|
|
|
404
|
-
|
|
405
|
-
- [React Router adapter](../play-react-router/README.md)
|
|
406
|
-
- [TanStack React Router adapter](../play-tanstack-react-router/README.md)
|
|
195
|
+
MIT — see [LICENSE](./LICENSE).
|
|
407
196
|
|
|
408
197
|
@xmachines/play-react - React renderer for XMachines Play architecture
|
|
409
198
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayErrorBoundary
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:53](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:53](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/PlayErrorBoundary.tsx#L53)
|
|
6
6
|
|
|
7
7
|
React class component error boundary for catching catalog component render errors.
|
|
8
8
|
|
|
@@ -36,7 +36,7 @@ Per CONS-14: Class component pattern works with all React versions (18 and 19).
|
|
|
36
36
|
new PlayErrorBoundary(props): PlayErrorBoundary;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
39
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/PlayErrorBoundary.tsx#L57)
|
|
40
40
|
|
|
41
41
|
#### Parameters
|
|
42
42
|
|
|
@@ -75,7 +75,7 @@ React.Component<
|
|
|
75
75
|
componentDidCatch(error, info): void;
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:66](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
78
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:66](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/PlayErrorBoundary.tsx#L66)
|
|
79
79
|
|
|
80
80
|
Catches exceptions generated in descendant components. Unhandled exceptions will cause
|
|
81
81
|
the entire component tree to unmount.
|
|
@@ -375,7 +375,7 @@ React.Component.getSnapshotBeforeUpdate;
|
|
|
375
375
|
render(): ReactNode;
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
378
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/PlayErrorBoundary.tsx#L70)
|
|
379
379
|
|
|
380
380
|
#### Returns
|
|
381
381
|
|
|
@@ -604,7 +604,7 @@ React.Component.UNSAFE_componentWillUpdate;
|
|
|
604
604
|
static getDerivedStateFromError(error): PlayErrorBoundaryState;
|
|
605
605
|
```
|
|
606
606
|
|
|
607
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
607
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/PlayErrorBoundary.tsx#L62)
|
|
608
608
|
|
|
609
609
|
#### Parameters
|
|
610
610
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function useActor(): PlayActor;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-react/src/useActor.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-react/src/useActor.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/useActor.ts#L31)
|
|
10
10
|
|
|
11
11
|
## Returns
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function usePlayView(): ViewContextValue;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-react/src/ActorProvider.tsx:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-react/src/ActorProvider.tsx:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/ActorProvider.tsx#L72)
|
|
10
10
|
|
|
11
11
|
Hook to access the current view spec, handlers, and registry.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function useSignalEffect(callback): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-react/src/useSignalEffect.ts:71](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-react/src/useSignalEffect.ts:71](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/useSignalEffect.ts#L71)
|
|
10
10
|
|
|
11
11
|
React hook that subscribes to signal changes and runs effect callback
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ActorProviderProps
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/ActorProvider.tsx:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-react/src/ActorProvider.tsx:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/ActorProvider.tsx#L31)
|
|
6
6
|
|
|
7
7
|
Props for the ActorProvider component.
|
|
8
8
|
|
|
@@ -18,10 +18,10 @@ Props for the ActorProvider component.
|
|
|
18
18
|
|
|
19
19
|
| Property | Type | Description | Inherited from | Defined in |
|
|
20
20
|
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
-
| <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) | Actor instance with currentView signal (requires Viewable capability). | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`actor`](../../play-actor/interfaces/BaseActorProviderProps.md#property-actor) | [packages/play-actor/src/abstract-actor.ts:154](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
22
|
-
| <a id="property-children"></a> `children` | `ReactNode` | Child components to render inside the provider tree | - | [packages/play-react/src/ActorProvider.tsx:37](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
23
|
-
| <a id="property-fallback"></a> `fallback?` | `ReactNode` | Optional component shown when currentView is null or a catalog component throws | - | [packages/play-react/src/ActorProvider.tsx:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
24
|
-
| <a id="property-onerror"></a> `onError?` | (`error`, `info`) => `void` | Optional error handler callback invoked when a catalog component throws during render | - | [packages/play-react/src/ActorProvider.tsx:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
25
|
-
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Called when an individual catalog component throws during render. Takes precedence over any onRenderError set via defineRegistry. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`onRenderError`](../../play-actor/interfaces/BaseActorProviderProps.md#property-onrendererror) | [packages/play-actor/src/abstract-actor.ts:167](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
26
|
-
| <a id="property-registryresult"></a> `registryResult` | `DefineRegistryResult` | Full result from defineRegistry() — contains the component registry and action handlers factory. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`registryResult`](../../play-actor/interfaces/BaseActorProviderProps.md#property-registryresult) | [packages/play-actor/src/abstract-actor.ts:156](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
27
|
-
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (controlled mode). When provided, spec.state is ignored and this store is the single source of truth. When omitted, a fresh @xstate/store atom is created per view transition from spec.state. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`store`](../../play-actor/interfaces/BaseActorProviderProps.md#property-store) | [packages/play-actor/src/abstract-actor.ts:162](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
21
|
+
| <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) | Actor instance with currentView signal (requires Viewable capability). | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`actor`](../../play-actor/interfaces/BaseActorProviderProps.md#property-actor) | [packages/play-actor/src/abstract-actor.ts:154](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-actor/src/abstract-actor.ts#L154) |
|
|
22
|
+
| <a id="property-children"></a> `children` | `ReactNode` | Child components to render inside the provider tree | - | [packages/play-react/src/ActorProvider.tsx:37](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/ActorProvider.tsx#L37) |
|
|
23
|
+
| <a id="property-fallback"></a> `fallback?` | `ReactNode` | Optional component shown when currentView is null or a catalog component throws | - | [packages/play-react/src/ActorProvider.tsx:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/ActorProvider.tsx#L33) |
|
|
24
|
+
| <a id="property-onerror"></a> `onError?` | (`error`, `info`) => `void` | Optional error handler callback invoked when a catalog component throws during render | - | [packages/play-react/src/ActorProvider.tsx:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-react/src/ActorProvider.tsx#L35) |
|
|
25
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Called when an individual catalog component throws during render. Takes precedence over any onRenderError set via defineRegistry. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`onRenderError`](../../play-actor/interfaces/BaseActorProviderProps.md#property-onrendererror) | [packages/play-actor/src/abstract-actor.ts:167](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-actor/src/abstract-actor.ts#L167) |
|
|
26
|
+
| <a id="property-registryresult"></a> `registryResult` | `DefineRegistryResult` | Full result from defineRegistry() — contains the component registry and action handlers factory. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`registryResult`](../../play-actor/interfaces/BaseActorProviderProps.md#property-registryresult) | [packages/play-actor/src/abstract-actor.ts:156](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-actor/src/abstract-actor.ts#L156) |
|
|
27
|
+
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (controlled mode). When provided, spec.state is ignored and this store is the single source of truth. When omitted, a fresh @xstate/store atom is created per view transition from spec.state. | [`BaseActorProviderProps`](../../play-actor/interfaces/BaseActorProviderProps.md).[`store`](../../play-actor/interfaces/BaseActorProviderProps.md#property-store) | [packages/play-actor/src/abstract-actor.ts:162](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.48/packages/play-actor/src/abstract-actor.ts#L162) |
|