@xmachines/docs 1.0.0-beta.46 → 1.0.0-beta.50
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 +3 -3
- 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/contributing/README.md +10 -0
- package/contributing/configuration.md +540 -0
- package/contributing/deployment.md +314 -0
- package/contributing/development.md +617 -0
- package/contributing/testing.md +460 -0
- 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 +11 -7
- package/guides/actor-model.md +18 -18
- package/guides/architecture.md +500 -0
- package/guides/getting-started.md +351 -142
- package/guides/signals.md +19 -19
- package/guides/state-machines.md +16 -16
- package/package.json +7 -5
- package/guides/installation.md +0 -257
|
@@ -1,108 +1,26 @@
|
|
|
1
1
|
[API](../../README.md) / @xmachines/play-dom
|
|
2
2
|
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
3
5
|
# @xmachines/play-dom
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Vanilla DOM 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
|
|
12
|
-
npm install @xmachines/play-dom
|
|
14
|
+
npm install @xmachines/play-dom
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
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";
|
|
17
|
+
**Peer dependencies:**
|
|
43
18
|
|
|
44
|
-
|
|
45
|
-
|
|
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();
|
|
96
|
-
|
|
97
|
-
const disconnect = ui.mount(actor, document.getElementById("app")!);
|
|
98
|
-
|
|
99
|
-
// Cleanup:
|
|
100
|
-
disconnect();
|
|
19
|
+
```bash
|
|
20
|
+
npm install xstate @xstate/store @json-render/core @json-render/xstate
|
|
101
21
|
```
|
|
102
22
|
|
|
103
|
-
## Quick Start
|
|
104
|
-
|
|
105
|
-
The lower-level one-call pattern — takes a catalog and component map directly:
|
|
23
|
+
## Quick Start
|
|
106
24
|
|
|
107
25
|
```typescript
|
|
108
26
|
import { createRenderer, schema } from "@xmachines/play-dom";
|
|
@@ -110,7 +28,7 @@ import { defineCatalog } from "@json-render/core";
|
|
|
110
28
|
import { z } from "zod";
|
|
111
29
|
import type { ComponentFn } from "@xmachines/play-dom";
|
|
112
30
|
|
|
113
|
-
// 1. Define catalog
|
|
31
|
+
// 1. Define a catalog
|
|
114
32
|
const catalog = defineCatalog(schema, {
|
|
115
33
|
components: {
|
|
116
34
|
Home: { props: z.object({ title: z.string() }) },
|
|
@@ -121,213 +39,203 @@ const catalog = defineCatalog(schema, {
|
|
|
121
39
|
logout: {},
|
|
122
40
|
},
|
|
123
41
|
});
|
|
124
|
-
type AppCatalog = typeof catalog;
|
|
125
42
|
|
|
126
43
|
// 2. Implement components
|
|
127
|
-
const Home: ComponentFn<
|
|
44
|
+
const Home: ComponentFn<typeof catalog, "Home"> = ({ props }) => {
|
|
128
45
|
const el = document.createElement("section");
|
|
129
46
|
el.textContent = props.title;
|
|
130
47
|
return el;
|
|
131
48
|
};
|
|
132
49
|
|
|
133
|
-
const Login: ComponentFn<
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
input.value = props.username ?? "";
|
|
137
|
-
input.addEventListener("input", () =>
|
|
138
|
-
ctx.store.update((s) => ({ ...s, username: input.value })),
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const button = document.createElement("button");
|
|
142
|
-
button.textContent = "Log In";
|
|
50
|
+
const Login: ComponentFn<typeof catalog, "Login"> = ({ props, on }) => {
|
|
51
|
+
const el = document.createElement("section");
|
|
52
|
+
const btn = document.createElement("button");
|
|
143
53
|
const submit = on("submit");
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return section;
|
|
54
|
+
btn.addEventListener("click", () => submit.emit());
|
|
55
|
+
el.append(btn);
|
|
56
|
+
return el;
|
|
148
57
|
};
|
|
149
58
|
|
|
150
|
-
// 3.
|
|
59
|
+
// 3. Build the factory once (module scope)
|
|
151
60
|
const mount = createRenderer(catalog, { Home, Login });
|
|
152
61
|
|
|
153
62
|
// 4. Mount when actor and container are ready
|
|
154
|
-
const actor = createPlayer()();
|
|
155
|
-
actor.start();
|
|
156
|
-
|
|
157
63
|
const disconnect = mount(actor, document.getElementById("app")!);
|
|
158
64
|
|
|
159
|
-
// Cleanup
|
|
65
|
+
// 5. Cleanup on teardown
|
|
160
66
|
disconnect();
|
|
161
67
|
```
|
|
162
68
|
|
|
163
|
-
##
|
|
69
|
+
## Usage
|
|
164
70
|
|
|
165
|
-
|
|
71
|
+
### `createRenderer` — one-call factory (recommended)
|
|
72
|
+
|
|
73
|
+
`createRenderer` is the simplest integration path. Call it once at module scope with your catalog and component map, then call the returned `mount` function for each actor/container pair.
|
|
166
74
|
|
|
167
75
|
```typescript
|
|
168
|
-
import {
|
|
76
|
+
import { createRenderer, schema } from "@xmachines/play-dom";
|
|
169
77
|
import { defineCatalog } from "@json-render/core";
|
|
170
|
-
import { z } from "zod";
|
|
171
78
|
|
|
172
79
|
const catalog = defineCatalog(schema, {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
80
|
+
/* ... */
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const mount = createRenderer(catalog, { MyComponent });
|
|
84
|
+
|
|
85
|
+
const disconnect = mount(actor, document.getElementById("app")!);
|
|
86
|
+
// Returns a cleanup function — call it to stop rendering and clear the container.
|
|
87
|
+
disconnect();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `createPlayUI` — batteries-included factory with full options
|
|
91
|
+
|
|
92
|
+
Use `createPlayUI` when you need render error handling, a fallback element, or a shared `registryResult` that you also need to reference programmatically (e.g. for `executeAction`).
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { defineRegistry, createPlayUI, schema } from "@xmachines/play-dom";
|
|
96
|
+
import { defineCatalog } from "@json-render/core";
|
|
97
|
+
|
|
98
|
+
const catalog = defineCatalog(schema, {
|
|
99
|
+
/* ... */
|
|
180
100
|
});
|
|
181
101
|
|
|
182
|
-
// Action handlers receive (params, setState, state)
|
|
183
|
-
// - params: resolved from the spec's on.submit.params (e.g. { $state: "/username" })
|
|
184
|
-
// - setState: write to the local state store (e.g. to clear a form)
|
|
185
|
-
// - state: current local state store snapshot
|
|
186
102
|
const registryResult = defineRegistry(catalog, {
|
|
187
|
-
components: {
|
|
188
|
-
Home: ({ props }) => {
|
|
189
|
-
const el = document.createElement("section");
|
|
190
|
-
el.textContent = props.title;
|
|
191
|
-
return el;
|
|
192
|
-
},
|
|
193
|
-
},
|
|
103
|
+
components: { Home, Login },
|
|
194
104
|
actions: {
|
|
195
105
|
login: async (params, setState) => {
|
|
196
|
-
|
|
197
|
-
actor.send({ type: "auth.login", username: params.username });
|
|
198
|
-
setState((prev) => ({ ...prev, username: "" })); // clear the form
|
|
106
|
+
/* ... */
|
|
199
107
|
},
|
|
200
108
|
logout: async () => actor.send({ type: "auth.logout" }),
|
|
201
109
|
},
|
|
202
110
|
});
|
|
203
111
|
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
registryResult, // wires setState/state from xstate store automatically
|
|
208
|
-
container: document.getElementById("app")!,
|
|
112
|
+
const mount = createPlayUI(registryResult, {
|
|
113
|
+
onRenderError: console.error,
|
|
114
|
+
fallback: document.getElementById("loading")!,
|
|
209
115
|
});
|
|
116
|
+
|
|
117
|
+
const disconnect = mount(actor, document.getElementById("app")!);
|
|
118
|
+
disconnect();
|
|
210
119
|
```
|
|
211
120
|
|
|
212
|
-
|
|
121
|
+
### `PlayRenderer` — class-based lifecycle control
|
|
213
122
|
|
|
214
|
-
|
|
123
|
+
Use `PlayRenderer` directly when you need explicit `connect()` / `disconnect()` lifecycle control, or when integrating into a system that manages the renderer's lifetime externally.
|
|
215
124
|
|
|
216
125
|
```typescript
|
|
217
|
-
|
|
218
|
-
props, // catalog-typed props for this component
|
|
219
|
-
children, // Node[] — rendered child nodes
|
|
220
|
-
on, // (eventName) => EventHandle — get emit() for catalog-declared events
|
|
221
|
-
emit, // (eventName) => void — fire an event directly
|
|
222
|
-
bindings, // Record<string, string> — $bindState paths for two-way bindings
|
|
223
|
-
ctx, // DomRenderContext — store, send, handlers, loading, functions
|
|
224
|
-
}) => {
|
|
225
|
-
const el = document.createElement("div");
|
|
226
|
-
el.append(...children);
|
|
227
|
-
return el;
|
|
228
|
-
};
|
|
229
|
-
```
|
|
126
|
+
import { PlayRenderer, defineRegistry, schema } from "@xmachines/play-dom";
|
|
230
127
|
|
|
231
|
-
|
|
128
|
+
const registryResult = defineRegistry(catalog, { components, actions });
|
|
232
129
|
|
|
233
|
-
|
|
130
|
+
const renderer = new PlayRenderer(container, actor, registryResult.registry, { registryResult });
|
|
234
131
|
|
|
235
|
-
|
|
236
|
-
|
|
132
|
+
renderer.connect();
|
|
133
|
+
// Later:
|
|
134
|
+
renderer.disconnect();
|
|
237
135
|
```
|
|
238
136
|
|
|
239
|
-
|
|
137
|
+
**Controlled store mode** — supply an external `StateStore` so the renderer shares state with other parts of your app:
|
|
240
138
|
|
|
241
139
|
```typescript
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
input.value = props.username ?? "";
|
|
245
|
-
// Write back to the store on user input
|
|
246
|
-
input.addEventListener("input", () => {
|
|
247
|
-
ctx.store.update((s) => ({ ...s, username: input.value }));
|
|
248
|
-
});
|
|
249
|
-
return input;
|
|
250
|
-
};
|
|
251
|
-
```
|
|
140
|
+
import { createAtom } from "@xstate/store";
|
|
141
|
+
import { xstateStoreStateStore } from "@json-render/xstate";
|
|
252
142
|
|
|
253
|
-
|
|
143
|
+
const atom = createAtom({ username: "" });
|
|
144
|
+
const store = xstateStoreStateStore({ atom });
|
|
254
145
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
submit.emit(); // resolves params from store, calls action handler
|
|
261
|
-
});
|
|
262
|
-
}
|
|
146
|
+
const renderer = new PlayRenderer(container, actor, registryResult.registry, {
|
|
147
|
+
registryResult,
|
|
148
|
+
store,
|
|
149
|
+
});
|
|
150
|
+
renderer.connect();
|
|
263
151
|
```
|
|
264
152
|
|
|
265
|
-
### `
|
|
153
|
+
### `connectRenderer` — functional API (backward-compatible)
|
|
154
|
+
|
|
155
|
+
`connectRenderer` is the original functional API, equivalent to creating a `PlayRenderer` and calling `connect()` in one step. Prefer `createRenderer` or `createPlayUI` for new code.
|
|
266
156
|
|
|
267
157
|
```typescript
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
158
|
+
import { connectRenderer, defineRegistry, schema } from "@xmachines/play-dom";
|
|
159
|
+
|
|
160
|
+
const registryResult = defineRegistry(catalog, {
|
|
161
|
+
components: {
|
|
162
|
+
Home: ({ props }) => {
|
|
163
|
+
const el = document.createElement("section");
|
|
164
|
+
el.textContent = props.title;
|
|
165
|
+
return el;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
actions: {
|
|
169
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
170
|
+
},
|
|
171
|
+
});
|
|
279
172
|
|
|
280
|
-
|
|
173
|
+
const disconnect = connectRenderer({
|
|
174
|
+
actor,
|
|
175
|
+
registry: registryResult.registry,
|
|
176
|
+
registryResult,
|
|
177
|
+
container: document.getElementById("app")!,
|
|
178
|
+
});
|
|
281
179
|
|
|
282
|
-
|
|
180
|
+
// Later:
|
|
181
|
+
disconnect();
|
|
182
|
+
```
|
|
283
183
|
|
|
284
|
-
|
|
285
|
-
| ------------------------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
286
|
-
| `visible` | Boolean or `{ $state: "/path" }` — hide element when false |
|
|
287
|
-
| `on.submit` / `on.click` | Action binding — `{ action: "login", params: { username: { $state: "/username" } } }` |
|
|
288
|
-
| `repeat: { statePath, key? }` | Render children once per item in the state array at `statePath` |
|
|
289
|
-
| `watch: { "/path": actionBinding }` | Fire action when store path changes after mount |
|
|
290
|
-
| `props.username: { $bindState: "/username" }` | Two-way binding — read from store, write back via `ctx.store.update()` |
|
|
291
|
-
| `props.value: { $state: "/value" }` | Read-only store reference |
|
|
292
|
-
| `props.label: { $computed: "computeFn", args: [...] }` | Computed prop via `functions` map |
|
|
184
|
+
## API Summary
|
|
293
185
|
|
|
294
|
-
|
|
186
|
+
### XMachines Layer
|
|
295
187
|
|
|
296
|
-
|
|
297
|
-
|
|
188
|
+
| Export | Kind | Description |
|
|
189
|
+
| ---------------------------------------- | -------- | --------------------------------------------------------------------------- |
|
|
190
|
+
| `createRenderer(catalog, components)` | function | One-call factory — returns `mount(actor, container, options?) → disconnect` |
|
|
191
|
+
| `createPlayUI(registryResult, options?)` | function | Batteries-included factory — returns `MountFn` |
|
|
192
|
+
| `PlayRenderer` | class | Class-based renderer with `connect()` / `disconnect()` lifecycle |
|
|
193
|
+
| `connectRenderer(options)` | function | Functional API; backward-compatible alternative to `PlayRenderer` |
|
|
194
|
+
| `defineRegistry(catalog, options)` | function | Build a catalog-typed `DomRegistry` with typed handlers |
|
|
195
|
+
| `renderSpec(...)` | function | Pure Spec → DOM renderer (low-level) |
|
|
196
|
+
| `schema` | const | The `@json-render/dom` schema — pass to `defineCatalog()` |
|
|
298
197
|
|
|
299
|
-
|
|
198
|
+
### Key Types
|
|
300
199
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
200
|
+
| Type | Description |
|
|
201
|
+
| ------------------------ | -------------------------------------------------------------------------------------- |
|
|
202
|
+
| `ComponentFn<C, K>` | Catalog-typed component function — returns `HTMLElement \| Text \| null` |
|
|
203
|
+
| `ComponentContext<C, K>` | Context passed to each component: `props`, `children`, `emit`, `on`, `bindings`, `ctx` |
|
|
204
|
+
| `ActionFn<C, K>` | Catalog-typed action function — receives `(params, setState, state)` |
|
|
205
|
+
| `EventHandle` | Handle returned by `on(eventName)` — has `emit()`, `shouldPreventDefault`, `bound` |
|
|
206
|
+
| `SetState` | State updater: `(prev => next) => void` |
|
|
207
|
+
| `DefineRegistryResult` | Result from `defineRegistry` — has `registry`, `handlers`, `executeAction` |
|
|
208
|
+
| `PlayDomOptions` | Options for `PlayRenderer` and `connectRenderer` |
|
|
209
|
+
| `BaseComponentProps<P>` | Catalog-agnostic component props for shared component libraries |
|
|
210
|
+
| `DomRegistry` | Raw registry type: `Record<string, DomComponentRenderer>` |
|
|
211
|
+
| `DomSchema` | Type of the `schema` export |
|
|
304
212
|
|
|
305
|
-
|
|
306
|
-
renderer.disconnect(); // stops watching, clears container
|
|
213
|
+
### Error Classes
|
|
307
214
|
|
|
308
|
-
|
|
309
|
-
|
|
215
|
+
| Class | Error Code | Description |
|
|
216
|
+
| ----------------------- | --------------------------------- | ---------------------------------------- |
|
|
217
|
+
| `MissingCatalogError` | `PLAY_RENDERER_MISSING_CATALOG` | Components map was `null` or `undefined` |
|
|
218
|
+
| `MissingComponentError` | `PLAY_RENDERER_MISSING_COMPONENT` | Component name not found in catalog |
|
|
310
219
|
|
|
311
|
-
##
|
|
220
|
+
## Rendering Behaviour
|
|
312
221
|
|
|
313
|
-
|
|
222
|
+
- **Initial render is synchronous** — the container is populated before `connect()` or `connectRenderer()` returns.
|
|
223
|
+
- **Signal-driven re-renders are microtask-deferred** — `watchSignal` schedules updates on the next microtask queue tick.
|
|
224
|
+
- **Null view** clears the container. A `fallback` element can be shown on initial mount when the view is `null`; it is **not** re-appended if the view later transitions back to `null` after a non-null view.
|
|
225
|
+
- **Double `connect()` is safe** — calling `connect()` on an already-connected renderer auto-disconnects first.
|
|
226
|
+
- **`disconnect()` clears the container** and unsubscribes all signal and store watchers.
|
|
314
227
|
|
|
315
|
-
|
|
316
|
-
| ---------------- | ------------------------------- | ----------------------------------------------------------------------------- |
|
|
317
|
-
| `actor` | `AbstractActor & Viewable` | Actor providing `currentView` signal |
|
|
318
|
-
| `registry` | `DomRegistry` | Component renderer map from `defineRegistry` |
|
|
319
|
-
| `registryResult` | `DefineRegistryResult` | Preferred — auto-wires `setState`/`state` from xstate store |
|
|
320
|
-
| `handlers` | `Record<string, ActionHandler>` | Pre-resolved handlers (legacy / advanced) |
|
|
321
|
-
| `container` | `HTMLElement` | DOM element to render into |
|
|
322
|
-
| `fallback` | `HTMLElement \| null` | Shown on initial mount when view is `null` (initial mount only) |
|
|
323
|
-
| `store` | `StateStore` | External store — controlled mode, overrides `spec.state` |
|
|
324
|
-
| `loading` | `boolean` | Streaming mode — suppresses missing-child warnings, exposes `ctx.ctx.loading` |
|
|
228
|
+
## Testing
|
|
325
229
|
|
|
326
|
-
|
|
230
|
+
```bash
|
|
231
|
+
# Run all tests (jsdom environment)
|
|
232
|
+
npm test
|
|
233
|
+
|
|
234
|
+
# Run with coverage
|
|
235
|
+
npm run test:coverage
|
|
236
|
+
```
|
|
327
237
|
|
|
328
|
-
|
|
329
|
-
- [DOM Router adapter](../play-dom-router/README.md)
|
|
330
|
-
- [Play RFC](../../packages/docs/rfc/play.md)
|
|
238
|
+
Tests live in `test/` and use [Vitest](https://vitest.dev/) with a jsdom environment. Coverage thresholds: 80% lines, functions, branches, and statements.
|
|
331
239
|
|
|
332
240
|
@xmachines/play-dom — Vanilla DOM renderer for XMachines Play architecture.
|
|
333
241
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayRenderer
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-dom/src/PlayRenderer.ts:78](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:78](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/PlayRenderer.ts#L78)
|
|
6
6
|
|
|
7
7
|
PlayRenderer connects an actor's `currentView` signal to the DOM renderer.
|
|
8
8
|
|
|
@@ -50,7 +50,7 @@ new PlayRenderer(
|
|
|
50
50
|
options?): PlayRenderer;
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Defined in: [packages/play-dom/src/PlayRenderer.ts:101](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
53
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:101](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/PlayRenderer.ts#L101)
|
|
54
54
|
|
|
55
55
|
#### Parameters
|
|
56
56
|
|
|
@@ -73,7 +73,7 @@ Defined in: [packages/play-dom/src/PlayRenderer.ts:101](https://gitlab.com/xmach
|
|
|
73
73
|
connect(): void;
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Defined in: [packages/play-dom/src/PlayRenderer.ts:117](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
76
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:117](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/PlayRenderer.ts#L117)
|
|
77
77
|
|
|
78
78
|
Start watching actor.currentView and render to container.
|
|
79
79
|
Renders the initial view synchronously, then subscribes to signal changes.
|
|
@@ -95,7 +95,7 @@ change. Guard against this by auto-disconnecting first.
|
|
|
95
95
|
disconnect(): void;
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
Defined in: [packages/play-dom/src/PlayRenderer.ts:126](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
98
|
+
Defined in: [packages/play-dom/src/PlayRenderer.ts:126](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/PlayRenderer.ts#L126)
|
|
99
99
|
|
|
100
100
|
Stop watching and clear the container.
|
|
101
101
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function connectRenderer(options): () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-dom/src/connect-renderer.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-dom/src/connect-renderer.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/connect-renderer.ts#L65)
|
|
10
10
|
|
|
11
11
|
Connect a signal-driven DOM renderer to an actor's `currentView` signal.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function createPlayUI(registryResult, options?): MountFn;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-dom/src/create-play-ui.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-dom/src/create-play-ui.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/create-play-ui.ts#L64)
|
|
10
10
|
|
|
11
11
|
Create a batteries-included DOM renderer mount function.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function createRenderer<C>(catalog, componentMap): (actor, container, options?) => () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-dom/src/create-renderer.ts:83](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-dom/src/create-renderer.ts:83](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/create-renderer.ts#L83)
|
|
10
10
|
|
|
11
11
|
Create a reusable DOM renderer factory from a catalog and component map.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function defineRegistry<C>(_catalog, options): DefineRegistryResult;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-dom/src/json-render/types.ts:398](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-dom/src/json-render/types.ts:398](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L398)
|
|
10
10
|
|
|
11
11
|
## Type Parameters
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ function renderSpec(
|
|
|
17
17
|
): Node | null;
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Defined in: [packages/play-dom/src/json-render/renderer.ts:116](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
20
|
+
Defined in: [packages/play-dom/src/json-render/renderer.ts:116](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/renderer.ts#L116)
|
|
21
21
|
|
|
22
22
|
Render a Spec tree into DOM nodes using the provided `DomRegistry`.
|
|
23
23
|
|
|
@@ -52,10 +52,10 @@ or has no registered renderer.
|
|
|
52
52
|
|
|
53
53
|
## Remarks
|
|
54
54
|
|
|
55
|
-
**Devtools isolation in tests:** The module-level `
|
|
55
|
+
**Devtools isolation in tests:** The module-level `devtoolsActive` flag is a
|
|
56
56
|
singleton that persists for the lifetime of the module. In test environments,
|
|
57
57
|
any call to `markDevtoolsActive()` MUST be paired with a `release()` call
|
|
58
|
-
inside a `try/finally` block. Failing to do so leaves `
|
|
58
|
+
inside a `try/finally` block. Failing to do so leaves `devtoolsActive = true`
|
|
59
59
|
for all subsequent tests, causing false positives in devtools-conditional
|
|
60
60
|
rendering paths (e.g. `data-jr-key` wrapper spans).
|
|
61
61
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ComponentContext\<C, K\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-dom/src/json-render/types.ts:184](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-dom/src/json-render/types.ts:184](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L184)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -15,9 +15,9 @@ Defined in: [packages/play-dom/src/json-render/types.ts:184](https://gitlab.com/
|
|
|
15
15
|
|
|
16
16
|
| Property | Type | Description | Defined in |
|
|
17
17
|
| ----------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
18
|
-
| <a id="property-bindings"></a> `bindings` | `Record`\<`string`, `string`\> \| `undefined` | Two-way binding paths resolved from `$bindState` / `$bindItem` prop expressions. | [packages/play-dom/src/json-render/types.ts:194](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
19
|
-
| <a id="property-children"></a> `children` | `Node`[] | Rendered child nodes from the spec's `children` list. | [packages/play-dom/src/json-render/types.ts:190](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
20
|
-
| <a id="property-ctx"></a> `ctx` | [`DomRenderContext`](DomRenderContext.md) | Low-level render context. | [packages/play-dom/src/json-render/types.ts:206](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
21
|
-
| <a id="property-emit"></a> `emit` | (`event`) => `void` | Dispatch a named event defined in the spec's `on` map. | [packages/play-dom/src/json-render/types.ts:198](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
22
|
-
| <a id="property-on"></a> `on` | (`event`) => [`EventHandle`](EventHandle.md) | Get an `EventHandle` for a named event from the spec's `on` map. | [packages/play-dom/src/json-render/types.ts:202](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
23
|
-
| <a id="property-props"></a> `props` | `InferComponentProps`\<`C`, `K`\> | Catalog-typed, store-resolved props for this component. | [packages/play-dom/src/json-render/types.ts:186](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
18
|
+
| <a id="property-bindings"></a> `bindings` | `Record`\<`string`, `string`\> \| `undefined` | Two-way binding paths resolved from `$bindState` / `$bindItem` prop expressions. | [packages/play-dom/src/json-render/types.ts:194](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L194) |
|
|
19
|
+
| <a id="property-children"></a> `children` | `Node`[] | Rendered child nodes from the spec's `children` list. | [packages/play-dom/src/json-render/types.ts:190](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L190) |
|
|
20
|
+
| <a id="property-ctx"></a> `ctx` | [`DomRenderContext`](DomRenderContext.md) | Low-level render context. | [packages/play-dom/src/json-render/types.ts:206](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L206) |
|
|
21
|
+
| <a id="property-emit"></a> `emit` | (`event`) => `void` | Dispatch a named event defined in the spec's `on` map. | [packages/play-dom/src/json-render/types.ts:198](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L198) |
|
|
22
|
+
| <a id="property-on"></a> `on` | (`event`) => [`EventHandle`](EventHandle.md) | Get an `EventHandle` for a named event from the spec's `on` map. | [packages/play-dom/src/json-render/types.ts:202](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L202) |
|
|
23
|
+
| <a id="property-props"></a> `props` | `InferComponentProps`\<`C`, `K`\> | Catalog-typed, store-resolved props for this component. | [packages/play-dom/src/json-render/types.ts:186](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/src/json-render/types.ts#L186) |
|