@xmachines/docs 1.0.0-beta.32 → 1.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/@xmachines/play/classes/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 +9 -10
- package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
- package/api/@xmachines/play-actor/functions/typedSpec.md +7 -10
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +46 -0
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +33 -0
- 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 +4 -4
- package/api/@xmachines/play-dom/README.md +309 -37
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +39 -26
- package/api/@xmachines/play-dom/functions/connectRenderer.md +39 -20
- package/api/@xmachines/play-dom/functions/createPlayUI.md +28 -0
- package/api/@xmachines/play-dom/functions/createRenderer.md +43 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-dom/functions/renderSpec.md +43 -9
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +9 -9
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +19 -9
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +29 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +7 -7
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +14 -9
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +6 -6
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +14 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +7 -5
- package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +27 -0
- package/api/@xmachines/play-dom/type-aliases/ActionFn.md +23 -7
- package/api/@xmachines/play-dom/type-aliases/Actions.md +1 -1
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +114 -0
- package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +25 -0
- 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 +39 -0
- 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 +25 -0
- package/api/@xmachines/play-dom/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-dom/type-aliases/SetState.md +30 -0
- package/api/@xmachines/play-dom/variables/schema.md +1 -1
- package/api/@xmachines/play-dom-router/README.md +166 -59
- 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/RouteMap.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +3 -3
- 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 +166 -48
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -5
- package/api/@xmachines/play-react/functions/ActionProvider.md +21 -0
- package/api/@xmachines/play-react/functions/JSONUIProvider.md +21 -0
- package/api/@xmachines/play-react/functions/Renderer.md +21 -0
- package/api/@xmachines/play-react/functions/StateProvider.md +27 -0
- package/api/@xmachines/play-react/functions/ValidationProvider.md +21 -0
- package/api/@xmachines/play-react/functions/VisibilityProvider.md +21 -0
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +32 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/interfaces/ActionProviderProps.md +15 -0
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +27 -0
- package/api/@xmachines/play-react/interfaces/JSONUIProviderProps.md +21 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +26 -0
- package/api/@xmachines/play-react/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-react/interfaces/StateProviderProps.md +16 -0
- package/api/@xmachines/play-react/interfaces/ValidationProviderProps.md +14 -0
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +20 -0
- package/api/@xmachines/play-react/interfaces/VisibilityProviderProps.md +13 -0
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-react/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +33 -0
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -50
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +43 -0
- 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/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/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/classes/BaseRouteMap.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/createRouteMapFromMachine.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.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/RouteMap.md +4 -4
- 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/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/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 +159 -42
- package/api/@xmachines/play-solid/functions/ActionProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/JSONUIProvider.md +21 -0
- package/api/@xmachines/play-solid/functions/Renderer.md +21 -0
- package/api/@xmachines/play-solid/functions/StateProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/ValidationProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/VisibilityProvider.md +20 -0
- package/api/@xmachines/play-solid/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-solid/functions/useAction.md +24 -0
- package/api/@xmachines/play-solid/functions/useActions.md +13 -0
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/useFieldValidation.md +29 -0
- package/api/@xmachines/play-solid/functions/useIsVisible.md +19 -0
- package/api/@xmachines/play-solid/functions/useOptionalValidation.md +13 -0
- package/api/@xmachines/play-solid/functions/usePlayView.md +30 -0
- package/api/@xmachines/play-solid/functions/useStateBinding.md +25 -0
- package/api/@xmachines/play-solid/functions/useStateStore.md +13 -0
- package/api/@xmachines/play-solid/functions/useStateValue.md +25 -0
- package/api/@xmachines/play-solid/functions/useVisibility.md +13 -0
- package/api/@xmachines/play-solid/interfaces/ActionProviderProps.md +12 -0
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +30 -0
- package/api/@xmachines/play-solid/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-solid/interfaces/JSONUIProviderProps.md +21 -0
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +26 -0
- package/api/@xmachines/play-solid/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-solid/interfaces/StateProviderProps.md +13 -0
- package/api/@xmachines/play-solid/interfaces/ValidationProviderProps.md +11 -0
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +21 -0
- package/api/@xmachines/play-solid/type-aliases/ComponentRegistry.md +17 -0
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-solid/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-solid/type-aliases/SetState.md +21 -0
- package/api/@xmachines/play-solid/type-aliases/VisibilityProviderProps.md +9 -0
- package/api/@xmachines/play-solid/variables/ActorContext.md +13 -0
- package/api/@xmachines/play-solid/variables/ActorProvider.md +27 -0
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +5 -18
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +26 -0
- 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/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 +142 -27
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-svelte/functions/getActorContext.md +21 -0
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +19 -0
- package/api/@xmachines/play-svelte/functions/setActorContext.md +19 -0
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +40 -0
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +6 -5
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +24 -0
- package/api/@xmachines/play-svelte/type-aliases/PlayActor.md +9 -0
- package/api/@xmachines/play-svelte/type-aliases/RenderErrorHandler.md +7 -0
- 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/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/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/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/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/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/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/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 +137 -40
- package/api/@xmachines/play-vue/functions/defineRegistry.md +2 -2
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +28 -0
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/interfaces/ActionProviderProps.md +12 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +25 -0
- package/api/@xmachines/play-vue/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-vue/interfaces/JSONUIProviderProps.md +20 -0
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +24 -0
- package/api/@xmachines/play-vue/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-vue/interfaces/StateProviderProps.md +15 -0
- package/api/@xmachines/play-vue/interfaces/ValidationProviderProps.md +11 -0
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +21 -0
- 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/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-vue/variables/ActionProvider.md +64 -0
- package/api/@xmachines/play-vue/variables/JSONUIProvider.md +96 -0
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/Renderer.md +79 -0
- package/api/@xmachines/play-vue/variables/StateProvider.md +79 -0
- package/api/@xmachines/play-vue/variables/ValidationProvider.md +55 -0
- package/api/@xmachines/play-vue/variables/VisibilityProvider.md +40 -0
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.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/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/classes/PlayerActor.md +24 -24
- 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/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/functions/xmAliases.md +1 -1
- package/api/_media/README.md +404 -0
- package/examples/@xmachines/play-dom-demo/README.md +42 -22
- 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-react-demo/README.md +53 -46
- 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-solid-demo/README.md +53 -34
- 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 +23 -20
- package/examples/@xmachines/play-svelte-spa-router-demo/README.md +8 -10
- package/examples/@xmachines/play-sveltekit-router-demo/README.md +10 -12
- package/examples/@xmachines/play-vue-demo/README.md +55 -37
- package/examples/form-validation.md +112 -41
- package/examples/routing-patterns.md +9 -19
- package/guides/README.md +8 -0
- package/guides/actor-model.md +180 -0
- package/guides/getting-started.md +54 -37
- package/guides/installation.md +6 -6
- package/guides/signals.md +166 -0
- package/guides/state-machines.md +288 -0
- package/package.json +2 -2
- package/rfc/play.md +62 -35
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +0 -17
- package/api/@xmachines/play-dom/interfaces/DefineRegistryOptions.md +0 -23
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +0 -23
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +0 -23
- package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +0 -21
- package/api/@xmachines/play-svelte/variables/getBoundProp.md +0 -7
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +0 -21
|
@@ -4,76 +4,328 @@
|
|
|
4
4
|
|
|
5
5
|
**Vanilla DOM renderer for XMachines**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Framework-free view rendering driven by an XState v5 actor's `currentView` TC39 Signal. Implements the same catalog-typed `defineRegistry` / `ComponentFn` / `ActionFn` API surface as `@json-render/react`, `/solid`, `/vue`, and `/svelte`.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @xmachines/play-dom
|
|
12
|
+
npm install @xmachines/play-dom @json-render/core zod
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Key Exports
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
| Export | Description |
|
|
18
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `createPlayUI(registryResult, options?)` | Batteries-included factory: returns `mount(actor, container) → disconnect` — parallel to `PlayUIProvider` in framework packages |
|
|
20
|
+
| `createRenderer(catalog, componentMap)` | One-call factory: returns `mount(actor, container, options?) → disconnect` |
|
|
21
|
+
| `connectRenderer(options)` | Functional API: connect actor → DOM with full options |
|
|
22
|
+
| `defineRegistry(catalog, { components, actions })` | Build a catalog-typed `DomRegistry` with typed action handlers |
|
|
23
|
+
| `UIProviderOptions` | Standard options interface: `validationFunctions`, `navigate`, `functions`, `onRenderError`, `fallback` |
|
|
24
|
+
| `PlayRenderer` | Class-based renderer — `connect()` / `disconnect()` lifecycle |
|
|
25
|
+
| `schema` | DOM schema for `defineCatalog` (mirrors `@json-render/react/schema`) |
|
|
26
|
+
| `ComponentFn<C, K>` | Catalog-typed DOM component function type |
|
|
27
|
+
| `ComponentContext<C, K>` | Context passed to each `ComponentFn` — `props`, `on`, `emit`, `children`, `bindings`, `ctx` |
|
|
28
|
+
| `ActionFn<C, K>` | `(params, setState, state) => Promise<void>` — catalog-typed action handler |
|
|
29
|
+
| `SetState` | `(updater: prev => next) => void` — write to the local state store |
|
|
30
|
+
| `BaseComponentProps<P>` | Base type for catalog component prop definitions |
|
|
31
|
+
| `CatalogHasActions<C>` | Conditional type: `true` when catalog declares actions |
|
|
32
|
+
| `renderSpec(spec, store, registry, send, handlers)` | Pure Spec → DOM renderer (advanced use) |
|
|
33
|
+
|
|
34
|
+
## Quick Start — `createPlayUI`
|
|
35
|
+
|
|
36
|
+
The standard entry point — mirrors `PlayUIProvider` in framework packages. Pass a `registryResult` (from `defineRegistry`) plus optional `UIProviderOptions`, and get back a `mount` function:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { defineRegistry, createPlayUI, schema } from "@xmachines/play-dom";
|
|
40
|
+
import { defineCatalog } from "@json-render/core";
|
|
41
|
+
import { z } from "zod";
|
|
42
|
+
import type { ComponentFn } from "@xmachines/play-dom";
|
|
43
|
+
|
|
44
|
+
// 1. Define catalog
|
|
45
|
+
const catalog = defineCatalog(schema, {
|
|
46
|
+
components: {
|
|
47
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
48
|
+
Login: { props: z.object({ title: z.string(), username: z.string().optional() }) },
|
|
49
|
+
},
|
|
50
|
+
actions: {
|
|
51
|
+
login: { params: z.object({ username: z.string() }) },
|
|
52
|
+
logout: {},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 2. Build registry with typed action handlers
|
|
57
|
+
const registryResult = defineRegistry(catalog, {
|
|
58
|
+
components: {
|
|
59
|
+
Home: ({ props }) => {
|
|
60
|
+
const el = document.createElement("section");
|
|
61
|
+
el.textContent = props.title;
|
|
62
|
+
return el;
|
|
63
|
+
},
|
|
64
|
+
Login: ({ props, on }) => {
|
|
65
|
+
const section = document.createElement("section");
|
|
66
|
+
const button = document.createElement("button");
|
|
67
|
+
button.textContent = "Log In";
|
|
68
|
+
const submit = on("submit");
|
|
69
|
+
button.addEventListener("click", () => submit.emit());
|
|
70
|
+
section.append(button);
|
|
71
|
+
return section;
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
actions: {
|
|
75
|
+
login: async (params) => {
|
|
76
|
+
if (!params) return;
|
|
77
|
+
actor.send({ type: "auth.login", username: params.username });
|
|
78
|
+
},
|
|
79
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// 3. Create the UI factory (once, at module level)
|
|
84
|
+
const ui = createPlayUI(registryResult, {
|
|
85
|
+
onRenderError: (error, elementType) => console.warn(`<${elementType}> crashed:`, error),
|
|
86
|
+
fallback: (() => {
|
|
87
|
+
const el = document.createElement("p");
|
|
88
|
+
el.textContent = "Loading…";
|
|
89
|
+
return el;
|
|
90
|
+
})(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// 4. Mount when actor and container are ready
|
|
94
|
+
const actor = createPlayer()();
|
|
95
|
+
actor.start();
|
|
24
96
|
|
|
25
|
-
|
|
97
|
+
const disconnect = ui.mount(actor, document.getElementById("app")!);
|
|
26
98
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
99
|
+
// Cleanup:
|
|
100
|
+
disconnect();
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Quick Start — `createRenderer`
|
|
104
|
+
|
|
105
|
+
The lower-level one-call pattern — takes a catalog and component map directly:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { createRenderer, schema } from "@xmachines/play-dom";
|
|
30
109
|
import { defineCatalog } from "@json-render/core";
|
|
31
|
-
import {
|
|
110
|
+
import { z } from "zod";
|
|
32
111
|
import type { ComponentFn } from "@xmachines/play-dom";
|
|
33
112
|
|
|
34
|
-
// 1.
|
|
35
|
-
const
|
|
36
|
-
|
|
113
|
+
// 1. Define catalog
|
|
114
|
+
const catalog = defineCatalog(schema, {
|
|
115
|
+
components: {
|
|
116
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
117
|
+
Login: { props: z.object({ title: z.string(), username: z.string().optional() }) },
|
|
118
|
+
},
|
|
119
|
+
actions: {
|
|
120
|
+
login: { params: z.object({ username: z.string() }) },
|
|
121
|
+
logout: {},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
type AppCatalog = typeof catalog;
|
|
37
125
|
|
|
38
|
-
// 2. Implement
|
|
39
|
-
const Home: ComponentFn<
|
|
126
|
+
// 2. Implement components
|
|
127
|
+
const Home: ComponentFn<AppCatalog, "Home"> = ({ props }) => {
|
|
40
128
|
const el = document.createElement("section");
|
|
41
129
|
el.textContent = props.title;
|
|
42
130
|
return el;
|
|
43
131
|
};
|
|
44
132
|
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
133
|
+
const Login: ComponentFn<AppCatalog, "Login"> = ({ props, on }) => {
|
|
134
|
+
const section = document.createElement("section");
|
|
135
|
+
const input = document.createElement("input");
|
|
136
|
+
input.value = props.username ?? "";
|
|
137
|
+
input.addEventListener("input", () => ctx.store.update((s) => ({ ...s, username: input.value })));
|
|
138
|
+
|
|
139
|
+
const button = document.createElement("button");
|
|
140
|
+
button.textContent = "Log In";
|
|
141
|
+
const submit = on("submit");
|
|
142
|
+
button.addEventListener("click", () => submit.emit());
|
|
143
|
+
|
|
144
|
+
section.append(input, button);
|
|
145
|
+
return section;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// 3. Create the renderer factory (once, at module level)
|
|
149
|
+
const mount = createRenderer(catalog, { Home, Login });
|
|
150
|
+
|
|
151
|
+
// 4. Mount when actor and container are ready
|
|
152
|
+
const actor = createPlayer()();
|
|
153
|
+
actor.start();
|
|
154
|
+
|
|
155
|
+
const disconnect = mount(actor, document.getElementById("app")!);
|
|
156
|
+
|
|
157
|
+
// Cleanup:
|
|
158
|
+
disconnect();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## `defineRegistry` — Full Control
|
|
162
|
+
|
|
163
|
+
When you need `registryResult.executeAction()` or want to share the registry with `connectRenderer`:
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { defineRegistry, connectRenderer, schema } from "@xmachines/play-dom";
|
|
167
|
+
import { defineCatalog } from "@json-render/core";
|
|
168
|
+
import { z } from "zod";
|
|
169
|
+
|
|
170
|
+
const catalog = defineCatalog(schema, {
|
|
171
|
+
components: {
|
|
172
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
173
|
+
},
|
|
48
174
|
actions: {
|
|
49
|
-
login:
|
|
175
|
+
login: { params: z.object({ username: z.string() }) },
|
|
176
|
+
logout: {},
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Action handlers receive (params, setState, state)
|
|
181
|
+
// - params: resolved from the spec's on.submit.params (e.g. { $state: "/username" })
|
|
182
|
+
// - setState: write to the local state store (e.g. to clear a form)
|
|
183
|
+
// - state: current local state store snapshot
|
|
184
|
+
const registryResult = defineRegistry(catalog, {
|
|
185
|
+
components: {
|
|
186
|
+
Home: ({ props }) => {
|
|
187
|
+
const el = document.createElement("section");
|
|
188
|
+
el.textContent = props.title;
|
|
189
|
+
return el;
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
actions: {
|
|
193
|
+
login: async (params, setState) => {
|
|
50
194
|
if (!params) return;
|
|
51
195
|
actor.send({ type: "auth.login", username: params.username });
|
|
196
|
+
setState((prev) => ({ ...prev, username: "" })); // clear the form
|
|
52
197
|
},
|
|
53
198
|
logout: async () => actor.send({ type: "auth.logout" }),
|
|
54
199
|
},
|
|
55
200
|
});
|
|
56
201
|
|
|
57
|
-
// 4. Resolve handlers and connect
|
|
58
|
-
const actor = definePlayer({ machine: authMachine })();
|
|
59
|
-
actor.start();
|
|
60
|
-
|
|
61
|
-
const handlers = registryResult.handlers(
|
|
62
|
-
() => undefined,
|
|
63
|
-
() => ({}),
|
|
64
|
-
);
|
|
65
|
-
const container = document.getElementById("app")!;
|
|
66
202
|
const disconnect = connectRenderer({
|
|
67
203
|
actor,
|
|
68
204
|
registry: registryResult.registry,
|
|
69
|
-
|
|
70
|
-
|
|
205
|
+
registryResult, // wires setState/state from xstate store automatically
|
|
206
|
+
container: document.getElementById("app")!,
|
|
71
207
|
});
|
|
72
208
|
```
|
|
73
209
|
|
|
210
|
+
## Component API
|
|
211
|
+
|
|
212
|
+
### `ComponentFn<C, K>` — component function signature
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
const MyCard: ComponentFn<AppCatalog, "Card"> = ({
|
|
216
|
+
props, // catalog-typed props for this component
|
|
217
|
+
children, // Node[] — rendered child nodes
|
|
218
|
+
on, // (eventName) => EventHandle — get emit() for catalog-declared events
|
|
219
|
+
emit, // (eventName) => void — fire an event directly
|
|
220
|
+
bindings, // Record<string, string> — $bindState paths for two-way bindings
|
|
221
|
+
ctx, // DomRenderContext — store, send, handlers, loading, functions
|
|
222
|
+
}) => {
|
|
223
|
+
const el = document.createElement("div");
|
|
224
|
+
el.append(...children);
|
|
225
|
+
return el;
|
|
226
|
+
};
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Two-way binding with `$bindState`
|
|
230
|
+
|
|
231
|
+
In the view spec:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{ "username": { "$bindState": "/username" } }
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
In the component:
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
const Login: ComponentFn<AppCatalog, "Login"> = ({ props, ctx }) => {
|
|
241
|
+
const input = document.createElement("input");
|
|
242
|
+
input.value = props.username ?? "";
|
|
243
|
+
// Write back to the store on user input
|
|
244
|
+
input.addEventListener("input", () => {
|
|
245
|
+
ctx.store.update((s) => ({ ...s, username: input.value }));
|
|
246
|
+
});
|
|
247
|
+
return input;
|
|
248
|
+
};
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### `on()` — event handle
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
const submit = on("submit"); // EventHandle
|
|
255
|
+
if (submit.bound) {
|
|
256
|
+
button.addEventListener("click", (e) => {
|
|
257
|
+
if (submit.shouldPreventDefault) e.preventDefault();
|
|
258
|
+
submit.emit(); // resolves params from store, calls action handler
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### `ActionFn` — action handler signature
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
// Full signature — all three params are available
|
|
267
|
+
login: async (params, setState, state) => {
|
|
268
|
+
actor.send({ type: "auth.login", username: params!.username });
|
|
269
|
+
setState(prev => ({ ...prev, username: "" }));
|
|
270
|
+
console.log("previous state was:", state);
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// Params-only — setState/state can be omitted if unused
|
|
274
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
275
|
+
route: async (params) => actor.send({ type: "play.route", to: params!.to }),
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Spec Features
|
|
279
|
+
|
|
280
|
+
`renderSpec` / `renderElement` supports these spec directives:
|
|
281
|
+
|
|
282
|
+
| Directive | Description |
|
|
283
|
+
| ------------------------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
284
|
+
| `visible` | Boolean or `{ $state: "/path" }` — hide element when false |
|
|
285
|
+
| `on.submit` / `on.click` | Action binding — `{ action: "login", params: { username: { $state: "/username" } } }` |
|
|
286
|
+
| `repeat: { statePath, key? }` | Render children once per item in the state array at `statePath` |
|
|
287
|
+
| `watch: { "/path": actionBinding }` | Fire action when store path changes after mount |
|
|
288
|
+
| `props.username: { $bindState: "/username" }` | Two-way binding — read from store, write back via `ctx.store.update()` |
|
|
289
|
+
| `props.value: { $state: "/value" }` | Read-only store reference |
|
|
290
|
+
| `props.label: { $computed: "computeFn", args: [...] }` | Computed prop via `functions` map |
|
|
291
|
+
|
|
292
|
+
## `PlayRenderer` — class API
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { PlayRenderer, defineRegistry } from "@xmachines/play-dom";
|
|
296
|
+
|
|
297
|
+
const { registry, registryResult } = defineRegistry(catalog, { components, actions });
|
|
298
|
+
|
|
299
|
+
const renderer = new PlayRenderer(document.getElementById("app")!, actor, registry, {
|
|
300
|
+
registryResult,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
renderer.connect(); // starts watching actor.currentView
|
|
304
|
+
renderer.disconnect(); // stops watching, clears container
|
|
305
|
+
|
|
306
|
+
// double-connect is safe — connect() calls disconnect() internally if already connected
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Options Reference
|
|
310
|
+
|
|
311
|
+
### `ConnectRendererOptions` / `PlayDomOptions`
|
|
312
|
+
|
|
313
|
+
| Option | Type | Description |
|
|
314
|
+
| ---------------- | ------------------------------- | ----------------------------------------------------------------------------- |
|
|
315
|
+
| `actor` | `AbstractActor & Viewable` | Actor providing `currentView` signal |
|
|
316
|
+
| `registry` | `DomRegistry` | Component renderer map from `defineRegistry` |
|
|
317
|
+
| `registryResult` | `DefineRegistryResult` | Preferred — auto-wires `setState`/`state` from xstate store |
|
|
318
|
+
| `handlers` | `Record<string, ActionHandler>` | Pre-resolved handlers (legacy / advanced) |
|
|
319
|
+
| `container` | `HTMLElement` | DOM element to render into |
|
|
320
|
+
| `fallback` | `HTMLElement \| null` | Shown on initial mount when view is `null` (initial mount only) |
|
|
321
|
+
| `store` | `StateStore` | External store — controlled mode, overrides `spec.state` |
|
|
322
|
+
| `loading` | `boolean` | Streaming mode — suppresses missing-child warnings, exposes `ctx.ctx.loading` |
|
|
323
|
+
|
|
74
324
|
## Learn More
|
|
75
325
|
|
|
76
326
|
- [DOM Router adapter `@xmachines/play-dom-router`](../play-dom-router/README.md)
|
|
327
|
+
- [API reference](../../_media/README.md)
|
|
328
|
+
- [Play RFC](../../packages/docs/rfc/play.md)
|
|
77
329
|
|
|
78
330
|
@xmachines/play-dom — Vanilla DOM renderer for XMachines Play architecture.
|
|
79
331
|
|
|
@@ -81,8 +333,9 @@ Public API split into two layers:
|
|
|
81
333
|
|
|
82
334
|
**XMachines layer** (this package):
|
|
83
335
|
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
336
|
+
- `createRenderer()` — one-call factory: returns `mount(actor, container, options?) → disconnect`
|
|
337
|
+
- `PlayRenderer` — class-based renderer with `connect()` / `disconnect()` lifecycle
|
|
338
|
+
- `connectRenderer()` — functional API (backward-compat alternative to `PlayRenderer`)
|
|
86
339
|
- `ConnectRendererOptions`, `PlayDomOptions`
|
|
87
340
|
|
|
88
341
|
**json-render layer** (upstreamable to @json-render/dom):
|
|
@@ -96,6 +349,9 @@ Public API split into two layers:
|
|
|
96
349
|
- `DomRegistry` — raw registry type
|
|
97
350
|
- `DomRenderContext` — raw render context
|
|
98
351
|
- `EventHandle` — event handle returned by on()
|
|
352
|
+
- `SetState` — state updater function passed to ActionFn
|
|
353
|
+
- `CatalogHasActions` — conditional type: true when catalog declares actions
|
|
354
|
+
- `BaseComponentProps` — base props type for catalog component definitions
|
|
99
355
|
|
|
100
356
|
## Classes
|
|
101
357
|
|
|
@@ -105,21 +361,29 @@ Public API split into two layers:
|
|
|
105
361
|
|
|
106
362
|
- [ComponentContext](interfaces/ComponentContext.md)
|
|
107
363
|
- [ConnectRendererOptions](interfaces/ConnectRendererOptions.md)
|
|
108
|
-
- [
|
|
364
|
+
- [CreatePlayUIOptions](interfaces/CreatePlayUIOptions.md)
|
|
109
365
|
- [DefineRegistryResult](interfaces/DefineRegistryResult.md)
|
|
110
366
|
- [DomRenderContext](interfaces/DomRenderContext.md)
|
|
111
367
|
- [EventHandle](interfaces/EventHandle.md)
|
|
368
|
+
- [MountOptions](interfaces/MountOptions.md)
|
|
112
369
|
- [PlayDomOptions](interfaces/PlayDomOptions.md)
|
|
370
|
+
- [UIProviderOptions](interfaces/UIProviderOptions.md)
|
|
113
371
|
|
|
114
372
|
## Type Aliases
|
|
115
373
|
|
|
116
374
|
- [ActionFn](type-aliases/ActionFn.md)
|
|
117
375
|
- [Actions](type-aliases/Actions.md)
|
|
376
|
+
- [BaseComponentProps](type-aliases/BaseComponentProps.md)
|
|
377
|
+
- [CatalogHasActions](type-aliases/CatalogHasActions.md)
|
|
118
378
|
- [ComponentFn](type-aliases/ComponentFn.md)
|
|
119
379
|
- [ComponentRegistry](type-aliases/ComponentRegistry.md)
|
|
380
|
+
- [DefineRegistryOptions](type-aliases/DefineRegistryOptions.md)
|
|
120
381
|
- [DomComponentRenderer](type-aliases/DomComponentRenderer.md)
|
|
121
382
|
- [DomRegistry](type-aliases/DomRegistry.md)
|
|
122
383
|
- [DomSchema](type-aliases/DomSchema.md)
|
|
384
|
+
- [MountFn](type-aliases/MountFn.md)
|
|
385
|
+
- [RenderErrorHandler](type-aliases/RenderErrorHandler.md)
|
|
386
|
+
- [SetState](type-aliases/SetState.md)
|
|
123
387
|
|
|
124
388
|
## Variables
|
|
125
389
|
|
|
@@ -128,5 +392,13 @@ Public API split into two layers:
|
|
|
128
392
|
## Functions
|
|
129
393
|
|
|
130
394
|
- [connectRenderer](functions/connectRenderer.md)
|
|
395
|
+
- [createPlayUI](functions/createPlayUI.md)
|
|
396
|
+
- [createRenderer](functions/createRenderer.md)
|
|
131
397
|
- [defineRegistry](functions/defineRegistry.md)
|
|
132
398
|
- [renderSpec](functions/renderSpec.md)
|
|
399
|
+
|
|
400
|
+
## References
|
|
401
|
+
|
|
402
|
+
### RenderErrorHandler
|
|
403
|
+
|
|
404
|
+
Re-exports [RenderErrorHandler](type-aliases/RenderErrorHandler.md)
|
|
@@ -2,34 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayRenderer
|
|
4
4
|
|
|
5
|
-
Defined in: [PlayRenderer.ts:
|
|
5
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:78](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.34/packages/play-dom/src/PlayRenderer.ts#L78)
|
|
6
6
|
|
|
7
|
-
PlayRenderer connects an actor's currentView signal to the DOM renderer.
|
|
7
|
+
PlayRenderer connects an actor's `currentView` signal to the DOM renderer.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Watches `actor.currentView` via TC39 Signals and renders `DomComponentRenderer`
|
|
10
|
+
functions into `container` on every view transition. Cleared on `disconnect()`.
|
|
11
|
+
|
|
12
|
+
**Preferred usage — via `registryResult`:**
|
|
10
13
|
|
|
11
14
|
```typescript
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { PlayRenderer, defineRegistry } from "@xmachines/play-dom";
|
|
16
|
+
|
|
17
|
+
const registryResult = defineRegistry(catalog, { components, actions });
|
|
18
|
+
const renderer = new PlayRenderer(container, actor, registryResult.registry, {
|
|
19
|
+
registryResult, // wires setState/getState from xstate store automatically
|
|
20
|
+
});
|
|
18
21
|
renderer.connect();
|
|
22
|
+
// Later:
|
|
23
|
+
renderer.disconnect();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Controlled store mode** — bring your own `StateStore`:
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
```typescript
|
|
21
29
|
import { createAtom } from "@xstate/store";
|
|
22
30
|
import { xstateStoreStateStore } from "@json-render/xstate";
|
|
23
|
-
const store = xstateStoreStateStore({ atom: createAtom({ username: "" }) });
|
|
24
|
-
const renderer = new PlayRenderer(container, actor, registry, {
|
|
25
|
-
store,
|
|
26
|
-
handlers: resolvedHandlers,
|
|
27
|
-
});
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
const atom = createAtom({ username: "" });
|
|
33
|
+
const store = xstateStoreStateStore({ atom });
|
|
34
|
+
const renderer = new PlayRenderer(container, actor, registry, { registryResult, store });
|
|
35
|
+
renderer.connect();
|
|
31
36
|
```
|
|
32
37
|
|
|
38
|
+
Double `connect()` is safe — calling `connect()` while already connected
|
|
39
|
+
automatically disconnects first, preventing double-render subscriptions.
|
|
40
|
+
|
|
33
41
|
## Constructors
|
|
34
42
|
|
|
35
43
|
### Constructor
|
|
@@ -42,16 +50,16 @@ new PlayRenderer(
|
|
|
42
50
|
options?): PlayRenderer;
|
|
43
51
|
```
|
|
44
52
|
|
|
45
|
-
Defined in: [PlayRenderer.ts:
|
|
53
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:101](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.34/packages/play-dom/src/PlayRenderer.ts#L101)
|
|
46
54
|
|
|
47
55
|
#### Parameters
|
|
48
56
|
|
|
49
|
-
| Parameter | Type | Description
|
|
50
|
-
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| `container` | `HTMLElement` |
|
|
52
|
-
| `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
|
|
53
|
-
| `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) |
|
|
54
|
-
| `options` | [`PlayDomOptions`](../interfaces/PlayDomOptions.md) |
|
|
57
|
+
| Parameter | Type | Description |
|
|
58
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
59
|
+
| `container` | `HTMLElement` | `HTMLElement` to render into. Cleared and repopulated on every view transition. |
|
|
60
|
+
| `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 providing the `currentView` signal (must implement `Viewable`). |
|
|
61
|
+
| `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | Component renderer map — typically `registryResult.registry` from `defineRegistry`. |
|
|
62
|
+
| `options` | [`PlayDomOptions`](../interfaces/PlayDomOptions.md) | Configuration: - `registryResult` — preferred; auto-wires `setState`/`state` from the xstate store. - `handlers` — pre-resolved handler map (legacy; used when `registryResult` is absent). - `store` — external `StateStore` (controlled mode; overrides `spec.state` seeding). - `loading` — streaming mode flag; suppresses missing-child warnings. |
|
|
55
63
|
|
|
56
64
|
#### Returns
|
|
57
65
|
|
|
@@ -65,11 +73,16 @@ Defined in: [PlayRenderer.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/bl
|
|
|
65
73
|
connect(): void;
|
|
66
74
|
```
|
|
67
75
|
|
|
68
|
-
Defined in: [PlayRenderer.ts:
|
|
76
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:117](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.34/packages/play-dom/src/PlayRenderer.ts#L117)
|
|
69
77
|
|
|
70
78
|
Start watching actor.currentView and render to container.
|
|
71
79
|
Renders the initial view synchronously, then subscribes to signal changes.
|
|
72
80
|
|
|
81
|
+
Calling `connect()` on an already-connected renderer (where a previous
|
|
82
|
+
`connect()` was never followed by `disconnect()`) would silently install a
|
|
83
|
+
second `watchSignal` subscription, causing double-renders on every view
|
|
84
|
+
change. Guard against this by auto-disconnecting first.
|
|
85
|
+
|
|
73
86
|
#### Returns
|
|
74
87
|
|
|
75
88
|
`void`
|
|
@@ -82,7 +95,7 @@ Renders the initial view synchronously, then subscribes to signal changes.
|
|
|
82
95
|
disconnect(): void;
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
Defined in: [PlayRenderer.ts:
|
|
98
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:126](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.34/packages/play-dom/src/PlayRenderer.ts#L126)
|
|
86
99
|
|
|
87
100
|
Stop watching and clear the container.
|
|
88
101
|
|
|
@@ -6,46 +6,65 @@
|
|
|
6
6
|
function connectRenderer(options): () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [connect-renderer.ts:
|
|
9
|
+
Defined in: [packages/play-dom/src/connect-renderer.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.34/packages/play-dom/src/connect-renderer.ts#L65)
|
|
10
10
|
|
|
11
|
-
Connect a signal-driven DOM renderer to an actor's currentView signal.
|
|
11
|
+
Connect a signal-driven DOM renderer to an actor's `currentView` signal.
|
|
12
12
|
|
|
13
|
-
Subscribes to `actor.currentView` via TC39 Signals and renders
|
|
14
|
-
|
|
13
|
+
Subscribes to `actor.currentView` via TC39 Signals and renders catalog-typed
|
|
14
|
+
components into `container` on every view transition. Clears the container
|
|
15
|
+
when the view is `null` (optionally appends `fallback` on initial mount).
|
|
15
16
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
17
|
+
- Initial render is **synchronous** — the container is populated before `connectRenderer` returns.
|
|
18
|
+
- Signal-driven re-renders are **microtask-deferred** — `watchSignal` schedules them
|
|
19
|
+
on the next microtask queue tick, not synchronously within the signal update.
|
|
20
|
+
|
|
21
|
+
For the one-call pattern, prefer [createRenderer](createRenderer.md) which wraps `defineRegistry`
|
|
22
|
+
and `PlayRenderer` into a single factory function.
|
|
19
23
|
|
|
20
24
|
## Parameters
|
|
21
25
|
|
|
22
|
-
| Parameter | Type | Description
|
|
23
|
-
| --------- | ------------------------------------------------------------------- |
|
|
24
|
-
| `options` | [`ConnectRendererOptions`](../interfaces/ConnectRendererOptions.md) | ConnectRendererOptions |
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --------- | ------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
28
|
+
| `options` | [`ConnectRendererOptions`](../interfaces/ConnectRendererOptions.md) | [ConnectRendererOptions](../interfaces/ConnectRendererOptions.md) |
|
|
25
29
|
|
|
26
30
|
## Returns
|
|
27
31
|
|
|
28
|
-
A cleanup function
|
|
32
|
+
A cleanup function — call to stop all DOM mutations and remove subscriptions.
|
|
29
33
|
|
|
30
34
|
() => `void`
|
|
31
35
|
|
|
32
36
|
## Example
|
|
33
37
|
|
|
34
38
|
```typescript
|
|
35
|
-
import { connectRenderer,
|
|
39
|
+
import { connectRenderer, defineRegistry, schema } from "@xmachines/play-dom";
|
|
40
|
+
import { defineCatalog } from "@json-render/core";
|
|
41
|
+
import { z } from "zod";
|
|
36
42
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const catalog = defineCatalog(schema, {
|
|
44
|
+
components: { Home: { props: z.object({ title: z.string() }) } },
|
|
45
|
+
actions: { logout: {} },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const registryResult = defineRegistry(catalog, {
|
|
49
|
+
components: {
|
|
50
|
+
Home: ({ props }) => {
|
|
51
|
+
const el = document.createElement("section");
|
|
52
|
+
el.textContent = props.title;
|
|
43
53
|
return el;
|
|
44
54
|
},
|
|
45
55
|
},
|
|
56
|
+
actions: {
|
|
57
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const disconnect = connectRenderer({
|
|
62
|
+
actor,
|
|
63
|
+
registry: registryResult.registry,
|
|
64
|
+
registryResult, // preferred — wires setState/state from xstate store automatically
|
|
46
65
|
container: document.getElementById("app")!,
|
|
47
66
|
});
|
|
48
67
|
|
|
49
|
-
// Later:
|
|
50
|
-
|
|
68
|
+
// Later:
|
|
69
|
+
disconnect();
|
|
51
70
|
```
|